Nicky-Case-ification/js/kg.0.2.1.js

7626 lines
1.3 MiB
Executable File
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(function(e){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=e()}else if(typeof define==="function"&&define.amd){define([],e)}else{var t;if(typeof window!=="undefined"){t=window}else if(typeof global!=="undefined"){t=global}else if(typeof self!=="undefined"){t=self}else{t=this}t.renderMathInElement=e()}})(function(){var e,t,n;return function e(t,n,r){function o(c,a){if(!n[c]){if(!t[c]){var u=typeof require=="function"&&require;if(!a&&u)return u(c,!0);if(i)return i(c,!0);var f=new Error("Cannot find module '"+c+"'");throw f.code="MODULE_NOT_FOUND",f}var s=n[c]={exports:{}};t[c][0].call(s.exports,function(e){var n=t[c][1][e];return o(n?n:e)},s,s.exports,e,t,n,r)}return n[c].exports}var i=typeof require=="function"&&require;for(var c=0;c<r.length;c++)o(r[c]);return o}({1:[function(e,t,n){"use strict";var r=e("babel-runtime/core-js/object/assign");var o=i(r);function i(e){return e&&e.__esModule?e:{default:e}}var c=e("./splitAtDelimiters");var a=function e(t,n){var r=[{type:"text",data:t}];for(var o=0;o<n.length;o++){var i=n[o];r=c(r,i.left,i.right,i.display||false)}return r};var u=function e(t,n){var r=a(t,n.delimiters);var o=document.createDocumentFragment();for(var i=0;i<r.length;i++){if(r[i].type==="text"){o.appendChild(document.createTextNode(r[i].data))}else{var c=document.createElement("span");var u=r[i].data;n.displayMode=r[i].display;try{katex.render(u,c,n)}catch(e){if(!(e instanceof katex.ParseError)){throw e}n.errorCallback("KaTeX auto-render: Failed to parse `"+r[i].data+"` with ",e);o.appendChild(document.createTextNode(r[i].rawData));continue}o.appendChild(c)}}return o};var f=function e(t,n){for(var r=0;r<t.childNodes.length;r++){var o=t.childNodes[r];if(o.nodeType===3){var i=u(o.textContent,n);r+=i.childNodes.length-1;t.replaceChild(i,o)}else if(o.nodeType===1){var c=n.ignoredTags.indexOf(o.nodeName.toLowerCase())===-1;if(c){e(o,n)}}}};var s={delimiters:[{left:"$$",right:"$$",display:true},{left:"\\[",right:"\\]",display:true},{left:"\\(",right:"\\)",display:false}],ignoredTags:["script","noscript","style","textarea","pre","code"],errorCallback:function e(t,n){console.error(t,n)}};var l=function e(t,n){if(!t){throw new Error("No element provided to render")}var r=(0,o.default)({},s,n);f(t,r)};t.exports=l},{"./splitAtDelimiters":2,"babel-runtime/core-js/object/assign":3}],2:[function(e,t,n){"use strict";var r=function e(t,n,r){var o=r;var i=0;var c=t.length;while(o<n.length){var a=n[o];if(i<=0&&n.slice(o,o+c)===t){return o}else if(a==="\\"){o++}else if(a==="{"){i++}else if(a==="}"){i--}o++}return-1};var o=function e(t,n,o,i){var c=[];for(var a=0;a<t.length;a++){if(t[a].type==="text"){var u=t[a].data;var f=true;var s=0;var l=void 0;l=u.indexOf(n);if(l!==-1){s=l;c.push({type:"text",data:u.slice(0,s)});f=false}while(true){if(f){l=u.indexOf(n,s);if(l===-1){break}c.push({type:"text",data:u.slice(s,l)});s=l}else{l=r(o,u,s+n.length);if(l===-1){break}c.push({type:"math",data:u.slice(s+n.length,l),rawData:u.slice(s,l+o.length),display:i});s=l+o.length}f=!f}c.push({type:"text",data:u.slice(s)})}else{c.push(t[a])}}return c};t.exports=o},{}],3:[function(e,t,n){t.exports={default:e("core-js/library/fn/object/assign"),__esModule:true}},{"core-js/library/fn/object/assign":4}],4:[function(e,t,n){e("../../modules/es6.object.assign");t.exports=e("../../modules/_core").Object.assign},{"../../modules/_core":9,"../../modules/es6.object.assign":39}],5:[function(e,t,n){t.exports=function(e){if(typeof e!="function")throw TypeError(e+" is not a function!");return e}},{}],6:[function(e,t,n){var r=e("./_is-object");t.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},{"./_is-object":22}],7:[function(e,t,n){var r=e("./_to-iobject"),o=e("./_to-length"),i=e("./_to-index");t.exports=function(e){return function(t,n,c){var a=r(t),u=o(a.length),f=i(c,u),s;if(e&&n!=n)while(u>f){s=a[f++];if(s!=s)return true}else for(;u>f;f++)if(e||f in a){if(a[f]===n)return e||f||0}return!e&&-1}}},{"./_to-index":32,"./_to-iobject":34,"./_to-length":35}],8:[function(e,t,n){var r={}.toString;t.exports=function(e){return r.call(e).slice(8,-1)}},{}],9:[function(e,t,n){var r=t.exports={version:"2.4.0"};if(typeof __e=="number")__e=r},{}],10:[function(e,t,n){var r=e("./_a-function");t.exports=function(e,t,n){r(e);if(t===undefined)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}}},{"./_a-function":5}],11:[function(e,t,n){t.exports=function(e){if(e==undefined)throw TypeError("Can't call method on "+e);return e}},{}],12:[function(e,t,n){t.exports=!e("./_fails")(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7})},{"./_fails":16}],13:[function(e,t,n){var r=e("./_is-object"),o=e("./_global").document,i=r(o)&&r(o.createElement);t.exports=function(e){return i?o.createElement(e):{}}},{"./_global":17,"./_is-object":22}],14:[function(e,t,n){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},{}],15:[function(e,t,n){var r=e("./_global"),o=e("./_core"),i=e("./_ctx"),c=e("./_hide"),a="prototype";var u=function(e,t,n){var f=e&u.F,s=e&u.G,l=e&u.S,p=e&u.P,d=e&u.B,_=e&u.W,v=s?o:o[t]||(o[t]={}),h=v[a],b=s?r:l?r[t]:(r[t]||{})[a],y,g,x;if(s)n=t;for(y in n){g=!f&&b&&b[y]!==undefined;if(g&&y in v)continue;x=g?b[y]:n[y];v[y]=s&&typeof b[y]!="function"?n[y]:d&&g?i(x,r):_&&b[y]==x?function(e){var t=function(t,n,r){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,r)}return e.apply(this,arguments)};t[a]=e[a];return t}(x):p&&typeof x=="function"?i(Function.call,x):x;if(p){(v.virtual||(v.virtual={}))[y]=x;if(e&u.R&&h&&!h[y])c(h,y,x)}}};u.F=1;u.G=2;u.S=4;u.P=8;u.B=16;u.W=32;u.U=64;u.R=128;t.exports=u},{"./_core":9,"./_ctx":10,"./_global":17,"./_hide":19}],16:[function(e,t,n){t.exports=function(e){try{return!!e()}catch(e){return true}}},{}],17:[function(e,t,n){var r=t.exports=typeof window!="undefined"&&window.Math==Math?window:typeof self!="undefined"&&self.Math==Math?self:Function("return this")();if(typeof __g=="number")__g=r},{}],18:[function(e,t,n){var r={}.hasOwnProperty;t.exports=function(e,t){return r.call(e,t)}},{}],19:[function(e,t,n){var r=e("./_object-dp"),o=e("./_property-desc");t.exports=e("./_descriptors")?function(e,t,n){return r.f(e,t,o(1,n))}:function(e,t,n){e[t]=n;return e}},{"./_descriptors":12,"./_object-dp":24,"./_property-desc":29}],20:[function(e,t,n){t.exports=!e("./_descriptors")&&!e("./_fails")(function(){return Object.defineProperty(e("./_dom-create")("div"),"a",{get:function(){return 7}}).a!=7})},{"./_descriptors":12,"./_dom-create":13,"./_fails":16}],21:[function(e,t,n){var r=e("./_cof");t.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return r(e)=="String"?e.split(""):Object(e)}},{"./_cof":8}],22:[function(e,t,n){t.exports=function(e){return typeof e==="object"?e!==null:typeof e==="function"}},{}],23:[function(e,t,n){"use strict";var r=e("./_object-keys"),o=e("./_object-gops"),i=e("./_object-pie"),c=e("./_to-object"),a=e("./_iobject"),u=Object.assign;t.exports=!u||e("./_fails")(function(){var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";e[n]=7;r.split("").forEach(function(e){t[e]=e});return u({},e)[n]!=7||Object.keys(u({},t)).join("")!=r})?function e(t,n){var u=c(t),f=arguments.length,s=1,l=o.f,p=i.f;while(f>s){var d=a(arguments[s++]),_=l?r(d).concat(l(d)):r(d),v=_.length,h=0,b;while(v>h)if(p.call(d,b=_[h++]))u[b]=d[b]}return u}:u},{"./_fails":16,"./_iobject":21,"./_object-gops":25,"./_object-keys":27,"./_object-pie":28,"./_to-object":36}],24:[function(e,t,n){var r=e("./_an-object"),o=e("./_ie8-dom-define"),i=e("./_to-primitive"),c=Object.defineProperty;n.f=e("./_descriptors")?Object.defineProperty:function e(t,n,a){r(t);n=i(n,true);r(a);if(o)try{return c(t,n,a)}catch(e){}if("get"in a||"set"in a)throw TypeError("Accessors not supported!");if("value"in a)t[n]=a.value;return t}},{"./_an-object":6,"./_descriptors":12,"./_ie8-dom-define":20,"./_to-primitive":37}],25:[function(e,t,n){n.f=Object.getOwnPropertySymbols},{}],26:[function(e,t,n){var r=e("./_has"),o=e("./_to-iobject"),i=e("./_array-includes")(false),c=e("./_shared-key")("IE_PROTO");t.exports=function(e,t){var n=o(e),a=0,u=[],f;for(f in n)if(f!=c)r(n,f)&&u.push(f);while(t.length>a)if(r(n,f=t[a++])){~i(u,f)||u.push(f)}return u}},{"./_array-includes":7,"./_has":18,"./_shared-key":30,"./_to-iobject":34}],27:[function(e,t,n){var r=e("./_object-keys-internal"),o=e("./_enum-bug-keys");t.exports=Object.keys||function e(t){return r(t,o)}},{"./_enum-bug-keys":14,"./_object-keys-internal":26}],28:[function(e,t,n){n.f={}.propertyIsEnumerable},{}],29:[function(e,t,n){t.exports=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}}},{}],30:[function(e,t,n){var r=e("./_shared")("keys"),o=e("./_uid");t.exports=function(e){return r[e]||(r[e]=o(e))}},{"./_shared":31,"./_uid":38}],31:[function(e,t,n){var r=e("./_global"),o="__core-js_shared__",i=r[o]||(r[o]={});t.exports=function(e){return i[e]||(i[e]={})}},{"./_global":17}],32:[function(e,t,n){var r=e("./_to-integer"),o=Math.max,i=Math.min;t.exports=function(e,t){e=r(e);return e<0?o(e+t,0):i(e,t)}},{"./_to-integer":33}],33:[function(e,t,n){var r=Math.ceil,o=Math.floor;t.exports=function(e){return isNaN(e=+e)?0:(e>0?o:r)(e)}},{}],34:[function(e,t,n){var r=e("./_iobject"),o=e("./_defined");t.exports=function(e){return r(o(e))}},{"./_defined":11,"./_iobject":21}],35:[function(e,t,n){var r=e("./_to-integer"),o=Math.min;t.exports=function(e){return e>0?o(r(e),9007199254740991):0}},{"./_to-integer":33}],36:[function(e,t,n){var r=e("./_defined");t.exports=function(e){return Object(r(e))}},{"./_defined":11}],37:[function(e,t,n){var r=e("./_is-object");t.exports=function(e,t){if(!r(e))return e;var n,o;if(t&&typeof(n=e.toString)=="function"&&!r(o=n.call(e)))return o;if(typeof(n=e.valueOf)=="function"&&!r(o=n.call(e)))return o;if(!t&&typeof(n=e.toString)=="function"&&!r(o=n.call(e)))return o;throw TypeError("Can't convert object to primitive value")}},{"./_is-object":22}],38:[function(e,t,n){var r=0,o=Math.random();t.exports=function(e){return"Symbol(".concat(e===undefined?"":e,")_",(++r+o).toString(36))}},{}],39:[function(e,t,n){var r=e("./_export");r(r.S+r.F,"Object",{assign:e("./_object-assign")})},{"./_export":15,"./_object-assign":23}]},{},[1])(1)});
(function(e){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=e()}else if(typeof define==="function"&&define.amd){define([],e)}else{var t;if(typeof window!=="undefined"){t=window}else if(typeof global!=="undefined"){t=global}else if(typeof self!=="undefined"){t=self}else{t=this}t.katex=e()}})(function(){var e,t,r;return function e(t,r,a){function i(l,s){if(!r[l]){if(!t[l]){var o=typeof require=="function"&&require;if(!s&&o)return o(l,!0);if(n)return n(l,!0);var u=new Error("Cannot find module '"+l+"'");throw u.code="MODULE_NOT_FOUND",u}var f=r[l]={exports:{}};t[l][0].call(f.exports,function(e){var r=t[l][1][e];return i(r?r:e)},f,f.exports,e,t,r,a)}return r[l].exports}var n=typeof require=="function"&&require;for(var l=0;l<a.length;l++)i(a[l]);return i}({1:[function(e,t,r){"use strict";var a=e("./src/ParseError");var i=h(a);var n=e("./src/Settings");var l=h(n);var s=e("./src/buildTree");var o=h(s);var u=e("./src/parseTree");var f=h(u);var d=e("./src/utils");var c=h(d);function h(e){return e&&e.__esModule?e:{default:e}}var v=function e(t,r,a){c.default.clearNode(r);var i=new l.default(a);var n=(0,f.default)(t,i);var s=(0,o.default)(n,t,i).toNode();r.appendChild(s)};if(typeof document!=="undefined"){if(document.compatMode!=="CSS1Compat"){typeof console!=="undefined"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your "+"website has a suitable doctype.");v=function e(){throw new i.default("KaTeX doesn't work in quirks mode.")}}}var p=function e(t,r){var a=new l.default(r);var i=(0,f.default)(t,a);return(0,o.default)(i,t,a).toMarkup()};var m=function e(t,r){var a=new l.default(r);return(0,f.default)(t,a)};t.exports={render:v,renderToString:p,__parse:m,ParseError:i.default}},{"./src/ParseError":29,"./src/Settings":32,"./src/buildTree":37,"./src/parseTree":46,"./src/utils":51}],2:[function(e,t,r){t.exports={default:e("core-js/library/fn/json/stringify"),__esModule:true}},{"core-js/library/fn/json/stringify":6}],3:[function(e,t,r){t.exports={default:e("core-js/library/fn/object/define-property"),__esModule:true}},{"core-js/library/fn/object/define-property":7}],4:[function(e,t,r){"use strict";r.__esModule=true;r.default=function(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}},{}],5:[function(e,t,r){"use strict";r.__esModule=true;var a=e("../core-js/object/define-property");var i=n(a);function n(e){return e&&e.__esModule?e:{default:e}}r.default=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||false;a.configurable=true;if("value"in a)a.writable=true;(0,i.default)(e,a.key,a)}}return function(t,r,a){if(r)e(t.prototype,r);if(a)e(t,a);return t}}()},{"../core-js/object/define-property":3}],6:[function(e,t,r){var a=e("../../modules/_core"),i=a.JSON||(a.JSON={stringify:JSON.stringify});t.exports=function e(t){return i.stringify.apply(i,arguments)}},{"../../modules/_core":10}],7:[function(e,t,r){e("../../modules/es6.object.define-property");var a=e("../../modules/_core").Object;t.exports=function e(t,r,i){return a.defineProperty(t,r,i)}},{"../../modules/_core":10,"../../modules/es6.object.define-property":23}],8:[function(e,t,r){t.exports=function(e){if(typeof e!="function")throw TypeError(e+" is not a function!");return e}},{}],9:[function(e,t,r){var a=e("./_is-object");t.exports=function(e){if(!a(e))throw TypeError(e+" is not an object!");return e}},{"./_is-object":19}],10:[function(e,t,r){var a=t.exports={version:"2.4.0"};if(typeof __e=="number")__e=a},{}],11:[function(e,t,r){var a=e("./_a-function");t.exports=function(e,t,r){a(e);if(t===undefined)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 2:return function(r,a){return e.call(t,r,a)};case 3:return function(r,a,i){return e.call(t,r,a,i)}}return function(){return e.apply(t,arguments)}}},{"./_a-function":8}],12:[function(e,t,r){t.exports=!e("./_fails")(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7})},{"./_fails":15}],13:[function(e,t,r){var a=e("./_is-object"),i=e("./_global").document,n=a(i)&&a(i.createElement);t.exports=function(e){return n?i.createElement(e):{}}},{"./_global":16,"./_is-object":19}],14:[function(e,t,r){var a=e("./_global"),i=e("./_core"),n=e("./_ctx"),l=e("./_hide"),s="prototype";var o=function(e,t,r){var u=e&o.F,f=e&o.G,d=e&o.S,c=e&o.P,h=e&o.B,v=e&o.W,p=f?i:i[t]||(i[t]={}),m=p[s],g=f?a:d?a[t]:(a[t]||{})[s],y,b,x;if(f)r=t;for(y in r){b=!u&&g&&g[y]!==undefined;if(b&&y in p)continue;x=b?g[y]:r[y];p[y]=f&&typeof g[y]!="function"?r[y]:h&&b?n(x,a):v&&g[y]==x?function(e){var t=function(t,r,a){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,r)}return new e(t,r,a)}return e.apply(this,arguments)};t[s]=e[s];return t}(x):c&&typeof x=="function"?n(Function.call,x):x;if(c){(p.virtual||(p.virtual={}))[y]=x;if(e&o.R&&m&&!m[y])l(m,y,x)}}};o.F=1;o.G=2;o.S=4;o.P=8;o.B=16;o.W=32;o.U=64;o.R=128;t.exports=o},{"./_core":10,"./_ctx":11,"./_global":16,"./_hide":17}],15:[function(e,t,r){t.exports=function(e){try{return!!e()}catch(e){return true}}},{}],16:[function(e,t,r){var a=t.exports=typeof window!="undefined"&&window.Math==Math?window:typeof self!="undefined"&&self.Math==Math?self:Function("return this")();if(typeof __g=="number")__g=a},{}],17:[function(e,t,r){var a=e("./_object-dp"),i=e("./_property-desc");t.exports=e("./_descriptors")?function(e,t,r){return a.f(e,t,i(1,r))}:function(e,t,r){e[t]=r;return e}},{"./_descriptors":12,"./_object-dp":20,"./_property-desc":21}],18:[function(e,t,r){t.exports=!e("./_descriptors")&&!e("./_fails")(function(){return Object.defineProperty(e("./_dom-create")("div"),"a",{get:function(){return 7}}).a!=7})},{"./_descriptors":12,"./_dom-create":13,"./_fails":15}],19:[function(e,t,r){t.exports=function(e){return typeof e==="object"?e!==null:typeof e==="function"}},{}],20:[function(e,t,r){var a=e("./_an-object"),i=e("./_ie8-dom-define"),n=e("./_to-primitive"),l=Object.defineProperty;r.f=e("./_descriptors")?Object.defineProperty:function e(t,r,s){a(t);r=n(r,true);a(s);if(i)try{return l(t,r,s)}catch(e){}if("get"in s||"set"in s)throw TypeError("Accessors not supported!");if("value"in s)t[r]=s.value;return t}},{"./_an-object":9,"./_descriptors":12,"./_ie8-dom-define":18,"./_to-primitive":22}],21:[function(e,t,r){t.exports=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}}},{}],22:[function(e,t,r){var a=e("./_is-object");t.exports=function(e,t){if(!a(e))return e;var r,i;if(t&&typeof(r=e.toString)=="function"&&!a(i=r.call(e)))return i;if(typeof(r=e.valueOf)=="function"&&!a(i=r.call(e)))return i;if(!t&&typeof(r=e.toString)=="function"&&!a(i=r.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},{"./_is-object":19}],23:[function(e,t,r){var a=e("./_export");a(a.S+a.F*!e("./_descriptors"),"Object",{defineProperty:e("./_object-dp").f})},{"./_descriptors":12,"./_export":14,"./_object-dp":20}],24:[function(e,t,r){"use strict";function a(e){if(!e.__matchAtRelocatable){var t=e.source+"|()";var r="g"+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"");e.__matchAtRelocatable=new RegExp(t,r)}return e.__matchAtRelocatable}function i(e,t,r){if(e.global||e.sticky){throw new Error("matchAt(...): Only non-global regexes are supported")}var i=a(e);i.lastIndex=r;var n=i.exec(t);if(n[n.length-1]==null){n.length=n.length-1;return n}else{return null}}t.exports=i},{}],25:[function(e,t,r){"use strict";var a=Object.prototype.hasOwnProperty;var i=Object.prototype.propertyIsEnumerable;function n(e){if(e===null||e===undefined){throw new TypeError("Object.assign cannot be called with null or undefined")}return Object(e)}function l(){try{if(!Object.assign){return false}var e=new String("abc");e[5]="de";if(Object.getOwnPropertyNames(e)[0]==="5"){return false}var t={};for(var r=0;r<10;r++){t["_"+String.fromCharCode(r)]=r}var a=Object.getOwnPropertyNames(t).map(function(e){return t[e]});if(a.join("")!=="0123456789"){return false}var i={};"abcdefghijklmnopqrst".split("").forEach(function(e){i[e]=e});if(Object.keys(Object.assign({},i)).join("")!=="abcdefghijklmnopqrst"){return false}return true}catch(e){return false}}t.exports=l()?Object.assign:function(e,t){var r;var l=n(e);var s;for(var o=1;o<arguments.length;o++){r=Object(arguments[o]);for(var u in r){if(a.call(r,u)){l[u]=r[u]}}if(Object.getOwnPropertySymbols){s=Object.getOwnPropertySymbols(r);for(var f=0;f<s.length;f++){if(i.call(r,s[f])){l[s[f]]=r[s[f]]}}}}return l}},{}],26:[function(e,t,r){"use strict";var a=e("babel-runtime/helpers/classCallCheck");var i=d(a);var n=e("babel-runtime/helpers/createClass");var l=d(n);var s=e("match-at");var o=d(s);var u=e("./ParseError");var f=d(u);function d(e){return e&&e.__esModule?e:{default:e}}var c=function(){function e(t,r,a,n){(0,i.default)(this,e);this.text=t;this.start=r;this.end=a;this.lexer=n}(0,l.default)(e,[{key:"range",value:function t(r,a){if(r.lexer!==this.lexer){return new e(a)}return new e(a,this.start,r.end,this.lexer)}}]);return e}();var h=new RegExp("([ \r\n\t]+)|"+"([!-\\[\\]-\u2027\u202a-\ud7ff\uf900-\uffff]"+"|[\ud800-\udbff][\udc00-\udfff]"+"|\\\\(?:[a-zA-Z]+|[^\ud800-\udfff])"+")");var v=function(){function e(t){(0,i.default)(this,e);this.input=t;this.pos=0}(0,l.default)(e,[{key:"lex",value:function e(){var t=this.input;var r=this.pos;if(r===t.length){return new c("EOF",r,r,this)}var a=(0,o.default)(h,t,r);if(a===null){throw new f.default("Unexpected character: '"+t[r]+"'",new c(t[r],r,r+1,this))}var i=a[2]||" ";var n=this.pos;this.pos+=a[0].length;var l=this.pos;return new c(i,n,l,this)}}]);return e}();t.exports=v},{"./ParseError":29,"babel-runtime/helpers/classCallCheck":4,"babel-runtime/helpers/createClass":5,"match-at":24}],27:[function(e,t,r){"use strict";var a=e("babel-runtime/helpers/classCallCheck");var i=p(a);var n=e("babel-runtime/helpers/createClass");var l=p(n);var s=e("./Lexer");var o=p(s);var u=e("./macros");var f=p(u);var d=e("./ParseError");var c=p(d);var h=e("object-assign");var v=p(h);function p(e){return e&&e.__esModule?e:{default:e}}var m=function(){function e(t,r){(0,i.default)(this,e);this.lexer=new o.default(t);this.macros=(0,v.default)({},f.default,r);this.stack=[];this.discardedWhiteSpace=[]}(0,l.default)(e,[{key:"nextToken",value:function e(){for(;;){if(this.stack.length===0){this.stack.push(this.lexer.lex())}var t=this.stack.pop();var r=t.text;if(!(r.charAt(0)==="\\"&&this.macros.hasOwnProperty(r))){return t}var a=void 0;var i=this.macros[r];if(typeof i==="string"){var n=0;if(i.indexOf("#")!==-1){var l=i.replace(/##/g,"");while(l.indexOf("#"+(n+1))!==-1){++n}}var s=new o.default(i);i=[];a=s.lex();while(a.text!=="EOF"){i.push(a);a=s.lex()}i.reverse();i.numArgs=n;this.macros[r]=i}if(i.numArgs){var u=[];var f=void 0;for(f=0;f<i.numArgs;++f){var d=this.get(true);if(d.text==="{"){var h=[];var v=1;while(v!==0){a=this.get(false);h.push(a);if(a.text==="{"){++v}else if(a.text==="}"){--v}else if(a.text==="EOF"){throw new c.default("End of input in macro argument",d)}}h.pop();h.reverse();u[f]=h}else if(d.text==="EOF"){throw new c.default("End of input expecting macro argument",t)}else{u[f]=[d]}}i=i.slice();for(f=i.length-1;f>=0;--f){a=i[f];if(a.text==="#"){if(f===0){throw new c.default("Incomplete placeholder at end of macro body",a)}a=i[--f];if(a.text==="#"){i.splice(f+1,1)}else if(/^[1-9]$/.test(a.text)){i.splice.apply(i,[f,2].concat(u[a.text-1]))}else{throw new c.default("Not a valid argument number",a)}}}}this.stack=this.stack.concat(i)}}},{key:"get",value:function e(t){this.discardedWhiteSpace=[];var r=this.nextToken();if(t){while(r.text===" "){this.discardedWhiteSpace.push(r);r=this.nextToken()}}return r}},{key:"unget",value:function e(t){this.stack.push(t);while(this.discardedWhiteSpace.length!==0){this.stack.push(this.discardedWhiteSpace.pop())}}}]);return e}();t.exports=m},{"./Lexer":26,"./ParseError":29,"./macros":44,"babel-runtime/helpers/classCallCheck":4,"babel-runtime/helpers/createClass":5,"object-assign":25}],28:[function(e,t,r){"use strict";var a=e("babel-runtime/helpers/classCallCheck");var i=u(a);var n=e("babel-runtime/helpers/createClass");var l=u(n);var s=e("./fontMetrics");var o=u(s);function u(e){return e&&e.__esModule?e:{default:e}}var f=6;var d=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]];var c=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488];var h=function e(t,r){return r.size<2?t:d[t-1][r.size-1]};var v=function(){function e(t){(0,i.default)(this,e);this.style=t.style;this.color=t.color;this.size=t.size||f;this.textSize=t.textSize||this.size;this.phantom=t.phantom;this.font=t.font;this.sizeMultiplier=c[this.size-1];this._fontMetrics=null}(0,l.default)(e,[{key:"extend",value:function t(r){var a={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font};for(var i in r){if(r.hasOwnProperty(i)){a[i]=r[i]}}return new e(a)}},{key:"havingStyle",value:function e(t){if(this.style===t){return this}else{return this.extend({style:t,size:h(this.textSize,t)})}}},{key:"havingCrampedStyle",value:function e(){return this.havingStyle(this.style.cramp())}},{key:"havingSize",value:function e(t){if(this.size===t&&this.textSize===t){return this}else{return this.extend({style:this.style.text(),size:t,textSize:t})}}},{key:"havingBaseStyle",value:function e(t){t=t||this.style.text();var r=h(f,t);if(this.size===r&&this.textSize===f&&this.style===t){return this}else{return this.extend({style:t,size:r,baseSize:f})}}},{key:"withColor",value:function e(t){return this.extend({color:t})}},{key:"withPhantom",value:function e(){return this.extend({phantom:true})}},{key:"withFont",value:function e(t){return this.extend({font:t||this.font})}},{key:"sizingClasses",value:function e(t){if(t.size!==this.size){return["sizing","reset-size"+t.size,"size"+this.size]}else{return[]}}},{key:"baseSizingClasses",value:function e(){if(this.size!==f){return["sizing","reset-size"+this.size,"size"+f]}else{return[]}}},{key:"fontMetrics",value:function e(){if(!this._fontMetrics){this._fontMetrics=o.default.getFontMetrics(this.size)}return this._fontMetrics}},{key:"getColor",value:function t(){if(this.phantom){return"transparent"}else{return e.colorMap[this.color]||this.color}}}]);return e}();v.colorMap={"katex-blue":"#6495ed","katex-orange":"#ffa500","katex-pink":"#ff00af","katex-red":"#df0030","katex-green":"#28ae7b","katex-gray":"gray","katex-purple":"#9d38bd","katex-blueA":"#ccfaff","katex-blueB":"#80f6ff","katex-blueC":"#63d9ea","katex-blueD":"#11accd","katex-blueE":"#0c7f99","katex-tealA":"#94fff5","katex-tealB":"#26edd5","katex-tealC":"#01d1c1","katex-tealD":"#01a995","katex-tealE":"#208170","katex-greenA":"#b6ffb0","katex-greenB":"#8af281","katex-greenC":"#74cf70","katex-greenD":"#1fab54","katex-greenE":"#0d923f","katex-goldA":"#ffd0a9","katex-goldB":"#ffbb71","katex-goldC":"#ff9c39","katex-goldD":"#e07d10","katex-goldE":"#a75a05","katex-redA":"#fca9a9","katex-redB":"#ff8482","katex-redC":"#f9685d","katex-redD":"#e84d39","katex-redE":"#bc2612","katex-maroonA":"#ffbde0","katex-maroonB":"#ff92c6","katex-maroonC":"#ed5fa6","katex-maroonD":"#ca337c","katex-maroonE":"#9e034e","katex-purpleA":"#ddd7ff","katex-purpleB":"#c6b9fc","katex-purpleC":"#aa87ff","katex-purpleD":"#7854ab","katex-purpleE":"#543b78","katex-mintA":"#f5f9e8","katex-mintB":"#edf2df","katex-mintC":"#e0e5cc","katex-grayA":"#f6f7f7","katex-grayB":"#f0f1f2","katex-grayC":"#e3e5e6","katex-grayD":"#d6d8da","katex-grayE":"#babec2","katex-grayF":"#888d93","katex-grayG":"#626569","katex-grayH":"#3b3e40","katex-grayI":"#21242c","katex-kaBlue":"#314453","katex-kaGreen":"#71B307"};v.BASESIZE=f;t.exports=v},{"./fontMetrics":41,"babel-runtime/helpers/classCallCheck":4,"babel-runtime/helpers/createClass":5}],29:[function(e,t,r){"use strict";var a=e("babel-runtime/helpers/classCallCheck");var i=n(a);function n(e){return e&&e.__esModule?e:{default:e}}var l=function e(t,r){(0,i.default)(this,e);var a="KaTeX parse error: "+t;var n=void 0;var l=void 0;if(r&&r.lexer&&r.start<=r.end){var s=r.lexer.input;n=r.start;l=r.end;if(n===s.length){a+=" at end of input: "}else{a+=" at position "+(n+1)+": "}var o=s.slice(n,l).replace(/[^]/g,"$&\u0332");var u=void 0;if(n>15){u="\u2026"+s.slice(n-15,n)}else{u=s.slice(0,n)}var f=void 0;if(l+15<s.length){f=s.slice(l,l+15)+"\u2026"}else{f=s.slice(l)}a+=u+o+f}var d=new Error(a);d.name="ParseError";d.__proto__=e.prototype;d.position=n;return d};l.prototype.__proto__=Error.prototype;t.exports=l},{"babel-runtime/helpers/classCallCheck":4}],30:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var a=e("babel-runtime/helpers/classCallCheck");var i=n(a);function n(e){return e&&e.__esModule?e:{default:e}}var l=function e(t,r,a,n,l){(0,i.default)(this,e);this.type=t;this.value=r;this.mode=a;if(n&&(!l||l.lexer===n.lexer)){this.lexer=n.lexer;this.start=n.start;this.end=(l||n).end}};r.default=l},{"babel-runtime/helpers/classCallCheck":4}],31:[function(e,t,r){"use strict";var a=e("babel-runtime/helpers/classCallCheck");var i=M(a);var n=e("babel-runtime/helpers/createClass");var l=M(n);var s=e("./functions");var o=M(s);var u=e("./environments");var f=M(u);var d=e("./MacroExpander");var c=M(d);var h=e("./symbols");var v=M(h);var p=e("./utils");var m=M(p);var g=e("./units");var y=M(g);var b=e("./unicodeRegexes");var x=e("./ParseNode");var w=M(x);var k=e("./ParseError");var S=M(k);function M(e){return e&&e.__esModule?e:{default:e}}function z(e,t,r){this.result=e;this.isFunction=t;this.token=r}var C=function(){function e(t,r){(0,i.default)(this,e);this.gullet=new c.default(t,r.macros);if(r.colorIsTextColor){this.gullet.macros["\\color"]="\\textcolor"}this.settings=r;this.leftrightDepth=0}(0,l.default)(e,[{key:"expect",value:function e(t,r){if(this.nextToken.text!==t){throw new S.default("Expected '"+t+"', got '"+this.nextToken.text+"'",this.nextToken)}if(r!==false){this.consume()}}},{key:"consume",value:function e(){this.nextToken=this.gullet.get(this.mode==="math")}},{key:"switchMode",value:function e(t){this.gullet.unget(this.nextToken);this.mode=t;this.consume()}},{key:"parse",value:function e(){this.mode="math";this.consume();var e=this.parseInput();return e}},{key:"parseInput",value:function e(){var t=this.parseExpression(false);this.expect("EOF",false);return t}},{key:"parseExpression",value:function t(r,a){var i=[];while(true){var n=this.nextToken;if(e.endOfExpression.indexOf(n.text)!==-1){break}if(a&&n.text===a){break}if(r&&o.default[n.text]&&o.default[n.text].infix){break}var l=this.parseAtom();if(!l){if(!this.settings.throwOnError&&n.text[0]==="\\"){var s=this.handleUnsupportedCmd();i.push(s);continue}break}i.push(l)}return this.handleInfixNodes(i)}},{key:"handleInfixNodes",value:function e(t){var r=-1;var a=void 0;for(var i=0;i<t.length;i++){var n=t[i];if(n.type==="infix"){if(r!==-1){throw new S.default("only one infix operator per group",n.value.token)}r=i;a=n.value.replaceWith}}if(r!==-1){var l=void 0;var s=void 0;var o=t.slice(0,r);var u=t.slice(r+1);if(o.length===1&&o[0].type==="ordgroup"){l=o[0]}else{l=new w.default("ordgroup",o,this.mode)}if(u.length===1&&u[0].type==="ordgroup"){s=u[0]}else{s=new w.default("ordgroup",u,this.mode)}var f=this.callFunction(a,[l,s],null);return[new w.default(f.type,f,this.mode)]}else{return t}}},{key:"handleSupSubscript",value:function t(r){var a=this.nextToken;var i=a.text;this.consume();var n=this.parseGroup();if(!n){if(!this.settings.throwOnError&&this.nextToken.text[0]==="\\"){return this.handleUnsupportedCmd()}else{throw new S.default("Expected group after '"+i+"'",a)}}else if(n.isFunction){var l=o.default[n.result].greediness;if(l>e.SUPSUB_GREEDINESS){return this.parseFunction(n)}else{throw new S.default("Got function '"+n.result+"' with no arguments "+"as "+r,a)}}else{return n.result}}},{key:"handleUnsupportedCmd",value:function e(){var t=this.nextToken.text;var r=[];for(var a=0;a<t.length;a++){r.push(new w.default("textord",t[a],"text"))}var i=new w.default("text",{body:r,type:"text"},this.mode);var n=new w.default("color",{color:this.settings.errorColor,value:[i],type:"color"},this.mode);this.consume();return n}},{key:"parseAtom",value:function e(){var t=this.parseImplicitGroup();if(this.mode==="text"){return t}var r=void 0;var a=void 0;while(true){var i=this.nextToken;if(i.text==="\\limits"||i.text==="\\nolimits"){if(!t||t.type!=="op"){throw new S.default("Limit controls must follow a math operator",i)}else{var n=i.text==="\\limits";t.value.limits=n;t.value.alwaysHandleSupSub=true}this.consume()}else if(i.text==="^"){if(r){throw new S.default("Double superscript",i)}r=this.handleSupSubscript("superscript")}else if(i.text==="_"){if(a){throw new S.default("Double subscript",i)}a=this.handleSupSubscript("subscript")}else if(i.text==="'"){if(r){throw new S.default("Double superscript",i)}var l=new w.default("textord","\\prime",this.mode);var s=[l];this.consume();while(this.nextToken.text==="'"){s.push(l);this.consume()}if(this.nextToken.text==="^"){s.push(this.handleSupSubscript("superscript"))}r=new w.default("ordgroup",s,this.mode)}else{break}}if(r||a){return new w.default("supsub",{base:t,sup:r,sub:a},this.mode)}else{return t}}},{key:"parseImplicitGroup",value:function t(){var r=this.parseSymbol();if(r==null){return this.parseFunction()}var a=r.result;if(a==="\\left"){var i=this.parseFunction(r);++this.leftrightDepth;var n=this.parseExpression(false);--this.leftrightDepth;this.expect("\\right",false);var l=this.parseFunction();return new w.default("leftright",{body:n,left:i.value.value,right:l.value.value},this.mode)}else if(a==="\\begin"){var s=this.parseFunction(r);var o=s.value.name;if(!f.default.hasOwnProperty(o)){throw new S.default("No such environment: "+o,s.value.nameGroup)}var u=f.default[o];var d=this.parseArguments("\\begin{"+o+"}",u);var c={mode:this.mode,envName:o,parser:this,positions:d.pop()};var h=u.handler(c,d);this.expect("\\end",false);var v=this.nextToken;var p=this.parseFunction();if(p.value.name!==o){throw new S.default("Mismatch: \\begin{"+o+"} matched "+"by \\end{"+p.value.name+"}",v)}h.position=p.position;return h}else if(m.default.contains(e.sizeFuncs,a)){this.consumeSpaces();var g=this.parseExpression(false);return new w.default("sizing",{size:m.default.indexOf(e.sizeFuncs,a)+1,value:g},this.mode)}else if(m.default.contains(e.styleFuncs,a)){this.consumeSpaces();var y=this.parseExpression(true);return new w.default("styling",{style:a.slice(1,a.length-5),value:y},this.mode)}else if(a in e.oldFontFuncs){var b=e.oldFontFuncs[a];this.consumeSpaces();var x=this.parseExpression(true);if(b.slice(0,4)==="text"){return new w.default("text",{style:b,body:new w.default("ordgroup",x,this.mode)},this.mode)}else{return new w.default("font",{font:b,body:new w.default("ordgroup",x,this.mode)},this.mode)}}else if(a==="\\color"){var k=this.parseColorGroup(false);if(!k){throw new S.default("\\color not followed by color")}var M=this.parseExpression(true);return new w.default("color",{type:"color",color:k.result.value,value:M},this.mode)}else if(a==="$"){if(this.mode==="math"){throw new S.default("$ within math mode")}this.consume();var z=this.mode;this.switchMode("math");var C=this.parseExpression(false,"$");this.expect("$",true);this.switchMode(z);return new w.default("styling",{style:"text",value:C},"math")}else{return this.parseFunction(r)}}},{key:"parseFunction",value:function e(t){if(!t){t=this.parseGroup()}if(t){if(t.isFunction){var r=t.result;var a=o.default[r];if(this.mode==="text"&&!a.allowedInText){throw new S.default("Can't use function '"+r+"' in text mode",t.token)}var i=this.parseArguments(r,a);var n=t.token;var l=this.callFunction(r,i,i.pop(),n);return new w.default(l.type,l,this.mode)}else{return t.result}}else{return null}}},{key:"callFunction",value:function e(t,r,a,i){var n={funcName:t,parser:this,positions:a,token:i};return o.default[t].handler(n,r)}},{key:"parseArguments",value:function e(t,r){var a=r.numArgs+r.numOptionalArgs;if(a===0){return[[this.pos]]}var i=r.greediness;var n=[this.pos];var l=[];for(var s=0;s<a;s++){var u=this.nextToken;var f=r.argTypes&&r.argTypes[s];var d=void 0;if(s<r.numOptionalArgs){if(f){d=this.parseGroupOfType(f,true)}else{d=this.parseGroup(true)}if(!d){l.push(null);n.push(this.pos);continue}}else{if(f){d=this.parseGroupOfType(f)}else{d=this.parseGroup()}if(!d){if(!this.settings.throwOnError&&this.nextToken.text[0]==="\\"){d=new z(this.handleUnsupportedCmd(this.nextToken.text),false)}else{throw new S.default("Expected group after '"+t+"'",u)}}}var c=void 0;if(d.isFunction){var h=o.default[d.result].greediness;if(h>i){c=this.parseFunction(d)}else{throw new S.default("Got function '"+d.result+"' as "+"argument to '"+t+"'",u)}}else{c=d.result}l.push(c);n.push(this.pos)}l.push(n);return l}},{key:"parseGroupOfType",value:function e(t,r){var a=this.mode;if(t==="original"){t=a}if(t==="color"){return this.parseColorGroup(r)}if(t==="size"){return this.parseSizeGroup(r)}this.switchMode(t);if(t==="text"){this.consumeSpaces()}var i=this.parseGroup(r);this.switchMode(a);return i}},{key:"consumeSpaces",value:function e(){while(this.nextToken.text===" "){this.consume()}}},{key:"parseStringGroup",value:function e(t,r){if(r&&this.nextToken.text!=="["){return null}var a=this.mode;this.mode="text";this.expect(r?"[":"{");var i="";var n=this.nextToken;var l=n;while(this.nextToken.text!==(r?"]":"}")){if(this.nextToken.text==="EOF"){throw new S.default("Unexpected end of input in "+t,n.range(this.nextToken,i))}l=this.nextToken;i+=l.text;this.consume()}this.mode=a;this.expect(r?"]":"}");return n.range(l,i)}},{key:"parseRegexGroup",value:function e(t,r){var a=this.mode;this.mode="text";var i=this.nextToken;var n=i;var l="";while(this.nextToken.text!=="EOF"&&t.test(l+this.nextToken.text)){n=this.nextToken;l+=n.text;this.consume()}if(l===""){throw new S.default("Invalid "+r+": '"+i.text+"'",i)}this.mode=a;return i.range(n,l)}},{key:"parseColorGroup",value:function e(t){var r=this.parseStringGroup("color",t);if(!r){return null}var a=/^(#[a-z0-9]+|[a-z]+)$/i.exec(r.text);if(!a){throw new S.default("Invalid color: '"+r.text+"'",r)}return new z(new w.default("color",a[0],this.mode),false)}},{key:"parseSizeGroup",value:function e(t){var r=void 0;if(!t&&this.nextToken.text!=="{"){r=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size")}else{r=this.parseStringGroup("size",t)}if(!r){return null}var a=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(r.text);if(!a){throw new S.default("Invalid size: '"+r.text+"'",r)}var i={number:+(a[1]+a[2]),unit:a[3]};if(!y.default.validUnit(i)){throw new S.default("Invalid unit: '"+i.unit+"'",r)}return new z(new w.default("size",i,this.mode),false)}},{key:"parseGroup",value:function e(t){var r=this.nextToken;if(this.nextToken.text===(t?"[":"{")){this.consume();var a=this.parseExpression(false,t?"]":null);var i=this.nextToken;this.expect(t?"]":"}");if(this.mode==="text"){this.formLigatures(a)}return new z(new w.default("ordgroup",a,this.mode,r,i),false)}else{return t?null:this.parseSymbol()}}},{key:"formLigatures",value:function e(t){var r=t.length-1;for(var a=0;a<r;++a){var i=t[a];var n=i.value;if(n==="-"&&t[a+1].value==="-"){if(a+1<r&&t[a+2].value==="-"){t.splice(a,3,new w.default("textord","---","text",i,t[a+2]));r-=2}else{t.splice(a,2,new w.default("textord","--","text",i,t[a+1]));r-=1}}if((n==="'"||n==="`")&&t[a+1].value===n){t.splice(a,2,new w.default("textord",n+n,"text",i,t[a+1]));r-=1}}}},{key:"parseSymbol",value:function e(){var t=this.nextToken;if(o.default[t.text]){this.consume();return new z(t.text,true,t)}else if(v.default[this.mode][t.text]){this.consume();return new z(new w.default(v.default[this.mode][t.text].group,t.text,this.mode,t),false,t)}else if(this.mode==="text"&&b.cjkRegex.test(t.text)){this.consume();return new z(new w.default("textord",t.text,this.mode,t),false,t)}else if(t.text==="$"){return new z(t.text,false,t)}else{return null}}}]);return e}();C.endOfExpression=["}","\\end","\\right","&","\\\\","\\cr"];C.SUPSUB_GREEDINESS=1;C.sizeFuncs=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"];C.styleFuncs=["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"];C.oldFontFuncs={"\\rm":"mathrm","\\sf":"mathsf","\\tt":"mathtt","\\bf":"mathbf","\\it":"mathit"};C.prototype.ParseNode=w.default;t.exports=C},{"./MacroExpander":27,"./ParseError":29,"./ParseNode":30,"./environments":40,"./functions":43,"./symbols":48,"./unicodeRegexes":49,"./units":50,"./utils":51,"babel-runtime/helpers/classCallCheck":4,"babel-runtime/helpers/createClass":5}],32:[function(e,t,r){"use strict";var a=e("babel-runtime/helpers/classCallCheck");var i=s(a);var n=e("./utils");var l=s(n);function s(e){return e&&e.__esModule?e:{default:e}}var o=function e(t){(0,i.default)(this,e);t=t||{};this.displayMode=l.default.deflt(t.displayMode,false);this.throwOnError=l.default.deflt(t.throwOnError,true);this.errorColor=l.default.deflt(t.errorColor,"#cc0000");this.macros=t.macros||{};this.colorIsTextColor=l.default.deflt(t.colorIsTextColor,false)};t.exports=o},{"./utils":51,"babel-runtime/helpers/classCallCheck":4}],33:[function(e,t,r){"use strict";var a=e("babel-runtime/helpers/classCallCheck");var i=s(a);var n=e("babel-runtime/helpers/createClass");var l=s(n);function s(e){return e&&e.__esModule?e:{default:e}}var o=function(){function e(t,r,a){(0,i.default)(this,e);this.id=t;this.size=r;this.cramped=a}(0,l.default)(e,[{key:"sup",value:function e(){return g[y[this.id]]}},{key:"sub",value:function e(){return g[b[this.id]]}},{key:"fracNum",value:function e(){return g[x[this.id]]}},{key:"fracDen",value:function e(){return g[w[this.id]]}},{key:"cramp",value:function e(){return g[k[this.id]]}},{key:"text",value:function e(){return g[S[this.id]]}},{key:"isTight",value:function e(){return this.size>=2}}]);return e}();var u=0;var f=1;var d=2;var c=3;var h=4;var v=5;var p=6;var m=7;var g=[new o(u,0,false),new o(f,0,true),new o(d,1,false),new o(c,1,true),new o(h,2,false),new o(v,2,true),new o(p,3,false),new o(m,3,true)];var y=[h,v,h,v,p,m,p,m];var b=[v,v,v,v,m,m,m,m];var x=[d,c,h,v,p,m,p,m];var w=[c,c,v,v,m,m,m,m];var k=[f,f,c,c,v,v,m,m];var S=[u,f,d,c,d,c,d,c];t.exports={DISPLAY:g[u],TEXT:g[d],SCRIPT:g[h],SCRIPTSCRIPT:g[p]}},{"babel-runtime/helpers/classCallCheck":4,"babel-runtime/helpers/createClass":5}],34:[function(e,t,r){"use strict";var a=e("./domTree");var i=d(a);var n=e("./fontMetrics");var l=d(n);var s=e("./symbols");var o=d(s);var u=e("./utils");var f=d(u);function d(e){return e&&e.__esModule?e:{default:e}}var c=["\\imath","\\jmath","\\pounds"];var h=function e(t,r,a){if(o.default[a][t]&&o.default[a][t].replace){t=o.default[a][t].replace}return{value:t,metrics:l.default.getCharacterMetrics(t,r)}};var v=function e(t,r,a,n,l){var s=h(t,r,a);var o=s.metrics;t=s.value;var u=void 0;if(o){var f=o.italic;if(a==="text"){f=0}u=new i.default.symbolNode(t,o.height,o.depth,f,o.skew,l)}else{typeof console!=="undefined"&&console.warn("No character metrics for '"+t+"' in style '"+r+"'");u=new i.default.symbolNode(t,0,0,0,0,l)}if(n){u.maxFontSize=n.sizeMultiplier;if(n.style.isTight()){u.classes.push("mtight")}if(n.getColor()){u.style.color=n.getColor()}}return u};var p=function e(t,r,a,i){if(t==="\\"||o.default[r][t].font==="main"){return v(t,"Main-Regular",r,a,i)}else{return v(t,"AMS-Regular",r,a,i.concat(["amsrm"]))}};var m=function e(t,r,a,i,n){if(n==="mathord"){var l=g(t,r,a,i);return v(t,l.fontName,r,a,i.concat([l.fontClass]))}else if(n==="textord"){var s=o.default[r][t]&&o.default[r][t].font;if(s==="ams"){return v(t,"AMS-Regular",r,a,i.concat(["amsrm"]))}else{return v(t,"Main-Regular",r,a,i.concat(["mathrm"]))}}else{throw new Error("unexpected type: "+n+" in mathDefault")}};var g=function e(t,r,a,i){if(/[0-9]/.test(t.charAt(0))||f.default.contains(c,t)){return{fontName:"Main-Italic",fontClass:"mainit"}}else{return{fontName:"Math-Italic",fontClass:"mathit"
}}};var y=function e(t,r,a){var i=t.mode;var n=t.value;var l=["mord"];var s=r.font;if(s){var o=void 0;if(s==="mathit"||f.default.contains(c,n)){o=g(n,i,r,l)}else{o=z[s]}if(h(n,o.fontName,i).metrics){return v(n,o.fontName,i,r,l.concat([o.fontClass||s]))}else{return m(n,i,r,l,a)}}else{return m(n,i,r,l,a)}};var b=function e(t){var r=0;var a=0;var i=0;if(t.children){for(var n=0;n<t.children.length;n++){if(t.children[n].height>r){r=t.children[n].height}if(t.children[n].depth>a){a=t.children[n].depth}if(t.children[n].maxFontSize>i){i=t.children[n].maxFontSize}}}t.height=r;t.depth=a;t.maxFontSize=i};var x=function e(t,r,a){var n=new i.default.span(t,r,a);b(n);return n};var w=function e(t,r){t.children=r.concat(t.children);b(t)};var k=function e(t){var r=new i.default.documentFragment(t);b(r);return r};var S=function e(t,r,a,n){var l=void 0;var s=void 0;var o=void 0;if(r==="individualShift"){var u=t;t=[u[0]];l=-u[0].shift-u[0].elem.depth;s=l;for(o=1;o<u.length;o++){var f=-u[o].shift-s-u[o].elem.depth;var d=f-(u[o-1].elem.height+u[o-1].elem.depth);s=s+f;t.push({type:"kern",size:d});t.push(u[o])}}else if(r==="top"){var c=a;for(o=0;o<t.length;o++){if(t[o].type==="kern"){c-=t[o].size}else{c-=t[o].elem.height+t[o].elem.depth}}l=c}else if(r==="bottom"){l=-a}else if(r==="shift"){l=-t[0].elem.depth-a}else if(r==="firstBaseline"){l=-t[0].elem.depth}else{l=0}var h=0;for(o=0;o<t.length;o++){if(t[o].type==="elem"){var v=t[o].elem;h=Math.max(h,v.maxFontSize,v.height)}}h+=2;var p=x(["pstrut"],[]);p.style.height=h+"em";var m=[];var g=l;var y=l;s=l;for(o=0;o<t.length;o++){if(t[o].type==="kern"){s+=t[o].size}else{var b=t[o].elem;var w=x([],[p,b]);w.style.top=-h-s-b.depth+"em";if(t[o].marginLeft){w.style.marginLeft=t[o].marginLeft}if(t[o].marginRight){w.style.marginRight=t[o].marginRight}m.push(w);s+=b.height+b.depth}g=Math.min(g,s);y=Math.max(y,s)}var k=x(["vlist"],m);k.style.height=y+"em";var S=void 0;if(g<0){var M=x(["vlist"],[]);M.style.height=-g+"em";var z=x(["vlist-s"],[new i.default.symbolNode("\u200b")]);S=[x(["vlist-r"],[k,z]),x(["vlist-r"],[M])]}else{S=[x(["vlist-r"],[k])]}var C=x(["vlist-t"],S);if(S.length===2){C.classes.push("vlist-t2")}C.height=y;C.depth=-g;return C};var M={"\\qquad":{size:"2em",className:"qquad"},"\\quad":{size:"1em",className:"quad"},"\\enspace":{size:"0.5em",className:"enspace"},"\\;":{size:"0.277778em",className:"thickspace"},"\\:":{size:"0.22222em",className:"mediumspace"},"\\,":{size:"0.16667em",className:"thinspace"},"\\!":{size:"-0.16667em",className:"negativethinspace"}};var z={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}};t.exports={fontMap:z,makeSymbol:v,mathsym:p,makeSpan:x,makeFragment:k,makeVList:S,makeOrd:y,prependChildren:w,spacingFunctions:M}},{"./domTree":39,"./fontMetrics":41,"./symbols":48,"./utils":51}],35:[function(e,t,r){"use strict";var a=e("babel-runtime/core-js/json/stringify");var i=w(a);var n=e("./ParseError");var l=w(n);var s=e("./Style");var o=w(s);var u=e("./buildCommon");var f=w(u);var d=e("./delimiter");var c=w(d);var h=e("./domTree");var v=w(h);var p=e("./units");var m=w(p);var g=e("./utils");var y=w(g);var b=e("./stretchy");var x=w(b);function w(e){return e&&e.__esModule?e:{default:e}}var k=function e(t){return t instanceof v.default.span&&t.classes[0]==="mspace"};var S=function e(t){return t&&t.classes[0]==="mbin"};var M=function e(t,r){if(t){return y.default.contains(["mbin","mopen","mrel","mop","mpunct"],t.classes[0])}else{return r}};var z=function e(t,r){if(t){return y.default.contains(["mrel","mclose","mpunct"],t.classes[0])}else{return r}};var C=function e(t,r){var a=r;while(a<t.length&&k(t[a])){a++}if(a===r){return null}else{return t.splice(r,a-r)}};var T=function e(t,r,a){var i=[];for(var n=0;n<t.length;n++){var l=t[n];var s=L(l,r);if(s instanceof v.default.documentFragment){Array.prototype.push.apply(i,s.children)}else{i.push(s)}}for(var o=0;o<i.length;o++){var d=C(i,o);if(d){if(o<i.length){if(i[o]instanceof v.default.symbolNode){i[o]=(0,u.makeSpan)([].concat(i[o].classes),[i[o]])}f.default.prependChildren(i[o],d)}else{Array.prototype.push.apply(i,d);break}}}for(var c=0;c<i.length;c++){if(S(i[c])&&(M(i[c-1],a)||z(i[c+1],a))){i[c].classes[0]="mord"}}return i};var N=function e(t){if(t instanceof v.default.documentFragment){if(t.children.length){return e(t.children[t.children.length-1])}}else{if(y.default.contains(["mord","mop","mbin","mrel","mopen","mclose","mpunct","minner"],t.classes[0])){return t.classes[0]}}return null};var A=function e(t,r){if(!t.value.base){return false}else{var a=t.value.base;if(a.type==="op"){return a.value.limits&&(r.style.size===o.default.DISPLAY.size||a.value.alwaysHandleSupSub)}else if(a.type==="accent"){return _(a.value.base)}else if(a.type==="horizBrace"){var i=t.value.sub?false:true;return i===a.value.isOver}else{return null}}};var q=function e(t){if(!t){return false}else if(t.type==="ordgroup"){if(t.value.length===1){return e(t.value[0])}else{return t}}else if(t.type==="color"){if(t.value.value.length===1){return e(t.value.value[0])}else{return t}}else if(t.type==="font"){return e(t.value.body)}else{return t}};var _=function e(t){var r=q(t);return r.type==="mathord"||r.type==="textord"||r.type==="bin"||r.type==="rel"||r.type==="inner"||r.type==="open"||r.type==="close"||r.type==="punct"};var E=function e(t,r){var a=["nulldelimiter"].concat(t.baseSizingClasses());return(0,u.makeSpan)(r.concat(a))};var O={};O.mathord=function(e,t){return f.default.makeOrd(e,t,"mathord")};O.textord=function(e,t){return f.default.makeOrd(e,t,"textord")};O.bin=function(e,t){return f.default.mathsym(e.value,e.mode,t,["mbin"])};O.rel=function(e,t){return f.default.mathsym(e.value,e.mode,t,["mrel"])};O.open=function(e,t){return f.default.mathsym(e.value,e.mode,t,["mopen"])};O.close=function(e,t){return f.default.mathsym(e.value,e.mode,t,["mclose"])};O.inner=function(e,t){return f.default.mathsym(e.value,e.mode,t,["minner"])};O.punct=function(e,t){return f.default.mathsym(e.value,e.mode,t,["mpunct"])};O.ordgroup=function(e,t){return(0,u.makeSpan)(["mord"],T(e.value,t,true),t)};O.text=function(e,t){var r=t.withFont(e.value.style);var a=T(e.value.body,r,true);for(var i=0;i<a.length-1;i++){if(a[i].tryCombine(a[i+1])){a.splice(i+1,1);i--}}return(0,u.makeSpan)(["mord","text"],a,r)};O.color=function(e,t){var r=T(e.value.value,t.withColor(e.value.color),false);return new f.default.makeFragment(r)};O.supsub=function(e,t){if(A(e,t)){return O[e.value.base.type](e,t)}var r=L(e.value.base,t);var a=void 0;var i=void 0;var n=t.fontMetrics();var l=void 0;var s=0;var d=0;if(e.value.sup){l=t.havingStyle(t.style.sup());a=L(e.value.sup,l,t);if(!_(e.value.base)){s=r.height-l.fontMetrics().supDrop*l.sizeMultiplier/t.sizeMultiplier}}if(e.value.sub){l=t.havingStyle(t.style.sub());i=L(e.value.sub,l,t);if(!_(e.value.base)){d=r.depth+l.fontMetrics().subDrop*l.sizeMultiplier/t.sizeMultiplier}}var c=void 0;if(t.style===o.default.DISPLAY){c=n.sup1}else if(t.style.cramped){c=n.sup3}else{c=n.sup2}var h=t.sizeMultiplier;var p=.5/n.ptPerEm/h+"em";var m=void 0;if(!e.value.sup){d=Math.max(d,n.sub1,i.height-.8*n.xHeight);var g=[{type:"elem",elem:i,marginRight:p}];if(r instanceof v.default.symbolNode){g[0].marginLeft=-r.italic+"em"}m=f.default.makeVList(g,"shift",d,t)}else if(!e.value.sub){s=Math.max(s,c,a.depth+.25*n.xHeight);m=f.default.makeVList([{type:"elem",elem:a,marginRight:p}],"shift",-s,t)}else{s=Math.max(s,c,a.depth+.25*n.xHeight);d=Math.max(d,n.sub2);var y=n.defaultRuleThickness;if(s-a.depth-(i.height-d)<4*y){d=4*y-(s-a.depth)+i.height;var b=.8*n.xHeight-(s-a.depth);if(b>0){s+=b;d-=b}}var x=[{type:"elem",elem:i,shift:d,marginRight:p},{type:"elem",elem:a,shift:-s,marginRight:p}];if(r instanceof v.default.symbolNode){x[0].marginLeft=-r.italic+"em"}m=f.default.makeVList(x,"individualShift",null,t)}var w=N(r)||"mord";return(0,u.makeSpan)([w],[r,(0,u.makeSpan)(["msupsub"],[m])],t)};O.genfrac=function(e,t){var r=t.style;if(e.value.size==="display"){r=o.default.DISPLAY}else if(e.value.size==="text"){r=o.default.TEXT}var a=r.fracNum();var i=r.fracDen();var n=void 0;n=t.havingStyle(a);var l=L(e.value.numer,n,t);n=t.havingStyle(i);var s=L(e.value.denom,n,t);var d=void 0;var h=void 0;var v=void 0;if(e.value.hasBarLine){d=R("frac-line",t);h=d.height;v=d.height}else{d=null;h=0;v=t.fontMetrics().defaultRuleThickness}var p=void 0;var m=void 0;var g=void 0;if(r.size===o.default.DISPLAY.size){p=t.fontMetrics().num1;if(h>0){m=3*v}else{m=7*v}g=t.fontMetrics().denom1}else{if(h>0){p=t.fontMetrics().num2;m=v}else{p=t.fontMetrics().num3;m=3*v}g=t.fontMetrics().denom2}var y=void 0;if(h===0){var b=p-l.depth-(s.height-g);if(b<m){p+=.5*(m-b);g+=.5*(m-b)}y=f.default.makeVList([{type:"elem",elem:s,shift:g},{type:"elem",elem:l,shift:-p}],"individualShift",null,t)}else{var x=t.fontMetrics().axisHeight;if(p-l.depth-(x+.5*h)<m){p+=m-(p-l.depth-(x+.5*h))}if(x-.5*h-(s.height-g)<m){g+=m-(x-.5*h-(s.height-g))}var w=-(x-.5*h);y=f.default.makeVList([{type:"elem",elem:s,shift:g},{type:"elem",elem:d,shift:w},{type:"elem",elem:l,shift:-p}],"individualShift",null,t)}n=t.havingStyle(r);y.height*=n.sizeMultiplier/t.sizeMultiplier;y.depth*=n.sizeMultiplier/t.sizeMultiplier;var k=void 0;if(r.size===o.default.DISPLAY.size){k=t.fontMetrics().delim1}else{k=t.fontMetrics().delim2}var S=void 0;var M=void 0;if(e.value.leftDelim==null){S=E(t,["mopen"])}else{S=c.default.customSizedDelim(e.value.leftDelim,k,true,t.havingStyle(r),e.mode,["mopen"])}if(e.value.rightDelim==null){M=E(t,["mclose"])}else{M=c.default.customSizedDelim(e.value.rightDelim,k,true,t.havingStyle(r),e.mode,["mclose"])}return(0,u.makeSpan)(["mord"].concat(n.sizingClasses(t)),[S,(0,u.makeSpan)(["mfrac"],[y]),M],t)};O.array=function(e,t){var r=void 0;var a=void 0;var i=e.value.body.length;var n=0;var s=new Array(i);var o=1/t.fontMetrics().ptPerEm;var d=5*o;var c=12*o;var h=3*o;var v=y.default.deflt(e.value.arraystretch,1);var p=v*c;var g=.7*p;var b=.3*p;var x=0;for(r=0;r<e.value.body.length;++r){var w=e.value.body[r];var k=g;var S=b;if(n<w.length){n=w.length}var M=new Array(w.length);for(a=0;a<w.length;++a){var z=L(w[a],t);if(S<z.depth){S=z.depth}if(k<z.height){k=z.height}M[a]=z}var C=0;if(e.value.rowGaps[r]){C=m.default.calculateSize(e.value.rowGaps[r].value,t);if(C>0){C+=b;if(S<C){S=C}C=0}}if(e.value.addJot){S+=h}M.height=k;M.depth=S;x+=k;M.pos=x;x+=S+C;s[r]=M}var T=x/2+t.fontMetrics().axisHeight;var N=e.value.cols||[];var A=[];var q=void 0;var _=void 0;for(a=0,_=0;a<n||_<N.length;++a,++_){var E=N[_]||{};var O=true;while(E.type==="separator"){if(!O){q=(0,u.makeSpan)(["arraycolsep"],[]);q.style.width=t.fontMetrics().doubleRuleSep+"em";A.push(q)}if(E.separator==="|"){var R=(0,u.makeSpan)(["vertical-separator"],[]);R.style.height=x+"em";R.style.verticalAlign=-(x-T)+"em";A.push(R)}else{throw new l.default("Invalid separator type: "+E.separator)}_++;E=N[_]||{};O=false}if(a>=n){continue}var P=void 0;if(a>0||e.value.hskipBeforeAndAfter){P=y.default.deflt(E.pregap,d);if(P!==0){q=(0,u.makeSpan)(["arraycolsep"],[]);q.style.width=P+"em";A.push(q)}}var F=[];for(r=0;r<i;++r){var D=s[r];var B=D[a];if(!B){continue}var I=D.pos-T;B.depth=D.depth;B.height=D.height;F.push({type:"elem",elem:B,shift:I})}F=f.default.makeVList(F,"individualShift",null,t);F=(0,u.makeSpan)(["col-align-"+(E.align||"c")],[F]);A.push(F);if(a<n-1||e.value.hskipBeforeAndAfter){P=y.default.deflt(E.postgap,d);if(P!==0){q=(0,u.makeSpan)(["arraycolsep"],[]);q.style.width=P+"em";A.push(q)}}}s=(0,u.makeSpan)(["mtable"],A);return(0,u.makeSpan)(["mord"],[s],t)};O.spacing=function(e,t){if(e.value==="\\ "||e.value==="\\space"||e.value===" "||e.value==="~"){if(e.mode==="text"){return f.default.makeOrd(e,t,"textord")}else{return(0,u.makeSpan)(["mspace"],[f.default.mathsym(e.value,e.mode,t)],t)}}else{return(0,u.makeSpan)(["mspace",f.default.spacingFunctions[e.value].className],[],t)}};O.llap=function(e,t){var r=(0,u.makeSpan)(["inner"],[L(e.value.body,t)]);var a=(0,u.makeSpan)(["fix"],[]);return(0,u.makeSpan)(["mord","llap"],[r,a],t)};O.rlap=function(e,t){var r=(0,u.makeSpan)(["inner"],[L(e.value.body,t)]);var a=(0,u.makeSpan)(["fix"],[]);return(0,u.makeSpan)(["mord","rlap"],[r,a],t)};O.op=function(e,t){var r=void 0;var a=void 0;var i=false;if(e.type==="supsub"){r=e.value.sup;a=e.value.sub;e=e.value.base;i=true}var n=t.style;var l=["\\smallint"];var s=false;if(n.size===o.default.DISPLAY.size&&e.value.symbol&&!y.default.contains(l,e.value.body)){s=true}var d=void 0;if(e.value.symbol){var c=s?"Size2-Regular":"Size1-Regular";d=f.default.makeSymbol(e.value.body,c,"math",t,["mop","op-symbol",s?"large-op":"small-op"])}else if(e.value.value){var h=T(e.value.value,t,true);if(h.length===1&&h[0]instanceof v.default.symbolNode){d=h[0];d.classes[0]="mop"}else{d=(0,u.makeSpan)(["mop"],h,t)}}else{var p=[];for(var m=1;m<e.value.body.length;m++){p.push(f.default.mathsym(e.value.body[m],e.mode))}d=(0,u.makeSpan)(["mop"],p,t)}var g=0;var b=0;if(d instanceof v.default.symbolNode){g=(d.height-d.depth)/2-t.fontMetrics().axisHeight;b=d.italic}if(i){d=(0,u.makeSpan)([],[d]);var x=void 0;var w=void 0;var k=void 0;var S=void 0;var M=void 0;if(r){M=t.havingStyle(n.sup());x=L(r,M,t);w=Math.max(t.fontMetrics().bigOpSpacing1,t.fontMetrics().bigOpSpacing3-x.depth)}if(a){M=t.havingStyle(n.sub());k=L(a,M,t);S=Math.max(t.fontMetrics().bigOpSpacing2,t.fontMetrics().bigOpSpacing4-k.height)}var z=void 0;var C=void 0;var N=void 0;if(!r){C=d.height-g;z=f.default.makeVList([{type:"kern",size:t.fontMetrics().bigOpSpacing5},{type:"elem",elem:k,marginLeft:-b+"em"},{type:"kern",size:S},{type:"elem",elem:d}],"top",C,t)}else if(!a){N=d.depth+g;z=f.default.makeVList([{type:"elem",elem:d},{type:"kern",size:w},{type:"elem",elem:x,marginLeft:b+"em"},{type:"kern",size:t.fontMetrics().bigOpSpacing5}],"bottom",N,t)}else if(!r&&!a){return d}else{N=t.fontMetrics().bigOpSpacing5+k.height+k.depth+S+d.depth+g;z=f.default.makeVList([{type:"kern",size:t.fontMetrics().bigOpSpacing5},{type:"elem",elem:k,marginLeft:-b+"em"},{type:"kern",size:S},{type:"elem",elem:d},{type:"kern",size:w},{type:"elem",elem:x,marginLeft:b+"em"},{type:"kern",size:t.fontMetrics().bigOpSpacing5}],"bottom",N,t)}return(0,u.makeSpan)(["mop","op-limits"],[z],t)}else{if(g){d.style.position="relative";d.style.top=g+"em"}return d}};O.mod=function(e,t){var r=[];if(e.value.modType==="bmod"){if(!t.style.isTight()){r.push((0,u.makeSpan)(["mspace","negativemediumspace"],[],t))}r.push((0,u.makeSpan)(["mspace","thickspace"],[],t))}else if(t.style.size===o.default.DISPLAY.size){r.push((0,u.makeSpan)(["mspace","quad"],[],t))}else if(e.value.modType==="mod"){r.push((0,u.makeSpan)(["mspace","twelvemuspace"],[],t))}else{r.push((0,u.makeSpan)(["mspace","eightmuspace"],[],t))}if(e.value.modType==="pod"||e.value.modType==="pmod"){r.push(f.default.mathsym("(",e.mode))}if(e.value.modType!=="pod"){var a=[f.default.mathsym("m",e.mode),f.default.mathsym("o",e.mode),f.default.mathsym("d",e.mode)];if(e.value.modType==="bmod"){r.push((0,u.makeSpan)(["mbin"],a,t));r.push((0,u.makeSpan)(["mspace","thickspace"],[],t));if(!t.style.isTight()){r.push((0,u.makeSpan)(["mspace","negativemediumspace"],[],t))}}else{Array.prototype.push.apply(r,a);r.push((0,u.makeSpan)(["mspace","sixmuspace"],[],t))}}if(e.value.value){Array.prototype.push.apply(r,T(e.value.value,t,false))}if(e.value.modType==="pod"||e.value.modType==="pmod"){r.push(f.default.mathsym(")",e.mode))}return f.default.makeFragment(r)};O.katex=function(e,t){var r=(0,u.makeSpan)(["k"],[f.default.mathsym("K",e.mode)],t);var a=(0,u.makeSpan)(["a"],[f.default.mathsym("A",e.mode)],t);a.height=(a.height+.2)*.75;a.depth=(a.height-.2)*.75;var i=(0,u.makeSpan)(["t"],[f.default.mathsym("T",e.mode)],t);var n=(0,u.makeSpan)(["e"],[f.default.mathsym("E",e.mode)],t);n.height=n.height-.2155;n.depth=n.depth+.2155;var l=(0,u.makeSpan)(["x"],[f.default.mathsym("X",e.mode)],t);return(0,u.makeSpan)(["mord","katex-logo"],[r,a,i,n,l],t)};var R=function e(t,r,a){var i=(0,u.makeSpan)([t],[],r);i.height=a||r.fontMetrics().defaultRuleThickness;i.style.borderBottomWidth=i.height+"em";i.maxFontSize=1;return i};O.overline=function(e,t){var r=L(e.value.body,t.havingCrampedStyle());var a=R("overline-line",t);var i=f.default.makeVList([{type:"elem",elem:r},{type:"kern",size:3*a.height},{type:"elem",elem:a},{type:"kern",size:a.height}],"firstBaseline",null,t);return(0,u.makeSpan)(["mord","overline"],[i],t)};O.underline=function(e,t){var r=L(e.value.body,t);var a=R("underline-line",t);var i=f.default.makeVList([{type:"kern",size:a.height},{type:"elem",elem:a},{type:"kern",size:3*a.height},{type:"elem",elem:r}],"top",r.height,t);return(0,u.makeSpan)(["mord","underline"],[i],t)};O.sqrt=function(e,t){var r=L(e.value.body,t.havingCrampedStyle());var a=t.fontMetrics();var i=a.defaultRuleThickness;var n=i;if(t.style.id<o.default.TEXT.id){n=t.fontMetrics().xHeight}var l=i+n/4;var s=(r.height+r.depth+l+i)*t.sizeMultiplier;var d=c.default.customSizedDelim("\\surd",s,false,t,e.mode);var h=(0,u.makeSpan)(["sqrt-sign"],[d],t);var v=t.fontMetrics().sqrtRuleThickness*d.delimSizeMultiplier;var p=R("sqrt-line",t,v);var m=h.height+h.depth-v;if(m>r.height+r.depth+l){l=(l+m-r.height-r.depth)/2}var g=-(r.height+l+v)+h.height;h.style.top=g+"em";h.height-=g;h.depth+=g;var y=void 0;if(r.height===0&&r.depth===0){y=(0,u.makeSpan)()}else{y=f.default.makeVList([{type:"elem",elem:r},{type:"kern",size:l},{type:"elem",elem:p},{type:"kern",size:v}],"firstBaseline",null,t)}if(!e.value.index){return(0,u.makeSpan)(["mord","sqrt"],[h,y],t)}else{var b=t.havingStyle(o.default.SCRIPTSCRIPT);var x=L(e.value.index,b,t);var w=Math.max(h.height,y.height);var k=Math.max(h.depth,y.depth);var S=.6*(w-k);var M=f.default.makeVList([{type:"elem",elem:x}],"shift",-S,t);var z=(0,u.makeSpan)(["root"],[M]);return(0,u.makeSpan)(["mord","sqrt"],[z,h,y],t)}};function P(e,t,r){var a=T(e,t,false);var i=t.sizeMultiplier/r.sizeMultiplier;for(var n=0;n<a.length;n++){var l=y.default.indexOf(a[n].classes,"sizing");if(l<0){Array.prototype.push.apply(a[n].classes,t.sizingClasses(r))}else if(a[n].classes[l+1]==="reset-size"+t.size){a[n].classes[l+1]="reset-size"+r.size}a[n].height*=i;a[n].depth*=i}return f.default.makeFragment(a)}O.sizing=function(e,t){var r=t.havingSize(e.value.size);return P(e.value.value,r,t)};O.styling=function(e,t){var r={display:o.default.DISPLAY,text:o.default.TEXT,script:o.default.SCRIPT,scriptscript:o.default.SCRIPTSCRIPT};var a=r[e.value.style];var i=t.havingStyle(a);return P(e.value.value,i,t)};O.font=function(e,t){var r=e.value.font;return L(e.value.body,t.withFont(r))};O.delimsizing=function(e,t){var r=e.value.value;if(r==="."){return(0,u.makeSpan)([e.value.mclass])}return c.default.sizedDelim(r,e.value.size,t,e.mode,[e.value.mclass])};O.leftright=function(e,t){var r=T(e.value.body,t,true);var a=0;var i=0;var n=false;for(var l=0;l<r.length;l++){if(r[l].isMiddle){n=true}else{a=Math.max(r[l].height,a);i=Math.max(r[l].depth,i)}}a*=t.sizeMultiplier;i*=t.sizeMultiplier;var s=void 0;if(e.value.left==="."){s=E(t,["mopen"])}else{s=c.default.leftRightDelim(e.value.left,a,i,t,e.mode,["mopen"])}r.unshift(s);if(n){for(var o=1;o<r.length;o++){var d=r[o];if(d.isMiddle){r[o]=c.default.leftRightDelim(d.isMiddle.value,a,i,d.isMiddle.options,e.mode,[]);var h=C(d.children,0);if(h){f.default.prependChildren(r[o],h)}}}}var v=void 0;if(e.value.right==="."){v=E(t,["mclose"])}else{v=c.default.leftRightDelim(e.value.right,a,i,t,e.mode,["mclose"])}r.push(v);return(0,u.makeSpan)(["minner"],r,t)};O.middle=function(e,t){var r=void 0;if(e.value.value==="."){r=E(t,[])}else{r=c.default.sizedDelim(e.value.value,1,t,e.mode,[]);r.isMiddle={value:e.value.value,options:t}}return r};O.rule=function(e,t){var r=(0,u.makeSpan)(["mord","rule"],[],t);var a=0;if(e.value.shift){a=m.default.calculateSize(e.value.shift,t)}var i=m.default.calculateSize(e.value.width,t);var n=m.default.calculateSize(e.value.height,t);r.style.borderRightWidth=i+"em";r.style.borderTopWidth=n+"em";r.style.bottom=a+"em";r.width=i;r.height=n+a;r.depth=-a;r.maxFontSize=n*1.125*t.sizeMultiplier;return r};O.kern=function(e,t){var r=(0,u.makeSpan)(["mord","rule"],[],t);if(e.value.dimension){var a=m.default.calculateSize(e.value.dimension,t);r.style.marginLeft=a+"em"}return r};O.accent=function(e,t){var r=e.value.base;var a=void 0;if(e.type==="supsub"){var i=e;e=i.value.base;r=e.value.base;i.value.base=r;a=L(i,t)}var n=L(r,t.havingCrampedStyle());var l=e.value.isShifty&&_(r);var s=0;if(l){var o=q(r);var d=L(o,t.havingCrampedStyle());s=d.skew}var c=Math.min(n.height,t.fontMetrics().xHeight);var h=void 0;if(!e.value.isStretchy){var v=f.default.makeSymbol(e.value.label,"Main-Regular","math",t);v.italic=0;var p=e.value.label==="\\vec"?"accent-vec":null;h=(0,u.makeSpan)(["accent-body",p],[(0,u.makeSpan)([],[v])]);h.style.marginLeft=2*s+"em";h=f.default.makeVList([{type:"elem",elem:n},{type:"kern",size:-c},{type:"elem",elem:h}],"firstBaseline",null,t)}else{h=x.default.svgSpan(e,t);if(s>0){var m="calc(100% - "+2*s+"em) 100%";h.style.backgroundSize=m}h=f.default.makeVList([{type:"elem",elem:n},{type:"elem",elem:h}],"firstBaseline",null,t)}var g=(0,u.makeSpan)(["mord","accent"],[h],t);if(a){a.children[0]=g;a.height=Math.max(g.height,a.height);a.classes[0]="mord";return a}else{return g}};O.horizBrace=function(e,t){var r=t.style;var a=e.type==="supsub";var i=void 0;var n=void 0;if(a){if(e.value.sup){n=t.havingStyle(r.sup());i=L(e.value.sup,n,t)}else{n=t.havingStyle(r.sub());i=L(e.value.sub,n,t)}e=e.value.base}var l=L(e.value.base,t.havingBaseStyle(o.default.DISPLAY));var s=x.default.svgSpan(e,t);var d=void 0;if(e.value.isOver){d=f.default.makeVList([{type:"elem",elem:l},{type:"kern",size:.1},{type:"elem",elem:s}],"firstBaseline",null,t)}else{d=f.default.makeVList([{type:"elem",elem:s},{type:"kern",size:.1},{type:"elem",elem:l}],"bottom",l.depth+.1+s.height,t)}if(a){var c=(0,u.makeSpan)(["mord",e.value.isOver?"mover":"munder"],[d],t);if(e.value.isOver){d=f.default.makeVList([{type:"elem",elem:c},{type:"kern",size:.2},{type:"elem",elem:i}],"firstBaseline",null,t)}else{d=f.default.makeVList([{type:"elem",elem:i},{type:"kern",size:.2},{type:"elem",elem:c}],"bottom",c.depth+.2+i.height,t)}}return(0,u.makeSpan)(["mord",e.value.isOver?"mover":"munder"],[d],t)};O.accentUnder=function(e,t){var r=L(e.value.body,t);var a=x.default.svgSpan(e,t);var i=/tilde/.test(e.value.label)?.12:0;var n=f.default.makeVList([{type:"elem",elem:a},{type:"kern",size:i},{type:"elem",elem:r}],"bottom",a.height+i,t);return(0,u.makeSpan)(["mord","accentunder"],[n],t)};O.enclose=function(e,t){var r=L(e.value.body,t);var a=e.value.label.substr(1);var i=t.sizeMultiplier;var n=void 0;var l=0;var s=0;if(a==="sout"){n=(0,u.makeSpan)(["stretchy","sout"]);n.height=t.fontMetrics().defaultRuleThickness/i;n.maxFontSize=1;s=-.5*t.fontMetrics().xHeight}else{r.classes.push(a==="fbox"?"boxpad":"cancel-pad");var o=_(e.value.body);l=a==="fbox"?.34:o?.2:0;s=r.depth+l;n=x.default.encloseSpan(r,o,a,l,t)}var d=f.default.makeVList([{type:"elem",elem:r,shift:0},{type:"elem",elem:n,shift:s}],"individualShift",null,t);if(/cancel/.test(a)){return(0,u.makeSpan)(["mord","cancel-lap"],[d],t)}else{return(0,u.makeSpan)(["mord"],[d],t)}};O.xArrow=function(e,t){var r=t.style;var a=t.havingStyle(r.sup());var i=L(e.value.body,a,t);i.classes.push("x-arrow-pad");var n=void 0;if(e.value.below){a=t.havingStyle(r.sub());n=L(e.value.below,a,t);n.classes.push("x-arrow-pad")}var l=x.default.svgSpan(e,t);var s=-t.fontMetrics().axisHeight+l.depth;var o=-t.fontMetrics().axisHeight-l.height-.111;var d=void 0;if(e.value.below){var c=-t.fontMetrics().axisHeight+n.height+l.height+.111;d=f.default.makeVList([{type:"elem",elem:i,shift:o},{type:"elem",elem:l,shift:s},{type:"elem",elem:n,shift:c}],"individualShift",null,t)}else{d=f.default.makeVList([{type:"elem",elem:i,shift:o},{type:"elem",elem:l,shift:s}],"individualShift",null,t)}return(0,u.makeSpan)(["mrel","x-arrow"],[d],t)};O.phantom=function(e,t){var r=T(e.value.value,t.withPhantom(),false);return new f.default.makeFragment(r)};O.mclass=function(e,t){var r=T(e.value.value,t,true);return(0,u.makeSpan)([e.value.mclass],r,t)};var L=function e(t,r,a){if(!t){return(0,u.makeSpan)()}if(O[t.type]){var i=O[t.type](t,r);if(a&&r.size!==a.size){i=(0,u.makeSpan)(r.sizingClasses(a),[i],r);var n=r.sizeMultiplier/a.sizeMultiplier;i.height*=n;i.depth*=n}return i}else{throw new l.default("Got group of unknown type: '"+t.type+"'")}};var F=function e(t,r){t=JSON.parse((0,i.default)(t));var a=T(t,r,true);var n=(0,u.makeSpan)(["base"],a,r);var l=(0,u.makeSpan)(["strut"]);var s=(0,u.makeSpan)(["strut","bottom"]);l.style.height=n.height+"em";s.style.height=n.height+n.depth+"em";s.style.verticalAlign=-n.depth+"em";var o=(0,u.makeSpan)(["katex-html"],[l,s,n]);o.setAttribute("aria-hidden","true");return o};t.exports=F},{"./ParseError":29,"./Style":33,"./buildCommon":34,"./delimiter":38,"./domTree":39,"./stretchy":47,"./units":50,"./utils":51,"babel-runtime/core-js/json/stringify":2}],36:[function(e,t,r){"use strict";var a=e("./buildCommon");var i=b(a);var n=e("./fontMetrics");var l=b(n);var s=e("./mathMLTree");var o=b(s);var u=e("./ParseError");var f=b(u);var d=e("./Style");var c=b(d);var h=e("./symbols");var v=b(h);var p=e("./utils");var m=b(p);var g=e("./stretchy");var y=b(g);function b(e){return e&&e.__esModule?e:{default:e}}var x=function e(t,r){if(v.default[r][t]&&v.default[r][t].replace){t=v.default[r][t].replace}return new o.default.TextNode(t)};var w=function e(t,r){var i=r.font;if(!i){return null}var n=t.mode;if(i==="mathit"){return"italic"}var s=t.value;if(m.default.contains(["\\imath","\\jmath"],s)){return null}if(v.default[n][s]&&v.default[n][s].replace){s=v.default[n][s].replace}var o=a.fontMap[i].fontName;if(l.default.getCharacterMetrics(s,o)){return a.fontMap[r.font].variant}return null};var k={};var S={mi:"italic",mn:"normal",mtext:"normal"};k.mathord=function(e,t){var r=new o.default.MathNode("mi",[x(e.value,e.mode)]);var a=w(e,t)||"italic";if(a!==S[r.type]){r.setAttribute("mathvariant",a)}return r};k.textord=function(e,t){var r=x(e.value,e.mode);var a=w(e,t)||"normal";var i=void 0;if(e.mode==="text"){i=new o.default.MathNode("mtext",[r])}else if(/[0-9]/.test(e.value)){i=new o.default.MathNode("mn",[r])}else if(e.value==="\\prime"){i=new o.default.MathNode("mo",[r])}else{i=new o.default.MathNode("mi",[r])}if(a!==S[i.type]){i.setAttribute("mathvariant",a)}return i};k.bin=function(e){var t=new o.default.MathNode("mo",[x(e.value,e.mode)]);return t};k.rel=function(e){var t=new o.default.MathNode("mo",[x(e.value,e.mode)]);return t};k.open=function(e){var t=new o.default.MathNode("mo",[x(e.value,e.mode)]);return t};k.close=function(e){var t=new o.default.MathNode("mo",[x(e.value,e.mode)]);return t};k.inner=function(e){var t=new o.default.MathNode("mo",[x(e.value,e.mode)]);return t};k.punct=function(e){var t=new o.default.MathNode("mo",[x(e.value,e.mode)]);t.setAttribute("separator","true");return t};k.ordgroup=function(e,t){var r=M(e.value,t);var a=new o.default.MathNode("mrow",r);return a};k.text=function(e,t){var r=e.value.body;var a=[];var i=null;for(var n=0;n<r.length;n++){var l=z(r[n],t);if(l.type==="mtext"&&i!=null){Array.prototype.push.apply(i.children,l.children)}else{a.push(l);if(l.type==="mtext"){i=l}}}if(a.length===1){return a[0]}else{return new o.default.MathNode("mrow",a)}};k.color=function(e,t){var r=M(e.value.value,t);var a=new o.default.MathNode("mstyle",r);a.setAttribute("mathcolor",e.value.color);return a};k.supsub=function(e,t){var r=false;var a=void 0;var i=void 0;if(e.value.base){if(e.value.base.value.type==="horizBrace"){i=e.value.sup?true:false;if(i===e.value.base.value.isOver){r=true;a=e.value.base.value.isOver}}}var n=true;var l=[z(e.value.base,t,n)];if(e.value.sub){l.push(z(e.value.sub,t,n))}if(e.value.sup){l.push(z(e.value.sup,t,n))}var s=void 0;if(r){s=a?"mover":"munder"}else if(!e.value.sub){s="msup"}else if(!e.value.sup){s="msub"}else{var u=e.value.base;if(u&&u.value.limits&&t.style===c.default.DISPLAY){s="munderover"}else{s="msubsup"}}var f=new o.default.MathNode(s,l);return f};k.genfrac=function(e,t){var r=new o.default.MathNode("mfrac",[z(e.value.numer,t),z(e.value.denom,t)]);if(!e.value.hasBarLine){r.setAttribute("linethickness","0px")}if(e.value.leftDelim!=null||e.value.rightDelim!=null){var a=[];if(e.value.leftDelim!=null){var i=new o.default.MathNode("mo",[new o.default.TextNode(e.value.leftDelim)]);i.setAttribute("fence","true");a.push(i)}a.push(r);if(e.value.rightDelim!=null){var n=new o.default.MathNode("mo",[new o.default.TextNode(e.value.rightDelim)]);n.setAttribute("fence","true");a.push(n)}var l=new o.default.MathNode("mrow",a);return l}return r};k.array=function(e,t){return new o.default.MathNode("mtable",e.value.body.map(function(e){return new o.default.MathNode("mtr",e.map(function(e){return new o.default.MathNode("mtd",[z(e,t)])}))}))};k.sqrt=function(e,t){var r=void 0;if(e.value.index){r=new o.default.MathNode("mroot",[z(e.value.body,t),z(e.value.index,t)])}else{r=new o.default.MathNode("msqrt",[z(e.value.body,t)])}return r};k.leftright=function(e,t){var r=M(e.value.body,t);if(e.value.left!=="."){var a=new o.default.MathNode("mo",[x(e.value.left,e.mode)]);a.setAttribute("fence","true");r.unshift(a)}if(e.value.right!=="."){var i=new o.default.MathNode("mo",[x(e.value.right,e.mode)]);i.setAttribute("fence","true");r.push(i)}var n=new o.default.MathNode("mrow",r);return n};k.middle=function(e,t){var r=new o.default.MathNode("mo",[x(e.value.middle,e.mode)]);r.setAttribute("fence","true");return r};k.accent=function(e,t){var r=void 0;if(e.value.isStretchy){r=y.default.mathMLnode(e.value.label)}else{r=new o.default.MathNode("mo",[x(e.value.label,e.mode)])}var a=new o.default.MathNode("mover",[z(e.value.base,t),r]);a.setAttribute("accent","true");return a};k.spacing=function(e){var t=void 0;if(e.value==="\\ "||e.value==="\\space"||e.value===" "||e.value==="~"){t=new o.default.MathNode("mtext",[new o.default.TextNode("\xa0")])}else{t=new o.default.MathNode("mspace");t.setAttribute("width",i.default.spacingFunctions[e.value].size)}return t};k.op=function(e,t){var r=void 0;if(e.value.symbol){r=new o.default.MathNode("mo",[x(e.value.body,e.mode)])}else if(e.value.value){r=new o.default.MathNode("mo",M(e.value.value,t))}else{r=new o.default.MathNode("mi",[new o.default.TextNode(e.value.body.slice(1))])}return r};k.mod=function(e,t){var r=[];if(e.value.modType==="pod"||e.value.modType==="pmod"){r.push(new o.default.MathNode("mo",[x("(",e.mode)]))}if(e.value.modType!=="pod"){r.push(new o.default.MathNode("mo",[x("mod",e.mode)]))}if(e.value.value){var a=new o.default.MathNode("mspace");a.setAttribute("width","0.333333em");r.push(a);r=r.concat(M(e.value.value,t))}if(e.value.modType==="pod"||e.value.modType==="pmod"){r.push(new o.default.MathNode("mo",[x(")",e.mode)]))}return new o.default.MathNode("mo",r)};k.katex=function(e){var t=new o.default.MathNode("mtext",[new o.default.TextNode("KaTeX")]);return t};k.font=function(e,t){var r=e.value.font;return z(e.value.body,t.withFont(r))};k.delimsizing=function(e){var t=[];if(e.value.value!=="."){t.push(x(e.value.value,e.mode))}var r=new o.default.MathNode("mo",t);if(e.value.mclass==="mopen"||e.value.mclass==="mclose"){r.setAttribute("fence","true")}else{r.setAttribute("fence","false")}return r};k.styling=function(e,t){var r={display:c.default.DISPLAY,text:c.default.TEXT,script:c.default.SCRIPT,scriptscript:c.default.SCRIPTSCRIPT};var a=r[e.value.style];var i=t.havingStyle(a);var n=M(e.value.value,i);var l=new o.default.MathNode("mstyle",n);var s={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]};var u=s[e.value.style];
l.setAttribute("scriptlevel",u[0]);l.setAttribute("displaystyle",u[1]);return l};k.sizing=function(e,t){var r=t.havingSize(e.value.size);var a=M(e.value.value,r);var i=new o.default.MathNode("mstyle",a);i.setAttribute("mathsize",r.sizeMultiplier+"em");return i};k.overline=function(e,t){var r=new o.default.MathNode("mo",[new o.default.TextNode("\u203e")]);r.setAttribute("stretchy","true");var a=new o.default.MathNode("mover",[z(e.value.body,t),r]);a.setAttribute("accent","true");return a};k.underline=function(e,t){var r=new o.default.MathNode("mo",[new o.default.TextNode("\u203e")]);r.setAttribute("stretchy","true");var a=new o.default.MathNode("munder",[z(e.value.body,t),r]);a.setAttribute("accentunder","true");return a};k.accentUnder=function(e,t){var r=y.default.mathMLnode(e.value.label);var a=new o.default.MathNode("munder",[z(e.value.body,t),r]);a.setAttribute("accentunder","true");return a};k.enclose=function(e,t){var r=new o.default.MathNode("menclose",[z(e.value.body,t)]);var a="";switch(e.value.label){case"\\bcancel":a="downdiagonalstrike";break;case"\\sout":a="horizontalstrike";break;case"\\fbox":a="box";break;default:a="updiagonalstrike"}r.setAttribute("notation",a);return r};k.horizBrace=function(e,t){var r=y.default.mathMLnode(e.value.label);return new o.default.MathNode(e.value.isOver?"mover":"munder",[z(e.value.base,t),r])};k.xArrow=function(e,t){var r=y.default.mathMLnode(e.value.label);var a=void 0;var i=void 0;if(e.value.body){var n=z(e.value.body,t);if(e.value.below){i=z(e.value.below,t);a=new o.default.MathNode("munderover",[r,i,n])}else{a=new o.default.MathNode("mover",[r,n])}}else if(e.value.below){i=z(e.value.below,t);a=new o.default.MathNode("munder",[r,i])}else{a=new o.default.MathNode("mover",[r])}return a};k.rule=function(e){var t=new o.default.MathNode("mrow");return t};k.kern=function(e){var t=new o.default.MathNode("mrow");return t};k.llap=function(e,t){var r=new o.default.MathNode("mpadded",[z(e.value.body,t)]);r.setAttribute("lspace","-1width");r.setAttribute("width","0px");return r};k.rlap=function(e,t){var r=new o.default.MathNode("mpadded",[z(e.value.body,t)]);r.setAttribute("width","0px");return r};k.phantom=function(e,t){var r=M(e.value.value,t);return new o.default.MathNode("mphantom",r)};k.mclass=function(e,t){var r=M(e.value.value,t);return new o.default.MathNode("mstyle",r)};var M=function e(t,r){var a=[];for(var i=0;i<t.length;i++){var n=t[i];a.push(z(n,r))}return a};var z=function e(t,r){var a=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;if(!t){return new o.default.MathNode("mrow")}if(k[t.type]){var i=k[t.type](t,r);if(a){if(i.type==="mrow"&&i.children.length===1){return i.children[0]}}return i}else{throw new f.default("Got group of unknown type: '"+t.type+"'")}};var C=function e(t,r,i){var n=M(t,i);var l=new o.default.MathNode("mrow",n);var s=new o.default.MathNode("annotation",[new o.default.TextNode(r)]);s.setAttribute("encoding","application/x-tex");var u=new o.default.MathNode("semantics",[l,s]);var f=new o.default.MathNode("math",[u]);return(0,a.makeSpan)(["katex-mathml"],[f])};t.exports=C},{"./ParseError":29,"./Style":33,"./buildCommon":34,"./fontMetrics":41,"./mathMLTree":45,"./stretchy":47,"./symbols":48,"./utils":51}],37:[function(e,t,r){"use strict";var a=e("./buildHTML");var i=v(a);var n=e("./buildMathML");var l=v(n);var s=e("./buildCommon");var o=e("./Options");var u=v(o);var f=e("./Settings");var d=v(f);var c=e("./Style");var h=v(c);function v(e){return e&&e.__esModule?e:{default:e}}var p=function e(t,r,a){a=a||new d.default({});var n=h.default.TEXT;if(a.displayMode){n=h.default.DISPLAY}var o=new u.default({style:n});var f=(0,l.default)(t,r,o);var c=(0,i.default)(t,o);var v=(0,s.makeSpan)(["katex"],[f,c]);if(a.displayMode){return(0,s.makeSpan)(["katex-display"],[v])}else{return v}};t.exports=p},{"./Options":28,"./Settings":32,"./Style":33,"./buildCommon":34,"./buildHTML":35,"./buildMathML":36}],38:[function(e,t,r){"use strict";var a=e("./ParseError");var i=p(a);var n=e("./Style");var l=p(n);var s=e("./buildCommon");var o=p(s);var u=e("./fontMetrics");var f=p(u);var d=e("./symbols");var c=p(d);var h=e("./utils");var v=p(h);function p(e){return e&&e.__esModule?e:{default:e}}var m=function e(t,r){if(c.default.math[t]&&c.default.math[t].replace){return f.default.getCharacterMetrics(c.default.math[t].replace,r)}else{return f.default.getCharacterMetrics(t,r)}};var g=function e(t,r,a,i){var n=a.havingBaseStyle(r);var l=(0,s.makeSpan)((i||[]).concat(n.sizingClasses(a)),[t],a);l.delimSizeMultiplier=n.sizeMultiplier/a.sizeMultiplier;l.height*=l.delimSizeMultiplier;l.depth*=l.delimSizeMultiplier;l.maxFontSize=n.sizeMultiplier;return l};var y=function e(t,r,a){var i=r.havingBaseStyle(a);var n=(1-r.sizeMultiplier/i.sizeMultiplier)*r.fontMetrics().axisHeight;t.classes.push("delimcenter");t.style.top=n+"em";t.height-=n;t.depth+=n};var b=function e(t,r,a,i,n,l){var s=o.default.makeSymbol(t,"Main-Regular",n,i);var u=g(s,r,i,l);if(a){y(u,i,r)}return u};var x=function e(t,r,a,i){return o.default.makeSymbol(t,"Size"+r+"-Regular",a,i)};var w=function e(t,r,a,i,n,o){var u=x(t,r,n,i);var f=g((0,s.makeSpan)(["delimsizing","size"+r],[u],i),l.default.TEXT,i,o);if(a){y(f,i,l.default.TEXT)}return f};var k=function e(t,r,a){var i=void 0;if(r==="Size1-Regular"){i="delim-size1"}else if(r==="Size4-Regular"){i="delim-size4"}var n=(0,s.makeSpan)(["delimsizinginner",i],[(0,s.makeSpan)([],[o.default.makeSymbol(t,r,a)])]);return{type:"elem",elem:n}};var S=function e(t,r,a,i,n,u){var f=void 0;var d=void 0;var c=void 0;var h=void 0;f=c=h=t;d=null;var v="Size1-Regular";if(t==="\\uparrow"){c=h="\u23d0"}else if(t==="\\Uparrow"){c=h="\u2016"}else if(t==="\\downarrow"){f=c="\u23d0"}else if(t==="\\Downarrow"){f=c="\u2016"}else if(t==="\\updownarrow"){f="\\uparrow";c="\u23d0";h="\\downarrow"}else if(t==="\\Updownarrow"){f="\\Uparrow";c="\u2016";h="\\Downarrow"}else if(t==="["||t==="\\lbrack"){f="\u23a1";c="\u23a2";h="\u23a3";v="Size4-Regular"}else if(t==="]"||t==="\\rbrack"){f="\u23a4";c="\u23a5";h="\u23a6";v="Size4-Regular"}else if(t==="\\lfloor"){c=f="\u23a2";h="\u23a3";v="Size4-Regular"}else if(t==="\\lceil"){f="\u23a1";c=h="\u23a2";v="Size4-Regular"}else if(t==="\\rfloor"){c=f="\u23a5";h="\u23a6";v="Size4-Regular"}else if(t==="\\rceil"){f="\u23a4";c=h="\u23a5";v="Size4-Regular"}else if(t==="("){f="\u239b";c="\u239c";h="\u239d";v="Size4-Regular"}else if(t===")"){f="\u239e";c="\u239f";h="\u23a0";v="Size4-Regular"}else if(t==="\\{"||t==="\\lbrace"){f="\u23a7";d="\u23a8";h="\u23a9";c="\u23aa";v="Size4-Regular"}else if(t==="\\}"||t==="\\rbrace"){f="\u23ab";d="\u23ac";h="\u23ad";c="\u23aa";v="Size4-Regular"}else if(t==="\\lgroup"){f="\u23a7";h="\u23a9";c="\u23aa";v="Size4-Regular"}else if(t==="\\rgroup"){f="\u23ab";h="\u23ad";c="\u23aa";v="Size4-Regular"}else if(t==="\\lmoustache"){f="\u23a7";h="\u23ad";c="\u23aa";v="Size4-Regular"}else if(t==="\\rmoustache"){f="\u23ab";h="\u23a9";c="\u23aa";v="Size4-Regular"}else if(t==="\\surd"){f="\ue001";h="\u23b7";c="\ue000";v="Size4-Regular"}var p=m(f,v);var y=p.height+p.depth;var b=m(c,v);var x=b.height+b.depth;var w=m(h,v);var S=w.height+w.depth;var M=0;var z=1;if(d!==null){var C=m(d,v);M=C.height+C.depth;z=2}var T=y+S+M;var N=Math.ceil((r-T)/(z*x));var A=T+N*z*x;var q=i.fontMetrics().axisHeight;if(a){q*=i.sizeMultiplier}var _=A/2-q;var E=[];E.push(k(h,v,n));if(d===null){for(var O=0;O<N;O++){E.push(k(c,v,n))}}else{for(var R=0;R<N;R++){E.push(k(c,v,n))}E.push(k(d,v,n));for(var P=0;P<N;P++){E.push(k(c,v,n))}}E.push(k(f,v,n));var L=i.havingBaseStyle(l.default.TEXT);var F=o.default.makeVList(E,"bottom",_,L);return g((0,s.makeSpan)(["delimsizing","mult"],[F],L),l.default.TEXT,i,u)};var M=["(",")","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","\\lceil","\\rceil","\\surd"];var z=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\\lmoustache","\\rmoustache"];var C=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"];var T=[0,1.2,1.8,2.4,3];var N=function e(t,r,a,n,l){if(t==="<"||t==="\\lt"){t="\\langle"}else if(t===">"||t==="\\gt"){t="\\rangle"}if(v.default.contains(M,t)||v.default.contains(C,t)){return w(t,r,false,a,n,l)}else if(v.default.contains(z,t)){return S(t,T[r],false,a,n,l)}else{throw new i.default("Illegal delimiter: '"+t+"'")}};var A=[{type:"small",style:l.default.SCRIPTSCRIPT},{type:"small",style:l.default.SCRIPT},{type:"small",style:l.default.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}];var q=[{type:"small",style:l.default.SCRIPTSCRIPT},{type:"small",style:l.default.SCRIPT},{type:"small",style:l.default.TEXT},{type:"stack"}];var _=[{type:"small",style:l.default.SCRIPTSCRIPT},{type:"small",style:l.default.SCRIPT},{type:"small",style:l.default.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}];var E=function e(t){if(t.type==="small"){return"Main-Regular"}else if(t.type==="large"){return"Size"+t.size+"-Regular"}else if(t.type==="stack"){return"Size4-Regular"}};var O=function e(t,r,a,i){var n=Math.min(2,3-i.style.size);for(var l=n;l<a.length;l++){if(a[l].type==="stack"){break}var s=m(t,E(a[l]));var o=s.height+s.depth;if(a[l].type==="small"){var u=i.havingBaseStyle(a[l].style);o*=u.sizeMultiplier}if(o>r){return a[l]}}return a[a.length-1]};var R=function e(t,r,a,i,n,l){if(t==="<"||t==="\\lt"){t="\\langle"}else if(t===">"||t==="\\gt"){t="\\rangle"}var s=void 0;if(v.default.contains(C,t)){s=A}else if(v.default.contains(M,t)){s=_}else{s=q}var o=O(t,r,s,i);if(o.type==="small"){return b(t,o.style,a,i,n,l)}else if(o.type==="large"){return w(t,o.size,a,i,n,l)}else if(o.type==="stack"){return S(t,r,a,i,n,l)}};var P=function e(t,r,a,i,n,l){var s=i.fontMetrics().axisHeight*i.sizeMultiplier;var o=901;var u=5/i.fontMetrics().ptPerEm;var f=Math.max(r-s,a+s);var d=Math.max(f/500*o,2*f-u);return R(t,d,true,i,n,l)};t.exports={sizedDelim:N,customSizedDelim:R,leftRightDelim:P}},{"./ParseError":29,"./Style":33,"./buildCommon":34,"./fontMetrics":41,"./symbols":48,"./utils":51}],39:[function(e,t,r){"use strict";var a=e("babel-runtime/helpers/classCallCheck");var i=d(a);var n=e("babel-runtime/helpers/createClass");var l=d(n);var s=e("./unicodeRegexes");var o=d(s);var u=e("./utils");var f=d(u);function d(e){return e&&e.__esModule?e:{default:e}}var c=function e(t){t=t.slice();for(var r=t.length-1;r>=0;r--){if(!t[r]){t.splice(r,1)}}return t.join(" ")};var h=function(){function e(t,r,a){(0,i.default)(this,e);this.classes=t||[];this.children=r||[];this.height=0;this.depth=0;this.maxFontSize=0;this.style={};this.attributes={};if(a){if(a.style.isTight()){this.classes.push("mtight")}if(a.getColor()){this.style.color=a.getColor()}}}(0,l.default)(e,[{key:"setAttribute",value:function e(t,r){this.attributes[t]=r}},{key:"tryCombine",value:function e(t){return false}},{key:"toNode",value:function e(){var t=document.createElement("span");t.className=c(this.classes);for(var r in this.style){if(Object.prototype.hasOwnProperty.call(this.style,r)){t.style[r]=this.style[r]}}for(var a in this.attributes){if(Object.prototype.hasOwnProperty.call(this.attributes,a)){t.setAttribute(a,this.attributes[a])}}for(var i=0;i<this.children.length;i++){t.appendChild(this.children[i].toNode())}return t}},{key:"toMarkup",value:function e(){var t="<span";if(this.classes.length){t+=' class="';t+=f.default.escape(c(this.classes));t+='"'}var r="";for(var a in this.style){if(this.style.hasOwnProperty(a)){r+=f.default.hyphenate(a)+":"+this.style[a]+";"}}if(r){t+=' style="'+f.default.escape(r)+'"'}for(var i in this.attributes){if(Object.prototype.hasOwnProperty.call(this.attributes,i)){t+=" "+i+'="';t+=f.default.escape(this.attributes[i]);t+='"'}}t+=">";for(var n=0;n<this.children.length;n++){t+=this.children[n].toMarkup()}t+="</span>";return t}}]);return e}();var v=function(){function e(t){(0,i.default)(this,e);this.children=t||[];this.height=0;this.depth=0;this.maxFontSize=0}(0,l.default)(e,[{key:"toNode",value:function e(){var t=document.createDocumentFragment();for(var r=0;r<this.children.length;r++){t.appendChild(this.children[r].toNode())}return t}},{key:"toMarkup",value:function e(){var t="";for(var r=0;r<this.children.length;r++){t+=this.children[r].toMarkup()}return t}}]);return e}();var p={"\xee":"\u0131\u0302","\xef":"\u0131\u0308","\xed":"\u0131\u0301","\xec":"\u0131\u0300"};var m=function(){function e(t,r,a,n,l,s,u){(0,i.default)(this,e);this.value=t||"";this.height=r||0;this.depth=a||0;this.italic=n||0;this.skew=l||0;this.classes=s||[];this.style=u||{};this.maxFontSize=0;if(o.default.cjkRegex.test(t)){if(o.default.hangulRegex.test(t)){this.classes.push("hangul_fallback")}else{this.classes.push("cjk_fallback")}}if(/[\xee\xef\xed\xec]/.test(this.value)){this.value=p[this.value]}}(0,l.default)(e,[{key:"tryCombine",value:function t(r){if(!r||!(r instanceof e)||this.italic>0||c(this.classes)!==c(r.classes)||this.skew!==r.skew||this.maxFontSize!==r.maxFontSize){return false}for(var a in this.style){if(this.style.hasOwnProperty(a)&&this.style[a]!==r.style[a]){return false}}for(var i in r.style){if(r.style.hasOwnProperty(i)&&this.style[i]!==r.style[i]){return false}}this.value+=r.value;this.height=Math.max(this.height,r.height);this.depth=Math.max(this.depth,r.depth);this.italic=r.italic;return true}},{key:"toNode",value:function e(){var t=document.createTextNode(this.value);var r=null;if(this.italic>0){r=document.createElement("span");r.style.marginRight=this.italic+"em"}if(this.classes.length>0){r=r||document.createElement("span");r.className=c(this.classes)}for(var a in this.style){if(this.style.hasOwnProperty(a)){r=r||document.createElement("span");r.style[a]=this.style[a]}}if(r){r.appendChild(t);return r}else{return t}}},{key:"toMarkup",value:function e(){var t=false;var r="<span";if(this.classes.length){t=true;r+=' class="';r+=f.default.escape(c(this.classes));r+='"'}var a="";if(this.italic>0){a+="margin-right:"+this.italic+"em;"}for(var i in this.style){if(this.style.hasOwnProperty(i)){a+=f.default.hyphenate(i)+":"+this.style[i]+";"}}if(a){t=true;r+=' style="'+f.default.escape(a)+'"'}var n=f.default.escape(this.value);if(t){r+=">";r+=n;r+="</span>";return r}else{return n}}}]);return e}();t.exports={span:h,documentFragment:v,symbolNode:m}},{"./unicodeRegexes":49,"./utils":51,"babel-runtime/helpers/classCallCheck":4,"babel-runtime/helpers/createClass":5}],40:[function(e,t,r){"use strict";var a=e("./ParseNode");var i=s(a);var n=e("./ParseError");var l=s(n);function s(e){return e&&e.__esModule?e:{default:e}}function o(e,t,r){var a=[];var n=[a];var s=[];while(true){var o=e.parseExpression(false,null);o=new i.default("ordgroup",o,e.mode);if(r){o=new i.default("styling",{style:r,value:[o]},e.mode)}a.push(o);var u=e.nextToken.text;if(u==="&"){e.consume()}else if(u==="\\end"){break}else if(u==="\\\\"||u==="\\cr"){var f=e.parseFunction();s.push(f.value.size);a=[];n.push(a)}else{throw new l.default("Expected & or \\\\ or \\end",e.nextToken)}}t.body=n;t.rowGaps=s;return new i.default(t.type,t,e.mode)}function u(e,r,a){if(typeof e==="string"){e=[e]}if(typeof r==="number"){r={numArgs:r}}var i={numArgs:r.numArgs||0,argTypes:r.argTypes,greediness:1,allowedInText:!!r.allowedInText,numOptionalArgs:r.numOptionalArgs||0,handler:a};for(var n=0;n<e.length;++n){t.exports[e[n]]=i}}function f(e){if(e.substr(0,1)==="d"){return"display"}else{return"text"}}u(["array","darray"],{numArgs:1},function(e,t){var r=t[0];r=r.value.map?r.value:[r];var a=r.map(function(e){var t=e.value;if("lcr".indexOf(t)!==-1){return{type:"align",align:t}}else if(t==="|"){return{type:"separator",separator:"|"}}throw new l.default("Unknown column alignment: "+e.value,e)});var i={type:"array",cols:a,hskipBeforeAndAfter:true};i=o(e.parser,i,f(e.envName));return i});u(["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix"],{},function(e){var t={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName];var r={type:"array",hskipBeforeAndAfter:false};r=o(e.parser,r,f(e.envName));if(t){r=new i.default("leftright",{body:[r],left:t[0],right:t[1]},e.mode)}return r});u(["cases","dcases"],{},function(e){var t={type:"array",arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]};t=o(e.parser,t,f(e.envName));t=new i.default("leftright",{body:[t],left:"\\{",right:"."},e.mode);return t});u("aligned",{},function(e){var t={type:"array",cols:[],addJot:true};t=o(e.parser,t,"display");var r=new i.default("ordgroup",[],e.mode);var a=0;t.value.body.forEach(function(e){for(var t=1;t<e.length;t+=2){var i=e[t].value.value[0];i.value.unshift(r)}if(a<e.length){a=e.length}});for(var n=0;n<a;++n){var l="r";var s=0;if(n%2===1){l="l"}else if(n>0){s=2}t.value.cols[n]={type:"align",align:l,pregap:s,postgap:0}}return t});u("gathered",{},function(e){var t={type:"array",cols:[{type:"align",align:"c"}],addJot:true};t=o(e.parser,t,"display");return t})},{"./ParseError":29,"./ParseNode":30}],41:[function(e,t,r){"use strict";var a=e("./unicodeRegexes");var i=e("./fontMetricsData");var n=l(i);function l(e){return e&&e.__esModule?e:{default:e}}var s={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2]};var o={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xc6":"A","\xc7":"C","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xd0":"D","\xd1":"N","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xdd":"Y","\xde":"o","\xdf":"B","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xe6":"a","\xe7":"c","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xf0":"d","\xf1":"n","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xfd":"y","\xfe":"o","\xff":"y","\u0410":"A","\u0411":"B","\u0412":"B","\u0413":"F","\u0414":"A","\u0415":"E","\u0416":"K","\u0417":"3","\u0418":"N","\u0419":"N","\u041a":"K","\u041b":"N","\u041c":"M","\u041d":"H","\u041e":"O","\u041f":"N","\u0420":"P","\u0421":"C","\u0422":"T","\u0423":"y","\u0424":"O","\u0425":"X","\u0426":"U","\u0427":"h","\u0428":"W","\u0429":"W","\u042a":"B","\u042b":"X","\u042c":"B","\u042d":"3","\u042e":"X","\u042f":"R","\u0430":"a","\u0431":"b","\u0432":"a","\u0433":"r","\u0434":"y","\u0435":"e","\u0436":"m","\u0437":"e","\u0438":"n","\u0439":"n","\u043a":"n","\u043b":"n","\u043c":"m","\u043d":"n","\u043e":"o","\u043f":"n","\u0440":"p","\u0441":"c","\u0442":"o","\u0443":"y","\u0444":"b","\u0445":"x","\u0446":"n","\u0447":"n","\u0448":"w","\u0449":"w","\u044a":"a","\u044b":"m","\u044c":"a","\u044d":"e","\u044e":"m","\u044f":"r"};var u=function e(t,r){var i=t.charCodeAt(0);if(t[0]in o){i=o[t[0]].charCodeAt(0)}else if(a.cjkRegex.test(t[0])){i="M".charCodeAt(0)}var l=n.default[r][i];if(l){return{depth:l[0],height:l[1],italic:l[2],skew:l[3],width:l[4]}}};var f={};var d=function e(t){var r=void 0;if(t>=5){r=0}else if(t>=3){r=1}else{r=2}if(!f[r]){var a=f[r]={};for(var i in s){if(s.hasOwnProperty(i)){a[i]=s[i][r]}}a.cssEmPerMu=a.quad/18}return f[r]};t.exports={getFontMetrics:d,getCharacterMetrics:u}},{"./fontMetricsData":42,"./unicodeRegexes":49}],42:[function(e,t,r){"use strict";t.exports={"AMS-Regular":{65:[0,.68889,0,0],66:[0,.68889,0,0],67:[0,.68889,0,0],68:[0,.68889,0,0],69:[0,.68889,0,0],70:[0,.68889,0,0],71:[0,.68889,0,0],72:[0,.68889,0,0],73:[0,.68889,0,0],74:[.16667,.68889,0,0],75:[0,.68889,0,0],76:[0,.68889,0,0],77:[0,.68889,0,0],78:[0,.68889,0,0],79:[.16667,.68889,0,0],80:[0,.68889,0,0],81:[.16667,.68889,0,0],82:[0,.68889,0,0],83:[0,.68889,0,0],84:[0,.68889,0,0],85:[0,.68889,0,0],86:[0,.68889,0,0],87:[0,.68889,0,0],88:[0,.68889,0,0],89:[0,.68889,0,0],90:[0,.68889,0,0],107:[0,.68889,0,0],165:[0,.675,.025,0],174:[.15559,.69224,0,0],240:[0,.68889,0,0],295:[0,.68889,0,0],710:[0,.825,0,0],732:[0,.9,0,0],770:[0,.825,0,0],771:[0,.9,0,0],989:[.08167,.58167,0,0],1008:[0,.43056,.04028,0],8245:[0,.54986,0,0],8463:[0,.68889,0,0],8487:[0,.68889,0,0],8498:[0,.68889,0,0],8502:[0,.68889,0,0],8503:[0,.68889,0,0],8504:[0,.68889,0,0],8513:[0,.68889,0,0],8592:[-.03598,.46402,0,0],8594:[-.03598,.46402,0,0],8602:[-.13313,.36687,0,0],8603:[-.13313,.36687,0,0],8606:[.01354,.52239,0,0],8608:[.01354,.52239,0,0],8610:[.01354,.52239,0,0],8611:[.01354,.52239,0,0],8619:[0,.54986,0,0],8620:[0,.54986,0,0],8621:[-.13313,.37788,0,0],8622:[-.13313,.36687,0,0],8624:[0,.69224,0,0],8625:[0,.69224,0,0],8630:[0,.43056,0,0],8631:[0,.43056,0,0],8634:[.08198,.58198,0,0],8635:[.08198,.58198,0,0],8638:[.19444,.69224,0,0],8639:[.19444,.69224,0,0],8642:[.19444,.69224,0,0],8643:[.19444,.69224,0,0],8644:[.1808,.675,0,0],8646:[.1808,.675,0,0],8647:[.1808,.675,0,0],8648:[.19444,.69224,0,0],8649:[.1808,.675,0,0],8650:[.19444,.69224,0,0],8651:[.01354,.52239,0,0],8652:[.01354,.52239,0,0],8653:[-.13313,.36687,0,0],8654:[-.13313,.36687,0,0],8655:[-.13313,.36687,0,0],8666:[.13667,.63667,0,0],8667:[.13667,.63667,0,0],8669:[-.13313,.37788,0,0],8672:[-.064,.437,0,0],8674:[-.064,.437,0,0],8705:[0,.825,0,0],8708:[0,.68889,0,0],8709:[.08167,.58167,0,0],8717:[0,.43056,0,0],8722:[-.03598,.46402,0,0],8724:[.08198,.69224,0,0],8726:[.08167,.58167,0,0],8733:[0,.69224,0,0],8736:[0,.69224,0,0],8737:[0,.69224,0,0],8738:[.03517,.52239,0,0],8739:[.08167,.58167,0,0],8740:[.25142,.74111,0,0],8741:[.08167,.58167,0,0],8742:[.25142,.74111,0,0],8756:[0,.69224,0,0],8757:[0,.69224,0,0],8764:[-.13313,.36687,0,0],8765:[-.13313,.37788,0,0],8769:[-.13313,.36687,0,0],8770:[-.03625,.46375,0,0],8774:[.30274,.79383,0,0],8776:[-.01688,.48312,0,0],8778:[.08167,.58167,0,0],8782:[.06062,.54986,0,0],8783:[.06062,.54986,0,0],8785:[.08198,.58198,0,0],8786:[.08198,.58198,0,0],8787:[.08198,.58198,0,0],8790:[0,.69224,0,0],8791:[.22958,.72958,0,0],8796:[.08198,.91667,0,0],8806:[.25583,.75583,0,0],8807:[.25583,.75583,0,0],8808:[.25142,.75726,0,0],8809:[.25142,.75726,0,0],8812:[.25583,.75583,0,0],8814:[.20576,.70576,0,0],8815:[.20576,.70576,0,0],8816:[.30274,.79383,0,0],8817:[.30274,.79383,0,0],8818:[.22958,.72958,0,0],8819:[.22958,.72958,0,0],8822:[.1808,.675,0,0],8823:[.1808,.675,0,0],8828:[.13667,.63667,0,0],8829:[.13667,.63667,0,0],8830:[.22958,.72958,0,0],8831:[.22958,.72958,0,0],8832:[.20576,.70576,0,0],8833:[.20576,.70576,0,0],8840:[.30274,.79383,0,0],8841:[.30274,.79383,0,0],8842:[.13597,.63597,0,0],8843:[.13597,.63597,0,0],8847:[.03517,.54986,0,0],8848:[.03517,.54986,0,0],8858:[.08198,.58198,0,0],8859:[.08198,.58198,0,0],8861:[.08198,.58198,0,0],8862:[0,.675,0,0],8863:[0,.675,0,0],8864:[0,.675,0,0],8865:[0,.675,0,0],8872:[0,.69224,0,0],8873:[0,.69224,0,0],8874:[0,.69224,0,0],8876:[0,.68889,0,0],8877:[0,.68889,0,0],8878:[0,.68889,0,0],8879:[0,.68889,0,0],8882:[.03517,.54986,0,0],8883:[.03517,.54986,0,0],8884:[.13667,.63667,0,0],8885:[.13667,.63667,0,0],8888:[0,.54986,0,0],8890:[.19444,.43056,0,0],8891:[.19444,.69224,0,0],8892:[.19444,.69224,0,0],8901:[0,.54986,0,0],8903:[.08167,.58167,0,0],8905:[.08167,.58167,0,0],8906:[.08167,.58167,0,0],8907:[0,.69224,0,0],8908:[0,.69224,0,0],8909:[-.03598,.46402,0,0],8910:[0,.54986,0,0],8911:[0,.54986,0,0],8912:[.03517,.54986,0,0],8913:[.03517,.54986,0,0],8914:[0,.54986,0,0],8915:[0,.54986,0,0],8916:[0,.69224,0,0],8918:[.0391,.5391,0,0],8919:[.0391,.5391,0,0],8920:[.03517,.54986,0,0],8921:[.03517,.54986,0,0],8922:[.38569,.88569,0,0],8923:[.38569,.88569,0,0],8926:[.13667,.63667,0,0],8927:[.13667,.63667,0,0],8928:[.30274,.79383,0,0],8929:[.30274,.79383,0,0],8934:[.23222,.74111,0,0],8935:[.23222,.74111,0,0],8936:[.23222,.74111,0,0],8937:[.23222,.74111,0,0],8938:[.20576,.70576,0,0],8939:[.20576,.70576,0,0],8940:[.30274,.79383,0,0],8941:[.30274,.79383,0,0],8994:[.19444,.69224,0,0],8995:[.19444,.69224,0,0],9416:[.15559,.69224,0,0],9484:[0,.69224,0,0],9488:[0,.69224,0,0],9492:[0,.37788,0,0],9496:[0,.37788,0,0],9585:[.19444,.68889,0,0],9586:[.19444,.74111,0,0],9632:[0,.675,0,0],9633:[0,.675,0,0],9650:[0,.54986,0,0],9651:[0,.54986,0,0],9654:[.03517,.54986,0,0],9660:[0,.54986,0,0],9661:[0,.54986,0,0],9664:[.03517,.54986,0,0],9674:[.11111,.69224,0,0],9733:[.19444,.69224,0,0],10003:[0,.69224,0,0],10016:[0,.69224,0,0],10731:[.11111,.69224,0,0],10846:[.19444,.75583,0,0],10877:[.13667,.63667,0,0],10878:[.13667,.63667,0,0],10885:[.25583,.75583,0,0],10886:[.25583,.75583,0,0],10887:[.13597,.63597,0,0],10888:[.13597,.63597,0,0],10889:[.26167,.75726,0,0],10890:[.26167,.75726,0,0],10891:[.48256,.98256,0,0],10892:[.48256,.98256,0,0],10901:[.13667,.63667,0,0],10902:[.13667,.63667,0,0],10933:[.25142,.75726,0,0],10934:[.25142,.75726,0,0],10935:[.26167,.75726,0,0],10936:[.26167,.75726,0,0],10937:[.26167,.75726,0,0],10938:[.26167,.75726,0,0],10949:[.25583,.75583,0,0],10950:[.25583,.75583,0,0],10955:[.28481,.79383,0,0],10956:[.28481,.79383,0,0],57350:[.08167,.58167,0,0],57351:[.08167,.58167,0,0],57352:[.08167,.58167,0,0],57353:[0,.43056,.04028,0],57356:[.25142,.75726,0,0],57357:[.25142,.75726,0,0],57358:[.41951,.91951,0,0],57359:[.30274,.79383,0,0],57360:[.30274,.79383,0,0],57361:[.41951,.91951,0,0],57366:[.25142,.75726,0,0],57367:[.25142,.75726,0,0],57368:[.25142,.75726,0,0],57369:[.25142,.75726,0,0],57370:[.13597,.63597,0,0],57371:[.13597,.63597,0,0]},"Caligraphic-Regular":{48:[0,.43056,0,0],49:[0,.43056,0,0],50:[0,.43056,0,0],51:[.19444,.43056,0,0],52:[.19444,.43056,0,0],53:[.19444,.43056,0,0],54:[0,.64444,0,0],55:[.19444,.43056,0,0],56:[0,.64444,0,0],57:[.19444,.43056,0,0],65:[0,.68333,0,.19445],66:[0,.68333,.03041,.13889],67:[0,.68333,.05834,.13889],68:[0,.68333,.02778,.08334],69:[0,.68333,.08944,.11111],70:[0,.68333,.09931,.11111],71:[.09722,.68333,.0593,.11111],72:[0,.68333,.00965,.11111],73:[0,.68333,.07382,0],74:[.09722,.68333,.18472,.16667],75:[0,.68333,.01445,.05556],76:[0,.68333,0,.13889],77:[0,.68333,0,.13889],78:[0,.68333,.14736,.08334],79:[0,.68333,.02778,.11111],80:[0,.68333,.08222,.08334],81:[.09722,.68333,0,.11111],82:[0,.68333,0,.08334],83:[0,.68333,.075,.13889],84:[0,.68333,.25417,0],85:[0,.68333,.09931,.08334],86:[0,.68333,.08222,0],87:[0,.68333,.08222,.08334],88:[0,.68333,.14643,.13889],89:[.09722,.68333,.08222,.08334],90:[0,.68333,.07944,.13889]},"Fraktur-Regular":{33:[0,.69141,0,0],34:[0,.69141,0,0],38:[0,.69141,0,0],39:[0,.69141,0,0],40:[.24982,.74947,0,0],41:[.24982,.74947,0,0],42:[0,.62119,0,0],43:[.08319,.58283,0,0],44:[0,.10803,0,0],45:[.08319,.58283,0,0],46:[0,.10803,0,0],47:[.24982,.74947,0,0],48:[0,.47534,0,0],49:[0,.47534,0,0],50:[0,.47534,0,0],51:[.18906,.47534,0,0],52:[.18906,.47534,0,0],53:[.18906,.47534,0,0],54:[0,.69141,0,0],55:[.18906,.47534,0,0],56:[0,.69141,0,0],57:[.18906,.47534,0,0],58:[0,.47534,0,0],59:[.12604,.47534,0,0],61:[-.13099,.36866,0,0],63:[0,.69141,0,0],65:[0,.69141,0,0],66:[0,.69141,0,0],67:[0,.69141,0,0],68:[0,.69141,0,0],69:[0,.69141,0,0],70:[.12604,.69141,0,0],71:[0,.69141,0,0],72:[.06302,.69141,0,0],73:[0,.69141,0,0],74:[.12604,.69141,0,0],75:[0,.69141,0,0],76:[0,.69141,0,0],77:[0,.69141,0,0],78:[0,.69141,0,0],79:[0,.69141,0,0],80:[.18906,.69141,0,0],81:[.03781,.69141,0,0],82:[0,.69141,0,0],83:[0,.69141,0,0],84:[0,.69141,0,0],85:[0,.69141,0,0],86:[0,.69141,0,0],87:[0,.69141,0,0],88:[0,.69141,0,0],89:[.18906,.69141,0,0],90:[.12604,.69141,0,0],91:[.24982,.74947,0,0],93:[.24982,.74947,0,0],94:[0,.69141,0,0],97:[0,.47534,0,0],98:[0,.69141,0,0],99:[0,.47534,0,0],100:[0,.62119,0,0],101:[0,.47534,0,0],102:[.18906,.69141,0,0],103:[.18906,.47534,0,0],104:[.18906,.69141,0,0],105:[0,.69141,0,0],106:[0,.69141,0,0],107:[0,.69141,0,0],108:[0,.69141,0,0],109:[0,.47534,0,0],110:[0,.47534,0,0],111:[0,.47534,0,0],112:[.18906,.52396,0,0],113:[.18906,.47534,0,0],114:[0,.47534,0,0],115:[0,.47534,0,0],116:[0,.62119,0,0],117:[0,.47534,0,0],118:[0,.52396,0,0],119:[0,.52396,0,0],120:[.18906,.47534,0,0],121:[.18906,.47534,0,0],122:[.18906,.47534,0,0],8216:[0,.69141,0,0],8217:[0,.69141,0,0],58112:[0,.62119,0,0],58113:[0,.62119,0,0],58114:[.18906,.69141,0,0],58115:[.18906,.69141,0,0],58116:[.18906,.47534,0,0],58117:[0,.69141,0,0],58118:[0,.62119,0,0],58119:[0,.47534,0,0]},"Main-Bold":{33:[0,.69444,0,0],34:[0,.69444,0,0],35:[.19444,.69444,0,0],36:[.05556,.75,0,0],37:[.05556,.75,0,0],38:[0,.69444,0,0],39:[0,.69444,0,0],40:[.25,.75,0,0],41:[.25,.75,0,0],42:[0,.75,0,0],43:[.13333,.63333,0,0],44:[.19444,.15556,0,0],45:[0,.44444,0,0],46:[0,.15556,0,0],47:[.25,.75,0,0],48:[0,.64444,0,0],49:[0,.64444,0,0],50:[0,.64444,0,0],51:[0,.64444,0,0],52:[0,.64444,0,0],53:[0,.64444,0,0],54:[0,.64444,0,0],55:[0,.64444,0,0],56:[0,.64444,0,0],57:[0,.64444,0,0],58:[0,.44444,0,0],59:[.19444,.44444,0,0],60:[.08556,.58556,0,0],61:[-.10889,.39111,0,0],62:[.08556,.58556,0,0],63:[0,.69444,0,0],64:[0,.69444,0,0],65:[0,.68611,0,0],66:[0,.68611,0,0],67:[0,.68611,0,0],68:[0,.68611,0,0],69:[0,.68611,0,0],70:[0,.68611,0,0],71:[0,.68611,0,0],72:[0,.68611,0,0],73:[0,.68611,0,0],74:[0,.68611,0,0],75:[0,.68611,0,0],76:[0,.68611,0,0],77:[0,.68611,0,0],78:[0,.68611,0,0],79:[0,.68611,0,0],80:[0,.68611,0,0],81:[.19444,.68611,0,0],82:[0,.68611,0,0],83:[0,.68611,0,0],84:[0,.68611,0,0],85:[0,.68611,0,0],86:[0,.68611,.01597,0],87:[0,.68611,.01597,0],88:[0,.68611,0,0],89:[0,.68611,.02875,0],90:[0,.68611,0,0],91:[.25,.75,0,0],92:[.25,.75,0,0],93:[.25,.75,0,0],94:[0,.69444,0,0],95:[.31,.13444,.03194,0],96:[0,.69444,0,0],97:[0,.44444,0,0],98:[0,.69444,0,0],99:[0,.44444,0,0],100:[0,.69444,0,0],101:[0,.44444,0,0],102:[0,.69444,.10903,0],103:[.19444,.44444,.01597,0],104:[0,.69444,0,0],105:[0,.69444,0,0],106:[.19444,.69444,0,0],107:[0,.69444,0,0],108:[0,.69444,0,0],109:[0,.44444,0,0],110:[0,.44444,0,0],111:[0,.44444,0,0],112:[.19444,.44444,0,0],113:[.19444,.44444,0,0],114:[0,.44444,0,0],115:[0,.44444,0,0],116:[0,.63492,0,0],117:[0,.44444,0,0],118:[0,.44444,.01597,0],119:[0,.44444,.01597,0],120:[0,.44444,0,0],121:[.19444,.44444,.01597,0],122:[0,.44444,0,0],123:[.25,.75,0,0],124:[.25,.75,0,0],125:[.25,.75,0,0],126:[.35,.34444,0,0],168:[0,.69444,0,0],172:[0,.44444,0,0],175:[0,.59611,0,0],176:[0,.69444,0,0],177:[.13333,.63333,0,0],180:[0,.69444,0,0],215:[.13333,.63333,0,0],247:[.13333,.63333,0,0],305:[0,.44444,0,0],567:[.19444,.44444,0,0],710:[0,.69444,0,0],711:[0,.63194,0,0],713:[0,.59611,0,0],714:[0,.69444,0,0],715:[0,.69444,0,0],728:[0,.69444,0,0],729:[0,.69444,0,0],730:[0,.69444,0,0],732:[0,.69444,0,0],768:[0,.69444,0,0],769:[0,.69444,0,0],770:[0,.69444,0,0],771:[0,.69444,0,0],772:[0,.59611,0,0],774:[0,.69444,0,0],775:[0,.69444,0,0],776:[0,.69444,0,0],778:[0,.69444,0,0],779:[0,.69444,0,0],780:[0,.63194,0,0],824:[.19444,.69444,0,0],915:[0,.68611,0,0],916:[0,.68611,0,0],920:[0,.68611,0,0],923:[0,.68611,0,0],926:[0,.68611,0,0],928:[0,.68611,0,0],931:[0,.68611,0,0],933:[0,.68611,0,0],934:[0,.68611,0,0],936:[0,.68611,0,0],937:[0,.68611,0,0],8211:[0,.44444,.03194,0],8212:[0,.44444,.03194,0],8216:[0,.69444,0,0],8217:[0,.69444,0,0],8220:[0,.69444,0,0],8221:[0,.69444,0,0],8224:[.19444,.69444,0,0],8225:[.19444,.69444,0,0],8242:[0,.55556,0,0],8407:[0,.72444,.15486,0],8463:[0,.69444,0,0],8465:[0,.69444,0,0],8467:[0,.69444,0,0],8472:[.19444,.44444,0,0],8476:[0,.69444,0,0],8501:[0,.69444,0,0],8592:[-.10889,.39111,0,0],8593:[.19444,.69444,0,0],8594:[-.10889,.39111,0,0],8595:[.19444,.69444,0,0],8596:[-.10889,.39111,0,0],8597:[.25,.75,0,0],
8598:[.19444,.69444,0,0],8599:[.19444,.69444,0,0],8600:[.19444,.69444,0,0],8601:[.19444,.69444,0,0],8636:[-.10889,.39111,0,0],8637:[-.10889,.39111,0,0],8640:[-.10889,.39111,0,0],8641:[-.10889,.39111,0,0],8656:[-.10889,.39111,0,0],8657:[.19444,.69444,0,0],8658:[-.10889,.39111,0,0],8659:[.19444,.69444,0,0],8660:[-.10889,.39111,0,0],8661:[.25,.75,0,0],8704:[0,.69444,0,0],8706:[0,.69444,.06389,0],8707:[0,.69444,0,0],8709:[.05556,.75,0,0],8711:[0,.68611,0,0],8712:[.08556,.58556,0,0],8715:[.08556,.58556,0,0],8722:[.13333,.63333,0,0],8723:[.13333,.63333,0,0],8725:[.25,.75,0,0],8726:[.25,.75,0,0],8727:[-.02778,.47222,0,0],8728:[-.02639,.47361,0,0],8729:[-.02639,.47361,0,0],8730:[.18,.82,0,0],8733:[0,.44444,0,0],8734:[0,.44444,0,0],8736:[0,.69224,0,0],8739:[.25,.75,0,0],8741:[.25,.75,0,0],8743:[0,.55556,0,0],8744:[0,.55556,0,0],8745:[0,.55556,0,0],8746:[0,.55556,0,0],8747:[.19444,.69444,.12778,0],8764:[-.10889,.39111,0,0],8768:[.19444,.69444,0,0],8771:[.00222,.50222,0,0],8776:[.02444,.52444,0,0],8781:[.00222,.50222,0,0],8801:[.00222,.50222,0,0],8804:[.19667,.69667,0,0],8805:[.19667,.69667,0,0],8810:[.08556,.58556,0,0],8811:[.08556,.58556,0,0],8826:[.08556,.58556,0,0],8827:[.08556,.58556,0,0],8834:[.08556,.58556,0,0],8835:[.08556,.58556,0,0],8838:[.19667,.69667,0,0],8839:[.19667,.69667,0,0],8846:[0,.55556,0,0],8849:[.19667,.69667,0,0],8850:[.19667,.69667,0,0],8851:[0,.55556,0,0],8852:[0,.55556,0,0],8853:[.13333,.63333,0,0],8854:[.13333,.63333,0,0],8855:[.13333,.63333,0,0],8856:[.13333,.63333,0,0],8857:[.13333,.63333,0,0],8866:[0,.69444,0,0],8867:[0,.69444,0,0],8868:[0,.69444,0,0],8869:[0,.69444,0,0],8900:[-.02639,.47361,0,0],8901:[-.02639,.47361,0,0],8902:[-.02778,.47222,0,0],8968:[.25,.75,0,0],8969:[.25,.75,0,0],8970:[.25,.75,0,0],8971:[.25,.75,0,0],8994:[-.13889,.36111,0,0],8995:[-.13889,.36111,0,0],9651:[.19444,.69444,0,0],9657:[-.02778,.47222,0,0],9661:[.19444,.69444,0,0],9667:[-.02778,.47222,0,0],9711:[.19444,.69444,0,0],9824:[.12963,.69444,0,0],9825:[.12963,.69444,0,0],9826:[.12963,.69444,0,0],9827:[.12963,.69444,0,0],9837:[0,.75,0,0],9838:[.19444,.69444,0,0],9839:[.19444,.69444,0,0],10216:[.25,.75,0,0],10217:[.25,.75,0,0],10815:[0,.68611,0,0],10927:[.19667,.69667,0,0],10928:[.19667,.69667,0,0]},"Main-Italic":{33:[0,.69444,.12417,0],34:[0,.69444,.06961,0],35:[.19444,.69444,.06616,0],37:[.05556,.75,.13639,0],38:[0,.69444,.09694,0],39:[0,.69444,.12417,0],40:[.25,.75,.16194,0],41:[.25,.75,.03694,0],42:[0,.75,.14917,0],43:[.05667,.56167,.03694,0],44:[.19444,.10556,0,0],45:[0,.43056,.02826,0],46:[0,.10556,0,0],47:[.25,.75,.16194,0],48:[0,.64444,.13556,0],49:[0,.64444,.13556,0],50:[0,.64444,.13556,0],51:[0,.64444,.13556,0],52:[.19444,.64444,.13556,0],53:[0,.64444,.13556,0],54:[0,.64444,.13556,0],55:[.19444,.64444,.13556,0],56:[0,.64444,.13556,0],57:[0,.64444,.13556,0],58:[0,.43056,.0582,0],59:[.19444,.43056,.0582,0],61:[-.13313,.36687,.06616,0],63:[0,.69444,.1225,0],64:[0,.69444,.09597,0],65:[0,.68333,0,0],66:[0,.68333,.10257,0],67:[0,.68333,.14528,0],68:[0,.68333,.09403,0],69:[0,.68333,.12028,0],70:[0,.68333,.13305,0],71:[0,.68333,.08722,0],72:[0,.68333,.16389,0],73:[0,.68333,.15806,0],74:[0,.68333,.14028,0],75:[0,.68333,.14528,0],76:[0,.68333,0,0],77:[0,.68333,.16389,0],78:[0,.68333,.16389,0],79:[0,.68333,.09403,0],80:[0,.68333,.10257,0],81:[.19444,.68333,.09403,0],82:[0,.68333,.03868,0],83:[0,.68333,.11972,0],84:[0,.68333,.13305,0],85:[0,.68333,.16389,0],86:[0,.68333,.18361,0],87:[0,.68333,.18361,0],88:[0,.68333,.15806,0],89:[0,.68333,.19383,0],90:[0,.68333,.14528,0],91:[.25,.75,.1875,0],93:[.25,.75,.10528,0],94:[0,.69444,.06646,0],95:[.31,.12056,.09208,0],97:[0,.43056,.07671,0],98:[0,.69444,.06312,0],99:[0,.43056,.05653,0],100:[0,.69444,.10333,0],101:[0,.43056,.07514,0],102:[.19444,.69444,.21194,0],103:[.19444,.43056,.08847,0],104:[0,.69444,.07671,0],105:[0,.65536,.1019,0],106:[.19444,.65536,.14467,0],107:[0,.69444,.10764,0],108:[0,.69444,.10333,0],109:[0,.43056,.07671,0],110:[0,.43056,.07671,0],111:[0,.43056,.06312,0],112:[.19444,.43056,.06312,0],113:[.19444,.43056,.08847,0],114:[0,.43056,.10764,0],115:[0,.43056,.08208,0],116:[0,.61508,.09486,0],117:[0,.43056,.07671,0],118:[0,.43056,.10764,0],119:[0,.43056,.10764,0],120:[0,.43056,.12042,0],121:[.19444,.43056,.08847,0],122:[0,.43056,.12292,0],126:[.35,.31786,.11585,0],163:[0,.69444,0,0],305:[0,.43056,0,.02778],567:[.19444,.43056,0,.08334],768:[0,.69444,0,0],769:[0,.69444,.09694,0],770:[0,.69444,.06646,0],771:[0,.66786,.11585,0],772:[0,.56167,.10333,0],774:[0,.69444,.10806,0],775:[0,.66786,.11752,0],776:[0,.66786,.10474,0],778:[0,.69444,0,0],779:[0,.69444,.1225,0],780:[0,.62847,.08295,0],915:[0,.68333,.13305,0],916:[0,.68333,0,0],920:[0,.68333,.09403,0],923:[0,.68333,0,0],926:[0,.68333,.15294,0],928:[0,.68333,.16389,0],931:[0,.68333,.12028,0],933:[0,.68333,.11111,0],934:[0,.68333,.05986,0],936:[0,.68333,.11111,0],937:[0,.68333,.10257,0],8211:[0,.43056,.09208,0],8212:[0,.43056,.09208,0],8216:[0,.69444,.12417,0],8217:[0,.69444,.12417,0],8220:[0,.69444,.1685,0],8221:[0,.69444,.06961,0],8463:[0,.68889,0,0]},"Main-Regular":{32:[0,0,0,0],33:[0,.69444,0,0],34:[0,.69444,0,0],35:[.19444,.69444,0,0],36:[.05556,.75,0,0],37:[.05556,.75,0,0],38:[0,.69444,0,0],39:[0,.69444,0,0],40:[.25,.75,0,0],41:[.25,.75,0,0],42:[0,.75,0,0],43:[.08333,.58333,0,0],44:[.19444,.10556,0,0],45:[0,.43056,0,0],46:[0,.10556,0,0],47:[.25,.75,0,0],48:[0,.64444,0,0],49:[0,.64444,0,0],50:[0,.64444,0,0],51:[0,.64444,0,0],52:[0,.64444,0,0],53:[0,.64444,0,0],54:[0,.64444,0,0],55:[0,.64444,0,0],56:[0,.64444,0,0],57:[0,.64444,0,0],58:[0,.43056,0,0],59:[.19444,.43056,0,0],60:[.0391,.5391,0,0],61:[-.13313,.36687,0,0],62:[.0391,.5391,0,0],63:[0,.69444,0,0],64:[0,.69444,0,0],65:[0,.68333,0,0],66:[0,.68333,0,0],67:[0,.68333,0,0],68:[0,.68333,0,0],69:[0,.68333,0,0],70:[0,.68333,0,0],71:[0,.68333,0,0],72:[0,.68333,0,0],73:[0,.68333,0,0],74:[0,.68333,0,0],75:[0,.68333,0,0],76:[0,.68333,0,0],77:[0,.68333,0,0],78:[0,.68333,0,0],79:[0,.68333,0,0],80:[0,.68333,0,0],81:[.19444,.68333,0,0],82:[0,.68333,0,0],83:[0,.68333,0,0],84:[0,.68333,0,0],85:[0,.68333,0,0],86:[0,.68333,.01389,0],87:[0,.68333,.01389,0],88:[0,.68333,0,0],89:[0,.68333,.025,0],90:[0,.68333,0,0],91:[.25,.75,0,0],92:[.25,.75,0,0],93:[.25,.75,0,0],94:[0,.69444,0,0],95:[.31,.12056,.02778,0],96:[0,.69444,0,0],97:[0,.43056,0,0],98:[0,.69444,0,0],99:[0,.43056,0,0],100:[0,.69444,0,0],101:[0,.43056,0,0],102:[0,.69444,.07778,0],103:[.19444,.43056,.01389,0],104:[0,.69444,0,0],105:[0,.66786,0,0],106:[.19444,.66786,0,0],107:[0,.69444,0,0],108:[0,.69444,0,0],109:[0,.43056,0,0],110:[0,.43056,0,0],111:[0,.43056,0,0],112:[.19444,.43056,0,0],113:[.19444,.43056,0,0],114:[0,.43056,0,0],115:[0,.43056,0,0],116:[0,.61508,0,0],117:[0,.43056,0,0],118:[0,.43056,.01389,0],119:[0,.43056,.01389,0],120:[0,.43056,0,0],121:[.19444,.43056,.01389,0],122:[0,.43056,0,0],123:[.25,.75,0,0],124:[.25,.75,0,0],125:[.25,.75,0,0],126:[.35,.31786,0,0],160:[0,0,0,0],168:[0,.66786,0,0],172:[0,.43056,0,0],175:[0,.56778,0,0],176:[0,.69444,0,0],177:[.08333,.58333,0,0],180:[0,.69444,0,0],215:[.08333,.58333,0,0],247:[.08333,.58333,0,0],305:[0,.43056,0,0],567:[.19444,.43056,0,0],710:[0,.69444,0,0],711:[0,.62847,0,0],713:[0,.56778,0,0],714:[0,.69444,0,0],715:[0,.69444,0,0],728:[0,.69444,0,0],729:[0,.66786,0,0],730:[0,.69444,0,0],732:[0,.66786,0,0],768:[0,.69444,0,0],769:[0,.69444,0,0],770:[0,.69444,0,0],771:[0,.66786,0,0],772:[0,.56778,0,0],774:[0,.69444,0,0],775:[0,.66786,0,0],776:[0,.66786,0,0],778:[0,.69444,0,0],779:[0,.69444,0,0],780:[0,.62847,0,0],824:[.19444,.69444,0,0],915:[0,.68333,0,0],916:[0,.68333,0,0],920:[0,.68333,0,0],923:[0,.68333,0,0],926:[0,.68333,0,0],928:[0,.68333,0,0],931:[0,.68333,0,0],933:[0,.68333,0,0],934:[0,.68333,0,0],936:[0,.68333,0,0],937:[0,.68333,0,0],8211:[0,.43056,.02778,0],8212:[0,.43056,.02778,0],8216:[0,.69444,0,0],8217:[0,.69444,0,0],8220:[0,.69444,0,0],8221:[0,.69444,0,0],8224:[.19444,.69444,0,0],8225:[.19444,.69444,0,0],8230:[0,.12,0,0],8242:[0,.55556,0,0],8407:[0,.71444,.15382,0],8463:[0,.68889,0,0],8465:[0,.69444,0,0],8467:[0,.69444,0,.11111],8472:[.19444,.43056,0,.11111],8476:[0,.69444,0,0],8501:[0,.69444,0,0],8592:[-.13313,.36687,0,0],8593:[.19444,.69444,0,0],8594:[-.13313,.36687,0,0],8595:[.19444,.69444,0,0],8596:[-.13313,.36687,0,0],8597:[.25,.75,0,0],8598:[.19444,.69444,0,0],8599:[.19444,.69444,0,0],8600:[.19444,.69444,0,0],8601:[.19444,.69444,0,0],8614:[.011,.511,0,0],8617:[.011,.511,0,0],8618:[.011,.511,0,0],8636:[-.13313,.36687,0,0],8637:[-.13313,.36687,0,0],8640:[-.13313,.36687,0,0],8641:[-.13313,.36687,0,0],8652:[.011,.671,0,0],8656:[-.13313,.36687,0,0],8657:[.19444,.69444,0,0],8658:[-.13313,.36687,0,0],8659:[.19444,.69444,0,0],8660:[-.13313,.36687,0,0],8661:[.25,.75,0,0],8704:[0,.69444,0,0],8706:[0,.69444,.05556,.08334],8707:[0,.69444,0,0],8709:[.05556,.75,0,0],8711:[0,.68333,0,0],8712:[.0391,.5391,0,0],8715:[.0391,.5391,0,0],8722:[.08333,.58333,0,0],8723:[.08333,.58333,0,0],8725:[.25,.75,0,0],8726:[.25,.75,0,0],8727:[-.03472,.46528,0,0],8728:[-.05555,.44445,0,0],8729:[-.05555,.44445,0,0],8730:[.2,.8,0,0],8733:[0,.43056,0,0],8734:[0,.43056,0,0],8736:[0,.69224,0,0],8739:[.25,.75,0,0],8741:[.25,.75,0,0],8743:[0,.55556,0,0],8744:[0,.55556,0,0],8745:[0,.55556,0,0],8746:[0,.55556,0,0],8747:[.19444,.69444,.11111,0],8764:[-.13313,.36687,0,0],8768:[.19444,.69444,0,0],8771:[-.03625,.46375,0,0],8773:[-.022,.589,0,0],8776:[-.01688,.48312,0,0],8781:[-.03625,.46375,0,0],8784:[-.133,.67,0,0],8800:[.215,.716,0,0],8801:[-.03625,.46375,0,0],8804:[.13597,.63597,0,0],8805:[.13597,.63597,0,0],8810:[.0391,.5391,0,0],8811:[.0391,.5391,0,0],8826:[.0391,.5391,0,0],8827:[.0391,.5391,0,0],8834:[.0391,.5391,0,0],8835:[.0391,.5391,0,0],8838:[.13597,.63597,0,0],8839:[.13597,.63597,0,0],8846:[0,.55556,0,0],8849:[.13597,.63597,0,0],8850:[.13597,.63597,0,0],8851:[0,.55556,0,0],8852:[0,.55556,0,0],8853:[.08333,.58333,0,0],8854:[.08333,.58333,0,0],8855:[.08333,.58333,0,0],8856:[.08333,.58333,0,0],8857:[.08333,.58333,0,0],8866:[0,.69444,0,0],8867:[0,.69444,0,0],8868:[0,.69444,0,0],8869:[0,.69444,0,0],8872:[.249,.75,0,0],8900:[-.05555,.44445,0,0],8901:[-.05555,.44445,0,0],8902:[-.03472,.46528,0,0],8904:[.005,.505,0,0],8942:[.03,.9,0,0],8943:[-.19,.31,0,0],8945:[-.1,.82,0,0],8968:[.25,.75,0,0],8969:[.25,.75,0,0],8970:[.25,.75,0,0],8971:[.25,.75,0,0],8994:[-.14236,.35764,0,0],8995:[-.14236,.35764,0,0],9136:[.244,.744,0,0],9137:[.244,.744,0,0],9651:[.19444,.69444,0,0],9657:[-.03472,.46528,0,0],9661:[.19444,.69444,0,0],9667:[-.03472,.46528,0,0],9711:[.19444,.69444,0,0],9824:[.12963,.69444,0,0],9825:[.12963,.69444,0,0],9826:[.12963,.69444,0,0],9827:[.12963,.69444,0,0],9837:[0,.75,0,0],9838:[.19444,.69444,0,0],9839:[.19444,.69444,0,0],10216:[.25,.75,0,0],10217:[.25,.75,0,0],10222:[.244,.744,0,0],10223:[.244,.744,0,0],10229:[.011,.511,0,0],10230:[.011,.511,0,0],10231:[.011,.511,0,0],10232:[.024,.525,0,0],10233:[.024,.525,0,0],10234:[.024,.525,0,0],10236:[.011,.511,0,0],10815:[0,.68333,0,0],10927:[.13597,.63597,0,0],10928:[.13597,.63597,0,0]},"Math-BoldItalic":{47:[.19444,.69444,0,0],65:[0,.68611,0,0],66:[0,.68611,.04835,0],67:[0,.68611,.06979,0],68:[0,.68611,.03194,0],69:[0,.68611,.05451,0],70:[0,.68611,.15972,0],71:[0,.68611,0,0],72:[0,.68611,.08229,0],73:[0,.68611,.07778,0],74:[0,.68611,.10069,0],75:[0,.68611,.06979,0],76:[0,.68611,0,0],77:[0,.68611,.11424,0],78:[0,.68611,.11424,0],79:[0,.68611,.03194,0],80:[0,.68611,.15972,0],81:[.19444,.68611,0,0],82:[0,.68611,.00421,0],83:[0,.68611,.05382,0],84:[0,.68611,.15972,0],85:[0,.68611,.11424,0],86:[0,.68611,.25555,0],87:[0,.68611,.15972,0],88:[0,.68611,.07778,0],89:[0,.68611,.25555,0],90:[0,.68611,.06979,0],97:[0,.44444,0,0],98:[0,.69444,0,0],99:[0,.44444,0,0],100:[0,.69444,0,0],101:[0,.44444,0,0],102:[.19444,.69444,.11042,0],103:[.19444,.44444,.03704,0],104:[0,.69444,0,0],105:[0,.69326,0,0],106:[.19444,.69326,.0622,0],107:[0,.69444,.01852,0],108:[0,.69444,.0088,0],109:[0,.44444,0,0],110:[0,.44444,0,0],111:[0,.44444,0,0],112:[.19444,.44444,0,0],113:[.19444,.44444,.03704,0],114:[0,.44444,.03194,0],115:[0,.44444,0,0],116:[0,.63492,0,0],117:[0,.44444,0,0],118:[0,.44444,.03704,0],119:[0,.44444,.02778,0],120:[0,.44444,0,0],121:[.19444,.44444,.03704,0],122:[0,.44444,.04213,0],915:[0,.68611,.15972,0],916:[0,.68611,0,0],920:[0,.68611,.03194,0],923:[0,.68611,0,0],926:[0,.68611,.07458,0],928:[0,.68611,.08229,0],931:[0,.68611,.05451,0],933:[0,.68611,.15972,0],934:[0,.68611,0,0],936:[0,.68611,.11653,0],937:[0,.68611,.04835,0],945:[0,.44444,0,0],946:[.19444,.69444,.03403,0],947:[.19444,.44444,.06389,0],948:[0,.69444,.03819,0],949:[0,.44444,0,0],950:[.19444,.69444,.06215,0],951:[.19444,.44444,.03704,0],952:[0,.69444,.03194,0],953:[0,.44444,0,0],954:[0,.44444,0,0],955:[0,.69444,0,0],956:[.19444,.44444,0,0],957:[0,.44444,.06898,0],958:[.19444,.69444,.03021,0],959:[0,.44444,0,0],960:[0,.44444,.03704,0],961:[.19444,.44444,0,0],962:[.09722,.44444,.07917,0],963:[0,.44444,.03704,0],964:[0,.44444,.13472,0],965:[0,.44444,.03704,0],966:[.19444,.44444,0,0],967:[.19444,.44444,0,0],968:[.19444,.69444,.03704,0],969:[0,.44444,.03704,0],977:[0,.69444,0,0],981:[.19444,.69444,0,0],982:[0,.44444,.03194,0],1009:[.19444,.44444,0,0],1013:[0,.44444,0,0]},"Math-Italic":{47:[.19444,.69444,0,0],65:[0,.68333,0,.13889],66:[0,.68333,.05017,.08334],67:[0,.68333,.07153,.08334],68:[0,.68333,.02778,.05556],69:[0,.68333,.05764,.08334],70:[0,.68333,.13889,.08334],71:[0,.68333,0,.08334],72:[0,.68333,.08125,.05556],73:[0,.68333,.07847,.11111],74:[0,.68333,.09618,.16667],75:[0,.68333,.07153,.05556],76:[0,.68333,0,.02778],77:[0,.68333,.10903,.08334],78:[0,.68333,.10903,.08334],79:[0,.68333,.02778,.08334],80:[0,.68333,.13889,.08334],81:[.19444,.68333,0,.08334],82:[0,.68333,.00773,.08334],83:[0,.68333,.05764,.08334],84:[0,.68333,.13889,.08334],85:[0,.68333,.10903,.02778],86:[0,.68333,.22222,0],87:[0,.68333,.13889,0],88:[0,.68333,.07847,.08334],89:[0,.68333,.22222,0],90:[0,.68333,.07153,.08334],97:[0,.43056,0,0],98:[0,.69444,0,0],99:[0,.43056,0,.05556],100:[0,.69444,0,.16667],101:[0,.43056,0,.05556],102:[.19444,.69444,.10764,.16667],103:[.19444,.43056,.03588,.02778],104:[0,.69444,0,0],105:[0,.65952,0,0],106:[.19444,.65952,.05724,0],107:[0,.69444,.03148,0],108:[0,.69444,.01968,.08334],109:[0,.43056,0,0],110:[0,.43056,0,0],111:[0,.43056,0,.05556],112:[.19444,.43056,0,.08334],113:[.19444,.43056,.03588,.08334],114:[0,.43056,.02778,.05556],115:[0,.43056,0,.05556],116:[0,.61508,0,.08334],117:[0,.43056,0,.02778],118:[0,.43056,.03588,.02778],119:[0,.43056,.02691,.08334],120:[0,.43056,0,.02778],121:[.19444,.43056,.03588,.05556],122:[0,.43056,.04398,.05556],915:[0,.68333,.13889,.08334],916:[0,.68333,0,.16667],920:[0,.68333,.02778,.08334],923:[0,.68333,0,.16667],926:[0,.68333,.07569,.08334],928:[0,.68333,.08125,.05556],931:[0,.68333,.05764,.08334],933:[0,.68333,.13889,.05556],934:[0,.68333,0,.08334],936:[0,.68333,.11,.05556],937:[0,.68333,.05017,.08334],945:[0,.43056,.0037,.02778],946:[.19444,.69444,.05278,.08334],947:[.19444,.43056,.05556,0],948:[0,.69444,.03785,.05556],949:[0,.43056,0,.08334],950:[.19444,.69444,.07378,.08334],951:[.19444,.43056,.03588,.05556],952:[0,.69444,.02778,.08334],953:[0,.43056,0,.05556],954:[0,.43056,0,0],955:[0,.69444,0,0],956:[.19444,.43056,0,.02778],957:[0,.43056,.06366,.02778],958:[.19444,.69444,.04601,.11111],959:[0,.43056,0,.05556],960:[0,.43056,.03588,0],961:[.19444,.43056,0,.08334],962:[.09722,.43056,.07986,.08334],963:[0,.43056,.03588,0],964:[0,.43056,.1132,.02778],965:[0,.43056,.03588,.02778],966:[.19444,.43056,0,.08334],967:[.19444,.43056,0,.05556],968:[.19444,.69444,.03588,.11111],969:[0,.43056,.03588,0],977:[0,.69444,0,.08334],981:[.19444,.69444,0,.08334],982:[0,.43056,.02778,0],1009:[.19444,.43056,0,.08334],1013:[0,.43056,0,.05556]},"Math-Regular":{65:[0,.68333,0,.13889],66:[0,.68333,.05017,.08334],67:[0,.68333,.07153,.08334],68:[0,.68333,.02778,.05556],69:[0,.68333,.05764,.08334],70:[0,.68333,.13889,.08334],71:[0,.68333,0,.08334],72:[0,.68333,.08125,.05556],73:[0,.68333,.07847,.11111],74:[0,.68333,.09618,.16667],75:[0,.68333,.07153,.05556],76:[0,.68333,0,.02778],77:[0,.68333,.10903,.08334],78:[0,.68333,.10903,.08334],79:[0,.68333,.02778,.08334],80:[0,.68333,.13889,.08334],81:[.19444,.68333,0,.08334],82:[0,.68333,.00773,.08334],83:[0,.68333,.05764,.08334],84:[0,.68333,.13889,.08334],85:[0,.68333,.10903,.02778],86:[0,.68333,.22222,0],87:[0,.68333,.13889,0],88:[0,.68333,.07847,.08334],89:[0,.68333,.22222,0],90:[0,.68333,.07153,.08334],97:[0,.43056,0,0],98:[0,.69444,0,0],99:[0,.43056,0,.05556],100:[0,.69444,0,.16667],101:[0,.43056,0,.05556],102:[.19444,.69444,.10764,.16667],103:[.19444,.43056,.03588,.02778],104:[0,.69444,0,0],105:[0,.65952,0,0],106:[.19444,.65952,.05724,0],107:[0,.69444,.03148,0],108:[0,.69444,.01968,.08334],109:[0,.43056,0,0],110:[0,.43056,0,0],111:[0,.43056,0,.05556],112:[.19444,.43056,0,.08334],113:[.19444,.43056,.03588,.08334],114:[0,.43056,.02778,.05556],115:[0,.43056,0,.05556],116:[0,.61508,0,.08334],117:[0,.43056,0,.02778],118:[0,.43056,.03588,.02778],119:[0,.43056,.02691,.08334],120:[0,.43056,0,.02778],121:[.19444,.43056,.03588,.05556],122:[0,.43056,.04398,.05556],915:[0,.68333,.13889,.08334],916:[0,.68333,0,.16667],920:[0,.68333,.02778,.08334],923:[0,.68333,0,.16667],926:[0,.68333,.07569,.08334],928:[0,.68333,.08125,.05556],931:[0,.68333,.05764,.08334],933:[0,.68333,.13889,.05556],934:[0,.68333,0,.08334],936:[0,.68333,.11,.05556],937:[0,.68333,.05017,.08334],945:[0,.43056,.0037,.02778],946:[.19444,.69444,.05278,.08334],947:[.19444,.43056,.05556,0],948:[0,.69444,.03785,.05556],949:[0,.43056,0,.08334],950:[.19444,.69444,.07378,.08334],951:[.19444,.43056,.03588,.05556],952:[0,.69444,.02778,.08334],953:[0,.43056,0,.05556],954:[0,.43056,0,0],955:[0,.69444,0,0],956:[.19444,.43056,0,.02778],957:[0,.43056,.06366,.02778],958:[.19444,.69444,.04601,.11111],959:[0,.43056,0,.05556],960:[0,.43056,.03588,0],961:[.19444,.43056,0,.08334],962:[.09722,.43056,.07986,.08334],963:[0,.43056,.03588,0],964:[0,.43056,.1132,.02778],965:[0,.43056,.03588,.02778],966:[.19444,.43056,0,.08334],967:[.19444,.43056,0,.05556],968:[.19444,.69444,.03588,.11111],969:[0,.43056,.03588,0],977:[0,.69444,0,.08334],981:[.19444,.69444,0,.08334],982:[0,.43056,.02778,0],1009:[.19444,.43056,0,.08334],1013:[0,.43056,0,.05556]},"SansSerif-Regular":{33:[0,.69444,0,0],34:[0,.69444,0,0],35:[.19444,.69444,0,0],36:[.05556,.75,0,0],37:[.05556,.75,0,0],38:[0,.69444,0,0],39:[0,.69444,0,0],40:[.25,.75,0,0],41:[.25,.75,0,0],42:[0,.75,0,0],43:[.08333,.58333,0,0],44:[.125,.08333,0,0],45:[0,.44444,0,0],46:[0,.08333,0,0],47:[.25,.75,0,0],48:[0,.65556,0,0],49:[0,.65556,0,0],50:[0,.65556,0,0],51:[0,.65556,0,0],52:[0,.65556,0,0],53:[0,.65556,0,0],54:[0,.65556,0,0],55:[0,.65556,0,0],56:[0,.65556,0,0],57:[0,.65556,0,0],58:[0,.44444,0,0],59:[.125,.44444,0,0],61:[-.13,.37,0,0],63:[0,.69444,0,0],64:[0,.69444,0,0],65:[0,.69444,0,0],66:[0,.69444,0,0],67:[0,.69444,0,0],68:[0,.69444,0,0],69:[0,.69444,0,0],70:[0,.69444,0,0],71:[0,.69444,0,0],72:[0,.69444,0,0],73:[0,.69444,0,0],74:[0,.69444,0,0],75:[0,.69444,0,0],76:[0,.69444,0,0],77:[0,.69444,0,0],78:[0,.69444,0,0],79:[0,.69444,0,0],80:[0,.69444,0,0],81:[.125,.69444,0,0],82:[0,.69444,0,0],83:[0,.69444,0,0],84:[0,.69444,0,0],85:[0,.69444,0,0],86:[0,.69444,.01389,0],87:[0,.69444,.01389,0],88:[0,.69444,0,0],89:[0,.69444,.025,0],90:[0,.69444,0,0],91:[.25,.75,0,0],93:[.25,.75,0,0],94:[0,.69444,0,0],95:[.35,.09444,.02778,0],97:[0,.44444,0,0],98:[0,.69444,0,0],99:[0,.44444,0,0],100:[0,.69444,0,0],101:[0,.44444,0,0],102:[0,.69444,.06944,0],103:[.19444,.44444,.01389,0],104:[0,.69444,0,0],105:[0,.67937,0,0],106:[.19444,.67937,0,0],107:[0,.69444,0,0],108:[0,.69444,0,0],109:[0,.44444,0,0],110:[0,.44444,0,0],111:[0,.44444,0,0],112:[.19444,.44444,0,0],113:[.19444,.44444,0,0],114:[0,.44444,.01389,0],115:[0,.44444,0,0],116:[0,.57143,0,0],117:[0,.44444,0,0],118:[0,.44444,.01389,0],119:[0,.44444,.01389,0],120:[0,.44444,0,0],121:[.19444,.44444,.01389,0],122:[0,.44444,0,0],126:[.35,.32659,0,0],305:[0,.44444,0,0],567:[.19444,.44444,0,0],768:[0,.69444,0,0],769:[0,.69444,0,0],770:[0,.69444,0,0],771:[0,.67659,0,0],772:[0,.60889,0,0],774:[0,.69444,0,0],775:[0,.67937,0,0],776:[0,.67937,0,0],778:[0,.69444,0,0],779:[0,.69444,0,0],780:[0,.63194,0,0],915:[0,.69444,0,0],916:[0,.69444,0,0],920:[0,.69444,0,0],923:[0,.69444,0,0],926:[0,.69444,0,0],928:[0,.69444,0,0],931:[0,.69444,0,0],933:[0,.69444,0,0],934:[0,.69444,0,0],936:[0,.69444,0,0],937:[0,.69444,0,0],8211:[0,.44444,.02778,0],8212:[0,.44444,.02778,0],8216:[0,.69444,0,0],8217:[0,.69444,0,0],8220:[0,.69444,0,0],8221:[0,.69444,0,0]},"Script-Regular":{65:[0,.7,.22925,0],66:[0,.7,.04087,0],67:[0,.7,.1689,0],68:[0,.7,.09371,0],69:[0,.7,.18583,0],70:[0,.7,.13634,0],71:[0,.7,.17322,0],72:[0,.7,.29694,0],73:[0,.7,.19189,0],74:[.27778,.7,.19189,0],75:[0,.7,.31259,0],76:[0,.7,.19189,0],77:[0,.7,.15981,0],78:[0,.7,.3525,0],79:[0,.7,.08078,0],80:[0,.7,.08078,0],81:[0,.7,.03305,0],82:[0,.7,.06259,0],83:[0,.7,.19189,0],84:[0,.7,.29087,0],85:[0,.7,.25815,0],86:[0,.7,.27523,0],87:[0,.7,.27523,0],88:[0,.7,.26006,0],89:[0,.7,.2939,0],90:[0,.7,.24037,0]},"Size1-Regular":{40:[.35001,.85,0,0],41:[.35001,.85,0,0],47:[.35001,.85,0,0],91:[.35001,.85,0,0],92:[.35001,.85,0,0],93:[.35001,.85,0,0],123:[.35001,.85,0,0],125:[.35001,.85,0,0],710:[0,.72222,0,0],732:[0,.72222,0,0],770:[0,.72222,0,0],771:[0,.72222,0,0],8214:[-99e-5,.601,0,0],8593:[1e-5,.6,0,0],8595:[1e-5,.6,0,0],8657:[1e-5,.6,0,0],8659:[1e-5,.6,0,0],8719:[.25001,.75,0,0],8720:[.25001,.75,0,0],8721:[.25001,.75,0,0],8730:[.35001,.85,0,0],8739:[-.00599,.606,0,0],8741:[-.00599,.606,0,0],8747:[.30612,.805,.19445,0],8748:[.306,.805,.19445,0],8749:[.306,.805,.19445,0],8750:[.30612,.805,.19445,0],8896:[.25001,.75,0,0],8897:[.25001,.75,0,0],8898:[.25001,.75,0,0],8899:[.25001,.75,0,0],8968:[.35001,.85,0,0],8969:[.35001,.85,0,0],8970:[.35001,.85,0,0],8971:[.35001,.85,0,0],9168:[-99e-5,.601,0,0],10216:[.35001,.85,0,0],10217:[.35001,.85,0,0],10752:[.25001,.75,0,0],10753:[.25001,.75,0,0],10754:[.25001,.75,0,0],10756:[.25001,.75,0,0],10758:[.25001,.75,0,0]},"Size2-Regular":{40:[.65002,1.15,0,0],41:[.65002,1.15,0,0],47:[.65002,1.15,0,0],91:[.65002,1.15,0,0],92:[.65002,1.15,0,0],93:[.65002,1.15,0,0],123:[.65002,1.15,0,0],125:[.65002,1.15,0,0],710:[0,.75,0,0],732:[0,.75,0,0],770:[0,.75,0,0],771:[0,.75,0,0],8719:[.55001,1.05,0,0],8720:[.55001,1.05,0,0],8721:[.55001,1.05,0,0],8730:[.65002,1.15,0,0],8747:[.86225,1.36,.44445,0],8748:[.862,1.36,.44445,0],8749:[.862,1.36,.44445,0],8750:[.86225,1.36,.44445,0],8896:[.55001,1.05,0,0],8897:[.55001,1.05,0,0],8898:[.55001,1.05,0,0],8899:[.55001,1.05,0,0],8968:[.65002,1.15,0,0],8969:[.65002,1.15,0,0],8970:[.65002,1.15,0,0],8971:[.65002,1.15,0,0],10216:[.65002,1.15,0,0],10217:[.65002,1.15,0,0],10752:[.55001,1.05,0,0],10753:[.55001,1.05,0,0],10754:[.55001,1.05,0,0],10756:[.55001,1.05,0,0],10758:[.55001,1.05,0,0]},"Size3-Regular":{40:[.95003,1.45,0,0],41:[.95003,1.45,0,0],47:[.95003,1.45,0,0],91:[.95003,1.45,0,0],92:[.95003,1.45,0,0],93:[.95003,1.45,0,0],123:[.95003,1.45,0,0],125:[.95003,1.45,0,0],710:[0,.75,0,0],732:[0,.75,0,0],770:[0,.75,0,0],771:[0,.75,0,0],8730:[.95003,1.45,0,0],8968:[.95003,1.45,0,0],8969:[.95003,1.45,0,0],8970:[.95003,1.45,0,0],8971:[.95003,1.45,0,0],10216:[.95003,1.45,0,0],10217:[.95003,1.45,0,0]},"Size4-Regular":{40:[1.25003,1.75,0,0],41:[1.25003,1.75,0,0],47:[1.25003,1.75,0,0],91:[1.25003,1.75,0,0],92:[1.25003,1.75,0,0],93:[1.25003,1.75,0,0],123:[1.25003,1.75,0,0],125:[1.25003,1.75,0,0],710:[0,.825,0,0],732:[0,.825,0,0],770:[0,.825,0,0],771:[0,.825,0,0],8730:[1.25003,1.75,0,0],8968:[1.25003,1.75,0,0],8969:[1.25003,1.75,0,0],8970:[1.25003,1.75,0,0],8971:[1.25003,1.75,0,0],9115:[.64502,1.155,0,0],9116:[1e-5,.6,0,0],9117:[.64502,1.155,0,0],9118:[.64502,1.155,0,0],9119:[1e-5,.6,0,0],9120:[.64502,1.155,0,0],9121:[.64502,1.155,0,0],9122:[-99e-5,.601,0,0],9123:[.64502,1.155,0,0],9124:[.64502,1.155,0,0],9125:[-99e-5,.601,0,0],9126:[.64502,1.155,0,0],9127:[1e-5,.9,0,0],9128:[.65002,1.15,0,0],9129:[.90001,0,0,0],9130:[0,.3,0,0],9131:[1e-5,.9,0,0],9132:[.65002,1.15,0,0],9133:[.90001,0,0,0],9143:[.88502,.915,0,0],10216:[1.25003,1.75,0,0],10217:[1.25003,1.75,0,0],57344:[-.00499,.605,0,0],57345:[-.00499,.605,0,0],57680:[0,.12,0,0],57681:[0,.12,0,0],57682:[0,.12,0,0],57683:[0,.12,0,0]},"Typewriter-Regular":{33:[0,.61111,0,0],34:[0,.61111,0,0],35:[0,.61111,0,0],36:[.08333,.69444,0,0],37:[.08333,.69444,0,0],38:[0,.61111,0,0],39:[0,.61111,0,0],40:[.08333,.69444,0,0],41:[.08333,.69444,0,0],42:[0,.52083,0,0],43:[-.08056,.53055,0,0],44:[.13889,.125,0,0],45:[-.08056,.53055,0,0],46:[0,.125,0,0],47:[.08333,.69444,0,0],48:[0,.61111,0,0],49:[0,.61111,0,0],50:[0,.61111,0,0],51:[0,.61111,0,0],52:[0,.61111,0,0],53:[0,.61111,0,0],54:[0,.61111,0,0],55:[0,.61111,0,0],56:[0,.61111,0,0],57:[0,.61111,0,0],58:[0,.43056,0,0],59:[.13889,.43056,0,0],60:[-.05556,.55556,0,0],61:[-.19549,.41562,0,0],62:[-.05556,.55556,0,0],63:[0,.61111,0,0],64:[0,.61111,0,0],65:[0,.61111,0,0],66:[0,.61111,0,0],67:[0,.61111,0,0],68:[0,.61111,0,0],69:[0,.61111,0,0],70:[0,.61111,0,0],71:[0,.61111,0,0],72:[0,.61111,0,0],73:[0,.61111,0,0],74:[0,.61111,0,0],75:[0,.61111,0,0],76:[0,.61111,0,0],77:[0,.61111,0,0],78:[0,.61111,0,0],79:[0,.61111,0,0],80:[0,.61111,0,0],81:[.13889,.61111,0,0],82:[0,.61111,0,0],83:[0,.61111,0,0],84:[0,.61111,0,0],85:[0,.61111,0,0],86:[0,.61111,0,0],87:[0,.61111,0,0],88:[0,.61111,0,0],89:[0,.61111,0,0],90:[0,.61111,0,0],91:[.08333,.69444,0,0],92:[.08333,.69444,0,0],93:[.08333,.69444,0,0],94:[0,.61111,0,0],95:[.09514,0,0,0],96:[0,.61111,0,0],97:[0,.43056,0,0],98:[0,.61111,0,0],99:[0,.43056,0,0],100:[0,.61111,0,0],101:[0,.43056,0,0],102:[0,.61111,0,0],103:[.22222,.43056,0,0],104:[0,.61111,0,0],105:[0,.61111,0,0],106:[.22222,.61111,0,0],107:[0,.61111,0,0],108:[0,.61111,0,0],109:[0,.43056,0,0],110:[0,.43056,0,0],111:[0,.43056,0,0],112:[.22222,.43056,0,0],113:[.22222,.43056,0,0],114:[0,.43056,0,0],115:[0,.43056,0,0],116:[0,.55358,0,0],117:[0,.43056,0,0],118:[0,.43056,0,0],119:[0,.43056,0,0],120:[0,.43056,0,0],121:[.22222,.43056,0,0],122:[0,.43056,0,0],123:[.08333,.69444,0,0],124:[.08333,.69444,0,0],125:[.08333,.69444,0,0],126:[0,.61111,0,0],127:[0,.61111,0,0],305:[0,.43056,0,0],567:[.22222,.43056,0,0],768:[0,.61111,0,0],769:[0,.61111,0,0],770:[0,.61111,0,0],771:[0,.61111,0,0],772:[0,.56555,0,0],774:[0,.61111,0,0],776:[0,.61111,0,0],778:[0,.61111,0,0],780:[0,.56597,0,0],915:[0,.61111,0,0],916:[0,.61111,0,0],920:[0,.61111,0,0],923:[0,.61111,0,0],926:[0,.61111,0,0],928:[0,.61111,0,0],931:[0,.61111,0,0],933:[0,.61111,0,0],934:[0,.61111,0,0],936:[0,.61111,0,0],937:[0,.61111,0,0],2018:[0,.61111,0,0],2019:[0,.61111,0,0],8242:[0,.61111,0,0]}}},{}],43:[function(e,t,r){"use strict";var a=e("./utils");var i=u(a);var n=e("./ParseError");var l=u(n);var s=e("./ParseNode");var o=u(s);function u(e){return e&&e.__esModule?e:{default:e}}function f(e,r,a){if(typeof e==="string"){e=[e]}if(typeof r==="number"){r={numArgs:r}}var i={numArgs:r.numArgs,argTypes:r.argTypes,greediness:r.greediness===undefined?1:r.greediness,allowedInText:!!r.allowedInText,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,handler:a};for(var n=0;n<e.length;++n){t.exports[e[n]]=i}}var d=function e(t){if(t.type==="ordgroup"){return t.value}else{return[t]}};f("\\sqrt",{numArgs:1,numOptionalArgs:1},function(e,t){var r=t[0];var a=t[1];return{type:"sqrt",body:a,index:r}});var c={"\\text":undefined,"\\textrm":"mathrm","\\textsf":"mathsf","\\texttt":"mathtt","\\textnormal":"mathrm","\\textbf":"mathbf","\\textit":"textit"};f(["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textit"],{numArgs:1,argTypes:["text"],greediness:2,allowedInText:true},function(e,t){var r=t[0];return{type:"text",body:d(r),style:c[e.funcName]}});f("\\textcolor",{numArgs:2,allowedInText:true,greediness:3,argTypes:["color","original"]},function(e,t){var r=t[0];var a=t[1];return{type:"color",color:r.value,value:d(a)}});f("\\color",{numArgs:1,allowedInText:true,greediness:3,argTypes:["color"]},null);f("\\overline",{numArgs:1},function(e,t){var r=t[0];return{type:"overline",body:r}});f("\\underline",{numArgs:1},function(e,t){var r=t[0];return{type:"underline",body:r}});f("\\rule",{numArgs:2,numOptionalArgs:1,argTypes:["size","size","size"]},function(e,t){var r=t[0];var a=t[1];var i=t[2];return{type:"rule",shift:r&&r.value,width:a.value,height:i.value}});f(["\\kern","\\mkern"],{numArgs:1,argTypes:["size"]},function(e,t){return{type:"kern",dimension:t[0].value}});f("\\KaTeX",{numArgs:0},function(e){return{type:"katex"}});f("\\phantom",{numArgs:1},function(e,t){var r=t[0];return{type:"phantom",value:d(r)}});f(["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],{numArgs:1},function(e,t){var r=t[0];return{type:"mclass",mclass:"m"+e.funcName.substr(5),value:d(r)}});f("\\stackrel",{numArgs:2},function(e,t){var r=t[0];var a=t[1];var i=new o.default("op",{type:"op",limits:true,alwaysHandleSupSub:true,symbol:false,value:d(a)},a.mode);var n=new o.default("supsub",{base:i,sup:r,sub:null},r.mode);return{type:"mclass",mclass:"mrel",value:[n]}});f("\\bmod",{numArgs:0},function(e,t){return{type:"mod",modType:"bmod",value:null}});f(["\\pod","\\pmod","\\mod"],{numArgs:1},function(e,t){var r=t[0];return{type:"mod",modType:e.funcName.substr(1),value:d(r)}});var h={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}};var v=["(",")","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","\\lceil","\\rceil","<",">","\\langle","\\rangle","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\\lmoustache","\\rmoustache","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];var p={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};f(["\\blue","\\orange","\\pink","\\red","\\green","\\gray","\\purple","\\blueA","\\blueB","\\blueC","\\blueD","\\blueE","\\tealA","\\tealB","\\tealC","\\tealD","\\tealE","\\greenA","\\greenB","\\greenC","\\greenD","\\greenE","\\goldA","\\goldB","\\goldC","\\goldD","\\goldE","\\redA","\\redB","\\redC","\\redD","\\redE","\\maroonA","\\maroonB","\\maroonC","\\maroonD","\\maroonE","\\purpleA","\\purpleB","\\purpleC","\\purpleD","\\purpleE","\\mintA","\\mintB","\\mintC","\\grayA","\\grayB","\\grayC","\\grayD","\\grayE","\\grayF","\\grayG","\\grayH","\\grayI","\\kaBlue","\\kaGreen"],{numArgs:1,allowedInText:true,greediness:3},function(e,t){var r=t[0];return{type:"color",color:"katex-"+e.funcName.slice(1),value:d(r)}});f(["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],{numArgs:0},function(e){return{type:"op",limits:false,symbol:false,body:e.funcName}});f(["\\det","\\gcd","\\inf","\\lim","\\liminf","\\limsup","\\max","\\min","\\Pr","\\sup"],{numArgs:0},function(e){return{type:"op",limits:true,symbol:false,body:e.funcName}});f(["\\int","\\iint","\\iiint","\\oint"],{numArgs:0},function(e){return{type:"op",limits:false,symbol:true,body:e.funcName}});f(["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint"],{numArgs:0},function(e){return{type:"op",limits:true,symbol:true,body:e.funcName}});f("\\mathop",{numArgs:1},function(e,t){var r=t[0];return{type:"op",limits:false,symbol:false,value:d(r)}});f(["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac"],{numArgs:2,greediness:2
},function(e,t){var r=t[0];var a=t[1];var i=void 0;var n=null;var l=null;var s="auto";switch(e.funcName){case"\\dfrac":case"\\frac":case"\\tfrac":i=true;break;case"\\\\atopfrac":i=false;break;case"\\dbinom":case"\\binom":case"\\tbinom":i=false;n="(";l=")";break;default:throw new Error("Unrecognized genfrac command")}switch(e.funcName){case"\\dfrac":case"\\dbinom":s="display";break;case"\\tfrac":case"\\tbinom":s="text";break}return{type:"genfrac",numer:r,denom:a,hasBarLine:i,leftDelim:n,rightDelim:l,size:s}});f(["\\llap","\\rlap"],{numArgs:1,allowedInText:true},function(e,t){var r=t[0];return{type:e.funcName.slice(1),body:r}});var m=function e(t,r){if(i.default.contains(v,t.value)){return t}else{throw new l.default("Invalid delimiter: '"+t.value+"' after '"+r.funcName+"'",t)}};f(["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],{numArgs:1},function(e,t){var r=m(t[0],e);return{type:"delimsizing",size:h[e.funcName].size,mclass:h[e.funcName].mclass,value:r.value}});f(["\\left","\\right"],{numArgs:1},function(e,t){var r=m(t[0],e);return{type:"leftright",value:r.value}});f("\\middle",{numArgs:1},function(e,t){var r=m(t[0],e);if(!e.parser.leftrightDepth){throw new l.default("\\middle without preceding \\left",r)}return{type:"middle",value:r.value}});f(["\\tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],0,null);f(["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],0,null);f(["\\rm","\\sf","\\tt","\\bf","\\it"],0,null);f(["\\mathrm","\\mathit","\\mathbf","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],{numArgs:1,greediness:2},function(e,t){var r=t[0];var a=e.funcName;if(a in p){a=p[a]}return{type:"font",font:a.slice(1),body:r}});f(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],{numArgs:1},function(e,t){var r=t[0];var a=!i.default.contains(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot"],e.funcName);var n=!a||i.default.contains(["\\widehat","\\widetilde"],e.funcName);return{type:"accent",label:e.funcName,isStretchy:a,isShifty:n,value:d(r),base:r}});f(["\\overbrace","\\underbrace"],{numArgs:1},function(e,t){var r=t[0];return{type:"horizBrace",label:e.funcName,isOver:/^\\over/.test(e.funcName),base:r}});f(["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\undertilde"],{numArgs:1},function(e,t){var r=t[0];return{type:"accentUnder",label:e.funcName,value:d(r),body:r}});f(["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xLongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xLongequal","\\xtofrom"],{numArgs:1,numOptionalArgs:1},function(e,t){var r=t[0];var a=t[1];return{type:"xArrow",label:e.funcName,body:a,below:r}});f(["\\cancel","\\bcancel","\\xcancel","\\sout","\\fbox"],{numArgs:1},function(e,t){var r=t[0];return{type:"enclose",label:e.funcName,body:r}});f(["\\over","\\choose","\\atop"],{numArgs:0,infix:true},function(e){var t=void 0;switch(e.funcName){case"\\over":t="\\frac";break;case"\\choose":t="\\binom";break;case"\\atop":t="\\\\atopfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",replaceWith:t,token:e.token}});f(["\\\\","\\cr"],{numArgs:0,numOptionalArgs:1,argTypes:["size"]},function(e,t){var r=t[0];return{type:"cr",size:r}});f(["\\begin","\\end"],{numArgs:1,argTypes:["text"]},function(e,t){var r=t[0];if(r.type!=="ordgroup"){throw new l.default("Invalid environment name",r)}var a="";for(var i=0;i<r.value.length;++i){a+=r.value[i].value}return{type:"environment",name:a,nameGroup:r}})},{"./ParseError":29,"./ParseNode":30,"./utils":51}],44:[function(e,t,r){"use strict";function a(e,r){t.exports[e]=r}a("\\bgroup","{");a("\\egroup","}");a("\\begingroup","{");a("\\endgroup","}");a("\\mkern","\\kern");a("\\overset","\\mathop{#2}\\limits^{#1}");a("\\underset","\\mathop{#2}\\limits_{#1}");a("\\boxed","\\fbox{\\displaystyle{#1}}");a("\\iff","\\;\\Longleftrightarrow\\;");a("\\implies","\\;\\Longrightarrow\\;");a("\\impliedby","\\;\\Longleftarrow\\;");a("\\ordinarycolon",":");a("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");a("\\dblcolon","\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon");a("\\coloneqq","\\vcentcolon\\mathrel{\\mkern-1.2mu}=");a("\\Coloneqq","\\dblcolon\\mathrel{\\mkern-1.2mu}=");a("\\coloneq","\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}");a("\\Coloneq","\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}");a("\\eqqcolon","=\\mathrel{\\mkern-1.2mu}\\vcentcolon");a("\\Eqqcolon","=\\mathrel{\\mkern-1.2mu}\\dblcolon");a("\\eqcolon","\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon");a("\\Eqcolon","\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon");a("\\colonapprox","\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx");a("\\Colonapprox","\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx");a("\\colonsim","\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim");a("\\Colonsim","\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim");a("\\ratio","\\vcentcolon");a("\\coloncolon","\\dblcolon");a("\\colonequals","\\coloneqq");a("\\coloncolonequals","\\Coloneqq");a("\\equalscolon","\\eqqcolon");a("\\equalscoloncolon","\\Eqqcolon");a("\\colonminus","\\coloneq");a("\\coloncolonminus","\\Coloneq");a("\\minuscolon","\\eqcolon");a("\\minuscoloncolon","\\Eqcolon");a("\\coloncolonapprox","\\Colonapprox");a("\\coloncolonsim","\\Colonsim");a("\\simcolon","\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon");a("\\simcoloncolon","\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon");a("\\approxcolon","\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon");a("\\approxcoloncolon","\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon")},{}],45:[function(e,t,r){"use strict";var a=e("babel-runtime/helpers/classCallCheck");var i=u(a);var n=e("babel-runtime/helpers/createClass");var l=u(n);var s=e("./utils");var o=u(s);function u(e){return e&&e.__esModule?e:{default:e}}var f=function(){function e(t,r){(0,i.default)(this,e);this.type=t;this.attributes={};this.children=r||[]}(0,l.default)(e,[{key:"setAttribute",value:function e(t,r){this.attributes[t]=r}},{key:"toNode",value:function e(){var t=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var r in this.attributes){if(Object.prototype.hasOwnProperty.call(this.attributes,r)){t.setAttribute(r,this.attributes[r])}}for(var a=0;a<this.children.length;a++){t.appendChild(this.children[a].toNode())}return t}},{key:"toMarkup",value:function e(){var t="<"+this.type;for(var r in this.attributes){if(Object.prototype.hasOwnProperty.call(this.attributes,r)){t+=" "+r+'="';t+=o.default.escape(this.attributes[r]);t+='"'}}t+=">";for(var a=0;a<this.children.length;a++){t+=this.children[a].toMarkup()}t+="</"+this.type+">";return t}}]);return e}();var d=function(){function e(t){(0,i.default)(this,e);this.text=t}(0,l.default)(e,[{key:"toNode",value:function e(){return document.createTextNode(this.text)}},{key:"toMarkup",value:function e(){return o.default.escape(this.text)}}]);return e}();t.exports={MathNode:f,TextNode:d}},{"./utils":51,"babel-runtime/helpers/classCallCheck":4,"babel-runtime/helpers/createClass":5}],46:[function(e,t,r){"use strict";var a=e("./Parser");var i=n(a);function n(e){return e&&e.__esModule?e:{default:e}}var l=function e(t,r){if(!(typeof t==="string"||t instanceof String)){throw new TypeError("KaTeX can only parse string typed expression")}var a=new i.default(t,r);return a.parse()};t.exports=l},{"./Parser":31}],47:[function(e,t,r){"use strict";var a=e("./buildCommon");var i=e("./mathMLTree");var n=e("./utils");var l={widehat:"^",widetilde:"~",undertilde:"~",overleftarrow:"\u2190",underleftarrow:"\u2190",xleftarrow:"\u2190",overrightarrow:"\u2192",underrightarrow:"\u2192",xrightarrow:"\u2192",underbrace:"\u23b5",overbrace:"\u23de",overleftrightarrow:"\u2194",underleftrightarrow:"\u2194",xleftrightarrow:"\u2194",Overrightarrow:"\u21d2",xRightarrow:"\u21d2",overleftharpoon:"\u21bc",xleftharpoonup:"\u21bc",overrightharpoon:"\u21c0",xrightharpoonup:"\u21c0",xLeftarrow:"\u21d0",xLeftrightarrow:"\u21d4",xhookleftarrow:"\u21a9",xhookrightarrow:"\u21aa",xmapsto:"\u21a6",xrightharpoondown:"\u21c1",xleftharpoondown:"\u21bd",xrightleftharpoons:"\u21cc",xleftrightharpoons:"\u21cb",xtwoheadleftarrow:"\u219e",xtwoheadrightarrow:"\u21a0",xLongequal:"=",xtofrom:"\u21c4"};var s=function e(t){var r=new i.MathNode("mo",[new i.TextNode(l[t.substr(1)])]);r.setAttribute("stretchy","true");return r};var o={overleftarrow:[.522,0,"leftarrow"],underleftarrow:[.522,0,"leftarrow"],xleftarrow:[.261,.261,"leftarrow"],overrightarrow:[.522,0,"rightarrow"],underrightarrow:[.522,0,"rightarrow"],xrightarrow:[.261,.261,"rightarrow"],overbrace:[.548,0,"overbrace"],underbrace:[.548,0,"underbrace"],overleftrightarrow:[.522,0,"leftrightarrow"],underleftrightarrow:[.522,0,"leftrightarrow"],xleftrightarrow:[.261,.261,"leftrightarrow"],Overrightarrow:[.56,0,"doublerightarrow"],xLeftarrow:[.28,.28,"doubleleftarrow"],xRightarrow:[.28,.28,"doublerightarrow"],xLeftrightarrow:[.28,.28,"doubleleftrightarrow"],overleftharpoon:[.522,0,"leftharpoon"],overrightharpoon:[.522,0,"rightharpoon"],xleftharpoonup:[.261,.261,"leftharpoon"],xrightharpoonup:[.261,.261,"rightharpoon"],xhookleftarrow:[.261,.261,"hookleftarrow"],xhookrightarrow:[.261,.261,"hookrightarrow"],overlinesegment:[.414,0,"linesegment"],underlinesegment:[.414,0,"linesegment"],xmapsto:[.261,.261,"mapsto"],xrightharpoondown:[.261,.261,"rightharpoondown"],xleftharpoondown:[.261,.261,"leftharpoondown"],xrightleftharpoons:[.358,.358,"rightleftharpoons"],xleftrightharpoons:[.358,.358,"leftrightharpoons"],overgroup:[.342,0,"overgroup"],undergroup:[.342,0,"undergroup"],xtwoheadleftarrow:[.167,.167,"twoheadleftarrow"],xtwoheadrightarrow:[.167,.167,"twoheadrightarrow"],xLongequal:[.167,.167,"longequal"],xtofrom:[.264,.264,"tofrom"]};var u=function e(t,r){var i=t.value.label.substr(1);var l=0;var s=0;var u=["stretchy"];var f="";if(n.contains(["widehat","widetilde","undertilde"],i)){var d=t.value.value.length;if(d>5){l=.312;f=(i==="widehat"?"widehat":"tilde")+"4"}else{var c=[1,1,2,2,3,3][d];if(i==="widehat"){l=[0,.24,.3,.3,.36,.36][d];f="widehat"+c}else{l=[0,.26,.3,.3,.34,.34][d];f="tilde"+c}}}else{var h=o[i];l=h[0];s=h[1];f=h[2];if(i.substr(0,1)==="x"){u.push("x-arrow")}}var v=void 0;if(r.color){u.push(f);u.push("mask");u.push(f+"-mask");v=a.makeSpan(u,[],r);v.style.backgroundColor=r.getColor()}else{u.push(f);v=a.makeSpan(u,[],r)}v.height=l;v.depth=s;v.maxFontSize=1;return v};var f=function e(t,r,i,n,l){var s=a.makeSpan(["stretchy",i],[],l);if(l.color){if(i==="fbox"){s.style.borderColor=l.getColor()}else{s.classes[2]=i+"-mask";s.style.backgroundColor=l.getColor()}}s.height=t.height+t.depth+2*n;s.style.height=s.height+"em";if(/cancel/.test(i)&&r){s.maxFontSize=1.2}else{s.maxFontSize=1}return s};t.exports={encloseSpan:f,mathMLnode:s,svgSpan:u}},{"./buildCommon":34,"./mathMLTree":45,"./utils":51}],48:[function(e,t,r){"use strict";t.exports={math:{},text:{}};function a(e,r,a,i,n,l){t.exports[e][n]={font:r,group:a,replace:i};if(l){t.exports[e][i]=t.exports[e][n]}}var i="math";var n="text";var l="main";var s="ams";var o="accent";var u="bin";var f="close";var d="inner";var c="mathord";var h="op";var v="open";var p="punct";var m="rel";var g="spacing";var y="textord";a(i,l,m,"\u2261","\\equiv");a(i,l,m,"\u227a","\\prec");a(i,l,m,"\u227b","\\succ");a(i,l,m,"\u223c","\\sim");a(i,l,m,"\u22a5","\\perp");a(i,l,m,"\u2aaf","\\preceq");a(i,l,m,"\u2ab0","\\succeq");a(i,l,m,"\u2243","\\simeq");a(i,l,m,"\u2223","\\mid");a(i,l,m,"\u226a","\\ll");a(i,l,m,"\u226b","\\gg");a(i,l,m,"\u224d","\\asymp");a(i,l,m,"\u2225","\\parallel");a(i,l,m,"\u22c8","\\bowtie");a(i,l,m,"\u2323","\\smile");a(i,l,m,"\u2291","\\sqsubseteq");a(i,l,m,"\u2292","\\sqsupseteq");a(i,l,m,"\u2250","\\doteq");a(i,l,m,"\u2322","\\frown");a(i,l,m,"\u220b","\\ni");a(i,l,m,"\u221d","\\propto");a(i,l,m,"\u22a2","\\vdash");a(i,l,m,"\u22a3","\\dashv");a(i,l,m,"\u220b","\\owns");a(i,l,p,".","\\ldotp");a(i,l,p,"\u22c5","\\cdotp");a(i,l,y,"#","\\#");a(n,l,y,"#","\\#");a(i,l,y,"&","\\&");a(n,l,y,"&","\\&");a(i,l,y,"\u2135","\\aleph");a(i,l,y,"\u2200","\\forall");a(i,l,y,"\u210f","\\hbar");a(i,l,y,"\u2203","\\exists");a(i,l,y,"\u2207","\\nabla");a(i,l,y,"\u266d","\\flat");a(i,l,y,"\u2113","\\ell");a(i,l,y,"\u266e","\\natural");a(i,l,y,"\u2663","\\clubsuit");a(i,l,y,"\u2118","\\wp");a(i,l,y,"\u266f","\\sharp");a(i,l,y,"\u2662","\\diamondsuit");a(i,l,y,"\u211c","\\Re");a(i,l,y,"\u2661","\\heartsuit");a(i,l,y,"\u2111","\\Im");a(i,l,y,"\u2660","\\spadesuit");a(i,l,y,"\u2020","\\dag");a(n,l,y,"\u2020","\\dag");a(n,l,y,"\u2020","\\textdagger");a(i,l,y,"\u2021","\\ddag");a(n,l,y,"\u2021","\\ddag");a(n,l,y,"\u2020","\\textdaggerdbl");a(i,l,f,"\u23b1","\\rmoustache");a(i,l,v,"\u23b0","\\lmoustache");a(i,l,f,"\u27ef","\\rgroup");a(i,l,v,"\u27ee","\\lgroup");a(i,l,u,"\u2213","\\mp");a(i,l,u,"\u2296","\\ominus");a(i,l,u,"\u228e","\\uplus");a(i,l,u,"\u2293","\\sqcap");a(i,l,u,"\u2217","\\ast");a(i,l,u,"\u2294","\\sqcup");a(i,l,u,"\u25ef","\\bigcirc");a(i,l,u,"\u2219","\\bullet");a(i,l,u,"\u2021","\\ddagger");a(i,l,u,"\u2240","\\wr");a(i,l,u,"\u2a3f","\\amalg");a(i,l,m,"\u27f5","\\longleftarrow");a(i,l,m,"\u21d0","\\Leftarrow");a(i,l,m,"\u27f8","\\Longleftarrow");a(i,l,m,"\u27f6","\\longrightarrow");a(i,l,m,"\u21d2","\\Rightarrow");a(i,l,m,"\u27f9","\\Longrightarrow");a(i,l,m,"\u2194","\\leftrightarrow");a(i,l,m,"\u27f7","\\longleftrightarrow");a(i,l,m,"\u21d4","\\Leftrightarrow");a(i,l,m,"\u27fa","\\Longleftrightarrow");a(i,l,m,"\u21a6","\\mapsto");a(i,l,m,"\u27fc","\\longmapsto");a(i,l,m,"\u2197","\\nearrow");a(i,l,m,"\u21a9","\\hookleftarrow");a(i,l,m,"\u21aa","\\hookrightarrow");a(i,l,m,"\u2198","\\searrow");a(i,l,m,"\u21bc","\\leftharpoonup");a(i,l,m,"\u21c0","\\rightharpoonup");a(i,l,m,"\u2199","\\swarrow");a(i,l,m,"\u21bd","\\leftharpoondown");a(i,l,m,"\u21c1","\\rightharpoondown");a(i,l,m,"\u2196","\\nwarrow");a(i,l,m,"\u21cc","\\rightleftharpoons");a(i,s,m,"\u226e","\\nless");a(i,s,m,"\ue010","\\nleqslant");a(i,s,m,"\ue011","\\nleqq");a(i,s,m,"\u2a87","\\lneq");a(i,s,m,"\u2268","\\lneqq");a(i,s,m,"\ue00c","\\lvertneqq");a(i,s,m,"\u22e6","\\lnsim");a(i,s,m,"\u2a89","\\lnapprox");a(i,s,m,"\u2280","\\nprec");a(i,s,m,"\u22e0","\\npreceq");a(i,s,m,"\u22e8","\\precnsim");a(i,s,m,"\u2ab9","\\precnapprox");a(i,s,m,"\u2241","\\nsim");a(i,s,m,"\ue006","\\nshortmid");a(i,s,m,"\u2224","\\nmid");a(i,s,m,"\u22ac","\\nvdash");a(i,s,m,"\u22ad","\\nvDash");a(i,s,m,"\u22ea","\\ntriangleleft");a(i,s,m,"\u22ec","\\ntrianglelefteq");a(i,s,m,"\u228a","\\subsetneq");a(i,s,m,"\ue01a","\\varsubsetneq");a(i,s,m,"\u2acb","\\subsetneqq");a(i,s,m,"\ue017","\\varsubsetneqq");a(i,s,m,"\u226f","\\ngtr");a(i,s,m,"\ue00f","\\ngeqslant");a(i,s,m,"\ue00e","\\ngeqq");a(i,s,m,"\u2a88","\\gneq");a(i,s,m,"\u2269","\\gneqq");a(i,s,m,"\ue00d","\\gvertneqq");a(i,s,m,"\u22e7","\\gnsim");a(i,s,m,"\u2a8a","\\gnapprox");a(i,s,m,"\u2281","\\nsucc");a(i,s,m,"\u22e1","\\nsucceq");a(i,s,m,"\u22e9","\\succnsim");a(i,s,m,"\u2aba","\\succnapprox");a(i,s,m,"\u2246","\\ncong");a(i,s,m,"\ue007","\\nshortparallel");a(i,s,m,"\u2226","\\nparallel");a(i,s,m,"\u22af","\\nVDash");a(i,s,m,"\u22eb","\\ntriangleright");a(i,s,m,"\u22ed","\\ntrianglerighteq");a(i,s,m,"\ue018","\\nsupseteqq");a(i,s,m,"\u228b","\\supsetneq");a(i,s,m,"\ue01b","\\varsupsetneq");a(i,s,m,"\u2acc","\\supsetneqq");a(i,s,m,"\ue019","\\varsupsetneqq");a(i,s,m,"\u22ae","\\nVdash");a(i,s,m,"\u2ab5","\\precneqq");a(i,s,m,"\u2ab6","\\succneqq");a(i,s,m,"\ue016","\\nsubseteqq");a(i,s,u,"\u22b4","\\unlhd");a(i,s,u,"\u22b5","\\unrhd");a(i,s,m,"\u219a","\\nleftarrow");a(i,s,m,"\u219b","\\nrightarrow");a(i,s,m,"\u21cd","\\nLeftarrow");a(i,s,m,"\u21cf","\\nRightarrow");a(i,s,m,"\u21ae","\\nleftrightarrow");a(i,s,m,"\u21ce","\\nLeftrightarrow");a(i,s,m,"\u25b3","\\vartriangle");a(i,s,y,"\u210f","\\hslash");a(i,s,y,"\u25bd","\\triangledown");a(i,s,y,"\u25ca","\\lozenge");a(i,s,y,"\u24c8","\\circledS");a(i,s,y,"\xae","\\circledR");a(n,s,y,"\xae","\\circledR");a(i,s,y,"\u2221","\\measuredangle");a(i,s,y,"\u2204","\\nexists");a(i,s,y,"\u2127","\\mho");a(i,s,y,"\u2132","\\Finv");a(i,s,y,"\u2141","\\Game");a(i,s,y,"k","\\Bbbk");a(i,s,y,"\u2035","\\backprime");a(i,s,y,"\u25b2","\\blacktriangle");a(i,s,y,"\u25bc","\\blacktriangledown");a(i,s,y,"\u25a0","\\blacksquare");a(i,s,y,"\u29eb","\\blacklozenge");a(i,s,y,"\u2605","\\bigstar");a(i,s,y,"\u2222","\\sphericalangle");a(i,s,y,"\u2201","\\complement");a(i,s,y,"\xf0","\\eth");a(i,s,y,"\u2571","\\diagup");a(i,s,y,"\u2572","\\diagdown");a(i,s,y,"\u25a1","\\square");a(i,s,y,"\u25a1","\\Box");a(i,s,y,"\u25ca","\\Diamond");a(i,s,y,"\xa5","\\yen");a(i,s,y,"\u2713","\\checkmark");a(n,s,y,"\u2713","\\checkmark");a(i,s,y,"\u2136","\\beth");a(i,s,y,"\u2138","\\daleth");a(i,s,y,"\u2137","\\gimel");a(i,s,y,"\u03dd","\\digamma");a(i,s,y,"\u03f0","\\varkappa");a(i,s,v,"\u250c","\\ulcorner");a(i,s,f,"\u2510","\\urcorner");a(i,s,v,"\u2514","\\llcorner");a(i,s,f,"\u2518","\\lrcorner");a(i,s,m,"\u2266","\\leqq");a(i,s,m,"\u2a7d","\\leqslant");a(i,s,m,"\u2a95","\\eqslantless");a(i,s,m,"\u2272","\\lesssim");a(i,s,m,"\u2a85","\\lessapprox");a(i,s,m,"\u224a","\\approxeq");a(i,s,u,"\u22d6","\\lessdot");a(i,s,m,"\u22d8","\\lll");a(i,s,m,"\u2276","\\lessgtr");a(i,s,m,"\u22da","\\lesseqgtr");a(i,s,m,"\u2a8b","\\lesseqqgtr");a(i,s,m,"\u2251","\\doteqdot");a(i,s,m,"\u2253","\\risingdotseq");a(i,s,m,"\u2252","\\fallingdotseq");a(i,s,m,"\u223d","\\backsim");a(i,s,m,"\u22cd","\\backsimeq");a(i,s,m,"\u2ac5","\\subseteqq");a(i,s,m,"\u22d0","\\Subset");a(i,s,m,"\u228f","\\sqsubset");a(i,s,m,"\u227c","\\preccurlyeq");a(i,s,m,"\u22de","\\curlyeqprec");a(i,s,m,"\u227e","\\precsim");a(i,s,m,"\u2ab7","\\precapprox");a(i,s,m,"\u22b2","\\vartriangleleft");a(i,s,m,"\u22b4","\\trianglelefteq");a(i,s,m,"\u22a8","\\vDash");a(i,s,m,"\u22aa","\\Vvdash");a(i,s,m,"\u2323","\\smallsmile");a(i,s,m,"\u2322","\\smallfrown");a(i,s,m,"\u224f","\\bumpeq");a(i,s,m,"\u224e","\\Bumpeq");a(i,s,m,"\u2267","\\geqq");a(i,s,m,"\u2a7e","\\geqslant");a(i,s,m,"\u2a96","\\eqslantgtr");a(i,s,m,"\u2273","\\gtrsim");a(i,s,m,"\u2a86","\\gtrapprox");a(i,s,u,"\u22d7","\\gtrdot");a(i,s,m,"\u22d9","\\ggg");a(i,s,m,"\u2277","\\gtrless");a(i,s,m,"\u22db","\\gtreqless");a(i,s,m,"\u2a8c","\\gtreqqless");a(i,s,m,"\u2256","\\eqcirc");a(i,s,m,"\u2257","\\circeq");a(i,s,m,"\u225c","\\triangleq");a(i,s,m,"\u223c","\\thicksim");a(i,s,m,"\u2248","\\thickapprox");a(i,s,m,"\u2ac6","\\supseteqq");a(i,s,m,"\u22d1","\\Supset");a(i,s,m,"\u2290","\\sqsupset");a(i,s,m,"\u227d","\\succcurlyeq");a(i,s,m,"\u22df","\\curlyeqsucc");a(i,s,m,"\u227f","\\succsim");a(i,s,m,"\u2ab8","\\succapprox");a(i,s,m,"\u22b3","\\vartriangleright");a(i,s,m,"\u22b5","\\trianglerighteq");a(i,s,m,"\u22a9","\\Vdash");a(i,s,m,"\u2223","\\shortmid");a(i,s,m,"\u2225","\\shortparallel");a(i,s,m,"\u226c","\\between");a(i,s,m,"\u22d4","\\pitchfork");a(i,s,m,"\u221d","\\varpropto");a(i,s,m,"\u25c0","\\blacktriangleleft");a(i,s,m,"\u2234","\\therefore");a(i,s,m,"\u220d","\\backepsilon");a(i,s,m,"\u25b6","\\blacktriangleright");a(i,s,m,"\u2235","\\because");a(i,s,m,"\u22d8","\\llless");a(i,s,m,"\u22d9","\\gggtr");a(i,s,u,"\u22b2","\\lhd");a(i,s,u,"\u22b3","\\rhd");a(i,s,m,"\u2242","\\eqsim");a(i,l,m,"\u22c8","\\Join");a(i,s,m,"\u2251","\\Doteq");a(i,s,u,"\u2214","\\dotplus");a(i,s,u,"\u2216","\\smallsetminus");a(i,s,u,"\u22d2","\\Cap");a(i,s,u,"\u22d3","\\Cup");a(i,s,u,"\u2a5e","\\doublebarwedge");a(i,s,u,"\u229f","\\boxminus");a(i,s,u,"\u229e","\\boxplus");a(i,s,u,"\u22c7","\\divideontimes");a(i,s,u,"\u22c9","\\ltimes");a(i,s,u,"\u22ca","\\rtimes");a(i,s,u,"\u22cb","\\leftthreetimes");a(i,s,u,"\u22cc","\\rightthreetimes");a(i,s,u,"\u22cf","\\curlywedge");a(i,s,u,"\u22ce","\\curlyvee");a(i,s,u,"\u229d","\\circleddash");a(i,s,u,"\u229b","\\circledast");a(i,s,u,"\u22c5","\\centerdot");a(i,s,u,"\u22ba","\\intercal");a(i,s,u,"\u22d2","\\doublecap");a(i,s,u,"\u22d3","\\doublecup");a(i,s,u,"\u22a0","\\boxtimes");a(i,s,m,"\u21e2","\\dashrightarrow");a(i,s,m,"\u21e0","\\dashleftarrow");a(i,s,m,"\u21c7","\\leftleftarrows");a(i,s,m,"\u21c6","\\leftrightarrows");a(i,s,m,"\u21da","\\Lleftarrow");a(i,s,m,"\u219e","\\twoheadleftarrow");a(i,s,m,"\u21a2","\\leftarrowtail");a(i,s,m,"\u21ab","\\looparrowleft");a(i,s,m,"\u21cb","\\leftrightharpoons");a(i,s,m,"\u21b6","\\curvearrowleft");a(i,s,m,"\u21ba","\\circlearrowleft");a(i,s,m,"\u21b0","\\Lsh");a(i,s,m,"\u21c8","\\upuparrows");a(i,s,m,"\u21bf","\\upharpoonleft");a(i,s,m,"\u21c3","\\downharpoonleft");a(i,s,m,"\u22b8","\\multimap");a(i,s,m,"\u21ad","\\leftrightsquigarrow");a(i,s,m,"\u21c9","\\rightrightarrows");a(i,s,m,"\u21c4","\\rightleftarrows");a(i,s,m,"\u21a0","\\twoheadrightarrow");a(i,s,m,"\u21a3","\\rightarrowtail");a(i,s,m,"\u21ac","\\looparrowright");a(i,s,m,"\u21b7","\\curvearrowright");a(i,s,m,"\u21bb","\\circlearrowright");a(i,s,m,"\u21b1","\\Rsh");a(i,s,m,"\u21ca","\\downdownarrows");a(i,s,m,"\u21be","\\upharpoonright");a(i,s,m,"\u21c2","\\downharpoonright");a(i,s,m,"\u21dd","\\rightsquigarrow");a(i,s,m,"\u21dd","\\leadsto");a(i,s,m,"\u21db","\\Rrightarrow");a(i,s,m,"\u21be","\\restriction");a(i,l,y,"\u2018","`");a(i,l,y,"$","\\$");a(n,l,y,"$","\\$");a(n,l,y,"$","\\textdollar");a(i,l,y,"%","\\%");a(n,l,y,"%","\\%");a(i,l,y,"_","\\_");a(n,l,y,"_","\\_");a(n,l,y,"_","\\textunderscore");a(i,l,y,"\u2220","\\angle");a(i,l,y,"\u221e","\\infty");a(i,l,y,"\u2032","\\prime");a(i,l,y,"\u25b3","\\triangle");a(i,l,y,"\u0393","\\Gamma",true);a(i,l,y,"\u0394","\\Delta",true);a(i,l,y,"\u0398","\\Theta",true);a(i,l,y,"\u039b","\\Lambda",true);a(i,l,y,"\u039e","\\Xi",true);a(i,l,y,"\u03a0","\\Pi",true);a(i,l,y,"\u03a3","\\Sigma",true);a(i,l,y,"\u03a5","\\Upsilon",true);a(i,l,y,"\u03a6","\\Phi",true);a(i,l,y,"\u03a8","\\Psi",true);a(i,l,y,"\u03a9","\\Omega",true);a(i,l,y,"\xac","\\neg");a(i,l,y,"\xac","\\lnot");a(i,l,y,"\u22a4","\\top");a(i,l,y,"\u22a5","\\bot");a(i,l,y,"\u2205","\\emptyset");a(i,s,y,"\u2205","\\varnothing");a(i,l,c,"\u03b1","\\alpha",true);a(i,l,c,"\u03b2","\\beta",true);a(i,l,c,"\u03b3","\\gamma",true);a(i,l,c,"\u03b4","\\delta",true);a(i,l,c,"\u03f5","\\epsilon",true);a(i,l,c,"\u03b6","\\zeta",true);a(i,l,c,"\u03b7","\\eta",true);a(i,l,c,"\u03b8","\\theta",true);a(i,l,c,"\u03b9","\\iota",true);a(i,l,c,"\u03ba","\\kappa",true);a(i,l,c,"\u03bb","\\lambda",true);a(i,l,c,"\u03bc","\\mu",true);a(i,l,c,"\u03bd","\\nu",true);a(i,l,c,"\u03be","\\xi",true);a(i,l,c,"\u03bf","\\omicron",true);a(i,l,c,"\u03c0","\\pi",true);a(i,l,c,"\u03c1","\\rho",true);a(i,l,c,"\u03c3","\\sigma",true);a(i,l,c,"\u03c4","\\tau",true);a(i,l,c,"\u03c5","\\upsilon",true);a(i,l,c,"\u03d5","\\phi",true);a(i,l,c,"\u03c7","\\chi",true);a(i,l,c,"\u03c8","\\psi",true);a(i,l,c,"\u03c9","\\omega",true);a(i,l,c,"\u03b5","\\varepsilon",true);a(i,l,c,"\u03d1","\\vartheta",true);a(i,l,c,"\u03d6","\\varpi",true);a(i,l,c,"\u03f1","\\varrho",true);a(i,l,c,"\u03c2","\\varsigma",true);a(i,l,c,"\u03c6","\\varphi",true);a(i,l,u,"\u2217","*");a(i,l,u,"+","+");a(i,l,u,"\u2212","-");a(i,l,u,"\u22c5","\\cdot");a(i,l,u,"\u2218","\\circ");a(i,l,u,"\xf7","\\div");a(i,l,u,"\xb1","\\pm");a(i,l,u,"\xd7","\\times");a(i,l,u,"\u2229","\\cap");a(i,l,u,"\u222a","\\cup");a(i,l,u,"\u2216","\\setminus");a(i,l,u,"\u2227","\\land");a(i,l,u,"\u2228","\\lor");a(i,l,u,"\u2227","\\wedge");a(i,l,u,"\u2228","\\vee");a(i,l,y,"\u221a","\\surd");a(i,l,v,"(","(");a(i,l,v,"[","[");a(i,l,v,"\u27e8","\\langle");a(i,l,v,"\u2223","\\lvert");a(i,l,v,"\u2225","\\lVert");a(i,l,f,")",")");a(i,l,f,"]","]");a(i,l,f,"?","?");a(i,l,f,"!","!");a(i,l,f,"\u27e9","\\rangle");a(i,l,f,"\u2223","\\rvert");a(i,l,f,"\u2225","\\rVert");a(i,l,m,"=","=");a(i,l,m,"<","<");a(i,l,m,">",">");a(i,l,m,":",":");a(i,l,m,"\u2248","\\approx");a(i,l,m,"\u2245","\\cong");a(i,l,m,"\u2265","\\ge");a(i,l,m,"\u2265","\\geq");a(i,l,m,"\u2190","\\gets");a(i,l,m,">","\\gt");a(i,l,m,"\u2208","\\in");a(i,l,m,"\u2209","\\notin");a(i,l,m,"\u2282","\\subset");a(i,l,m,"\u2283","\\supset");a(i,l,m,"\u2286","\\subseteq");a(i,l,m,"\u2287","\\supseteq");a(i,s,m,"\u2288","\\nsubseteq");a(i,s,m,"\u2289","\\nsupseteq");a(i,l,m,"\u22a8","\\models");a(i,l,m,"\u2190","\\leftarrow");a(i,l,m,"\u2264","\\le");a(i,l,m,"\u2264","\\leq");a(i,l,m,"<","\\lt");a(i,l,m,"\u2260","\\ne");a(i,l,m,"\u2260","\\neq");a(i,l,m,"\u2192","\\rightarrow");a(i,l,m,"\u2192","\\to");a(i,s,m,"\u2271","\\ngeq");a(i,s,m,"\u2270","\\nleq");a(i,l,g,null,"\\!");a(i,l,g,"\xa0","\\ ");a(i,l,g,"\xa0","~");a(i,l,g,null,"\\,");a(i,l,g,null,"\\:");a(i,l,g,null,"\\;");a(i,l,g,null,"\\enspace");a(i,l,g,null,"\\qquad");a(i,l,g,null,"\\quad");a(i,l,g,"\xa0","\\space");a(i,l,p,",",",");a(i,l,p,";",";");a(i,l,p,":","\\colon");a(i,s,u,"\u22bc","\\barwedge");a(i,s,u,"\u22bb","\\veebar");a(i,l,u,"\u2299","\\odot");a(i,l,u,"\u2295","\\oplus");a(i,l,u,"\u2297","\\otimes");a(i,l,y,"\u2202","\\partial");a(i,l,u,"\u2298","\\oslash");a(i,s,u,"\u229a","\\circledcirc");a(i,s,u,"\u22a1","\\boxdot");a(i,l,u,"\u25b3","\\bigtriangleup");a(i,l,u,"\u25bd","\\bigtriangledown");a(i,l,u,"\u2020","\\dagger");a(i,l,u,"\u22c4","\\diamond");a(i,l,u,"\u22c6","\\star");a(i,l,u,"\u25c3","\\triangleleft");a(i,l,u,"\u25b9","\\triangleright");a(i,l,v,"{","\\{");a(n,l,y,"{","\\{");a(n,l,y,"{","\\textbraceleft");a(i,l,f,"}","\\}");a(n,l,y,"}","\\}");a(n,l,y,"}","\\textbraceright");a(i,l,v,"{","\\lbrace");a(i,l,f,"}","\\rbrace");a(i,l,v,"[","\\lbrack");a(i,l,f,"]","\\rbrack");a(n,l,y,"<","\\textless");a(n,l,y,">","\\textgreater");a(i,l,v,"\u230a","\\lfloor");a(i,l,f,"\u230b","\\rfloor");a(i,l,v,"\u2308","\\lceil");a(i,l,f,"\u2309","\\rceil");a(i,l,y,"\\","\\backslash");a(i,l,y,"\u2223","|");a(i,l,y,"\u2223","\\vert");a(n,l,y,"|","\\textbar");a(i,l,y,"\u2225","\\|");a(i,l,y,"\u2225","\\Vert");a(n,l,y,"\u2225","\\textbardbl");a(i,l,m,"\u2191","\\uparrow");a(i,l,m,"\u21d1","\\Uparrow");a(i,l,m,"\u2193","\\downarrow");a(i,l,m,"\u21d3","\\Downarrow");a(i,l,m,"\u2195","\\updownarrow");a(i,l,m,"\u21d5","\\Updownarrow");a(i,l,h,"\u2210","\\coprod");a(i,l,h,"\u22c1","\\bigvee");a(i,l,h,"\u22c0","\\bigwedge");a(i,l,h,"\u2a04","\\biguplus");a(i,l,h,"\u22c2","\\bigcap");a(i,l,h,"\u22c3","\\bigcup");a(i,l,h,"\u222b","\\int");a(i,l,h,"\u222b","\\intop");a(i,l,h,"\u222c","\\iint");a(i,l,h,"\u222d","\\iiint");a(i,l,h,"\u220f","\\prod");a(i,l,h,"\u2211","\\sum");a(i,l,h,"\u2a02","\\bigotimes");a(i,l,h,"\u2a01","\\bigoplus");a(i,l,h,"\u2a00","\\bigodot");a(i,l,h,"\u222e","\\oint");a(i,l,h,"\u2a06","\\bigsqcup");a(i,l,h,"\u222b","\\smallint");a(n,l,d,"\u2026","\\textellipsis");a(i,l,d,"\u2026","\\mathellipsis");a(n,l,d,"\u2026","\\ldots");a(i,l,d,"\u2026","\\ldots");a(i,l,d,"\u22ef","\\cdots");a(i,l,d,"\u22f1","\\ddots");a(i,l,y,"\u22ee","\\vdots");a(i,l,o,"\xb4","\\acute");a(i,l,o,"`","\\grave");a(i,l,o,"\xa8","\\ddot");a(i,l,o,"~","\\tilde");a(i,l,o,"\xaf","\\bar");a(i,l,o,"\u02d8","\\breve");a(i,l,o,"\u02c7","\\check");a(i,l,o,"^","\\hat");a(i,l,o,"\u20d7","\\vec");a(i,l,o,"\u02d9","\\dot");a(i,l,c,"\u0131","\\imath");a(i,l,c,"\u0237","\\jmath");a(n,l,y,"\u2013","--");a(n,l,y,"\u2013","\\textendash");a(n,l,y,"\u2014","---");a(n,l,y,"\u2014","\\textemdash");a(n,l,y,"\u2018","`");a(n,l,y,"\u2018","\\textquoteleft");a(n,l,y,"\u2019","'");a(n,l,y,"\u2019","\\textquoteright");a(n,l,y,"\u201c","``");a(n,l,y,"\u201c","\\textquotedblleft");a(n,l,y,"\u201d","''");a(n,l,y,"\u201d","\\textquotedblright");a(i,l,y,"\xb0","\\degree");a(n,l,y,"\xb0","\\degree");a(i,l,c,"\xa3","\\pounds");a(i,l,c,"\xa3","\\mathsterling");a(n,l,c,"\xa3","\\pounds");a(n,l,c,"\xa3","\\textsterling");a(i,s,y,"\u2720","\\maltese");a(n,s,y,"\u2720","\\maltese");a(n,l,g,"\xa0","\\ ");a(n,l,g,"\xa0"," ");a(n,l,g,"\xa0","~");var b='0123456789/@."';for(var x=0;x<b.length;x++){var w=b.charAt(x);a(i,l,y,w,w)}var k='0123456789!@*()-=+[]<>|";:?/.,';for(var S=0;S<k.length;S++){var M=k.charAt(S);a(n,l,y,M,M)}var z="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(var C=0;C<z.length;C++){var T=z.charAt(C);a(i,l,c,T,T);a(n,l,y,T,T)}for(var N=192;N<=214;N++){var A=String.fromCharCode(N);a(n,l,y,A,A)}for(var q=216;q<=246;q++){var _=String.fromCharCode(q);a(n,l,y,_,_)}for(var E=248;E<=255;E++){var O=String.fromCharCode(E);a(n,l,y,O,O)}for(var R=1040;R<=1103;R++){var P=String.fromCharCode(R);a(n,l,y,P,P)}a(n,l,y,"\u2013","\u2013");a(n,l,y,"\u2014","\u2014");a(n,l,y,"\u2018","\u2018");a(n,l,y,"\u2019","\u2019");a(n,l,y,"\u201c","\u201c");a(n,l,y,"\u201d","\u201d")},{}],49:[function(e,t,r){"use strict";var a=/[\uAC00-\uD7AF]/;var i=/[\u3040-\u309F]|[\u30A0-\u30FF]|[\u4E00-\u9FAF]|[\uAC00-\uD7AF]/;t.exports={cjkRegex:i,hangulRegex:a}},{}],50:[function(e,t,r){"use strict";var a=e("./ParseError");var i=n(a);function n(e){return e&&e.__esModule?e:{default:e}}var l={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800};var s={ex:true,em:true,mu:true};var o=function e(t){if(t.unit){t=t.unit}return t in l||t in s||t==="ex"};var u=function e(t,r){var a=void 0;if(t.unit in l){a=l[t.unit]/r.fontMetrics().ptPerEm/r.sizeMultiplier}else if(t.unit==="mu"){a=r.fontMetrics().cssEmPerMu}else{var n=void 0;if(r.style.isTight()){n=r.havingStyle(r.style.text())}else{n=r}if(t.unit==="ex"){a=n.fontMetrics().xHeight}else if(t.unit==="em"){a=n.fontMetrics().quad}else{throw new i.default("Invalid unit: '"+t.unit+"'")}if(n!==r){a*=n.sizeMultiplier/r.sizeMultiplier}}return t.number*a};t.exports={validUnit:o,calculateSize:u}},{"./ParseError":29}],51:[function(e,t,r){"use strict";var a=Array.prototype.indexOf;var i=function e(t,r){if(t==null){return-1}if(a&&t.indexOf===a){return t.indexOf(r)}var i=t.length;for(var n=0;n<i;n++){if(t[n]===r){return n}}return-1};var n=function e(t,r){return i(t,r)!==-1};var l=function e(t,r){return t===undefined?r:t};var s=/([A-Z])/g;var o=function e(t){return t.replace(s,"-$1").toLowerCase()};var u={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"};var f=/[&><"']/g;function d(e){return u[e]}function c(e){return(""+e).replace(f,d)}var h=void 0;if(typeof document!=="undefined"){var v=document.createElement("span");if("textContent"in v){h=function e(t,r){t.textContent=r}}else{h=function e(t,r){t.innerText=r}}}function p(e){h(e,"")}t.exports={contains:n,deflt:l,escape:c,hyphenate:o,indexOf:i,setTextContent:h,clearNode:p}},{}]},{},[1])(1)});
// https://d3js.org v5.9.7 Copyright 2019 Mike Bostock
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.d3=t.d3||{})}(this,function(t){"use strict";function n(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function e(t){var e;return 1===t.length&&(e=t,t=function(t,r){return n(e(t),r)}),{left:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);r<i;){var o=r+i>>>1;t(n[o],e)<0?r=o+1:i=o}return r},right:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);r<i;){var o=r+i>>>1;t(n[o],e)>0?i=o:r=o+1}return r}}}var r=e(n),i=r.right,o=r.left;function a(t,n){return[t,n]}function u(t){return null===t?NaN:+t}function c(t,n){var e,r,i=t.length,o=0,a=-1,c=0,f=0;if(null==n)for(;++a<i;)isNaN(e=u(t[a]))||(f+=(r=e-c)*(e-(c+=r/++o)));else for(;++a<i;)isNaN(e=u(n(t[a],a,t)))||(f+=(r=e-c)*(e-(c+=r/++o)));if(o>1)return f/(o-1)}function f(t,n){var e=c(t,n);return e?Math.sqrt(e):e}function s(t,n){var e,r,i,o=t.length,a=-1;if(null==n){for(;++a<o;)if(null!=(e=t[a])&&e>=e)for(r=i=e;++a<o;)null!=(e=t[a])&&(r>e&&(r=e),i<e&&(i=e))}else for(;++a<o;)if(null!=(e=n(t[a],a,t))&&e>=e)for(r=i=e;++a<o;)null!=(e=n(t[a],a,t))&&(r>e&&(r=e),i<e&&(i=e));return[r,i]}var l=Array.prototype,h=l.slice,d=l.map;function p(t){return function(){return t}}function v(t){return t}function g(t,n,e){t=+t,n=+n,e=(i=arguments.length)<2?(n=t,t=0,1):i<3?1:+e;for(var r=-1,i=0|Math.max(0,Math.ceil((n-t)/e)),o=new Array(i);++r<i;)o[r]=t+r*e;return o}var y=Math.sqrt(50),_=Math.sqrt(10),b=Math.sqrt(2);function m(t,n,e){var r,i,o,a,u=-1;if(e=+e,(t=+t)===(n=+n)&&e>0)return[t];if((r=n<t)&&(i=t,t=n,n=i),0===(a=x(t,n,e))||!isFinite(a))return[];if(a>0)for(t=Math.ceil(t/a),n=Math.floor(n/a),o=new Array(i=Math.ceil(n-t+1));++u<i;)o[u]=(t+u)*a;else for(t=Math.floor(t*a),n=Math.ceil(n*a),o=new Array(i=Math.ceil(t-n+1));++u<i;)o[u]=(t-u)/a;return r&&o.reverse(),o}function x(t,n,e){var r=(n-t)/Math.max(0,e),i=Math.floor(Math.log(r)/Math.LN10),o=r/Math.pow(10,i);return i>=0?(o>=y?10:o>=_?5:o>=b?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=y?10:o>=_?5:o>=b?2:1)}function w(t,n,e){var r=Math.abs(n-t)/Math.max(0,e),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=y?i*=10:o>=_?i*=5:o>=b&&(i*=2),n<t?-i:i}function M(t){return Math.ceil(Math.log(t.length)/Math.LN2)+1}function N(t,n,e){if(null==e&&(e=u),r=t.length){if((n=+n)<=0||r<2)return+e(t[0],0,t);if(n>=1)return+e(t[r-1],r-1,t);var r,i=(r-1)*n,o=Math.floor(i),a=+e(t[o],o,t);return a+(+e(t[o+1],o+1,t)-a)*(i-o)}}function A(t,n){var e,r,i=t.length,o=-1;if(null==n){for(;++o<i;)if(null!=(e=t[o])&&e>=e)for(r=e;++o<i;)null!=(e=t[o])&&e>r&&(r=e)}else for(;++o<i;)if(null!=(e=n(t[o],o,t))&&e>=e)for(r=e;++o<i;)null!=(e=n(t[o],o,t))&&e>r&&(r=e);return r}function T(t){for(var n,e,r,i=t.length,o=-1,a=0;++o<i;)a+=t[o].length;for(e=new Array(a);--i>=0;)for(n=(r=t[i]).length;--n>=0;)e[--a]=r[n];return e}function S(t,n){var e,r,i=t.length,o=-1;if(null==n){for(;++o<i;)if(null!=(e=t[o])&&e>=e)for(r=e;++o<i;)null!=(e=t[o])&&r>e&&(r=e)}else for(;++o<i;)if(null!=(e=n(t[o],o,t))&&e>=e)for(r=e;++o<i;)null!=(e=n(t[o],o,t))&&r>e&&(r=e);return r}function k(t){if(!(i=t.length))return[];for(var n=-1,e=S(t,E),r=new Array(e);++n<e;)for(var i,o=-1,a=r[n]=new Array(i);++o<i;)a[o]=t[o][n];return r}function E(t){return t.length}var C=Array.prototype.slice;function P(t){return t}var z=1,R=2,D=3,q=4,L=1e-6;function U(t){return"translate("+(t+.5)+",0)"}function O(t){return"translate(0,"+(t+.5)+")"}function B(){return!this.__axis}function Y(t,n){var e=[],r=null,i=null,o=6,a=6,u=3,c=t===z||t===q?-1:1,f=t===q||t===R?"x":"y",s=t===z||t===D?U:O;function l(l){var h=null==r?n.ticks?n.ticks.apply(n,e):n.domain():r,d=null==i?n.tickFormat?n.tickFormat.apply(n,e):P:i,p=Math.max(o,0)+u,v=n.range(),g=+v[0]+.5,y=+v[v.length-1]+.5,_=(n.bandwidth?function(t){var n=Math.max(0,t.bandwidth()-1)/2;return t.round()&&(n=Math.round(n)),function(e){return+t(e)+n}}:function(t){return function(n){return+t(n)}})(n.copy()),b=l.selection?l.selection():l,m=b.selectAll(".domain").data([null]),x=b.selectAll(".tick").data(h,n).order(),w=x.exit(),M=x.enter().append("g").attr("class","tick"),N=x.select("line"),A=x.select("text");m=m.merge(m.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),x=x.merge(M),N=N.merge(M.append("line").attr("stroke","currentColor").attr(f+"2",c*o)),A=A.merge(M.append("text").attr("fill","currentColor").attr(f,c*p).attr("dy",t===z?"0em":t===D?"0.71em":"0.32em")),l!==b&&(m=m.transition(l),x=x.transition(l),N=N.transition(l),A=A.transition(l),w=w.transition(l).attr("opacity",L).attr("transform",function(t){return isFinite(t=_(t))?s(t):this.getAttribute("transform")}),M.attr("opacity",L).attr("transform",function(t){var n=this.parentNode.__axis;return s(n&&isFinite(n=n(t))?n:_(t))})),w.remove(),m.attr("d",t===q||t==R?a?"M"+c*a+","+g+"H0.5V"+y+"H"+c*a:"M0.5,"+g+"V"+y:a?"M"+g+","+c*a+"V0.5H"+y+"V"+c*a:"M"+g+",0.5H"+y),x.attr("opacity",1).attr("transform",function(t){return s(_(t))}),N.attr(f+"2",c*o),A.attr(f,c*p).text(d),b.filter(B).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===R?"start":t===q?"end":"middle"),b.each(function(){this.__axis=_})}return l.scale=function(t){return arguments.length?(n=t,l):n},l.ticks=function(){return e=C.call(arguments),l},l.tickArguments=function(t){return arguments.length?(e=null==t?[]:C.call(t),l):e.slice()},l.tickValues=function(t){return arguments.length?(r=null==t?null:C.call(t),l):r&&r.slice()},l.tickFormat=function(t){return arguments.length?(i=t,l):i},l.tickSize=function(t){return arguments.length?(o=a=+t,l):o},l.tickSizeInner=function(t){return arguments.length?(o=+t,l):o},l.tickSizeOuter=function(t){return arguments.length?(a=+t,l):a},l.tickPadding=function(t){return arguments.length?(u=+t,l):u},l}var F={value:function(){}};function I(){for(var t,n=0,e=arguments.length,r={};n<e;++n){if(!(t=arguments[n]+"")||t in r)throw new Error("illegal type: "+t);r[t]=[]}return new j(r)}function j(t){this._=t}function H(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function X(t,n,e){for(var r=0,i=t.length;r<i;++r)if(t[r].name===n){t[r]=F,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}j.prototype=I.prototype={constructor:j,on:function(t,n){var e,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map(function(t){var n="",e=t.indexOf(".");if(e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})),a=-1,u=o.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++a<u;)if(e=(t=o[a]).type)i[e]=X(i[e],t.name,n);else if(null==n)for(e in i)i[e]=X(i[e],t.name,null);return this}for(;++a<u;)if((e=(t=o[a]).type)&&(e=H(i[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new j(t)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r,i=new Array(e),o=0;o<e;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,e=(r=this._[t]).length;o<e;++o)r[o].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(n,e)}};var G="http://www.w3.org/1999/xhtml",V={svg:"http://www.w3.org/2000/svg",xhtml:G,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function $(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),V.hasOwnProperty(n)?{space:V[n],local:t}:t}function W(t){var n=$(t);return(n.local?function(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}:function(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===G&&n.documentElement.namespaceURI===G?n.createElement(t):n.createElementNS(e,t)}})(n)}function Z(){}function Q(t){return null==t?Z:function(){return this.querySelector(t)}}function J(){return[]}function K(t){return null==t?J:function(){return this.querySelectorAll(t)}}function tt(t){return function(){return this.matches(t)}}function nt(t){return new Array(t.length)}function et(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}et.prototype={constructor:et,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var rt="$";function it(t,n,e,r,i,o){for(var a,u=0,c=n.length,f=o.length;u<f;++u)(a=n[u])?(a.__data__=o[u],r[u]=a):e[u]=new et(t,o[u]);for(;u<c;++u)(a=n[u])&&(i[u]=a)}function ot(t,n,e,r,i,o,a){var u,c,f,s={},l=n.length,h=o.length,d=new Array(l);for(u=0;u<l;++u)(c=n[u])&&(d[u]=f=rt+a.call(c,c.__data__,u,n),f in s?i[u]=c:s[f]=c);for(u=0;u<h;++u)(c=s[f=rt+a.call(t,o[u],u,o)])?(r[u]=c,c.__data__=o[u],s[f]=null):e[u]=new et(t,o[u]);for(u=0;u<l;++u)(c=n[u])&&s[d[u]]===c&&(i[u]=c)}function at(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function ut(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function ct(t,n){return t.style.getPropertyValue(n)||ut(t).getComputedStyle(t,null).getPropertyValue(n)}function ft(t){return t.trim().split(/^|\s+/)}function st(t){return t.classList||new lt(t)}function lt(t){this._node=t,this._names=ft(t.getAttribute("class")||"")}function ht(t,n){for(var e=st(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function dt(t,n){for(var e=st(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function pt(){this.textContent=""}function vt(){this.innerHTML=""}function gt(){this.nextSibling&&this.parentNode.appendChild(this)}function yt(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function _t(){return null}function bt(){var t=this.parentNode;t&&t.removeChild(this)}function mt(){return this.parentNode.insertBefore(this.cloneNode(!1),this.nextSibling)}function xt(){return this.parentNode.insertBefore(this.cloneNode(!0),this.nextSibling)}lt.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var wt={};(t.event=null,"undefined"!=typeof document)&&("onmouseenter"in document.documentElement||(wt={mouseenter:"mouseover",mouseleave:"mouseout"}));function Mt(t,n,e){return t=Nt(t,n,e),function(n){var e=n.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||t.call(this,n)}}function Nt(n,e,r){return function(i){var o=t.event;t.event=i;try{n.call(this,this.__data__,e,r)}finally{t.event=o}}}function At(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r<o;++r)e=n[r],t.type&&e.type!==t.type||e.name!==t.name?n[++i]=e:this.removeEventListener(e.type,e.listener,e.capture);++i?n.length=i:delete this.__on}}}function Tt(t,n,e){var r=wt.hasOwnProperty(t.type)?Mt:Nt;return function(i,o,a){var u,c=this.__on,f=r(n,o,a);if(c)for(var s=0,l=c.length;s<l;++s)if((u=c[s]).type===t.type&&u.name===t.name)return this.removeEventListener(u.type,u.listener,u.capture),this.addEventListener(u.type,u.listener=f,u.capture=e),void(u.value=n);this.addEventListener(t.type,f,e),u={type:t.type,name:t.name,value:n,listener:f,capture:e},c?c.push(u):this.__on=[u]}}function St(n,e,r,i){var o=t.event;n.sourceEvent=t.event,t.event=n;try{return e.apply(r,i)}finally{t.event=o}}function kt(t,n,e){var r=ut(t),i=r.CustomEvent;"function"==typeof i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}var Et=[null];function Ct(t,n){this._groups=t,this._parents=n}function Pt(){return new Ct([[document.documentElement]],Et)}function zt(t){return"string"==typeof t?new Ct([[document.querySelector(t)]],[document.documentElement]):new Ct([[t]],Et)}Ct.prototype=Pt.prototype={constructor:Ct,select:function(t){"function"!=typeof t&&(t=Q(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a,u=n[i],c=u.length,f=r[i]=new Array(c),s=0;s<c;++s)(o=u[s])&&(a=t.call(o,o.__data__,s,u))&&("__data__"in o&&(a.__data__=o.__data__),f[s]=a);return new Ct(r,this._parents)},selectAll:function(t){"function"!=typeof t&&(t=K(t));for(var n=this._groups,e=n.length,r=[],i=[],o=0;o<e;++o)for(var a,u=n[o],c=u.length,f=0;f<c;++f)(a=u[f])&&(r.push(t.call(a,a.__data__,f,u)),i.push(a));return new Ct(r,i)},filter:function(t){"function"!=typeof t&&(t=tt(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a=n[i],u=a.length,c=r[i]=[],f=0;f<u;++f)(o=a[f])&&t.call(o,o.__data__,f,a)&&c.push(o);return new Ct(r,this._parents)},data:function(t,n){if(!t)return p=new Array(this.size()),s=-1,this.each(function(t){p[++s]=t}),p;var e,r=n?ot:it,i=this._parents,o=this._groups;"function"!=typeof t&&(e=t,t=function(){return e});for(var a=o.length,u=new Array(a),c=new Array(a),f=new Array(a),s=0;s<a;++s){var l=i[s],h=o[s],d=h.length,p=t.call(l,l&&l.__data__,s,i),v=p.length,g=c[s]=new Array(v),y=u[s]=new Array(v);r(l,h,g,y,f[s]=new Array(d),p,n);for(var _,b,m=0,x=0;m<v;++m)if(_=g[m]){for(m>=x&&(x=m+1);!(b=y[x])&&++x<v;);_._next=b||null}}return(u=new Ct(u,i))._enter=c,u._exit=f,u},enter:function(){return new Ct(this._enter||this._groups.map(nt),this._parents)},exit:function(){return new Ct(this._exit||this._groups.map(nt),this._parents)},join:function(t,n,e){var r=this.enter(),i=this,o=this.exit();return r="function"==typeof t?t(r):r.append(t+""),null!=n&&(i=n(i)),null==e?o.remove():e(o),r&&i?r.merge(i).order():i},merge:function(t){for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),a=new Array(r),u=0;u<o;++u)for(var c,f=n[u],s=e[u],l=f.length,h=a[u]=new Array(l),d=0;d<l;++d)(c=f[d]||s[d])&&(h[d]=c);for(;u<r;++u)a[u]=n[u];return new Ct(a,this._parents)},order:function(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],o=i.length-1,a=i[o];--o>=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=at);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o){for(var a,u=e[o],c=u.length,f=i[o]=new Array(c),s=0;s<c;++s)(a=u[s])&&(f[s]=a);f.sort(n)}return new Ct(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){var t=new Array(this.size()),n=-1;return this.each(function(){t[++n]=this}),t},node:function(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r=t[n],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null},size:function(){var t=0;return this.each(function(){++t}),t},empty:function(){return!this.node()},each:function(t){for(var n=this._groups,e=0,r=n.length;e<r;++e)for(var i,o=n[e],a=0,u=o.length;a<u;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,n){var e=$(t);if(arguments.length<2){var r=this.node();return e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}return this.each((null==n?e.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}}:"function"==typeof n?e.local?function(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}:function(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}:e.local?function(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}:function(t,n){return function(){this.setAttribute(t,n)}})(e,n))},style:function(t,n,e){return arguments.length>1?this.each((null==n?function(t){return function(){this.style.removeProperty(t)}}:"function"==typeof n?function(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}:function(t,n,e){return function(){this.style.setProperty(t,n,e)}})(t,n,null==e?"":e)):ct(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?function(t){return function(){delete this[t]}}:"function"==typeof n?function(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}:function(t,n){return function(){this[t]=n}})(t,n)):this.node()[t]},classed:function(t,n){var e=ft(t+"");if(arguments.length<2){for(var r=st(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?function(t,n){return function(){(n.apply(this,arguments)?ht:dt)(this,t)}}:n?function(t){return function(){ht(this,t)}}:function(t){return function(){dt(this,t)}})(e,n))},text:function(t){return arguments.length?this.each(null==t?pt:("function"==typeof t?function(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}:function(t){return function(){this.textContent=t}})(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?vt:("function"==typeof t?function(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}:function(t){return function(){this.innerHTML=t}})(t)):this.node().innerHTML},raise:function(){return this.each(gt)},lower:function(){return this.each(yt)},append:function(t){var n="function"==typeof t?t:W(t);return this.select(function(){return this.appendChild(n.apply(this,arguments))})},insert:function(t,n){var e="function"==typeof t?t:W(t),r=null==n?_t:"function"==typeof n?n:Q(n);return this.select(function(){return this.insertBefore(e.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(bt)},clone:function(t){return this.select(t?xt:mt)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,n,e){var r,i,o=function(t){return t.trim().split(/^|\s+/).map(function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}})}(t+""),a=o.length;if(!(arguments.length<2)){for(u=n?Tt:At,null==e&&(e=!1),r=0;r<a;++r)this.each(u(o[r],n,e));return this}var u=this.node().__on;if(u)for(var c,f=0,s=u.length;f<s;++f)for(r=0,c=u[f];r<a;++r)if((i=o[r]).type===c.type&&i.name===c.name)return c.value},dispatch:function(t,n){return this.each(("function"==typeof n?function(t,n){return function(){return kt(this,t,n.apply(this,arguments))}}:function(t,n){return function(){return kt(this,t,n)}})(t,n))}};var Rt=0;function Dt(){return new qt}function qt(){this._="@"+(++Rt).toString(36)}function Lt(){for(var n,e=t.event;n=e.sourceEvent;)e=n;return e}function Ut(t,n){var e=t.ownerSVGElement||t;if(e.createSVGPoint){var r=e.createSVGPoint();return r.x=n.clientX,r.y=n.clientY,[(r=r.matrixTransform(t.getScreenCTM().inverse())).x,r.y]}var i=t.getBoundingClientRect();return[n.clientX-i.left-t.clientLeft,n.clientY-i.top-t.clientTop]}function Ot(t){var n=Lt();return n.changedTouches&&(n=n.changedTouches[0]),Ut(t,n)}function Bt(t,n,e){arguments.length<3&&(e=n,n=Lt().changedTouches);for(var r,i=0,o=n?n.length:0;i<o;++i)if((r=n[i]).identifier===e)return Ut(t,r);return null}function Yt(){t.event.stopImmediatePropagation()}function Ft(){t.event.preventDefault(),t.event.stopImmediatePropagation()}function It(t){var n=t.document.documentElement,e=zt(t).on("dragstart.drag",Ft,!0);"onselectstart"in n?e.on("selectstart.drag",Ft,!0):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function jt(t,n){var e=t.document.documentElement,r=zt(t).on("dragstart.drag",null);n&&(r.on("click.drag",Ft,!0),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in e?r.on("selectstart.drag",null):(e.style.MozUserSelect=e.__noselect,delete e.__noselect)}function Ht(t){return function(){return t}}function Xt(t,n,e,r,i,o,a,u,c,f){this.target=t,this.type=n,this.subject=e,this.identifier=r,this.active=i,this.x=o,this.y=a,this.dx=u,this.dy=c,this._=f}function Gt(){return!t.event.button}function Vt(){return this.parentNode}function $t(n){return null==n?{x:t.event.x,y:t.event.y}:n}function Wt(){return"ontouchstart"in this}function Zt(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function Qt(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function Jt(){}qt.prototype=Dt.prototype={constructor:qt,get:function(t){for(var n=this._;!(n in t);)if(!(t=t.parentNode))return;return t[n]},set:function(t,n){return t[this._]=n},remove:function(t){return this._ in t&&delete t[this._]},toString:function(){return this._}},Xt.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var Kt="\\s*([+-]?\\d+)\\s*",tn="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",nn="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",en=/^#([0-9a-f]{3})$/,rn=/^#([0-9a-f]{6})$/,on=new RegExp("^rgb\\("+[Kt,Kt,Kt]+"\\)$"),an=new RegExp("^rgb\\("+[nn,nn,nn]+"\\)$"),un=new RegExp("^rgba\\("+[Kt,Kt,Kt,tn]+"\\)$"),cn=new RegExp("^rgba\\("+[nn,nn,nn,tn]+"\\)$"),fn=new RegExp("^hsl\\("+[tn,nn,nn]+"\\)$"),sn=new RegExp("^hsla\\("+[tn,nn,nn,tn]+"\\)$"),ln={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function hn(t){var n;return t=(t+"").trim().toLowerCase(),(n=en.exec(t))?new yn((n=parseInt(n[1],16))>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):(n=rn.exec(t))?dn(parseInt(n[1],16)):(n=on.exec(t))?new yn(n[1],n[2],n[3],1):(n=an.exec(t))?new yn(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=un.exec(t))?pn(n[1],n[2],n[3],n[4]):(n=cn.exec(t))?pn(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=fn.exec(t))?bn(n[1],n[2]/100,n[3]/100,1):(n=sn.exec(t))?bn(n[1],n[2]/100,n[3]/100,n[4]):ln.hasOwnProperty(t)?dn(ln[t]):"transparent"===t?new yn(NaN,NaN,NaN,0):null}function dn(t){return new yn(t>>16&255,t>>8&255,255&t,1)}function pn(t,n,e,r){return r<=0&&(t=n=e=NaN),new yn(t,n,e,r)}function vn(t){return t instanceof Jt||(t=hn(t)),t?new yn((t=t.rgb()).r,t.g,t.b,t.opacity):new yn}function gn(t,n,e,r){return 1===arguments.length?vn(t):new yn(t,n,e,null==r?1:r)}function yn(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function _n(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function bn(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new xn(t,n,e,r)}function mn(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof xn)return new xn(t.h,t.s,t.l,t.opacity);if(t instanceof Jt||(t=hn(t)),!t)return new xn;if(t instanceof xn)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),a=NaN,u=o-i,c=(o+i)/2;return u?(a=n===o?(e-r)/u+6*(e<r):e===o?(r-n)/u+2:(n-e)/u+4,u/=c<.5?o+i:2-o-i,a*=60):u=c>0&&c<1?0:a,new xn(a,u,c,t.opacity)}(t):new xn(t,n,e,null==r?1:r)}function xn(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function wn(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}Zt(Jt,hn,{displayable:function(){return this.rgb().displayable()},hex:function(){return this.rgb().hex()},toString:function(){return this.rgb()+""}}),Zt(yn,gn,Qt(Jt,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new yn(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new yn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:function(){return"#"+_n(this.r)+_n(this.g)+_n(this.b)},toString:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}})),Zt(xn,mn,Qt(Jt,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new xn(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new xn(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new yn(wn(t>=240?t-240:t+120,i,r),wn(t,i,r),wn(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var Mn=Math.PI/180,Nn=180/Math.PI,An=.96422,Tn=1,Sn=.82521,kn=4/29,En=6/29,Cn=3*En*En,Pn=En*En*En;function zn(t){if(t instanceof Dn)return new Dn(t.l,t.a,t.b,t.opacity);if(t instanceof Fn)return In(t);t instanceof yn||(t=vn(t));var n,e,r=On(t.r),i=On(t.g),o=On(t.b),a=qn((.2225045*r+.7168786*i+.0606169*o)/Tn);return r===i&&i===o?n=e=a:(n=qn((.4360747*r+.3850649*i+.1430804*o)/An),e=qn((.0139322*r+.0971045*i+.7141733*o)/Sn)),new Dn(116*a-16,500*(n-a),200*(a-e),t.opacity)}function Rn(t,n,e,r){return 1===arguments.length?zn(t):new Dn(t,n,e,null==r?1:r)}function Dn(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function qn(t){return t>Pn?Math.pow(t,1/3):t/Cn+kn}function Ln(t){return t>En?t*t*t:Cn*(t-kn)}function Un(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function On(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Bn(t){if(t instanceof Fn)return new Fn(t.h,t.c,t.l,t.opacity);if(t instanceof Dn||(t=zn(t)),0===t.a&&0===t.b)return new Fn(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var n=Math.atan2(t.b,t.a)*Nn;return new Fn(n<0?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function Yn(t,n,e,r){return 1===arguments.length?Bn(t):new Fn(t,n,e,null==r?1:r)}function Fn(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}function In(t){if(isNaN(t.h))return new Dn(t.l,0,0,t.opacity);var n=t.h*Mn;return new Dn(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}Zt(Dn,Rn,Qt(Jt,{brighter:function(t){return new Dn(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new Dn(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return new yn(Un(3.1338561*(n=An*Ln(n))-1.6168667*(t=Tn*Ln(t))-.4906146*(e=Sn*Ln(e))),Un(-.9787684*n+1.9161415*t+.033454*e),Un(.0719453*n-.2289914*t+1.4052427*e),this.opacity)}})),Zt(Fn,Yn,Qt(Jt,{brighter:function(t){return new Fn(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new Fn(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return In(this).rgb()}}));var jn=-.14861,Hn=1.78277,Xn=-.29227,Gn=-.90649,Vn=1.97294,$n=Vn*Gn,Wn=Vn*Hn,Zn=Hn*Xn-Gn*jn;function Qn(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof Jn)return new Jn(t.h,t.s,t.l,t.opacity);t instanceof yn||(t=vn(t));var n=t.r/255,e=t.g/255,r=t.b/255,i=(Zn*r+$n*n-Wn*e)/(Zn+$n-Wn),o=r-i,a=(Vn*(e-i)-Xn*o)/Gn,u=Math.sqrt(a*a+o*o)/(Vn*i*(1-i)),c=u?Math.atan2(a,o)*Nn-120:NaN;return new Jn(c<0?c+360:c,u,i,t.opacity)}(t):new Jn(t,n,e,null==r?1:r)}function Jn(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Kn(t,n,e,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*n+(4-6*o+3*a)*e+(1+3*t+3*o-3*a)*r+a*i)/6}function te(t){var n=t.length-1;return function(e){var r=e<=0?e=0:e>=1?(e=1,n-1):Math.floor(e*n),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,u=r<n-1?t[r+2]:2*o-i;return Kn((e-r/n)*n,a,i,o,u)}}function ne(t){var n=t.length;return function(e){var r=Math.floor(((e%=1)<0?++e:e)*n),i=t[(r+n-1)%n],o=t[r%n],a=t[(r+1)%n],u=t[(r+2)%n];return Kn((e-r/n)*n,i,o,a,u)}}function ee(t){return function(){return t}}function re(t,n){return function(e){return t+e*n}}function ie(t,n){var e=n-t;return e?re(t,e>180||e<-180?e-360*Math.round(e/360):e):ee(isNaN(t)?n:t)}function oe(t){return 1==(t=+t)?ae:function(n,e){return e-n?function(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}(n,e,t):ee(isNaN(n)?e:n)}}function ae(t,n){var e=n-t;return e?re(t,e):ee(isNaN(t)?n:t)}Zt(Jn,Qn,Qt(Jt,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Jn(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Jn(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*Mn,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),i=Math.sin(t);return new yn(255*(n+e*(jn*r+Hn*i)),255*(n+e*(Xn*r+Gn*i)),255*(n+e*(Vn*r)),this.opacity)}}));var ue=function t(n){var e=oe(n);function r(t,n){var r=e((t=gn(t)).r,(n=gn(n)).r),i=e(t.g,n.g),o=e(t.b,n.b),a=ae(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=o(n),t.opacity=a(n),t+""}}return r.gamma=t,r}(1);function ce(t){return function(n){var e,r,i=n.length,o=new Array(i),a=new Array(i),u=new Array(i);for(e=0;e<i;++e)r=gn(n[e]),o[e]=r.r||0,a[e]=r.g||0,u[e]=r.b||0;return o=t(o),a=t(a),u=t(u),r.opacity=1,function(t){return r.r=o(t),r.g=a(t),r.b=u(t),r+""}}}var fe=ce(te),se=ce(ne);function le(t,n){var e,r=n?n.length:0,i=t?Math.min(r,t.length):0,o=new Array(i),a=new Array(r);for(e=0;e<i;++e)o[e]=_e(t[e],n[e]);for(;e<r;++e)a[e]=n[e];return function(t){for(e=0;e<i;++e)a[e]=o[e](t);return a}}function he(t,n){var e=new Date;return n-=t=+t,function(r){return e.setTime(t+n*r),e}}function de(t,n){return n-=t=+t,function(e){return t+n*e}}function pe(t,n){var e,r={},i={};for(e in null!==t&&"object"==typeof t||(t={}),null!==n&&"object"==typeof n||(n={}),n)e in t?r[e]=_e(t[e],n[e]):i[e]=n[e];return function(t){for(e in r)i[e]=r[e](t);return i}}var ve=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ge=new RegExp(ve.source,"g");function ye(t,n){var e,r,i,o=ve.lastIndex=ge.lastIndex=0,a=-1,u=[],c=[];for(t+="",n+="";(e=ve.exec(t))&&(r=ge.exec(n));)(i=r.index)>o&&(i=n.slice(o,i),u[a]?u[a]+=i:u[++a]=i),(e=e[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,c.push({i:a,x:de(e,r)})),o=ge.lastIndex;return o<n.length&&(i=n.slice(o),u[a]?u[a]+=i:u[++a]=i),u.length<2?c[0]?function(t){return function(n){return t(n)+""}}(c[0].x):function(t){return function(){return t}}(n):(n=c.length,function(t){for(var e,r=0;r<n;++r)u[(e=c[r]).i]=e.x(t);return u.join("")})}function _e(t,n){var e,r=typeof n;return null==n||"boolean"===r?ee(n):("number"===r?de:"string"===r?(e=hn(n))?(n=e,ue):ye:n instanceof hn?ue:n instanceof Date?he:Array.isArray(n)?le:"function"!=typeof n.valueOf&&"function"!=typeof n.toString||isNaN(n)?pe:de)(t,n)}function be(t,n){return n-=t=+t,function(e){return Math.round(t+n*e)}}var me,xe,we,Me,Ne=180/Math.PI,Ae={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Te(t,n,e,r,i,o){var a,u,c;return(a=Math.sqrt(t*t+n*n))&&(t/=a,n/=a),(c=t*e+n*r)&&(e-=t*c,r-=n*c),(u=Math.sqrt(e*e+r*r))&&(e/=u,r/=u,c/=u),t*r<n*e&&(t=-t,n=-n,c=-c,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(n,t)*Ne,skewX:Math.atan(c)*Ne,scaleX:a,scaleY:u}}function Se(t,n,e,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var u=[],c=[];return o=t(o),a=t(a),function(t,r,i,o,a,u){if(t!==i||r!==o){var c=a.push("translate(",null,n,null,e);u.push({i:c-4,x:de(t,i)},{i:c-2,x:de(r,o)})}else(i||o)&&a.push("translate("+i+n+o+e)}(o.translateX,o.translateY,a.translateX,a.translateY,u,c),function(t,n,e,o){t!==n?(t-n>180?n+=360:n-t>180&&(t+=360),o.push({i:e.push(i(e)+"rotate(",null,r)-2,x:de(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}(o.rotate,a.rotate,u,c),function(t,n,e,o){t!==n?o.push({i:e.push(i(e)+"skewX(",null,r)-2,x:de(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}(o.skewX,a.skewX,u,c),function(t,n,e,r,o,a){if(t!==e||n!==r){var u=o.push(i(o)+"scale(",null,",",null,")");a.push({i:u-4,x:de(t,e)},{i:u-2,x:de(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,u,c),o=a=null,function(t){for(var n,e=-1,r=c.length;++e<r;)u[(n=c[e]).i]=n.x(t);return u.join("")}}}var ke=Se(function(t){return"none"===t?Ae:(me||(me=document.createElement("DIV"),xe=document.documentElement,we=document.defaultView),me.style.transform=t,t=we.getComputedStyle(xe.appendChild(me),null).getPropertyValue("transform"),xe.removeChild(me),Te(+(t=t.slice(7,-1).split(","))[0],+t[1],+t[2],+t[3],+t[4],+t[5]))},"px, ","px)","deg)"),Ee=Se(function(t){return null==t?Ae:(Me||(Me=document.createElementNS("http://www.w3.org/2000/svg","g")),Me.setAttribute("transform",t),(t=Me.transform.baseVal.consolidate())?Te((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):Ae)},", ",")",")"),Ce=Math.SQRT2,Pe=2,ze=4,Re=1e-12;function De(t){return((t=Math.exp(t))+1/t)/2}function qe(t,n){var e,r,i=t[0],o=t[1],a=t[2],u=n[0],c=n[1],f=n[2],s=u-i,l=c-o,h=s*s+l*l;if(h<Re)r=Math.log(f/a)/Ce,e=function(t){return[i+t*s,o+t*l,a*Math.exp(Ce*t*r)]};else{var d=Math.sqrt(h),p=(f*f-a*a+ze*h)/(2*a*Pe*d),v=(f*f-a*a-ze*h)/(2*f*Pe*d),g=Math.log(Math.sqrt(p*p+1)-p),y=Math.log(Math.sqrt(v*v+1)-v);r=(y-g)/Ce,e=function(t){var n,e=t*r,u=De(g),c=a/(Pe*d)*(u*(n=Ce*e+g,((n=Math.exp(2*n))-1)/(n+1))-function(t){return((t=Math.exp(t))-1/t)/2}(g));return[i+c*s,o+c*l,a*u/De(Ce*e+g)]}}return e.duration=1e3*r,e}function Le(t){return function(n,e){var r=t((n=mn(n)).h,(e=mn(e)).h),i=ae(n.s,e.s),o=ae(n.l,e.l),a=ae(n.opacity,e.opacity);return function(t){return n.h=r(t),n.s=i(t),n.l=o(t),n.opacity=a(t),n+""}}}var Ue=Le(ie),Oe=Le(ae);function Be(t){return function(n,e){var r=t((n=Yn(n)).h,(e=Yn(e)).h),i=ae(n.c,e.c),o=ae(n.l,e.l),a=ae(n.opacity,e.opacity);return function(t){return n.h=r(t),n.c=i(t),n.l=o(t),n.opacity=a(t),n+""}}}var Ye=Be(ie),Fe=Be(ae);function Ie(t){return function n(e){function r(n,r){var i=t((n=Qn(n)).h,(r=Qn(r)).h),o=ae(n.s,r.s),a=ae(n.l,r.l),u=ae(n.opacity,r.opacity);return function(t){return n.h=i(t),n.s=o(t),n.l=a(Math.pow(t,e)),n.opacity=u(t),n+""}}return e=+e,r.gamma=n,r}(1)}var je=Ie(ie),He=Ie(ae);var Xe,Ge,Ve=0,$e=0,We=0,Ze=1e3,Qe=0,Je=0,Ke=0,tr="object"==typeof performance&&performance.now?performance:Date,nr="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function er(){return Je||(nr(rr),Je=tr.now()+Ke)}function rr(){Je=0}function ir(){this._call=this._time=this._next=null}function or(t,n,e){var r=new ir;return r.restart(t,n,e),r}function ar(){er(),++Ve;for(var t,n=Xe;n;)(t=Je-n._time)>=0&&n._call.call(null,t),n=n._next;--Ve}function ur(){Je=(Qe=tr.now())+Ke,Ve=$e=0;try{ar()}finally{Ve=0,function(){var t,n,e=Xe,r=1/0;for(;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Xe=n);Ge=t,fr(r)}(),Je=0}}function cr(){var t=tr.now(),n=t-Qe;n>Ze&&(Ke-=n,Qe=t)}function fr(t){Ve||($e&&($e=clearTimeout($e)),t-Je>24?(t<1/0&&($e=setTimeout(ur,t-tr.now()-Ke)),We&&(We=clearInterval(We))):(We||(Qe=tr.now(),We=setInterval(cr,Ze)),Ve=1,nr(ur)))}function sr(t,n,e){var r=new ir;return n=null==n?0:+n,r.restart(function(e){r.stop(),t(e+n)},n,e),r}ir.prototype=or.prototype={constructor:ir,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?er():+e)+(null==n?0:+n),this._next||Ge===this||(Ge?Ge._next=this:Xe=this,Ge=this),this._call=t,this._time=e,fr()},stop:function(){this._call&&(this._call=null,this._time=1/0,fr())}};var lr=I("start","end","cancel","interrupt"),hr=[],dr=0,pr=1,vr=2,gr=3,yr=4,_r=5,br=6;function mr(t,n,e,r,i,o){var a=t.__transition;if(a){if(e in a)return}else t.__transition={};!function(t,n,e){var r,i=t.__transition;function o(c){var f,s,l,h;if(e.state!==pr)return u();for(f in i)if((h=i[f]).name===e.name){if(h.state===gr)return sr(o);h.state===yr?(h.state=br,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete i[f]):+f<n&&(h.state=br,h.timer.stop(),h.on.call("cancel",t,t.__data__,h.index,h.group),delete i[f])}if(sr(function(){e.state===gr&&(e.state=yr,e.timer.restart(a,e.delay,e.time),a(c))}),e.state=vr,e.on.call("start",t,t.__data__,e.index,e.group),e.state===vr){for(e.state=gr,r=new Array(l=e.tween.length),f=0,s=-1;f<l;++f)(h=e.tween[f].value.call(t,t.__data__,e.index,e.group))&&(r[++s]=h);r.length=s+1}}function a(n){for(var i=n<e.duration?e.ease.call(null,n/e.duration):(e.timer.restart(u),e.state=_r,1),o=-1,a=r.length;++o<a;)r[o].call(t,i);e.state===_r&&(e.on.call("end",t,t.__data__,e.index,e.group),u())}function u(){for(var r in e.state=br,e.timer.stop(),delete i[n],i)return;delete t.__transition}i[n]=e,e.timer=or(function(t){e.state=pr,e.timer.restart(o,e.delay,e.time),e.delay<=t&&o(t-e.delay)},0,e.time)}(t,e,{name:n,index:r,group:i,on:lr,tween:hr,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:dr})}function xr(t,n){var e=Mr(t,n);if(e.state>dr)throw new Error("too late; already scheduled");return e}function wr(t,n){var e=Mr(t,n);if(e.state>gr)throw new Error("too late; already running");return e}function Mr(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}function Nr(t,n){var e,r,i,o=t.__transition,a=!0;if(o){for(i in n=null==n?null:n+"",o)(e=o[i]).name===n?(r=e.state>vr&&e.state<_r,e.state=br,e.timer.stop(),e.on.call(r?"interrupt":"cancel",t,t.__data__,e.index,e.group),delete o[i]):a=!1;a&&delete t.__transition}}function Ar(t,n,e){var r=t._id;return t.each(function(){var t=wr(this,r);(t.value||(t.value={}))[n]=e.apply(this,arguments)}),function(t){return Mr(t,r).value[n]}}function Tr(t,n){var e;return("number"==typeof n?de:n instanceof hn?ue:(e=hn(n))?(n=e,ue):ye)(t,n)}var Sr=Pt.prototype.constructor;function kr(t){return function(){this.style.removeProperty(t)}}var Er=0;function Cr(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function Pr(t){return Pt().transition(t)}function zr(){return++Er}var Rr=Pt.prototype;function Dr(t){return((t*=2)<=1?t*t:--t*(2-t)+1)/2}function qr(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}Cr.prototype=Pr.prototype={constructor:Cr,select:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=Q(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a)for(var u,c,f=r[a],s=f.length,l=o[a]=new Array(s),h=0;h<s;++h)(u=f[h])&&(c=t.call(u,u.__data__,h,f))&&("__data__"in u&&(c.__data__=u.__data__),l[h]=c,mr(l[h],n,e,h,l,Mr(u,e)));return new Cr(o,this._parents,n,e)},selectAll:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=K(t));for(var r=this._groups,i=r.length,o=[],a=[],u=0;u<i;++u)for(var c,f=r[u],s=f.length,l=0;l<s;++l)if(c=f[l]){for(var h,d=t.call(c,c.__data__,l,f),p=Mr(c,e),v=0,g=d.length;v<g;++v)(h=d[v])&&mr(h,n,e,v,d,p);o.push(d),a.push(c)}return new Cr(o,a,n,e)},filter:function(t){"function"!=typeof t&&(t=tt(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a=n[i],u=a.length,c=r[i]=[],f=0;f<u;++f)(o=a[f])&&t.call(o,o.__data__,f,a)&&c.push(o);return new Cr(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),a=new Array(r),u=0;u<o;++u)for(var c,f=n[u],s=e[u],l=f.length,h=a[u]=new Array(l),d=0;d<l;++d)(c=f[d]||s[d])&&(h[d]=c);for(;u<r;++u)a[u]=n[u];return new Cr(a,this._parents,this._name,this._id)},selection:function(){return new Sr(this._groups,this._parents)},transition:function(){for(var t=this._name,n=this._id,e=zr(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a,u=r[o],c=u.length,f=0;f<c;++f)if(a=u[f]){var s=Mr(a,n);mr(a,t,e,f,u,{time:s.time+s.delay+s.duration,delay:0,duration:s.duration,ease:s.ease})}return new Cr(r,this._parents,t,e)},call:Rr.call,nodes:Rr.nodes,node:Rr.node,size:Rr.size,empty:Rr.empty,each:Rr.each,on:function(t,n){var e=this._id;return arguments.length<2?Mr(this.node(),e).on.on(t):this.each(function(t,n,e){var r,i,o=function(t){return(t+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||"start"===t})}(n)?xr:wr;return function(){var a=o(this,t),u=a.on;u!==r&&(i=(r=u).copy()).on(n,e),a.on=i}}(e,t,n))},attr:function(t,n){var e=$(t),r="transform"===e?Ee:Tr;return this.attrTween(t,"function"==typeof n?(e.local?function(t,n,e){var r,i,o;return function(){var a,u,c=e(this);if(null!=c)return(a=this.getAttributeNS(t.space,t.local))===(u=c+"")?null:a===r&&u===i?o:(i=u,o=n(r=a,c));this.removeAttributeNS(t.space,t.local)}}:function(t,n,e){var r,i,o;return function(){var a,u,c=e(this);if(null!=c)return(a=this.getAttribute(t))===(u=c+"")?null:a===r&&u===i?o:(i=u,o=n(r=a,c));this.removeAttribute(t)}})(e,r,Ar(this,"attr."+t,n)):null==n?(e.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}})(e):(e.local?function(t,n,e){var r,i,o=e+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===o?null:a===r?i:i=n(r=a,e)}}:function(t,n,e){var r,i,o=e+"";return function(){var a=this.getAttribute(t);return a===o?null:a===r?i:i=n(r=a,e)}})(e,r,n))},attrTween:function(t,n){var e="attr."+t;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(null==n)return this.tween(e,null);if("function"!=typeof n)throw new Error;var r=$(t);return this.tween(e,(r.local?function(t,n){var e,r;function i(){var i=n.apply(this,arguments);return i!==r&&(e=(r=i)&&function(t,n){return function(e){this.setAttributeNS(t.space,t.local,n(e))}}(t,i)),e}return i._value=n,i}:function(t,n){var e,r;function i(){var i=n.apply(this,arguments);return i!==r&&(e=(r=i)&&function(t,n){return function(e){this.setAttribute(t,n(e))}}(t,i)),e}return i._value=n,i})(r,n))},style:function(t,n,e){var r="transform"==(t+="")?ke:Tr;return null==n?this.styleTween(t,function(t,n){var e,r,i;return function(){var o=ct(this,t),a=(this.style.removeProperty(t),ct(this,t));return o===a?null:o===e&&a===r?i:i=n(e=o,r=a)}}(t,r)).on("end.style."+t,kr(t)):"function"==typeof n?this.styleTween(t,function(t,n,e){var r,i,o;return function(){var a=ct(this,t),u=e(this),c=u+"";return null==u&&(this.style.removeProperty(t),c=u=ct(this,t)),a===c?null:a===r&&c===i?o:(i=c,o=n(r=a,u))}}(t,r,Ar(this,"style."+t,n))).each(function(t,n){var e,r,i,o,a="style."+n,u="end."+a;return function(){var c=wr(this,t),f=c.on,s=null==c.value[a]?o||(o=kr(n)):void 0;f===e&&i===s||(r=(e=f).copy()).on(u,i=s),c.on=r}}(this._id,t)):this.styleTween(t,function(t,n,e){var r,i,o=e+"";return function(){var a=ct(this,t);return a===o?null:a===r?i:i=n(r=a,e)}}(t,r,n),e).on("end.style."+t,null)},styleTween:function(t,n,e){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,function(t,n,e){var r,i;function o(){var o=n.apply(this,arguments);return o!==i&&(r=(i=o)&&function(t,n,e){return function(r){this.style.setProperty(t,n(r),e)}}(t,o,e)),r}return o._value=n,o}(t,n,null==e?"":e))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var n=t(this);this.textContent=null==n?"":n}}(Ar(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},remove:function(){return this.on("end.remove",(t=this._id,function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}));var t},tween:function(t,n){var e=this._id;if(t+="",arguments.length<2){for(var r,i=Mr(this.node(),e).tween,o=0,a=i.length;o<a;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==n?function(t,n){var e,r;return function(){var i=wr(this,t),o=i.tween;if(o!==e)for(var a=0,u=(r=e=o).length;a<u;++a)if(r[a].name===n){(r=r.slice()).splice(a,1);break}i.tween=r}}:function(t,n,e){var r,i;if("function"!=typeof e)throw new Error;return function(){var o=wr(this,t),a=o.tween;if(a!==r){i=(r=a).slice();for(var u={name:n,value:e},c=0,f=i.length;c<f;++c)if(i[c].name===n){i[c]=u;break}c===f&&i.push(u)}o.tween=i}})(e,t,n))},delay:function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?function(t,n){return function(){xr(this,t).delay=+n.apply(this,arguments)}}:function(t,n){return n=+n,function(){xr(this,t).delay=n}})(n,t)):Mr(this.node(),n).delay},duration:function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?function(t,n){return function(){wr(this,t).duration=+n.apply(this,arguments)}}:function(t,n){return n=+n,function(){wr(this,t).duration=n}})(n,t)):Mr(this.node(),n).duration},ease:function(t){var n=this._id;return arguments.length?this.each(function(t,n){if("function"!=typeof n)throw new Error;return function(){wr(this,t).ease=n}}(n,t)):Mr(this.node(),n).ease},end:function(){var t,n,e=this,r=e._id,i=e.size();return new Promise(function(o,a){var u={value:a},c={value:function(){0==--i&&o()}};e.each(function(){var e=wr(this,r),i=e.on;i!==t&&((n=(t=i).copy())._.cancel.push(u),n._.interrupt.push(u),n._.end.push(c)),e.on=n})})}};var Lr=function t(n){function e(t){return Math.pow(t,n)}return n=+n,e.exponent=t,e}(3),Ur=function t(n){function e(t){return 1-Math.pow(1-t,n)}return n=+n,e.exponent=t,e}(3),Or=function t(n){function e(t){return((t*=2)<=1?Math.pow(t,n):2-Math.pow(2-t,n))/2}return n=+n,e.exponent=t,e}(3),Br=Math.PI,Yr=Br/2;function Fr(t){return(1-Math.cos(Br*t))/2}function Ir(t){return((t*=2)<=1?Math.pow(2,10*t-10):2-Math.pow(2,10-10*t))/2}function jr(t){return((t*=2)<=1?1-Math.sqrt(1-t*t):Math.sqrt(1-(t-=2)*t)+1)/2}var Hr=4/11,Xr=6/11,Gr=8/11,Vr=.75,$r=9/11,Wr=10/11,Zr=.9375,Qr=21/22,Jr=63/64,Kr=1/Hr/Hr;function ti(t){return(t=+t)<Hr?Kr*t*t:t<Gr?Kr*(t-=Xr)*t+Vr:t<Wr?Kr*(t-=$r)*t+Zr:Kr*(t-=Qr)*t+Jr}var ni=function t(n){function e(t){return t*t*((n+1)*t-n)}return n=+n,e.overshoot=t,e}(1.70158),ei=function t(n){function e(t){return--t*t*((n+1)*t+n)+1}return n=+n,e.overshoot=t,e}(1.70158),ri=function t(n){function e(t){return((t*=2)<1?t*t*((n+1)*t-n):(t-=2)*t*((n+1)*t+n)+2)/2}return n=+n,e.overshoot=t,e}(1.70158),ii=2*Math.PI,oi=function t(n,e){var r=Math.asin(1/(n=Math.max(1,n)))*(e/=ii);function i(t){return n*Math.pow(2,10*--t)*Math.sin((r-t)/e)}return i.amplitude=function(n){return t(n,e*ii)},i.period=function(e){return t(n,e)},i}(1,.3),ai=function t(n,e){var r=Math.asin(1/(n=Math.max(1,n)))*(e/=ii);function i(t){return 1-n*Math.pow(2,-10*(t=+t))*Math.sin((t+r)/e)}return i.amplitude=function(n){return t(n,e*ii)},i.period=function(e){return t(n,e)},i}(1,.3),ui=function t(n,e){var r=Math.asin(1/(n=Math.max(1,n)))*(e/=ii);function i(t){return((t=2*t-1)<0?n*Math.pow(2,10*t)*Math.sin((r-t)/e):2-n*Math.pow(2,-10*t)*Math.sin((r+t)/e))/2}return i.amplitude=function(n){return t(n,e*ii)},i.period=function(e){return t(n,e)},i}(1,.3),ci={time:null,delay:0,duration:250,ease:qr};function fi(t,n){for(var e;!(e=t.__transition)||!(e=e[n]);)if(!(t=t.parentNode))return ci.time=er(),ci;return e}Pt.prototype.interrupt=function(t){return this.each(function(){Nr(this,t)})},Pt.prototype.transition=function(t){var n,e;t instanceof Cr?(n=t._id,t=t._name):(n=zr(),(e=ci).time=er(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a,u=r[o],c=u.length,f=0;f<c;++f)(a=u[f])&&mr(a,t,n,f,u,e||fi(a,n));return new Cr(r,this._parents,t,n)};var si=[null];function li(t){return function(){return t}}function hi(t,n,e){this.target=t,this.type=n,this.selection=e}function di(){t.event.stopImmediatePropagation()}function pi(){t.event.preventDefault(),t.event.stopImmediatePropagation()}var vi={name:"drag"},gi={name:"space"},yi={name:"handle"},_i={name:"center"},bi={name:"x",handles:["e","w"].map(Si),input:function(t,n){return t&&[[t[0],n[0][1]],[t[1],n[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},mi={name:"y",handles:["n","s"].map(Si),input:function(t,n){return t&&[[n[0][0],t[0]],[n[1][0],t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},xi={name:"xy",handles:["n","e","s","w","nw","ne","se","sw"].map(Si),input:function(t){return t},output:function(t){return t}},wi={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Mi={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},Ni={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},Ai={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},Ti={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function Si(t){return{type:t}}function ki(){return!t.event.button}function Ei(){var t=this.ownerSVGElement||this;return[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}function Ci(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function Pi(t){return t[0][0]===t[1][0]||t[0][1]===t[1][1]}function zi(n){var e,r=Ei,i=ki,o=I(u,"start","brush","end"),a=6;function u(t){var e=t.property("__brush",h).selectAll(".overlay").data([Si("overlay")]);e.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",wi.overlay).merge(e).each(function(){var t=Ci(this).extent;zt(this).attr("x",t[0][0]).attr("y",t[0][1]).attr("width",t[1][0]-t[0][0]).attr("height",t[1][1]-t[0][1])}),t.selectAll(".selection").data([Si("selection")]).enter().append("rect").attr("class","selection").attr("cursor",wi.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var r=t.selectAll(".handle").data(n.handles,function(t){return t.type});r.exit().remove(),r.enter().append("rect").attr("class",function(t){return"handle handle--"+t.type}).attr("cursor",function(t){return wi[t.type]}),t.each(c).attr("fill","none").attr("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush touchstart.brush",l)}function c(){var t=zt(this),n=Ci(this).selection;n?(t.selectAll(".selection").style("display",null).attr("x",n[0][0]).attr("y",n[0][1]).attr("width",n[1][0]-n[0][0]).attr("height",n[1][1]-n[0][1]),t.selectAll(".handle").style("display",null).attr("x",function(t){return"e"===t.type[t.type.length-1]?n[1][0]-a/2:n[0][0]-a/2}).attr("y",function(t){return"s"===t.type[0]?n[1][1]-a/2:n[0][1]-a/2}).attr("width",function(t){return"n"===t.type||"s"===t.type?n[1][0]-n[0][0]+a:a}).attr("height",function(t){return"e"===t.type||"w"===t.type?n[1][1]-n[0][1]+a:a})):t.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function f(t,n){return t.__brush.emitter||new s(t,n)}function s(t,n){this.that=t,this.args=n,this.state=t.__brush,this.active=0}function l(){if(t.event.touches){if(t.event.changedTouches.length<t.event.touches.length)return pi()}else if(e)return;if(i.apply(this,arguments)){var r,o,a,u,s,l,h,d,p,v,g,y,_,b=this,m=t.event.target.__data__.type,x="selection"===(t.event.metaKey?m="overlay":m)?vi:t.event.altKey?_i:yi,w=n===mi?null:Ai[m],M=n===bi?null:Ti[m],N=Ci(b),A=N.extent,T=N.selection,S=A[0][0],k=A[0][1],E=A[1][0],C=A[1][1],P=w&&M&&t.event.shiftKey,z=Ot(b),R=z,D=f(b,arguments).beforestart();"overlay"===m?N.selection=T=[[r=n===mi?S:z[0],a=n===bi?k:z[1]],[s=n===mi?E:r,h=n===bi?C:a]]:(r=T[0][0],a=T[0][1],s=T[1][0],h=T[1][1]),o=r,u=a,l=s,d=h;var q=zt(b).attr("pointer-events","none"),L=q.selectAll(".overlay").attr("cursor",wi[m]);if(t.event.touches)q.on("touchmove.brush",O,!0).on("touchend.brush touchcancel.brush",Y,!0);else{var U=zt(t.event.view).on("keydown.brush",function(){switch(t.event.keyCode){case 16:P=w&&M;break;case 18:x===yi&&(w&&(s=l-p*w,r=o+p*w),M&&(h=d-v*M,a=u+v*M),x=_i,B());break;case 32:x!==yi&&x!==_i||(w<0?s=l-p:w>0&&(r=o-p),M<0?h=d-v:M>0&&(a=u-v),x=gi,L.attr("cursor",wi.selection),B());break;default:return}pi()},!0).on("keyup.brush",function(){switch(t.event.keyCode){case 16:P&&(y=_=P=!1,B());break;case 18:x===_i&&(w<0?s=l:w>0&&(r=o),M<0?h=d:M>0&&(a=u),x=yi,B());break;case 32:x===gi&&(t.event.altKey?(w&&(s=l-p*w,r=o+p*w),M&&(h=d-v*M,a=u+v*M),x=_i):(w<0?s=l:w>0&&(r=o),M<0?h=d:M>0&&(a=u),x=yi),L.attr("cursor",wi[m]),B());break;default:return}pi()},!0).on("mousemove.brush",O,!0).on("mouseup.brush",Y,!0);It(t.event.view)}di(),Nr(b),c.call(b),D.start()}function O(){var t=Ot(b);!P||y||_||(Math.abs(t[0]-R[0])>Math.abs(t[1]-R[1])?_=!0:y=!0),R=t,g=!0,pi(),B()}function B(){var t;switch(p=R[0]-z[0],v=R[1]-z[1],x){case gi:case vi:w&&(p=Math.max(S-r,Math.min(E-s,p)),o=r+p,l=s+p),M&&(v=Math.max(k-a,Math.min(C-h,v)),u=a+v,d=h+v);break;case yi:w<0?(p=Math.max(S-r,Math.min(E-r,p)),o=r+p,l=s):w>0&&(p=Math.max(S-s,Math.min(E-s,p)),o=r,l=s+p),M<0?(v=Math.max(k-a,Math.min(C-a,v)),u=a+v,d=h):M>0&&(v=Math.max(k-h,Math.min(C-h,v)),u=a,d=h+v);break;case _i:w&&(o=Math.max(S,Math.min(E,r-p*w)),l=Math.max(S,Math.min(E,s+p*w))),M&&(u=Math.max(k,Math.min(C,a-v*M)),d=Math.max(k,Math.min(C,h+v*M)))}l<o&&(w*=-1,t=r,r=s,s=t,t=o,o=l,l=t,m in Mi&&L.attr("cursor",wi[m=Mi[m]])),d<u&&(M*=-1,t=a,a=h,h=t,t=u,u=d,d=t,m in Ni&&L.attr("cursor",wi[m=Ni[m]])),N.selection&&(T=N.selection),y&&(o=T[0][0],l=T[1][0]),_&&(u=T[0][1],d=T[1][1]),T[0][0]===o&&T[0][1]===u&&T[1][0]===l&&T[1][1]===d||(N.selection=[[o,u],[l,d]],c.call(b),D.brush())}function Y(){if(di(),t.event.touches){if(t.event.touches.length)return;e&&clearTimeout(e),e=setTimeout(function(){e=null},500),q.on("touchmove.brush touchend.brush touchcancel.brush",null)}else jt(t.event.view,g),U.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);q.attr("pointer-events","all"),L.attr("cursor",wi.overlay),N.selection&&(T=N.selection),Pi(T)&&(N.selection=null,c.call(b)),D.end()}}function h(){var t=this.__brush||{selection:null};return t.extent=r.apply(this,arguments),t.dim=n,t}return u.move=function(t,e){t.selection?t.on("start.brush",function(){f(this,arguments).beforestart().start()}).on("interrupt.brush end.brush",function(){f(this,arguments).end()}).tween("brush",function(){var t=this,r=t.__brush,i=f(t,arguments),o=r.selection,a=n.input("function"==typeof e?e.apply(this,arguments):e,r.extent),u=_e(o,a);function s(n){r.selection=1===n&&Pi(a)?null:u(n),c.call(t),i.brush()}return o&&a?s:s(1)}):t.each(function(){var t=arguments,r=this.__brush,i=n.input("function"==typeof e?e.apply(this,t):e,r.extent),o=f(this,t).beforestart();Nr(this),r.selection=null==i||Pi(i)?null:i,c.call(this),o.start().brush().end()})},s.prototype={beforestart:function(){return 1==++this.active&&(this.state.emitter=this,this.starting=!0),this},start:function(){return this.starting&&(this.starting=!1,this.emit("start")),this},brush:function(){return this.emit("brush"),this},end:function(){return 0==--this.active&&(delete this.state.emitter,this.emit("end")),this},emit:function(t){St(new hi(u,t,n.output(this.state.selection)),o.apply,o,[t,this.that,this.args])}},u.extent=function(t){return arguments.length?(r="function"==typeof t?t:li([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),u):r},u.filter=function(t){return arguments.length?(i="function"==typeof t?t:li(!!t),u):i},u.handleSize=function(t){return arguments.length?(a=+t,u):a},u.on=function(){var t=o.on.apply(o,arguments);return t===o?u:t},u}var Ri=Math.cos,Di=Math.sin,qi=Math.PI,Li=qi/2,Ui=2*qi,Oi=Math.max;var Bi=Array.prototype.slice;function Yi(t){return function(){return t}}var Fi=Math.PI,Ii=2*Fi,ji=Ii-1e-6;function Hi(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function Xi(){return new Hi}function Gi(t){return t.source}function Vi(t){return t.target}function $i(t){return t.radius}function Wi(t){return t.startAngle}function Zi(t){return t.endAngle}Hi.prototype=Xi.prototype={constructor:Hi,moveTo:function(t,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,n){this._+="L"+(this._x1=+t)+","+(this._y1=+n)},quadraticCurveTo:function(t,n,e,r){this._+="Q"+ +t+","+ +n+","+(this._x1=+e)+","+(this._y1=+r)},bezierCurveTo:function(t,n,e,r,i,o){this._+="C"+ +t+","+ +n+","+ +e+","+ +r+","+(this._x1=+i)+","+(this._y1=+o)},arcTo:function(t,n,e,r,i){t=+t,n=+n,e=+e,r=+r,i=+i;var o=this._x1,a=this._y1,u=e-t,c=r-n,f=o-t,s=a-n,l=f*f+s*s;if(i<0)throw new Error("negative radius: "+i);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=n);else if(l>1e-6)if(Math.abs(s*u-c*f)>1e-6&&i){var h=e-o,d=r-a,p=u*u+c*c,v=h*h+d*d,g=Math.sqrt(p),y=Math.sqrt(l),_=i*Math.tan((Fi-Math.acos((p+l-v)/(2*g*y)))/2),b=_/y,m=_/g;Math.abs(b-1)>1e-6&&(this._+="L"+(t+b*f)+","+(n+b*s)),this._+="A"+i+","+i+",0,0,"+ +(s*h>f*d)+","+(this._x1=t+m*u)+","+(this._y1=n+m*c)}else this._+="L"+(this._x1=t)+","+(this._y1=n);else;},arc:function(t,n,e,r,i,o){t=+t,n=+n;var a=(e=+e)*Math.cos(r),u=e*Math.sin(r),c=t+a,f=n+u,s=1^o,l=o?r-i:i-r;if(e<0)throw new Error("negative radius: "+e);null===this._x1?this._+="M"+c+","+f:(Math.abs(this._x1-c)>1e-6||Math.abs(this._y1-f)>1e-6)&&(this._+="L"+c+","+f),e&&(l<0&&(l=l%Ii+Ii),l>ji?this._+="A"+e+","+e+",0,1,"+s+","+(t-a)+","+(n-u)+"A"+e+","+e+",0,1,"+s+","+(this._x1=c)+","+(this._y1=f):l>1e-6&&(this._+="A"+e+","+e+",0,"+ +(l>=Fi)+","+s+","+(this._x1=t+e*Math.cos(i))+","+(this._y1=n+e*Math.sin(i))))},rect:function(t,n,e,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +e+"v"+ +r+"h"+-e+"Z"},toString:function(){return this._}};function Qi(){}function Ji(t,n){var e=new Qi;if(t instanceof Qi)t.each(function(t,n){e.set(n,t)});else if(Array.isArray(t)){var r,i=-1,o=t.length;if(null==n)for(;++i<o;)e.set(i,t[i]);else for(;++i<o;)e.set(n(r=t[i],i,t),r)}else if(t)for(var a in t)e.set(a,t[a]);return e}function Ki(){return{}}function to(t,n,e){t[n]=e}function no(){return Ji()}function eo(t,n,e){t.set(n,e)}function ro(){}Qi.prototype=Ji.prototype={constructor:Qi,has:function(t){return"$"+t in this},get:function(t){return this["$"+t]},set:function(t,n){return this["$"+t]=n,this},remove:function(t){var n="$"+t;return n in this&&delete this[n]},clear:function(){for(var t in this)"$"===t[0]&&delete this[t]},keys:function(){var t=[];for(var n in this)"$"===n[0]&&t.push(n.slice(1));return t},values:function(){var t=[];for(var n in this)"$"===n[0]&&t.push(this[n]);return t},entries:function(){var t=[];for(var n in this)"$"===n[0]&&t.push({key:n.slice(1),value:this[n]});return t},size:function(){var t=0;for(var n in this)"$"===n[0]&&++t;return t},empty:function(){for(var t in this)if("$"===t[0])return!1;return!0},each:function(t){for(var n in this)"$"===n[0]&&t(this[n],n.slice(1),this)}};var io=Ji.prototype;function oo(t,n){var e=new ro;if(t instanceof ro)t.each(function(t){e.add(t)});else if(t){var r=-1,i=t.length;if(null==n)for(;++r<i;)e.add(t[r]);else for(;++r<i;)e.add(n(t[r],r,t))}return e}ro.prototype=oo.prototype={constructor:ro,has:io.has,add:function(t){return this["$"+(t+="")]=t,this},remove:io.remove,clear:io.clear,values:io.keys,size:io.size,empty:io.empty,each:io.each};var ao=Array.prototype.slice;function uo(t,n){return t-n}function co(t){return function(){return t}}function fo(t,n){for(var e,r=-1,i=n.length;++r<i;)if(e=so(t,n[r]))return e;return 0}function so(t,n){for(var e=n[0],r=n[1],i=-1,o=0,a=t.length,u=a-1;o<a;u=o++){var c=t[o],f=c[0],s=c[1],l=t[u],h=l[0],d=l[1];if(lo(c,l,n))return 0;s>r!=d>r&&e<(h-f)*(r-s)/(d-s)+f&&(i=-i)}return i}function lo(t,n,e){var r,i,o,a;return function(t,n,e){return(n[0]-t[0])*(e[1]-t[1])==(e[0]-t[0])*(n[1]-t[1])}(t,n,e)&&(i=t[r=+(t[0]===n[0])],o=e[r],a=n[r],i<=o&&o<=a||a<=o&&o<=i)}function ho(){}var po=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function vo(){var t=1,n=1,e=M,r=u;function i(t){var n=e(t);if(Array.isArray(n))n=n.slice().sort(uo);else{var r=s(t),i=r[0],a=r[1];n=w(i,a,n),n=g(Math.floor(i/n)*n,Math.floor(a/n)*n,n)}return n.map(function(n){return o(t,n)})}function o(e,i){var o=[],u=[];return function(e,r,i){var o,u,c,f,s,l,h=new Array,d=new Array;o=u=-1,f=e[0]>=r,po[f<<1].forEach(p);for(;++o<t-1;)c=f,f=e[o+1]>=r,po[c|f<<1].forEach(p);po[f<<0].forEach(p);for(;++u<n-1;){for(o=-1,f=e[u*t+t]>=r,s=e[u*t]>=r,po[f<<1|s<<2].forEach(p);++o<t-1;)c=f,f=e[u*t+t+o+1]>=r,l=s,s=e[u*t+o+1]>=r,po[c|f<<1|s<<2|l<<3].forEach(p);po[f|s<<3].forEach(p)}o=-1,s=e[u*t]>=r,po[s<<2].forEach(p);for(;++o<t-1;)l=s,s=e[u*t+o+1]>=r,po[s<<2|l<<3].forEach(p);function p(t){var n,e,r=[t[0][0]+o,t[0][1]+u],c=[t[1][0]+o,t[1][1]+u],f=a(r),s=a(c);(n=d[f])?(e=h[s])?(delete d[n.end],delete h[e.start],n===e?(n.ring.push(c),i(n.ring)):h[n.start]=d[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete d[n.end],n.ring.push(c),d[n.end=s]=n):(n=h[s])?(e=d[f])?(delete h[n.start],delete d[e.end],n===e?(n.ring.push(c),i(n.ring)):h[e.start]=d[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete h[n.start],n.ring.unshift(r),h[n.start=f]=n):h[f]=d[s]={start:f,end:s,ring:[r,c]}}po[s<<3].forEach(p)}(e,i,function(t){r(t,e,i),function(t){for(var n=0,e=t.length,r=t[e-1][1]*t[0][0]-t[e-1][0]*t[0][1];++n<e;)r+=t[n-1][1]*t[n][0]-t[n-1][0]*t[n][1];return r}(t)>0?o.push([t]):u.push(t)}),u.forEach(function(t){for(var n,e=0,r=o.length;e<r;++e)if(-1!==fo((n=o[e])[0],t))return void n.push(t)}),{type:"MultiPolygon",value:i,coordinates:o}}function a(n){return 2*n[0]+n[1]*(t+1)*4}function u(e,r,i){e.forEach(function(e){var o,a=e[0],u=e[1],c=0|a,f=0|u,s=r[f*t+c];a>0&&a<t&&c===a&&(o=r[f*t+c-1],e[0]=a+(i-o)/(s-o)-.5),u>0&&u<n&&f===u&&(o=r[(f-1)*t+c],e[1]=u+(i-o)/(s-o)-.5)})}return i.contour=o,i.size=function(e){if(!arguments.length)return[t,n];var r=Math.ceil(e[0]),o=Math.ceil(e[1]);if(!(r>0&&o>0))throw new Error("invalid size");return t=r,n=o,i},i.thresholds=function(t){return arguments.length?(e="function"==typeof t?t:Array.isArray(t)?co(ao.call(t)):co(t),i):e},i.smooth=function(t){return arguments.length?(r=t?u:ho,i):r===u},i}function go(t,n,e){for(var r=t.width,i=t.height,o=1+(e<<1),a=0;a<i;++a)for(var u=0,c=0;u<r+e;++u)u<r&&(c+=t.data[u+a*r]),u>=e&&(u>=o&&(c-=t.data[u-o+a*r]),n.data[u-e+a*r]=c/Math.min(u+1,r-1+o-u,o))}function yo(t,n,e){for(var r=t.width,i=t.height,o=1+(e<<1),a=0;a<r;++a)for(var u=0,c=0;u<i+e;++u)u<i&&(c+=t.data[a+u*r]),u>=e&&(u>=o&&(c-=t.data[a+(u-o)*r]),n.data[a+(u-e)*r]=c/Math.min(u+1,i-1+o-u,o))}function _o(t){return t[0]}function bo(t){return t[1]}function mo(){return 1}var xo={},wo={},Mo=34,No=10,Ao=13;function To(t){return new Function("d","return {"+t.map(function(t,n){return JSON.stringify(t)+": d["+n+"]"}).join(",")+"}")}function So(t){var n=Object.create(null),e=[];return t.forEach(function(t){for(var r in t)r in n||e.push(n[r]=r)}),e}function ko(t,n){var e=t+"",r=e.length;return r<n?new Array(n-r+1).join(0)+e:e}function Eo(t){var n,e=t.getUTCHours(),r=t.getUTCMinutes(),i=t.getUTCSeconds(),o=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":((n=t.getUTCFullYear())<0?"-"+ko(-n,6):n>9999?"+"+ko(n,6):ko(n,4))+"-"+ko(t.getUTCMonth()+1,2)+"-"+ko(t.getUTCDate(),2)+(o?"T"+ko(e,2)+":"+ko(r,2)+":"+ko(i,2)+"."+ko(o,3)+"Z":i?"T"+ko(e,2)+":"+ko(r,2)+":"+ko(i,2)+"Z":r||e?"T"+ko(e,2)+":"+ko(r,2)+"Z":"")}function Co(t){var n=new RegExp('["'+t+"\n\r]"),e=t.charCodeAt(0);function r(t,n){var r,i=[],o=t.length,a=0,u=0,c=o<=0,f=!1;function s(){if(c)return wo;if(f)return f=!1,xo;var n,r,i=a;if(t.charCodeAt(i)===Mo){for(;a++<o&&t.charCodeAt(a)!==Mo||t.charCodeAt(++a)===Mo;);return(n=a)>=o?c=!0:(r=t.charCodeAt(a++))===No?f=!0:r===Ao&&(f=!0,t.charCodeAt(a)===No&&++a),t.slice(i+1,n-1).replace(/""/g,'"')}for(;a<o;){if((r=t.charCodeAt(n=a++))===No)f=!0;else if(r===Ao)f=!0,t.charCodeAt(a)===No&&++a;else if(r!==e)continue;return t.slice(i,n)}return c=!0,t.slice(i,o)}for(t.charCodeAt(o-1)===No&&--o,t.charCodeAt(o-1)===Ao&&--o;(r=s())!==wo;){for(var l=[];r!==xo&&r!==wo;)l.push(r),r=s();n&&null==(l=n(l,u++))||i.push(l)}return i}function i(n,e){return n.map(function(n){return e.map(function(t){return a(n[t])}).join(t)})}function o(n){return n.map(a).join(t)}function a(t){return null==t?"":t instanceof Date?Eo(t):n.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,n){var e,i,o=r(t,function(t,r){if(e)return e(t,r-1);i=t,e=n?function(t,n){var e=To(t);return function(r,i){return n(e(r),i,t)}}(t,n):To(t)});return o.columns=i||[],o},parseRows:r,format:function(n,e){return null==e&&(e=So(n)),[e.map(a).join(t)].concat(i(n,e)).join("\n")},formatBody:function(t,n){return null==n&&(n=So(t)),i(t,n).join("\n")},formatRows:function(t){return t.map(o).join("\n")}}}var Po=Co(","),zo=Po.parse,Ro=Po.parseRows,Do=Po.format,qo=Po.formatBody,Lo=Po.formatRows,Uo=Co("\t"),Oo=Uo.parse,Bo=Uo.parseRows,Yo=Uo.format,Fo=Uo.formatBody,Io=Uo.formatRows;function jo(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.blob()}function Ho(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.arrayBuffer()}function Xo(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.text()}function Go(t,n){return fetch(t,n).then(Xo)}function Vo(t){return function(n,e,r){return 2===arguments.length&&"function"==typeof e&&(r=e,e=void 0),Go(n,e).then(function(n){return t(n,r)})}}var $o=Vo(zo),Wo=Vo(Oo);function Zo(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.json()}function Qo(t){return function(n,e){return Go(n,e).then(function(n){return(new DOMParser).parseFromString(n,t)})}}var Jo=Qo("application/xml"),Ko=Qo("text/html"),ta=Qo("image/svg+xml");function na(t){return function(){return t}}function ea(){return 1e-6*(Math.random()-.5)}function ra(t,n,e,r){if(isNaN(n)||isNaN(e))return t;var i,o,a,u,c,f,s,l,h,d=t._root,p={data:r},v=t._x0,g=t._y0,y=t._x1,_=t._y1;if(!d)return t._root=p,t;for(;d.length;)if((f=n>=(o=(v+y)/2))?v=o:y=o,(s=e>=(a=(g+_)/2))?g=a:_=a,i=d,!(d=d[l=s<<1|f]))return i[l]=p,t;if(u=+t._x.call(null,d.data),c=+t._y.call(null,d.data),n===u&&e===c)return p.next=d,i?i[l]=p:t._root=p,t;do{i=i?i[l]=new Array(4):t._root=new Array(4),(f=n>=(o=(v+y)/2))?v=o:y=o,(s=e>=(a=(g+_)/2))?g=a:_=a}while((l=s<<1|f)==(h=(c>=a)<<1|u>=o));return i[h]=d,i[l]=p,t}function ia(t,n,e,r,i){this.node=t,this.x0=n,this.y0=e,this.x1=r,this.y1=i}function oa(t){return t[0]}function aa(t){return t[1]}function ua(t,n,e){var r=new ca(null==n?oa:n,null==e?aa:e,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function ca(t,n,e,r,i,o){this._x=t,this._y=n,this._x0=e,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function fa(t){for(var n={data:t.data},e=n;t=t.next;)e=e.next={data:t.data};return n}var sa=ua.prototype=ca.prototype;function la(t){return t.x+t.vx}function ha(t){return t.y+t.vy}function da(t){return t.index}function pa(t,n){var e=t.get(n);if(!e)throw new Error("missing: "+n);return e}function va(t){return t.x}function ga(t){return t.y}sa.copy=function(){var t,n,e=new ca(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return e;if(!r.length)return e._root=fa(r),e;for(t=[{source:r,target:e._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(n=r.source[i])&&(n.length?t.push({source:n,target:r.target[i]=new Array(4)}):r.target[i]=fa(n));return e},sa.add=function(t){var n=+this._x.call(null,t),e=+this._y.call(null,t);return ra(this.cover(n,e),n,e,t)},sa.addAll=function(t){var n,e,r,i,o=t.length,a=new Array(o),u=new Array(o),c=1/0,f=1/0,s=-1/0,l=-1/0;for(e=0;e<o;++e)isNaN(r=+this._x.call(null,n=t[e]))||isNaN(i=+this._y.call(null,n))||(a[e]=r,u[e]=i,r<c&&(c=r),r>s&&(s=r),i<f&&(f=i),i>l&&(l=i));if(c>s||f>l)return this;for(this.cover(c,f).cover(s,l),e=0;e<o;++e)ra(this,a[e],u[e],t[e]);return this},sa.cover=function(t,n){if(isNaN(t=+t)||isNaN(n=+n))return this;var e=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(e))i=(e=Math.floor(t))+1,o=(r=Math.floor(n))+1;else{for(var a,u,c=i-e,f=this._root;e>t||t>=i||r>n||n>=o;)switch(u=(n<r)<<1|t<e,(a=new Array(4))[u]=f,f=a,c*=2,u){case 0:i=e+c,o=r+c;break;case 1:e=i-c,o=r+c;break;case 2:i=e+c,r=o-c;break;case 3:e=i-c,r=o-c}this._root&&this._root.length&&(this._root=f)}return this._x0=e,this._y0=r,this._x1=i,this._y1=o,this},sa.data=function(){var t=[];return this.visit(function(n){if(!n.length)do{t.push(n.data)}while(n=n.next)}),t},sa.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},sa.find=function(t,n,e){var r,i,o,a,u,c,f,s=this._x0,l=this._y0,h=this._x1,d=this._y1,p=[],v=this._root;for(v&&p.push(new ia(v,s,l,h,d)),null==e?e=1/0:(s=t-e,l=n-e,h=t+e,d=n+e,e*=e);c=p.pop();)if(!(!(v=c.node)||(i=c.x0)>h||(o=c.y0)>d||(a=c.x1)<s||(u=c.y1)<l))if(v.length){var g=(i+a)/2,y=(o+u)/2;p.push(new ia(v[3],g,y,a,u),new ia(v[2],i,y,g,u),new ia(v[1],g,o,a,y),new ia(v[0],i,o,g,y)),(f=(n>=y)<<1|t>=g)&&(c=p[p.length-1],p[p.length-1]=p[p.length-1-f],p[p.length-1-f]=c)}else{var _=t-+this._x.call(null,v.data),b=n-+this._y.call(null,v.data),m=_*_+b*b;if(m<e){var x=Math.sqrt(e=m);s=t-x,l=n-x,h=t+x,d=n+x,r=v.data}}return r},sa.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t)))return this;var n,e,r,i,o,a,u,c,f,s,l,h,d=this._root,p=this._x0,v=this._y0,g=this._x1,y=this._y1;if(!d)return this;if(d.length)for(;;){if((f=o>=(u=(p+g)/2))?p=u:g=u,(s=a>=(c=(v+y)/2))?v=c:y=c,n=d,!(d=d[l=s<<1|f]))return this;if(!d.length)break;(n[l+1&3]||n[l+2&3]||n[l+3&3])&&(e=n,h=l)}for(;d.data!==t;)if(r=d,!(d=d.next))return this;return(i=d.next)&&delete d.next,r?(i?r.next=i:delete r.next,this):n?(i?n[l]=i:delete n[l],(d=n[0]||n[1]||n[2]||n[3])&&d===(n[3]||n[2]||n[1]||n[0])&&!d.length&&(e?e[h]=d:this._root=d),this):(this._root=i,this)},sa.removeAll=function(t){for(var n=0,e=t.length;n<e;++n)this.remove(t[n]);return this},sa.root=function(){return this._root},sa.size=function(){var t=0;return this.visit(function(n){if(!n.length)do{++t}while(n=n.next)}),t},sa.visit=function(t){var n,e,r,i,o,a,u=[],c=this._root;for(c&&u.push(new ia(c,this._x0,this._y0,this._x1,this._y1));n=u.pop();)if(!t(c=n.node,r=n.x0,i=n.y0,o=n.x1,a=n.y1)&&c.length){var f=(r+o)/2,s=(i+a)/2;(e=c[3])&&u.push(new ia(e,f,s,o,a)),(e=c[2])&&u.push(new ia(e,r,s,f,a)),(e=c[1])&&u.push(new ia(e,f,i,o,s)),(e=c[0])&&u.push(new ia(e,r,i,f,s))}return this},sa.visitAfter=function(t){var n,e=[],r=[];for(this._root&&e.push(new ia(this._root,this._x0,this._y0,this._x1,this._y1));n=e.pop();){var i=n.node;if(i.length){var o,a=n.x0,u=n.y0,c=n.x1,f=n.y1,s=(a+c)/2,l=(u+f)/2;(o=i[0])&&e.push(new ia(o,a,u,s,l)),(o=i[1])&&e.push(new ia(o,s,u,c,l)),(o=i[2])&&e.push(new ia(o,a,l,s,f)),(o=i[3])&&e.push(new ia(o,s,l,c,f))}r.push(n)}for(;n=r.pop();)t(n.node,n.x0,n.y0,n.x1,n.y1);return this},sa.x=function(t){return arguments.length?(this._x=t,this):this._x},sa.y=function(t){return arguments.length?(this._y=t,this):this._y};var ya=10,_a=Math.PI*(3-Math.sqrt(5));function ba(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]}function ma(t){return(t=ba(Math.abs(t)))?t[1]:NaN}var xa,wa=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Ma(t){return new Na(t)}function Na(t){if(!(n=wa.exec(t)))throw new Error("invalid format: "+t);var n;this.fill=n[1]||" ",this.align=n[2]||">",this.sign=n[3]||"-",this.symbol=n[4]||"",this.zero=!!n[5],this.width=n[6]&&+n[6],this.comma=!!n[7],this.precision=n[8]&&+n[8].slice(1),this.trim=!!n[9],this.type=n[10]||""}function Aa(t,n){var e=ba(t,n);if(!e)return t+"";var r=e[0],i=e[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}Ma.prototype=Na.prototype,Na.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Ta={"%":function(t,n){return(100*t).toFixed(n)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},g:function(t,n){return t.toPrecision(n)},o:function(t){return Math.round(t).toString(8)},p:function(t,n){return Aa(100*t,n)},r:Aa,s:function(t,n){var e=ba(t,n);if(!e)return t+"";var r=e[0],i=e[1],o=i-(xa=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+ba(t,Math.max(0,n+o-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function Sa(t){return t}var ka,Ea=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Ca(t){var n,e,r=t.grouping&&t.thousands?(n=t.grouping,e=t.thousands,function(t,r){for(var i=t.length,o=[],a=0,u=n[0],c=0;i>0&&u>0&&(c+u+1>r&&(u=Math.max(1,r-c)),o.push(t.substring(i-=u,i+u)),!((c+=u+1)>r));)u=n[a=(a+1)%n.length];return o.reverse().join(e)}):Sa,i=t.currency,o=t.decimal,a=t.numerals?function(t){return function(n){return n.replace(/[0-9]/g,function(n){return t[+n]})}}(t.numerals):Sa,u=t.percent||"%";function c(t){var n=(t=Ma(t)).fill,e=t.align,c=t.sign,f=t.symbol,s=t.zero,l=t.width,h=t.comma,d=t.precision,p=t.trim,v=t.type;"n"===v?(h=!0,v="g"):Ta[v]||(null==d&&(d=12),p=!0,v="g"),(s||"0"===n&&"="===e)&&(s=!0,n="0",e="=");var g="$"===f?i[0]:"#"===f&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",y="$"===f?i[1]:/[%p]/.test(v)?u:"",_=Ta[v],b=/[defgprs%]/.test(v);function m(t){var i,u,f,m=g,x=y;if("c"===v)x=_(t)+x,t="";else{var w=(t=+t)<0;if(t=_(Math.abs(t),d),p&&(t=function(t){t:for(var n,e=t.length,r=1,i=-1;r<e;++r)switch(t[r]){case".":i=n=r;break;case"0":0===i&&(i=r),n=r;break;default:if(i>0){if(!+t[r])break t;i=0}}return i>0?t.slice(0,i)+t.slice(n+1):t}(t)),w&&0==+t&&(w=!1),m=(w?"("===c?c:"-":"-"===c||"("===c?"":c)+m,x=("s"===v?Ea[8+xa/3]:"")+x+(w&&"("===c?")":""),b)for(i=-1,u=t.length;++i<u;)if(48>(f=t.charCodeAt(i))||f>57){x=(46===f?o+t.slice(i+1):t.slice(i))+x,t=t.slice(0,i);break}}h&&!s&&(t=r(t,1/0));var M=m.length+t.length+x.length,N=M<l?new Array(l-M+1).join(n):"";switch(h&&s&&(t=r(N+t,N.length?l-x.length:1/0),N=""),e){case"<":t=m+t+x+N;break;case"=":t=m+N+t+x;break;case"^":t=N.slice(0,M=N.length>>1)+m+t+x+N.slice(M);break;default:t=N+m+t+x}return a(t)}return d=null==d?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,d)):Math.max(0,Math.min(20,d)),m.toString=function(){return t+""},m}return{format:c,formatPrefix:function(t,n){var e=c(((t=Ma(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(ma(n)/3))),i=Math.pow(10,-r),o=Ea[8+r/3];return function(t){return e(i*t)+o}}}}function Pa(n){return ka=Ca(n),t.format=ka.format,t.formatPrefix=ka.formatPrefix,ka}function za(t){return Math.max(0,-ma(Math.abs(t)))}function Ra(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(ma(n)/3)))-ma(Math.abs(t)))}function Da(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,ma(n)-ma(t))+1}function qa(){return new La}function La(){this.reset()}Pa({decimal:".",thousands:",",grouping:[3],currency:["$",""]}),La.prototype={constructor:La,reset:function(){this.s=this.t=0},add:function(t){Oa(Ua,t,this.t),Oa(this,Ua.s,this.s),this.s?this.t+=Ua.t:this.s=Ua.t},valueOf:function(){return this.s}};var Ua=new La;function Oa(t,n,e){var r=t.s=n+e,i=r-n,o=r-i;t.t=n-o+(e-i)}var Ba=1e-6,Ya=1e-12,Fa=Math.PI,Ia=Fa/2,ja=Fa/4,Ha=2*Fa,Xa=180/Fa,Ga=Fa/180,Va=Math.abs,$a=Math.atan,Wa=Math.atan2,Za=Math.cos,Qa=Math.ceil,Ja=Math.exp,Ka=Math.log,tu=Math.pow,nu=Math.sin,eu=Math.sign||function(t){return t>0?1:t<0?-1:0},ru=Math.sqrt,iu=Math.tan;function ou(t){return t>1?0:t<-1?Fa:Math.acos(t)}function au(t){return t>1?Ia:t<-1?-Ia:Math.asin(t)}function uu(t){return(t=nu(t/2))*t}function cu(){}function fu(t,n){t&&lu.hasOwnProperty(t.type)&&lu[t.type](t,n)}var su={Feature:function(t,n){fu(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++r<i;)fu(e[r].geometry,n)}},lu={Sphere:function(t,n){n.sphere()},Point:function(t,n){t=t.coordinates,n.point(t[0],t[1],t[2])},MultiPoint:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)t=e[r],n.point(t[0],t[1],t[2])},LineString:function(t,n){hu(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)hu(e[r],n,0)},Polygon:function(t,n){du(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)du(e[r],n)},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,i=e.length;++r<i;)fu(e[r],n)}};function hu(t,n,e){var r,i=-1,o=t.length-e;for(n.lineStart();++i<o;)r=t[i],n.point(r[0],r[1],r[2]);n.lineEnd()}function du(t,n){var e=-1,r=t.length;for(n.polygonStart();++e<r;)hu(t[e],n,1);n.polygonEnd()}function pu(t,n){t&&su.hasOwnProperty(t.type)?su[t.type](t,n):fu(t,n)}var vu,gu,yu,_u,bu,mu=qa(),xu=qa(),wu={point:cu,lineStart:cu,lineEnd:cu,polygonStart:function(){mu.reset(),wu.lineStart=Mu,wu.lineEnd=Nu},polygonEnd:function(){var t=+mu;xu.add(t<0?Ha+t:t),this.lineStart=this.lineEnd=this.point=cu},sphere:function(){xu.add(Ha)}};function Mu(){wu.point=Au}function Nu(){Tu(vu,gu)}function Au(t,n){wu.point=Tu,vu=t,gu=n,yu=t*=Ga,_u=Za(n=(n*=Ga)/2+ja),bu=nu(n)}function Tu(t,n){var e=(t*=Ga)-yu,r=e>=0?1:-1,i=r*e,o=Za(n=(n*=Ga)/2+ja),a=nu(n),u=bu*a,c=_u*o+u*Za(i),f=u*r*nu(i);mu.add(Wa(f,c)),yu=t,_u=o,bu=a}function Su(t){return[Wa(t[1],t[0]),au(t[2])]}function ku(t){var n=t[0],e=t[1],r=Za(e);return[r*Za(n),r*nu(n),nu(e)]}function Eu(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function Cu(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function Pu(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function zu(t,n){return[t[0]*n,t[1]*n,t[2]*n]}function Ru(t){var n=ru(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}var Du,qu,Lu,Uu,Ou,Bu,Yu,Fu,Iu,ju,Hu,Xu,Gu,Vu,$u,Wu,Zu,Qu,Ju,Ku,tc,nc,ec,rc,ic,oc,ac=qa(),uc={point:cc,lineStart:sc,lineEnd:lc,polygonStart:function(){uc.point=hc,uc.lineStart=dc,uc.lineEnd=pc,ac.reset(),wu.polygonStart()},polygonEnd:function(){wu.polygonEnd(),uc.point=cc,uc.lineStart=sc,uc.lineEnd=lc,mu<0?(Du=-(Lu=180),qu=-(Uu=90)):ac>Ba?Uu=90:ac<-Ba&&(qu=-90),ju[0]=Du,ju[1]=Lu},sphere:function(){Du=-(Lu=180),qu=-(Uu=90)}};function cc(t,n){Iu.push(ju=[Du=t,Lu=t]),n<qu&&(qu=n),n>Uu&&(Uu=n)}function fc(t,n){var e=ku([t*Ga,n*Ga]);if(Fu){var r=Cu(Fu,e),i=Cu([r[1],-r[0],0],r);Ru(i),i=Su(i);var o,a=t-Ou,u=a>0?1:-1,c=i[0]*Xa*u,f=Va(a)>180;f^(u*Ou<c&&c<u*t)?(o=i[1]*Xa)>Uu&&(Uu=o):f^(u*Ou<(c=(c+360)%360-180)&&c<u*t)?(o=-i[1]*Xa)<qu&&(qu=o):(n<qu&&(qu=n),n>Uu&&(Uu=n)),f?t<Ou?vc(Du,t)>vc(Du,Lu)&&(Lu=t):vc(t,Lu)>vc(Du,Lu)&&(Du=t):Lu>=Du?(t<Du&&(Du=t),t>Lu&&(Lu=t)):t>Ou?vc(Du,t)>vc(Du,Lu)&&(Lu=t):vc(t,Lu)>vc(Du,Lu)&&(Du=t)}else Iu.push(ju=[Du=t,Lu=t]);n<qu&&(qu=n),n>Uu&&(Uu=n),Fu=e,Ou=t}function sc(){uc.point=fc}function lc(){ju[0]=Du,ju[1]=Lu,uc.point=cc,Fu=null}function hc(t,n){if(Fu){var e=t-Ou;ac.add(Va(e)>180?e+(e>0?360:-360):e)}else Bu=t,Yu=n;wu.point(t,n),fc(t,n)}function dc(){wu.lineStart()}function pc(){hc(Bu,Yu),wu.lineEnd(),Va(ac)>Ba&&(Du=-(Lu=180)),ju[0]=Du,ju[1]=Lu,Fu=null}function vc(t,n){return(n-=t)<0?n+360:n}function gc(t,n){return t[0]-n[0]}function yc(t,n){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:n<t[0]||t[1]<n}var _c={sphere:cu,point:bc,lineStart:xc,lineEnd:Nc,polygonStart:function(){_c.lineStart=Ac,_c.lineEnd=Tc},polygonEnd:function(){_c.lineStart=xc,_c.lineEnd=Nc}};function bc(t,n){t*=Ga;var e=Za(n*=Ga);mc(e*Za(t),e*nu(t),nu(n))}function mc(t,n,e){Gu+=(t-Gu)/++Hu,Vu+=(n-Vu)/Hu,$u+=(e-$u)/Hu}function xc(){_c.point=wc}function wc(t,n){t*=Ga;var e=Za(n*=Ga);rc=e*Za(t),ic=e*nu(t),oc=nu(n),_c.point=Mc,mc(rc,ic,oc)}function Mc(t,n){t*=Ga;var e=Za(n*=Ga),r=e*Za(t),i=e*nu(t),o=nu(n),a=Wa(ru((a=ic*o-oc*i)*a+(a=oc*r-rc*o)*a+(a=rc*i-ic*r)*a),rc*r+ic*i+oc*o);Xu+=a,Wu+=a*(rc+(rc=r)),Zu+=a*(ic+(ic=i)),Qu+=a*(oc+(oc=o)),mc(rc,ic,oc)}function Nc(){_c.point=bc}function Ac(){_c.point=Sc}function Tc(){kc(nc,ec),_c.point=bc}function Sc(t,n){nc=t,ec=n,t*=Ga,n*=Ga,_c.point=kc;var e=Za(n);rc=e*Za(t),ic=e*nu(t),oc=nu(n),mc(rc,ic,oc)}function kc(t,n){t*=Ga;var e=Za(n*=Ga),r=e*Za(t),i=e*nu(t),o=nu(n),a=ic*o-oc*i,u=oc*r-rc*o,c=rc*i-ic*r,f=ru(a*a+u*u+c*c),s=au(f),l=f&&-s/f;Ju+=l*a,Ku+=l*u,tc+=l*c,Xu+=s,Wu+=s*(rc+(rc=r)),Zu+=s*(ic+(ic=i)),Qu+=s*(oc+(oc=o)),mc(rc,ic,oc)}function Ec(t){return function(){return t}}function Cc(t,n){function e(e,r){return e=t(e,r),n(e[0],e[1])}return t.invert&&n.invert&&(e.invert=function(e,r){return(e=n.invert(e,r))&&t.invert(e[0],e[1])}),e}function Pc(t,n){return[Va(t)>Fa?t+Math.round(-t/Ha)*Ha:t,n]}function zc(t,n,e){return(t%=Ha)?n||e?Cc(Dc(t),qc(n,e)):Dc(t):n||e?qc(n,e):Pc}function Rc(t){return function(n,e){return[(n+=t)>Fa?n-Ha:n<-Fa?n+Ha:n,e]}}function Dc(t){var n=Rc(t);return n.invert=Rc(-t),n}function qc(t,n){var e=Za(t),r=nu(t),i=Za(n),o=nu(n);function a(t,n){var a=Za(n),u=Za(t)*a,c=nu(t)*a,f=nu(n),s=f*e+u*r;return[Wa(c*i-s*o,u*e-f*r),au(s*i+c*o)]}return a.invert=function(t,n){var a=Za(n),u=Za(t)*a,c=nu(t)*a,f=nu(n),s=f*i-c*o;return[Wa(c*i+f*o,u*e+s*r),au(s*e-u*r)]},a}function Lc(t){function n(n){return(n=t(n[0]*Ga,n[1]*Ga))[0]*=Xa,n[1]*=Xa,n}return t=zc(t[0]*Ga,t[1]*Ga,t.length>2?t[2]*Ga:0),n.invert=function(n){return(n=t.invert(n[0]*Ga,n[1]*Ga))[0]*=Xa,n[1]*=Xa,n},n}function Uc(t,n,e,r,i,o){if(e){var a=Za(n),u=nu(n),c=r*e;null==i?(i=n+r*Ha,o=n-c/2):(i=Oc(a,i),o=Oc(a,o),(r>0?i<o:i>o)&&(i+=r*Ha));for(var f,s=i;r>0?s>o:s<o;s-=c)f=Su([a,-u*Za(s),-u*nu(s)]),t.point(f[0],f[1])}}function Oc(t,n){(n=ku(n))[0]-=t,Ru(n);var e=ou(-n[1]);return((-n[2]<0?-e:e)+Ha-Ba)%Ha}function Bc(){var t,n=[];return{point:function(n,e){t.push([n,e])},lineStart:function(){n.push(t=[])},lineEnd:cu,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function Yc(t,n){return Va(t[0]-n[0])<Ba&&Va(t[1]-n[1])<Ba}function Fc(t,n,e,r){this.x=t,this.z=n,this.o=e,this.e=r,this.v=!1,this.n=this.p=null}function Ic(t,n,e,r,i){var o,a,u=[],c=[];if(t.forEach(function(t){if(!((n=t.length-1)<=0)){var n,e,r=t[0],a=t[n];if(Yc(r,a)){for(i.lineStart(),o=0;o<n;++o)i.point((r=t[o])[0],r[1]);i.lineEnd()}else u.push(e=new Fc(r,t,null,!0)),c.push(e.o=new Fc(r,null,e,!1)),u.push(e=new Fc(a,t,null,!1)),c.push(e.o=new Fc(a,null,e,!0))}}),u.length){for(c.sort(n),jc(u),jc(c),o=0,a=c.length;o<a;++o)c[o].e=e=!e;for(var f,s,l=u[0];;){for(var h=l,d=!0;h.v;)if((h=h.n)===l)return;f=h.z,i.lineStart();do{if(h.v=h.o.v=!0,h.e){if(d)for(o=0,a=f.length;o<a;++o)i.point((s=f[o])[0],s[1]);else r(h.x,h.n.x,1,i);h=h.n}else{if(d)for(f=h.p.z,o=f.length-1;o>=0;--o)i.point((s=f[o])[0],s[1]);else r(h.x,h.p.x,-1,i);h=h.p}f=(h=h.o).z,d=!d}while(!h.v);i.lineEnd()}}}function jc(t){if(n=t.length){for(var n,e,r=0,i=t[0];++r<n;)i.n=e=t[r],e.p=i,i=e;i.n=e=t[0],e.p=i}}Pc.invert=Pc;var Hc=qa();function Xc(t){return Va(t[0])<=Fa?t[0]:eu(t[0])*((Va(t[0])+Fa)%Ha-Fa)}function Gc(t,n){var e=Xc(n),r=n[1],i=nu(r),o=[nu(e),-Za(e),0],a=0,u=0;Hc.reset(),1===i?r=Ia+Ba:-1===i&&(r=-Ia-Ba);for(var c=0,f=t.length;c<f;++c)if(l=(s=t[c]).length)for(var s,l,h=s[l-1],d=Xc(h),p=h[1]/2+ja,v=nu(p),g=Za(p),y=0;y<l;++y,d=b,v=x,g=w,h=_){var _=s[y],b=Xc(_),m=_[1]/2+ja,x=nu(m),w=Za(m),M=b-d,N=M>=0?1:-1,A=N*M,T=A>Fa,S=v*x;if(Hc.add(Wa(S*N*nu(A),g*w+S*Za(A))),a+=T?M+N*Ha:M,T^d>=e^b>=e){var k=Cu(ku(h),ku(_));Ru(k);var E=Cu(o,k);Ru(E);var C=(T^M>=0?-1:1)*au(E[2]);(r>C||r===C&&(k[0]||k[1]))&&(u+=T^M>=0?1:-1)}}return(a<-Ba||a<Ba&&Hc<-Ba)^1&u}function Vc(t,n,e,r){return function(i){var o,a,u,c=n(i),f=Bc(),s=n(f),l=!1,h={point:d,lineStart:v,lineEnd:g,polygonStart:function(){h.point=y,h.lineStart=_,h.lineEnd=b,a=[],o=[]},polygonEnd:function(){h.point=d,h.lineStart=v,h.lineEnd=g,a=T(a);var t=Gc(o,r);a.length?(l||(i.polygonStart(),l=!0),Ic(a,Wc,t,e,i)):t&&(l||(i.polygonStart(),l=!0),i.lineStart(),e(null,null,1,i),i.lineEnd()),l&&(i.polygonEnd(),l=!1),a=o=null},sphere:function(){i.polygonStart(),i.lineStart(),e(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function d(n,e){t(n,e)&&i.point(n,e)}function p(t,n){c.point(t,n)}function v(){h.point=p,c.lineStart()}function g(){h.point=d,c.lineEnd()}function y(t,n){u.push([t,n]),s.point(t,n)}function _(){s.lineStart(),u=[]}function b(){y(u[0][0],u[0][1]),s.lineEnd();var t,n,e,r,c=s.clean(),h=f.result(),d=h.length;if(u.pop(),o.push(u),u=null,d)if(1&c){if((n=(e=h[0]).length-1)>0){for(l||(i.polygonStart(),l=!0),i.lineStart(),t=0;t<n;++t)i.point((r=e[t])[0],r[1]);i.lineEnd()}}else d>1&&2&c&&h.push(h.pop().concat(h.shift())),a.push(h.filter($c))}return h}}function $c(t){return t.length>1}function Wc(t,n){return((t=t.x)[0]<0?t[1]-Ia-Ba:Ia-t[1])-((n=n.x)[0]<0?n[1]-Ia-Ba:Ia-n[1])}var Zc=Vc(function(){return!0},function(t){var n,e=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),n=1},point:function(o,a){var u=o>0?Fa:-Fa,c=Va(o-e);Va(c-Fa)<Ba?(t.point(e,r=(r+a)/2>0?Ia:-Ia),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),t.point(o,r),n=0):i!==u&&c>=Fa&&(Va(e-i)<Ba&&(e-=i*Ba),Va(o-u)<Ba&&(o-=u*Ba),r=function(t,n,e,r){var i,o,a=nu(t-e);return Va(a)>Ba?$a((nu(n)*(o=Za(r))*nu(e)-nu(r)*(i=Za(n))*nu(t))/(i*o*a)):(n+r)/2}(e,r,o,a),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),n=0),t.point(e=o,r=a),i=u},lineEnd:function(){t.lineEnd(),e=r=NaN},clean:function(){return 2-n}}},function(t,n,e,r){var i;if(null==t)i=e*Ia,r.point(-Fa,i),r.point(0,i),r.point(Fa,i),r.point(Fa,0),r.point(Fa,-i),r.point(0,-i),r.point(-Fa,-i),r.point(-Fa,0),r.point(-Fa,i);else if(Va(t[0]-n[0])>Ba){var o=t[0]<n[0]?Fa:-Fa;i=e*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(n[0],n[1])},[-Fa,-Ia]);function Qc(t){var n=Za(t),e=6*Ga,r=n>0,i=Va(n)>Ba;function o(t,e){return Za(t)*Za(e)>n}function a(t,e,r){var i=[1,0,0],o=Cu(ku(t),ku(e)),a=Eu(o,o),u=o[0],c=a-u*u;if(!c)return!r&&t;var f=n*a/c,s=-n*u/c,l=Cu(i,o),h=zu(i,f);Pu(h,zu(o,s));var d=l,p=Eu(h,d),v=Eu(d,d),g=p*p-v*(Eu(h,h)-1);if(!(g<0)){var y=ru(g),_=zu(d,(-p-y)/v);if(Pu(_,h),_=Su(_),!r)return _;var b,m=t[0],x=e[0],w=t[1],M=e[1];x<m&&(b=m,m=x,x=b);var N=x-m,A=Va(N-Fa)<Ba;if(!A&&M<w&&(b=w,w=M,M=b),A||N<Ba?A?w+M>0^_[1]<(Va(_[0]-m)<Ba?w:M):w<=_[1]&&_[1]<=M:N>Fa^(m<=_[0]&&_[0]<=x)){var T=zu(d,(-p+y)/v);return Pu(T,h),[_,Su(T)]}}}function u(n,e){var i=r?t:Fa-t,o=0;return n<-i?o|=1:n>i&&(o|=2),e<-i?o|=4:e>i&&(o|=8),o}return Vc(o,function(t){var n,e,c,f,s;return{lineStart:function(){f=c=!1,s=1},point:function(l,h){var d,p=[l,h],v=o(l,h),g=r?v?0:u(l,h):v?u(l+(l<0?Fa:-Fa),h):0;if(!n&&(f=c=v)&&t.lineStart(),v!==c&&(!(d=a(n,p))||Yc(n,d)||Yc(p,d))&&(p[0]+=Ba,p[1]+=Ba,v=o(p[0],p[1])),v!==c)s=0,v?(t.lineStart(),d=a(p,n),t.point(d[0],d[1])):(d=a(n,p),t.point(d[0],d[1]),t.lineEnd()),n=d;else if(i&&n&&r^v){var y;g&e||!(y=a(p,n,!0))||(s=0,r?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1])))}!v||n&&Yc(n,p)||t.point(p[0],p[1]),n=p,c=v,e=g},lineEnd:function(){c&&t.lineEnd(),n=null},clean:function(){return s|(f&&c)<<1}}},function(n,r,i,o){Uc(o,t,e,i,n,r)},r?[0,-t]:[-Fa,t-Fa])}var Jc=1e9,Kc=-Jc;function tf(t,n,e,r){function i(i,o){return t<=i&&i<=e&&n<=o&&o<=r}function o(i,o,u,f){var s=0,l=0;if(null==i||(s=a(i,u))!==(l=a(o,u))||c(i,o)<0^u>0)do{f.point(0===s||3===s?t:e,s>1?r:n)}while((s=(s+u+4)%4)!==l);else f.point(o[0],o[1])}function a(r,i){return Va(r[0]-t)<Ba?i>0?0:3:Va(r[0]-e)<Ba?i>0?2:1:Va(r[1]-n)<Ba?i>0?1:0:i>0?3:2}function u(t,n){return c(t.x,n.x)}function c(t,n){var e=a(t,1),r=a(n,1);return e!==r?e-r:0===e?n[1]-t[1]:1===e?t[0]-n[0]:2===e?t[1]-n[1]:n[0]-t[0]}return function(a){var c,f,s,l,h,d,p,v,g,y,_,b=a,m=Bc(),x={point:w,lineStart:function(){x.point=M,f&&f.push(s=[]);y=!0,g=!1,p=v=NaN},lineEnd:function(){c&&(M(l,h),d&&g&&m.rejoin(),c.push(m.result()));x.point=w,g&&b.lineEnd()},polygonStart:function(){b=m,c=[],f=[],_=!0},polygonEnd:function(){var n=function(){for(var n=0,e=0,i=f.length;e<i;++e)for(var o,a,u=f[e],c=1,s=u.length,l=u[0],h=l[0],d=l[1];c<s;++c)o=h,a=d,l=u[c],h=l[0],d=l[1],a<=r?d>r&&(h-o)*(r-a)>(d-a)*(t-o)&&++n:d<=r&&(h-o)*(r-a)<(d-a)*(t-o)&&--n;return n}(),e=_&&n,i=(c=T(c)).length;(e||i)&&(a.polygonStart(),e&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),i&&Ic(c,u,n,o,a),a.polygonEnd());b=a,c=f=s=null}};function w(t,n){i(t,n)&&b.point(t,n)}function M(o,a){var u=i(o,a);if(f&&s.push([o,a]),y)l=o,h=a,d=u,y=!1,u&&(b.lineStart(),b.point(o,a));else if(u&&g)b.point(o,a);else{var c=[p=Math.max(Kc,Math.min(Jc,p)),v=Math.max(Kc,Math.min(Jc,v))],m=[o=Math.max(Kc,Math.min(Jc,o)),a=Math.max(Kc,Math.min(Jc,a))];!function(t,n,e,r,i,o){var a,u=t[0],c=t[1],f=0,s=1,l=n[0]-u,h=n[1]-c;if(a=e-u,l||!(a>0)){if(a/=l,l<0){if(a<f)return;a<s&&(s=a)}else if(l>0){if(a>s)return;a>f&&(f=a)}if(a=i-u,l||!(a<0)){if(a/=l,l<0){if(a>s)return;a>f&&(f=a)}else if(l>0){if(a<f)return;a<s&&(s=a)}if(a=r-c,h||!(a>0)){if(a/=h,h<0){if(a<f)return;a<s&&(s=a)}else if(h>0){if(a>s)return;a>f&&(f=a)}if(a=o-c,h||!(a<0)){if(a/=h,h<0){if(a>s)return;a>f&&(f=a)}else if(h>0){if(a<f)return;a<s&&(s=a)}return f>0&&(t[0]=u+f*l,t[1]=c+f*h),s<1&&(n[0]=u+s*l,n[1]=c+s*h),!0}}}}}(c,m,t,n,e,r)?u&&(b.lineStart(),b.point(o,a),_=!1):(g||(b.lineStart(),b.point(c[0],c[1])),b.point(m[0],m[1]),u||b.lineEnd(),_=!1)}p=o,v=a,g=u}return x}}var nf,ef,rf,of=qa(),af={sphere:cu,point:cu,lineStart:function(){af.point=cf,af.lineEnd=uf},lineEnd:cu,polygonStart:cu,polygonEnd:cu};function uf(){af.point=af.lineEnd=cu}function cf(t,n){nf=t*=Ga,ef=nu(n*=Ga),rf=Za(n),af.point=ff}function ff(t,n){t*=Ga;var e=nu(n*=Ga),r=Za(n),i=Va(t-nf),o=Za(i),a=r*nu(i),u=rf*e-ef*r*o,c=ef*e+rf*r*o;of.add(Wa(ru(a*a+u*u),c)),nf=t,ef=e,rf=r}function sf(t){return of.reset(),pu(t,af),+of}var lf=[null,null],hf={type:"LineString",coordinates:lf};function df(t,n){return lf[0]=t,lf[1]=n,sf(hf)}var pf={Feature:function(t,n){return gf(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++r<i;)if(gf(e[r].geometry,n))return!0;return!1}},vf={Sphere:function(){return!0},Point:function(t,n){return yf(t.coordinates,n)},MultiPoint:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)if(yf(e[r],n))return!0;return!1},LineString:function(t,n){return _f(t.coordinates,n)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)if(_f(e[r],n))return!0;return!1},Polygon:function(t,n){return bf(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)if(bf(e[r],n))return!0;return!1},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,i=e.length;++r<i;)if(gf(e[r],n))return!0;return!1}};function gf(t,n){return!(!t||!vf.hasOwnProperty(t.type))&&vf[t.type](t,n)}function yf(t,n){return 0===df(t,n)}function _f(t,n){for(var e,r,i,o=0,a=t.length;o<a;o++){if(0===(r=df(t[o],n)))return!0;if(o>0&&(i=df(t[o],t[o-1]))>0&&e<=i&&r<=i&&(e+r-i)*(1-Math.pow((e-r)/i,2))<Ya*i)return!0;e=r}return!1}function bf(t,n){return!!Gc(t.map(mf),xf(n))}function mf(t){return(t=t.map(xf)).pop(),t}function xf(t){return[t[0]*Ga,t[1]*Ga]}function wf(t,n,e){var r=g(t,n-Ba,e).concat(n);return function(t){return r.map(function(n){return[t,n]})}}function Mf(t,n,e){var r=g(t,n-Ba,e).concat(n);return function(t){return r.map(function(n){return[n,t]})}}function Nf(){var t,n,e,r,i,o,a,u,c,f,s,l,h=10,d=h,p=90,v=360,y=2.5;function _(){return{type:"MultiLineString",coordinates:b()}}function b(){return g(Qa(r/p)*p,e,p).map(s).concat(g(Qa(u/v)*v,a,v).map(l)).concat(g(Qa(n/h)*h,t,h).filter(function(t){return Va(t%p)>Ba}).map(c)).concat(g(Qa(o/d)*d,i,d).filter(function(t){return Va(t%v)>Ba}).map(f))}return _.lines=function(){return b().map(function(t){return{type:"LineString",coordinates:t}})},_.outline=function(){return{type:"Polygon",coordinates:[s(r).concat(l(a).slice(1),s(e).reverse().slice(1),l(u).reverse().slice(1))]}},_.extent=function(t){return arguments.length?_.extentMajor(t).extentMinor(t):_.extentMinor()},_.extentMajor=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],u=+t[0][1],a=+t[1][1],r>e&&(t=r,r=e,e=t),u>a&&(t=u,u=a,a=t),_.precision(y)):[[r,u],[e,a]]},_.extentMinor=function(e){return arguments.length?(n=+e[0][0],t=+e[1][0],o=+e[0][1],i=+e[1][1],n>t&&(e=n,n=t,t=e),o>i&&(e=o,o=i,i=e),_.precision(y)):[[n,o],[t,i]]},_.step=function(t){return arguments.length?_.stepMajor(t).stepMinor(t):_.stepMinor()},_.stepMajor=function(t){return arguments.length?(p=+t[0],v=+t[1],_):[p,v]},_.stepMinor=function(t){return arguments.length?(h=+t[0],d=+t[1],_):[h,d]},_.precision=function(h){return arguments.length?(y=+h,c=wf(o,i,90),f=Mf(n,t,y),s=wf(u,a,90),l=Mf(r,e,y),_):y},_.extentMajor([[-180,-90+Ba],[180,90-Ba]]).extentMinor([[-180,-80-Ba],[180,80+Ba]])}function Af(t){return t}var Tf,Sf,kf,Ef,Cf=qa(),Pf=qa(),zf={point:cu,lineStart:cu,lineEnd:cu,polygonStart:function(){zf.lineStart=Rf,zf.lineEnd=Lf},polygonEnd:function(){zf.lineStart=zf.lineEnd=zf.point=cu,Cf.add(Va(Pf)),Pf.reset()},result:function(){var t=Cf/2;return Cf.reset(),t}};function Rf(){zf.point=Df}function Df(t,n){zf.point=qf,Tf=kf=t,Sf=Ef=n}function qf(t,n){Pf.add(Ef*t-kf*n),kf=t,Ef=n}function Lf(){qf(Tf,Sf)}var Uf=1/0,Of=Uf,Bf=-Uf,Yf=Bf,Ff={point:function(t,n){t<Uf&&(Uf=t);t>Bf&&(Bf=t);n<Of&&(Of=n);n>Yf&&(Yf=n)},lineStart:cu,lineEnd:cu,polygonStart:cu,polygonEnd:cu,result:function(){var t=[[Uf,Of],[Bf,Yf]];return Bf=Yf=-(Of=Uf=1/0),t}};var If,jf,Hf,Xf,Gf=0,Vf=0,$f=0,Wf=0,Zf=0,Qf=0,Jf=0,Kf=0,ts=0,ns={point:es,lineStart:rs,lineEnd:as,polygonStart:function(){ns.lineStart=us,ns.lineEnd=cs},polygonEnd:function(){ns.point=es,ns.lineStart=rs,ns.lineEnd=as},result:function(){var t=ts?[Jf/ts,Kf/ts]:Qf?[Wf/Qf,Zf/Qf]:$f?[Gf/$f,Vf/$f]:[NaN,NaN];return Gf=Vf=$f=Wf=Zf=Qf=Jf=Kf=ts=0,t}};function es(t,n){Gf+=t,Vf+=n,++$f}function rs(){ns.point=is}function is(t,n){ns.point=os,es(Hf=t,Xf=n)}function os(t,n){var e=t-Hf,r=n-Xf,i=ru(e*e+r*r);Wf+=i*(Hf+t)/2,Zf+=i*(Xf+n)/2,Qf+=i,es(Hf=t,Xf=n)}function as(){ns.point=es}function us(){ns.point=fs}function cs(){ss(If,jf)}function fs(t,n){ns.point=ss,es(If=Hf=t,jf=Xf=n)}function ss(t,n){var e=t-Hf,r=n-Xf,i=ru(e*e+r*r);Wf+=i*(Hf+t)/2,Zf+=i*(Xf+n)/2,Qf+=i,Jf+=(i=Xf*t-Hf*n)*(Hf+t),Kf+=i*(Xf+n),ts+=3*i,es(Hf=t,Xf=n)}function ls(t){this._context=t}ls.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,n){switch(this._point){case 0:this._context.moveTo(t,n),this._point=1;break;case 1:this._context.lineTo(t,n);break;default:this._context.moveTo(t+this._radius,n),this._context.arc(t,n,this._radius,0,Ha)}},result:cu};var hs,ds,ps,vs,gs,ys=qa(),_s={point:cu,lineStart:function(){_s.point=bs},lineEnd:function(){hs&&ms(ds,ps),_s.point=cu},polygonStart:function(){hs=!0},polygonEnd:function(){hs=null},result:function(){var t=+ys;return ys.reset(),t}};function bs(t,n){_s.point=ms,ds=vs=t,ps=gs=n}function ms(t,n){vs-=t,gs-=n,ys.add(ru(vs*vs+gs*gs)),vs=t,gs=n}function xs(){this._string=[]}function ws(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Ms(t){return function(n){var e=new Ns;for(var r in t)e[r]=t[r];return e.stream=n,e}}function Ns(){}function As(t,n,e){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),pu(e,t.stream(Ff)),n(Ff.result()),null!=r&&t.clipExtent(r),t}function Ts(t,n,e){return As(t,function(e){var r=n[1][0]-n[0][0],i=n[1][1]-n[0][1],o=Math.min(r/(e[1][0]-e[0][0]),i/(e[1][1]-e[0][1])),a=+n[0][0]+(r-o*(e[1][0]+e[0][0]))/2,u=+n[0][1]+(i-o*(e[1][1]+e[0][1]))/2;t.scale(150*o).translate([a,u])},e)}function Ss(t,n,e){return Ts(t,[[0,0],n],e)}function ks(t,n,e){return As(t,function(e){var r=+n,i=r/(e[1][0]-e[0][0]),o=(r-i*(e[1][0]+e[0][0]))/2,a=-i*e[0][1];t.scale(150*i).translate([o,a])},e)}function Es(t,n,e){return As(t,function(e){var r=+n,i=r/(e[1][1]-e[0][1]),o=-i*e[0][0],a=(r-i*(e[1][1]+e[0][1]))/2;t.scale(150*i).translate([o,a])},e)}xs.prototype={_radius:4.5,_circle:ws(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,n){switch(this._point){case 0:this._string.push("M",t,",",n),this._point=1;break;case 1:this._string.push("L",t,",",n);break;default:null==this._circle&&(this._circle=ws(this._radius)),this._string.push("M",t,",",n,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},Ns.prototype={constructor:Ns,point:function(t,n){this.stream.point(t,n)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Cs=16,Ps=Za(30*Ga);function zs(t,n){return+n?function(t,n){function e(r,i,o,a,u,c,f,s,l,h,d,p,v,g){var y=f-r,_=s-i,b=y*y+_*_;if(b>4*n&&v--){var m=a+h,x=u+d,w=c+p,M=ru(m*m+x*x+w*w),N=au(w/=M),A=Va(Va(w)-1)<Ba||Va(o-l)<Ba?(o+l)/2:Wa(x,m),T=t(A,N),S=T[0],k=T[1],E=S-r,C=k-i,P=_*E-y*C;(P*P/b>n||Va((y*E+_*C)/b-.5)>.3||a*h+u*d+c*p<Ps)&&(e(r,i,o,a,u,c,S,k,A,m/=M,x/=M,w,v,g),g.point(S,k),e(S,k,A,m,x,w,f,s,l,h,d,p,v,g))}}return function(n){var r,i,o,a,u,c,f,s,l,h,d,p,v={point:g,lineStart:y,lineEnd:b,polygonStart:function(){n.polygonStart(),v.lineStart=m},polygonEnd:function(){n.polygonEnd(),v.lineStart=y}};function g(e,r){e=t(e,r),n.point(e[0],e[1])}function y(){s=NaN,v.point=_,n.lineStart()}function _(r,i){var o=ku([r,i]),a=t(r,i);e(s,l,f,h,d,p,s=a[0],l=a[1],f=r,h=o[0],d=o[1],p=o[2],Cs,n),n.point(s,l)}function b(){v.point=g,n.lineEnd()}function m(){y(),v.point=x,v.lineEnd=w}function x(t,n){_(r=t,n),i=s,o=l,a=h,u=d,c=p,v.point=_}function w(){e(s,l,f,h,d,p,i,o,r,a,u,c,Cs,n),v.lineEnd=b,b()}return v}}(t,n):function(t){return Ms({point:function(n,e){n=t(n,e),this.stream.point(n[0],n[1])}})}(t)}var Rs=Ms({point:function(t,n){this.stream.point(t*Ga,n*Ga)}});function Ds(t,n,e,r){var i=Za(r),o=nu(r),a=i*t,u=o*t,c=i/t,f=o/t,s=(o*e-i*n)/t,l=(o*n+i*e)/t;function h(t,r){return[a*t-u*r+n,e-u*t-a*r]}return h.invert=function(t,n){return[c*t-f*n+s,l-f*t-c*n]},h}function qs(t){return Ls(function(){return t})()}function Ls(t){var n,e,r,i,o,a,u,c,f,s,l=150,h=480,d=250,p=0,v=0,g=0,y=0,_=0,b=0,m=null,x=Zc,w=null,M=Af,N=.5;function A(t){return c(t[0]*Ga,t[1]*Ga)}function T(t){return(t=c.invert(t[0],t[1]))&&[t[0]*Xa,t[1]*Xa]}function S(){var t=Ds(l,0,0,b).apply(null,n(p,v)),r=(b?Ds:function(t,n,e){function r(r,i){return[n+t*r,e-t*i]}return r.invert=function(r,i){return[(r-n)/t,(e-i)/t]},r})(l,h-t[0],d-t[1],b);return e=zc(g,y,_),u=Cc(n,r),c=Cc(e,u),a=zs(u,N),k()}function k(){return f=s=null,A}return A.stream=function(t){return f&&s===t?f:f=Rs(function(t){return Ms({point:function(n,e){var r=t(n,e);return this.stream.point(r[0],r[1])}})}(e)(x(a(M(s=t)))))},A.preclip=function(t){return arguments.length?(x=t,m=void 0,k()):x},A.postclip=function(t){return arguments.length?(M=t,w=r=i=o=null,k()):M},A.clipAngle=function(t){return arguments.length?(x=+t?Qc(m=t*Ga):(m=null,Zc),k()):m*Xa},A.clipExtent=function(t){return arguments.length?(M=null==t?(w=r=i=o=null,Af):tf(w=+t[0][0],r=+t[0][1],i=+t[1][0],o=+t[1][1]),k()):null==w?null:[[w,r],[i,o]]},A.scale=function(t){return arguments.length?(l=+t,S()):l},A.translate=function(t){return arguments.length?(h=+t[0],d=+t[1],S()):[h,d]},A.center=function(t){return arguments.length?(p=t[0]%360*Ga,v=t[1]%360*Ga,S()):[p*Xa,v*Xa]},A.rotate=function(t){return arguments.length?(g=t[0]%360*Ga,y=t[1]%360*Ga,_=t.length>2?t[2]%360*Ga:0,S()):[g*Xa,y*Xa,_*Xa]},A.angle=function(t){return arguments.length?(b=t%360*Ga,S()):b*Xa},A.precision=function(t){return arguments.length?(a=zs(u,N=t*t),k()):ru(N)},A.fitExtent=function(t,n){return Ts(A,t,n)},A.fitSize=function(t,n){return Ss(A,t,n)},A.fitWidth=function(t,n){return ks(A,t,n)},A.fitHeight=function(t,n){return Es(A,t,n)},function(){return n=t.apply(this,arguments),A.invert=n.invert&&T,S()}}function Us(t){var n=0,e=Fa/3,r=Ls(t),i=r(n,e);return i.parallels=function(t){return arguments.length?r(n=t[0]*Ga,e=t[1]*Ga):[n*Xa,e*Xa]},i}function Os(t,n){var e=nu(t),r=(e+nu(n))/2;if(Va(r)<Ba)return function(t){var n=Za(t);function e(t,e){return[t*n,nu(e)/n]}return e.invert=function(t,e){return[t/n,au(e*n)]},e}(t);var i=1+e*(2*r-e),o=ru(i)/r;function a(t,n){var e=ru(i-2*r*nu(n))/r;return[e*nu(t*=r),o-e*Za(t)]}return a.invert=function(t,n){var e=o-n;return[Wa(t,Va(e))/r*eu(e),au((i-(t*t+e*e)*r*r)/(2*r))]},a}function Bs(){return Us(Os).scale(155.424).center([0,33.6442])}function Ys(){return Bs().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function Fs(t){return function(n,e){var r=Za(n),i=Za(e),o=t(r*i);return[o*i*nu(n),o*nu(e)]}}function Is(t){return function(n,e){var r=ru(n*n+e*e),i=t(r),o=nu(i),a=Za(i);return[Wa(n*o,r*a),au(r&&e*o/r)]}}var js=Fs(function(t){return ru(2/(1+t))});js.invert=Is(function(t){return 2*au(t/2)});var Hs=Fs(function(t){return(t=ou(t))&&t/nu(t)});function Xs(t,n){return[t,Ka(iu((Ia+n)/2))]}function Gs(t){var n,e,r,i=qs(t),o=i.center,a=i.scale,u=i.translate,c=i.clipExtent,f=null;function s(){var o=Fa*a(),u=i(Lc(i.rotate()).invert([0,0]));return c(null==f?[[u[0]-o,u[1]-o],[u[0]+o,u[1]+o]]:t===Xs?[[Math.max(u[0]-o,f),n],[Math.min(u[0]+o,e),r]]:[[f,Math.max(u[1]-o,n)],[e,Math.min(u[1]+o,r)]])}return i.scale=function(t){return arguments.length?(a(t),s()):a()},i.translate=function(t){return arguments.length?(u(t),s()):u()},i.center=function(t){return arguments.length?(o(t),s()):o()},i.clipExtent=function(t){return arguments.length?(null==t?f=n=e=r=null:(f=+t[0][0],n=+t[0][1],e=+t[1][0],r=+t[1][1]),s()):null==f?null:[[f,n],[e,r]]},s()}function Vs(t){return iu((Ia+t)/2)}function $s(t,n){var e=Za(t),r=t===n?nu(t):Ka(e/Za(n))/Ka(Vs(n)/Vs(t)),i=e*tu(Vs(t),r)/r;if(!r)return Xs;function o(t,n){i>0?n<-Ia+Ba&&(n=-Ia+Ba):n>Ia-Ba&&(n=Ia-Ba);var e=i/tu(Vs(n),r);return[e*nu(r*t),i-e*Za(r*t)]}return o.invert=function(t,n){var e=i-n,o=eu(r)*ru(t*t+e*e);return[Wa(t,Va(e))/r*eu(e),2*$a(tu(i/o,1/r))-Ia]},o}function Ws(t,n){return[t,n]}function Zs(t,n){var e=Za(t),r=t===n?nu(t):(e-Za(n))/(n-t),i=e/r+t;if(Va(r)<Ba)return Ws;function o(t,n){var e=i-n,o=r*t;return[e*nu(o),i-e*Za(o)]}return o.invert=function(t,n){var e=i-n;return[Wa(t,Va(e))/r*eu(e),i-eu(r)*ru(t*t+e*e)]},o}Hs.invert=Is(function(t){return t}),Xs.invert=function(t,n){return[t,2*$a(Ja(n))-Ia]},Ws.invert=Ws;var Qs=1.340264,Js=-.081106,Ks=893e-6,tl=.003796,nl=ru(3)/2;function el(t,n){var e=au(nl*nu(n)),r=e*e,i=r*r*r;return[t*Za(e)/(nl*(Qs+3*Js*r+i*(7*Ks+9*tl*r))),e*(Qs+Js*r+i*(Ks+tl*r))]}function rl(t,n){var e=Za(n),r=Za(t)*e;return[e*nu(t)/r,nu(n)/r]}function il(t,n,e,r){return 1===t&&1===n&&0===e&&0===r?Af:Ms({point:function(i,o){this.stream.point(i*t+e,o*n+r)}})}function ol(t,n){var e=n*n,r=e*e;return[t*(.8707-.131979*e+r*(r*(.003971*e-.001529*r)-.013791)),n*(1.007226+e*(.015085+r*(.028874*e-.044475-.005916*r)))]}function al(t,n){return[Za(n)*nu(t),nu(n)]}function ul(t,n){var e=Za(n),r=1+Za(t)*e;return[e*nu(t)/r,nu(n)/r]}function cl(t,n){return[Ka(iu((Ia+n)/2)),-t]}function fl(t,n){return t.parent===n.parent?1:2}function sl(t,n){return t+n.x}function ll(t,n){return Math.max(t,n.y)}function hl(t){var n=0,e=t.children,r=e&&e.length;if(r)for(;--r>=0;)n+=e[r].value;else n=1;t.value=n}function dl(t,n){var e,r,i,o,a,u=new yl(t),c=+t.value&&(u.value=t.value),f=[u];for(null==n&&(n=pl);e=f.pop();)if(c&&(e.value=+e.data.value),(i=n(e.data))&&(a=i.length))for(e.children=new Array(a),o=a-1;o>=0;--o)f.push(r=e.children[o]=new yl(i[o])),r.parent=e,r.depth=e.depth+1;return u.eachBefore(gl)}function pl(t){return t.children}function vl(t){t.data=t.data.data}function gl(t){var n=0;do{t.height=n}while((t=t.parent)&&t.height<++n)}function yl(t){this.data=t,this.depth=this.height=0,this.parent=null}el.invert=function(t,n){for(var e,r=n,i=r*r,o=i*i*i,a=0;a<12&&(o=(i=(r-=e=(r*(Qs+Js*i+o*(Ks+tl*i))-n)/(Qs+3*Js*i+o*(7*Ks+9*tl*i)))*r)*i*i,!(Va(e)<Ya));++a);return[nl*t*(Qs+3*Js*i+o*(7*Ks+9*tl*i))/Za(r),au(nu(r)/nl)]},rl.invert=Is($a),ol.invert=function(t,n){var e,r=n,i=25;do{var o=r*r,a=o*o;r-=e=(r*(1.007226+o*(.015085+a*(.028874*o-.044475-.005916*a)))-n)/(1.007226+o*(.045255+a*(.259866*o-.311325-.005916*11*a)))}while(Va(e)>Ba&&--i>0);return[t/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]},al.invert=Is(au),ul.invert=Is(function(t){return 2*$a(t)}),cl.invert=function(t,n){return[-n,2*$a(Ja(t))-Ia]},yl.prototype=dl.prototype={constructor:yl,count:function(){return this.eachAfter(hl)},each:function(t){var n,e,r,i,o=this,a=[o];do{for(n=a.reverse(),a=[];o=n.pop();)if(t(o),e=o.children)for(r=0,i=e.length;r<i;++r)a.push(e[r])}while(a.length);return this},eachAfter:function(t){for(var n,e,r,i=this,o=[i],a=[];i=o.pop();)if(a.push(i),n=i.children)for(e=0,r=n.length;e<r;++e)o.push(n[e]);for(;i=a.pop();)t(i);return this},eachBefore:function(t){for(var n,e,r=this,i=[r];r=i.pop();)if(t(r),n=r.children)for(e=n.length-1;e>=0;--e)i.push(n[e]);return this},sum:function(t){return this.eachAfter(function(n){for(var e=+t(n.data)||0,r=n.children,i=r&&r.length;--i>=0;)e+=r[i].value;n.value=e})},sort:function(t){return this.eachBefore(function(n){n.children&&n.children.sort(t)})},path:function(t){for(var n=this,e=function(t,n){if(t===n)return t;var e=t.ancestors(),r=n.ancestors(),i=null;for(t=e.pop(),n=r.pop();t===n;)i=t,t=e.pop(),n=r.pop();return i}(n,t),r=[n];n!==e;)n=n.parent,r.push(n);for(var i=r.length;t!==e;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,n=[t];t=t.parent;)n.push(t);return n},descendants:function(){var t=[];return this.each(function(n){t.push(n)}),t},leaves:function(){var t=[];return this.eachBefore(function(n){n.children||t.push(n)}),t},links:function(){var t=this,n=[];return t.each(function(e){e!==t&&n.push({source:e.parent,target:e})}),n},copy:function(){return dl(this).eachBefore(vl)}};var _l=Array.prototype.slice;function bl(t){for(var n,e,r=0,i=(t=function(t){for(var n,e,r=t.length;r;)e=Math.random()*r--|0,n=t[r],t[r]=t[e],t[e]=n;return t}(_l.call(t))).length,o=[];r<i;)n=t[r],e&&wl(e,n)?++r:(e=Nl(o=ml(o,n)),r=0);return e}function ml(t,n){var e,r;if(Ml(n,t))return[n];for(e=0;e<t.length;++e)if(xl(n,t[e])&&Ml(Al(t[e],n),t))return[t[e],n];for(e=0;e<t.length-1;++e)for(r=e+1;r<t.length;++r)if(xl(Al(t[e],t[r]),n)&&xl(Al(t[e],n),t[r])&&xl(Al(t[r],n),t[e])&&Ml(Tl(t[e],t[r],n),t))return[t[e],t[r],n];throw new Error}function xl(t,n){var e=t.r-n.r,r=n.x-t.x,i=n.y-t.y;return e<0||e*e<r*r+i*i}function wl(t,n){var e=t.r-n.r+1e-6,r=n.x-t.x,i=n.y-t.y;return e>0&&e*e>r*r+i*i}function Ml(t,n){for(var e=0;e<n.length;++e)if(!wl(t,n[e]))return!1;return!0}function Nl(t){switch(t.length){case 1:return{x:(n=t[0]).x,y:n.y,r:n.r};case 2:return Al(t[0],t[1]);case 3:return Tl(t[0],t[1],t[2])}var n}function Al(t,n){var e=t.x,r=t.y,i=t.r,o=n.x,a=n.y,u=n.r,c=o-e,f=a-r,s=u-i,l=Math.sqrt(c*c+f*f);return{x:(e+o+c/l*s)/2,y:(r+a+f/l*s)/2,r:(l+i+u)/2}}function Tl(t,n,e){var r=t.x,i=t.y,o=t.r,a=n.x,u=n.y,c=n.r,f=e.x,s=e.y,l=e.r,h=r-a,d=r-f,p=i-u,v=i-s,g=c-o,y=l-o,_=r*r+i*i-o*o,b=_-a*a-u*u+c*c,m=_-f*f-s*s+l*l,x=d*p-h*v,w=(p*m-v*b)/(2*x)-r,M=(v*g-p*y)/x,N=(d*b-h*m)/(2*x)-i,A=(h*y-d*g)/x,T=M*M+A*A-1,S=2*(o+w*M+N*A),k=w*w+N*N-o*o,E=-(T?(S+Math.sqrt(S*S-4*T*k))/(2*T):k/S);return{x:r+w+M*E,y:i+N+A*E,r:E}}function Sl(t,n,e){var r,i,o,a,u=t.x-n.x,c=t.y-n.y,f=u*u+c*c;f?(i=n.r+e.r,i*=i,a=t.r+e.r,i>(a*=a)?(r=(f+a-i)/(2*f),o=Math.sqrt(Math.max(0,a/f-r*r)),e.x=t.x-r*u-o*c,e.y=t.y-r*c+o*u):(r=(f+i-a)/(2*f),o=Math.sqrt(Math.max(0,i/f-r*r)),e.x=n.x+r*u-o*c,e.y=n.y+r*c+o*u)):(e.x=n.x+e.r,e.y=n.y)}function kl(t,n){var e=t.r+n.r-1e-6,r=n.x-t.x,i=n.y-t.y;return e>0&&e*e>r*r+i*i}function El(t){var n=t._,e=t.next._,r=n.r+e.r,i=(n.x*e.r+e.x*n.r)/r,o=(n.y*e.r+e.y*n.r)/r;return i*i+o*o}function Cl(t){this._=t,this.next=null,this.previous=null}function Pl(t){if(!(i=t.length))return 0;var n,e,r,i,o,a,u,c,f,s,l;if((n=t[0]).x=0,n.y=0,!(i>1))return n.r;if(e=t[1],n.x=-e.r,e.x=n.r,e.y=0,!(i>2))return n.r+e.r;Sl(e,n,r=t[2]),n=new Cl(n),e=new Cl(e),r=new Cl(r),n.next=r.previous=e,e.next=n.previous=r,r.next=e.previous=n;t:for(u=3;u<i;++u){Sl(n._,e._,r=t[u]),r=new Cl(r),c=e.next,f=n.previous,s=e._.r,l=n._.r;do{if(s<=l){if(kl(c._,r._)){e=c,n.next=e,e.previous=n,--u;continue t}s+=c._.r,c=c.next}else{if(kl(f._,r._)){(n=f).next=e,e.previous=n,--u;continue t}l+=f._.r,f=f.previous}}while(c!==f.next);for(r.previous=n,r.next=e,n.next=e.previous=e=r,o=El(n);(r=r.next)!==e;)(a=El(r))<o&&(n=r,o=a);e=n.next}for(n=[e._],r=e;(r=r.next)!==e;)n.push(r._);for(r=bl(n),u=0;u<i;++u)(n=t[u]).x-=r.x,n.y-=r.y;return r.r}function zl(t){if("function"!=typeof t)throw new Error;return t}function Rl(){return 0}function Dl(t){return function(){return t}}function ql(t){return Math.sqrt(t.value)}function Ll(t){return function(n){n.children||(n.r=Math.max(0,+t(n)||0))}}function Ul(t,n){return function(e){if(r=e.children){var r,i,o,a=r.length,u=t(e)*n||0;if(u)for(i=0;i<a;++i)r[i].r+=u;if(o=Pl(r),u)for(i=0;i<a;++i)r[i].r-=u;e.r=o+u}}}function Ol(t){return function(n){var e=n.parent;n.r*=t,e&&(n.x=e.x+t*n.x,n.y=e.y+t*n.y)}}function Bl(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function Yl(t,n,e,r,i){for(var o,a=t.children,u=-1,c=a.length,f=t.value&&(r-n)/t.value;++u<c;)(o=a[u]).y0=e,o.y1=i,o.x0=n,o.x1=n+=o.value*f}var Fl="$",Il={depth:-1},jl={};function Hl(t){return t.id}function Xl(t){return t.parentId}function Gl(t,n){return t.parent===n.parent?1:2}function Vl(t){var n=t.children;return n?n[0]:t.t}function $l(t){var n=t.children;return n?n[n.length-1]:t.t}function Wl(t,n,e){var r=e/(n.i-t.i);n.c-=r,n.s+=e,t.c+=r,n.z+=e,n.m+=e}function Zl(t,n,e){return t.a.parent===n.parent?t.a:e}function Ql(t,n){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=n}function Jl(t,n,e,r,i){for(var o,a=t.children,u=-1,c=a.length,f=t.value&&(i-e)/t.value;++u<c;)(o=a[u]).x0=n,o.x1=r,o.y0=e,o.y1=e+=o.value*f}Ql.prototype=Object.create(yl.prototype);var Kl=(1+Math.sqrt(5))/2;function th(t,n,e,r,i,o){for(var a,u,c,f,s,l,h,d,p,v,g,y=[],_=n.children,b=0,m=0,x=_.length,w=n.value;b<x;){c=i-e,f=o-r;do{s=_[m++].value}while(!s&&m<x);for(l=h=s,g=s*s*(v=Math.max(f/c,c/f)/(w*t)),p=Math.max(h/g,g/l);m<x;++m){if(s+=u=_[m].value,u<l&&(l=u),u>h&&(h=u),g=s*s*v,(d=Math.max(h/g,g/l))>p){s-=u;break}p=d}y.push(a={value:s,dice:c<f,children:_.slice(b,m)}),a.dice?Yl(a,e,r,i,w?r+=f*s/w:o):Jl(a,e,r,w?e+=c*s/w:i,o),w-=s,b=m}return y}var nh=function t(n){function e(t,e,r,i,o){th(n,t,e,r,i,o)}return e.ratio=function(n){return t((n=+n)>1?n:1)},e}(Kl);var eh=function t(n){function e(t,e,r,i,o){if((a=t._squarify)&&a.ratio===n)for(var a,u,c,f,s,l=-1,h=a.length,d=t.value;++l<h;){for(c=(u=a[l]).children,f=u.value=0,s=c.length;f<s;++f)u.value+=c[f].value;u.dice?Yl(u,e,r,i,r+=(o-r)*u.value/d):Jl(u,e,r,e+=(i-e)*u.value/d,o),d-=u.value}else t._squarify=a=th(n,t,e,r,i,o),a.ratio=n}return e.ratio=function(n){return t((n=+n)>1?n:1)},e}(Kl);function rh(t,n){return t[0]-n[0]||t[1]-n[1]}function ih(t){for(var n,e,r,i=t.length,o=[0,1],a=2,u=2;u<i;++u){for(;a>1&&(n=t[o[a-2]],e=t[o[a-1]],r=t[u],(e[0]-n[0])*(r[1]-n[1])-(e[1]-n[1])*(r[0]-n[0])<=0);)--a;o[a++]=u}return o.slice(0,a)}function oh(){return Math.random()}var ah=function t(n){function e(t,e){return t=null==t?0:+t,e=null==e?1:+e,1===arguments.length?(e=t,t=0):e-=t,function(){return n()*e+t}}return e.source=t,e}(oh),uh=function t(n){function e(t,e){var r,i;return t=null==t?0:+t,e=null==e?1:+e,function(){var o;if(null!=r)o=r,r=null;else do{r=2*n()-1,o=2*n()-1,i=r*r+o*o}while(!i||i>1);return t+e*o*Math.sqrt(-2*Math.log(i)/i)}}return e.source=t,e}(oh),ch=function t(n){function e(){var t=uh.source(n).apply(this,arguments);return function(){return Math.exp(t())}}return e.source=t,e}(oh),fh=function t(n){function e(t){return function(){for(var e=0,r=0;r<t;++r)e+=n();return e}}return e.source=t,e}(oh),sh=function t(n){function e(t){var e=fh.source(n)(t);return function(){return e()/t}}return e.source=t,e}(oh),lh=function t(n){function e(t){return function(){return-Math.log(1-n())/t}}return e.source=t,e}(oh);function hh(t,n){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(n).domain(t)}return this}function dh(t,n){switch(arguments.length){case 0:break;case 1:this.interpolator(t);break;default:this.interpolator(n).domain(t)}return this}var ph=Array.prototype,vh=ph.map,gh=ph.slice,yh={name:"implicit"};function _h(){var t=Ji(),n=[],e=[],r=yh;function i(i){var o=i+"",a=t.get(o);if(!a){if(r!==yh)return r;t.set(o,a=n.push(i))}return e[(a-1)%e.length]}return i.domain=function(e){if(!arguments.length)return n.slice();n=[],t=Ji();for(var r,o,a=-1,u=e.length;++a<u;)t.has(o=(r=e[a])+"")||t.set(o,n.push(r));return i},i.range=function(t){return arguments.length?(e=gh.call(t),i):e.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return _h(n,e).unknown(r)},hh.apply(i,arguments),i}function bh(){var t,n,e=_h().unknown(void 0),r=e.domain,i=e.range,o=[0,1],a=!1,u=0,c=0,f=.5;function s(){var e=r().length,s=o[1]<o[0],l=o[s-0],h=o[1-s];t=(h-l)/Math.max(1,e-u+2*c),a&&(t=Math.floor(t)),l+=(h-l-t*(e-u))*f,n=t*(1-u),a&&(l=Math.round(l),n=Math.round(n));var d=g(e).map(function(n){return l+t*n});return i(s?d.reverse():d)}return delete e.unknown,e.domain=function(t){return arguments.length?(r(t),s()):r()},e.range=function(t){return arguments.length?(o=[+t[0],+t[1]],s()):o.slice()},e.rangeRound=function(t){return o=[+t[0],+t[1]],a=!0,s()},e.bandwidth=function(){return n},e.step=function(){return t},e.round=function(t){return arguments.length?(a=!!t,s()):a},e.padding=function(t){return arguments.length?(u=Math.min(1,c=+t),s()):u},e.paddingInner=function(t){return arguments.length?(u=Math.min(1,t),s()):u},e.paddingOuter=function(t){return arguments.length?(c=+t,s()):c},e.align=function(t){return arguments.length?(f=Math.max(0,Math.min(1,t)),s()):f},e.copy=function(){return bh(r(),o).round(a).paddingInner(u).paddingOuter(c).align(f)},hh.apply(s(),arguments)}function mh(t){return+t}var xh=[0,1];function wh(t){return t}function Mh(t,n){return(n-=t=+t)?function(e){return(e-t)/n}:(e=isNaN(n)?NaN:.5,function(){return e});var e}function Nh(t){var n,e=t[0],r=t[t.length-1];return e>r&&(n=e,e=r,r=n),function(t){return Math.max(e,Math.min(r,t))}}function Ah(t,n,e){var r=t[0],i=t[1],o=n[0],a=n[1];return i<r?(r=Mh(i,r),o=e(a,o)):(r=Mh(r,i),o=e(o,a)),function(t){return o(r(t))}}function Th(t,n,e){var r=Math.min(t.length,n.length)-1,o=new Array(r),a=new Array(r),u=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),n=n.slice().reverse());++u<r;)o[u]=Mh(t[u],t[u+1]),a[u]=e(n[u],n[u+1]);return function(n){var e=i(t,n,1,r)-1;return a[e](o[e](n))}}function Sh(t,n){return n.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function kh(){var t,n,e,r,i,o,a=xh,u=xh,c=_e,f=wh;function s(){return r=Math.min(a.length,u.length)>2?Th:Ah,i=o=null,l}function l(n){return isNaN(n=+n)?e:(i||(i=r(a.map(t),u,c)))(t(f(n)))}return l.invert=function(e){return f(n((o||(o=r(u,a.map(t),de)))(e)))},l.domain=function(t){return arguments.length?(a=vh.call(t,mh),f===wh||(f=Nh(a)),s()):a.slice()},l.range=function(t){return arguments.length?(u=gh.call(t),s()):u.slice()},l.rangeRound=function(t){return u=gh.call(t),c=be,s()},l.clamp=function(t){return arguments.length?(f=t?Nh(a):wh,l):f!==wh},l.interpolate=function(t){return arguments.length?(c=t,s()):c},l.unknown=function(t){return arguments.length?(e=t,l):e},function(e,r){return t=e,n=r,s()}}function Eh(t,n){return kh()(t,n)}function Ch(n,e,r,i){var o,a=w(n,e,r);switch((i=Ma(null==i?",f":i)).type){case"s":var u=Math.max(Math.abs(n),Math.abs(e));return null!=i.precision||isNaN(o=Ra(a,u))||(i.precision=o),t.formatPrefix(i,u);case"":case"e":case"g":case"p":case"r":null!=i.precision||isNaN(o=Da(a,Math.max(Math.abs(n),Math.abs(e))))||(i.precision=o-("e"===i.type));break;case"f":case"%":null!=i.precision||isNaN(o=za(a))||(i.precision=o-2*("%"===i.type))}return t.format(i)}function Ph(t){var n=t.domain;return t.ticks=function(t){var e=n();return m(e[0],e[e.length-1],null==t?10:t)},t.tickFormat=function(t,e){var r=n();return Ch(r[0],r[r.length-1],null==t?10:t,e)},t.nice=function(e){null==e&&(e=10);var r,i=n(),o=0,a=i.length-1,u=i[o],c=i[a];return c<u&&(r=u,u=c,c=r,r=o,o=a,a=r),(r=x(u,c,e))>0?r=x(u=Math.floor(u/r)*r,c=Math.ceil(c/r)*r,e):r<0&&(r=x(u=Math.ceil(u*r)/r,c=Math.floor(c*r)/r,e)),r>0?(i[o]=Math.floor(u/r)*r,i[a]=Math.ceil(c/r)*r,n(i)):r<0&&(i[o]=Math.ceil(u*r)/r,i[a]=Math.floor(c*r)/r,n(i)),t},t}function zh(t,n){var e,r=0,i=(t=t.slice()).length-1,o=t[r],a=t[i];return a<o&&(e=r,r=i,i=e,e=o,o=a,a=e),t[r]=n.floor(o),t[i]=n.ceil(a),t}function Rh(t){return Math.log(t)}function Dh(t){return Math.exp(t)}function qh(t){return-Math.log(-t)}function Lh(t){return-Math.exp(-t)}function Uh(t){return isFinite(t)?+("1e"+t):t<0?0:t}function Oh(t){return function(n){return-t(-n)}}function Bh(n){var e,r,i=n(Rh,Dh),o=i.domain,a=10;function u(){return e=function(t){return t===Math.E?Math.log:10===t&&Math.log10||2===t&&Math.log2||(t=Math.log(t),function(n){return Math.log(n)/t})}(a),r=function(t){return 10===t?Uh:t===Math.E?Math.exp:function(n){return Math.pow(t,n)}}(a),o()[0]<0?(e=Oh(e),r=Oh(r),n(qh,Lh)):n(Rh,Dh),i}return i.base=function(t){return arguments.length?(a=+t,u()):a},i.domain=function(t){return arguments.length?(o(t),u()):o()},i.ticks=function(t){var n,i=o(),u=i[0],c=i[i.length-1];(n=c<u)&&(h=u,u=c,c=h);var f,s,l,h=e(u),d=e(c),p=null==t?10:+t,v=[];if(!(a%1)&&d-h<p){if(h=Math.round(h)-1,d=Math.round(d)+1,u>0){for(;h<d;++h)for(s=1,f=r(h);s<a;++s)if(!((l=f*s)<u)){if(l>c)break;v.push(l)}}else for(;h<d;++h)for(s=a-1,f=r(h);s>=1;--s)if(!((l=f*s)<u)){if(l>c)break;v.push(l)}}else v=m(h,d,Math.min(d-h,p)).map(r);return n?v.reverse():v},i.tickFormat=function(n,o){if(null==o&&(o=10===a?".0e":","),"function"!=typeof o&&(o=t.format(o)),n===1/0)return o;null==n&&(n=10);var u=Math.max(1,a*n/i.ticks().length);return function(t){var n=t/r(Math.round(e(t)));return n*a<a-.5&&(n*=a),n<=u?o(t):""}},i.nice=function(){return o(zh(o(),{floor:function(t){return r(Math.floor(e(t)))},ceil:function(t){return r(Math.ceil(e(t)))}}))},i}function Yh(t){return function(n){return Math.sign(n)*Math.log1p(Math.abs(n/t))}}function Fh(t){return function(n){return Math.sign(n)*Math.expm1(Math.abs(n))*t}}function Ih(t){var n=1,e=t(Yh(n),Fh(n));return e.constant=function(e){return arguments.length?t(Yh(n=+e),Fh(n)):n},Ph(e)}function jh(t){return function(n){return n<0?-Math.pow(-n,t):Math.pow(n,t)}}function Hh(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function Xh(t){return t<0?-t*t:t*t}function Gh(t){var n=t(wh,wh),e=1;return n.exponent=function(n){return arguments.length?1===(e=+n)?t(wh,wh):.5===e?t(Hh,Xh):t(jh(e),jh(1/e)):e},Ph(n)}function Vh(){var t=Gh(kh());return t.copy=function(){return Sh(t,Vh()).exponent(t.exponent())},hh.apply(t,arguments),t}var $h=new Date,Wh=new Date;function Zh(t,n,e,r){function i(n){return t(n=new Date(+n)),n}return i.floor=i,i.ceil=function(e){return t(e=new Date(e-1)),n(e,1),t(e),e},i.round=function(t){var n=i(t),e=i.ceil(t);return t-n<e-t?n:e},i.offset=function(t,e){return n(t=new Date(+t),null==e?1:Math.floor(e)),t},i.range=function(e,r,o){var a,u=[];if(e=i.ceil(e),o=null==o?1:Math.floor(o),!(e<r&&o>0))return u;do{u.push(a=new Date(+e)),n(e,o),t(e)}while(a<e&&e<r);return u},i.filter=function(e){return Zh(function(n){if(n>=n)for(;t(n),!e(n);)n.setTime(n-1)},function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;n(t,-1),!e(t););else for(;--r>=0;)for(;n(t,1),!e(t););})},e&&(i.count=function(n,r){return $h.setTime(+n),Wh.setTime(+r),t($h),t(Wh),Math.floor(e($h,Wh))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(n){return r(n)%t==0}:function(n){return i.count(0,n)%t==0}):i:null}),i}var Qh=Zh(function(){},function(t,n){t.setTime(+t+n)},function(t,n){return n-t});Qh.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?Zh(function(n){n.setTime(Math.floor(n/t)*t)},function(n,e){n.setTime(+n+e*t)},function(n,e){return(e-n)/t}):Qh:null};var Jh=Qh.range,Kh=6e4,td=6048e5,nd=Zh(function(t){t.setTime(t-t.getMilliseconds())},function(t,n){t.setTime(+t+1e3*n)},function(t,n){return(n-t)/1e3},function(t){return t.getUTCSeconds()}),ed=nd.range,rd=Zh(function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())},function(t,n){t.setTime(+t+n*Kh)},function(t,n){return(n-t)/Kh},function(t){return t.getMinutes()}),id=rd.range,od=Zh(function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-t.getMinutes()*Kh)},function(t,n){t.setTime(+t+36e5*n)},function(t,n){return(n-t)/36e5},function(t){return t.getHours()}),ad=od.range,ud=Zh(function(t){t.setHours(0,0,0,0)},function(t,n){t.setDate(t.getDate()+n)},function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Kh)/864e5},function(t){return t.getDate()-1}),cd=ud.range;function fd(t){return Zh(function(n){n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)},function(t,n){t.setDate(t.getDate()+7*n)},function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Kh)/td})}var sd=fd(0),ld=fd(1),hd=fd(2),dd=fd(3),pd=fd(4),vd=fd(5),gd=fd(6),yd=sd.range,_d=ld.range,bd=hd.range,md=dd.range,xd=pd.range,wd=vd.range,Md=gd.range,Nd=Zh(function(t){t.setDate(1),t.setHours(0,0,0,0)},function(t,n){t.setMonth(t.getMonth()+n)},function(t,n){return n.getMonth()-t.getMonth()+12*(n.getFullYear()-t.getFullYear())},function(t){return t.getMonth()}),Ad=Nd.range,Td=Zh(function(t){t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,n){t.setFullYear(t.getFullYear()+n)},function(t,n){return n.getFullYear()-t.getFullYear()},function(t){return t.getFullYear()});Td.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Zh(function(n){n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)},function(n,e){n.setFullYear(n.getFullYear()+e*t)}):null};var Sd=Td.range,kd=Zh(function(t){t.setUTCSeconds(0,0)},function(t,n){t.setTime(+t+n*Kh)},function(t,n){return(n-t)/Kh},function(t){return t.getUTCMinutes()}),Ed=kd.range,Cd=Zh(function(t){t.setUTCMinutes(0,0,0)},function(t,n){t.setTime(+t+36e5*n)},function(t,n){return(n-t)/36e5},function(t){return t.getUTCHours()}),Pd=Cd.range,zd=Zh(function(t){t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCDate(t.getUTCDate()+n)},function(t,n){return(n-t)/864e5},function(t){return t.getUTCDate()-1}),Rd=zd.range;function Dd(t){return Zh(function(n){n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)},function(t,n){t.setUTCDate(t.getUTCDate()+7*n)},function(t,n){return(n-t)/td})}var qd=Dd(0),Ld=Dd(1),Ud=Dd(2),Od=Dd(3),Bd=Dd(4),Yd=Dd(5),Fd=Dd(6),Id=qd.range,jd=Ld.range,Hd=Ud.range,Xd=Od.range,Gd=Bd.range,Vd=Yd.range,$d=Fd.range,Wd=Zh(function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCMonth(t.getUTCMonth()+n)},function(t,n){return n.getUTCMonth()-t.getUTCMonth()+12*(n.getUTCFullYear()-t.getUTCFullYear())},function(t){return t.getUTCMonth()}),Zd=Wd.range,Qd=Zh(function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n)},function(t,n){return n.getUTCFullYear()-t.getUTCFullYear()},function(t){return t.getUTCFullYear()});Qd.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Zh(function(n){n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)},function(n,e){n.setUTCFullYear(n.getUTCFullYear()+e*t)}):null};var Jd=Qd.range;function Kd(t){if(0<=t.y&&t.y<100){var n=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return n.setFullYear(t.y),n}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function tp(t){if(0<=t.y&&t.y<100){var n=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return n.setUTCFullYear(t.y),n}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function np(t){return{y:t,m:0,d:1,H:0,M:0,S:0,L:0}}function ep(t){var n=t.dateTime,e=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,u=t.months,c=t.shortMonths,f=sp(i),s=lp(i),l=sp(o),h=lp(o),d=sp(a),p=lp(a),v=sp(u),g=lp(u),y=sp(c),_=lp(c),b={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return c[t.getMonth()]},B:function(t){return u[t.getMonth()]},c:null,d:Pp,e:Pp,f:Lp,H:zp,I:Rp,j:Dp,L:qp,m:Up,M:Op,p:function(t){return i[+(t.getHours()>=12)]},Q:hv,s:dv,S:Bp,u:Yp,U:Fp,V:Ip,w:jp,W:Hp,x:null,X:null,y:Xp,Y:Gp,Z:Vp,"%":lv},m={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return c[t.getUTCMonth()]},B:function(t){return u[t.getUTCMonth()]},c:null,d:$p,e:$p,f:Kp,H:Wp,I:Zp,j:Qp,L:Jp,m:tv,M:nv,p:function(t){return i[+(t.getUTCHours()>=12)]},Q:hv,s:dv,S:ev,u:rv,U:iv,V:ov,w:av,W:uv,x:null,X:null,y:cv,Y:fv,Z:sv,"%":lv},x={a:function(t,n,e){var r=d.exec(n.slice(e));return r?(t.w=p[r[0].toLowerCase()],e+r[0].length):-1},A:function(t,n,e){var r=l.exec(n.slice(e));return r?(t.w=h[r[0].toLowerCase()],e+r[0].length):-1},b:function(t,n,e){var r=y.exec(n.slice(e));return r?(t.m=_[r[0].toLowerCase()],e+r[0].length):-1},B:function(t,n,e){var r=v.exec(n.slice(e));return r?(t.m=g[r[0].toLowerCase()],e+r[0].length):-1},c:function(t,e,r){return N(t,n,e,r)},d:xp,e:xp,f:Sp,H:Mp,I:Mp,j:wp,L:Tp,m:mp,M:Np,p:function(t,n,e){var r=f.exec(n.slice(e));return r?(t.p=s[r[0].toLowerCase()],e+r[0].length):-1},Q:Ep,s:Cp,S:Ap,u:dp,U:pp,V:vp,w:hp,W:gp,x:function(t,n,r){return N(t,e,n,r)},X:function(t,n,e){return N(t,r,n,e)},y:_p,Y:yp,Z:bp,"%":kp};function w(t,n){return function(e){var r,i,o,a=[],u=-1,c=0,f=t.length;for(e instanceof Date||(e=new Date(+e));++u<f;)37===t.charCodeAt(u)&&(a.push(t.slice(c,u)),null!=(i=ip[r=t.charAt(++u)])?r=t.charAt(++u):i="e"===r?" ":"0",(o=n[r])&&(r=o(e,i)),a.push(r),c=u+1);return a.push(t.slice(c,u)),a.join("")}}function M(t,n){return function(e){var r,i,o=np(1900);if(N(o,t,e+="",0)!=e.length)return null;if("Q"in o)return new Date(o.Q);if("p"in o&&(o.H=o.H%12+12*o.p),"V"in o){if(o.V<1||o.V>53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=tp(np(o.y))).getUTCDay(),r=i>4||0===i?Ld.ceil(r):Ld(r),r=zd.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=n(np(o.y))).getDay(),r=i>4||0===i?ld.ceil(r):ld(r),r=ud.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),i="Z"in o?tp(np(o.y)).getUTCDay():n(np(o.y)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,tp(o)):n(o)}}function N(t,n,e,r){for(var i,o,a=0,u=n.length,c=e.length;a<u;){if(r>=c)return-1;if(37===(i=n.charCodeAt(a++))){if(i=n.charAt(a++),!(o=x[i in ip?n.charAt(a++):i])||(r=o(t,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}return b.x=w(e,b),b.X=w(r,b),b.c=w(n,b),m.x=w(e,m),m.X=w(r,m),m.c=w(n,m),{format:function(t){var n=w(t+="",b);return n.toString=function(){return t},n},parse:function(t){var n=M(t+="",Kd);return n.toString=function(){return t},n},utcFormat:function(t){var n=w(t+="",m);return n.toString=function(){return t},n},utcParse:function(t){var n=M(t,tp);return n.toString=function(){return t},n}}}var rp,ip={"-":"",_:" ",0:"0"},op=/^\s*\d+/,ap=/^%/,up=/[\\^$*+?|[\]().{}]/g;function cp(t,n,e){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o<e?new Array(e-o+1).join(n)+i:i)}function fp(t){return t.replace(up,"\\$&")}function sp(t){return new RegExp("^(?:"+t.map(fp).join("|")+")","i")}function lp(t){for(var n={},e=-1,r=t.length;++e<r;)n[t[e].toLowerCase()]=e;return n}function hp(t,n,e){var r=op.exec(n.slice(e,e+1));return r?(t.w=+r[0],e+r[0].length):-1}function dp(t,n,e){var r=op.exec(n.slice(e,e+1));return r?(t.u=+r[0],e+r[0].length):-1}function pp(t,n,e){var r=op.exec(n.slice(e,e+2));return r?(t.U=+r[0],e+r[0].length):-1}function vp(t,n,e){var r=op.exec(n.slice(e,e+2));return r?(t.V=+r[0],e+r[0].length):-1}function gp(t,n,e){var r=op.exec(n.slice(e,e+2));return r?(t.W=+r[0],e+r[0].length):-1}function yp(t,n,e){var r=op.exec(n.slice(e,e+4));return r?(t.y=+r[0],e+r[0].length):-1}function _p(t,n,e){var r=op.exec(n.slice(e,e+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),e+r[0].length):-1}function bp(t,n,e){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(e,e+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),e+r[0].length):-1}function mp(t,n,e){var r=op.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function xp(t,n,e){var r=op.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function wp(t,n,e){var r=op.exec(n.slice(e,e+3));return r?(t.m=0,t.d=+r[0],e+r[0].length):-1}function Mp(t,n,e){var r=op.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function Np(t,n,e){var r=op.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function Ap(t,n,e){var r=op.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function Tp(t,n,e){var r=op.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function Sp(t,n,e){var r=op.exec(n.slice(e,e+6));return r?(t.L=Math.floor(r[0]/1e3),e+r[0].length):-1}function kp(t,n,e){var r=ap.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function Ep(t,n,e){var r=op.exec(n.slice(e));return r?(t.Q=+r[0],e+r[0].length):-1}function Cp(t,n,e){var r=op.exec(n.slice(e));return r?(t.Q=1e3*+r[0],e+r[0].length):-1}function Pp(t,n){return cp(t.getDate(),n,2)}function zp(t,n){return cp(t.getHours(),n,2)}function Rp(t,n){return cp(t.getHours()%12||12,n,2)}function Dp(t,n){return cp(1+ud.count(Td(t),t),n,3)}function qp(t,n){return cp(t.getMilliseconds(),n,3)}function Lp(t,n){return qp(t,n)+"000"}function Up(t,n){return cp(t.getMonth()+1,n,2)}function Op(t,n){return cp(t.getMinutes(),n,2)}function Bp(t,n){return cp(t.getSeconds(),n,2)}function Yp(t){var n=t.getDay();return 0===n?7:n}function Fp(t,n){return cp(sd.count(Td(t),t),n,2)}function Ip(t,n){var e=t.getDay();return t=e>=4||0===e?pd(t):pd.ceil(t),cp(pd.count(Td(t),t)+(4===Td(t).getDay()),n,2)}function jp(t){return t.getDay()}function Hp(t,n){return cp(ld.count(Td(t),t),n,2)}function Xp(t,n){return cp(t.getFullYear()%100,n,2)}function Gp(t,n){return cp(t.getFullYear()%1e4,n,4)}function Vp(t){var n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+cp(n/60|0,"0",2)+cp(n%60,"0",2)}function $p(t,n){return cp(t.getUTCDate(),n,2)}function Wp(t,n){return cp(t.getUTCHours(),n,2)}function Zp(t,n){return cp(t.getUTCHours()%12||12,n,2)}function Qp(t,n){return cp(1+zd.count(Qd(t),t),n,3)}function Jp(t,n){return cp(t.getUTCMilliseconds(),n,3)}function Kp(t,n){return Jp(t,n)+"000"}function tv(t,n){return cp(t.getUTCMonth()+1,n,2)}function nv(t,n){return cp(t.getUTCMinutes(),n,2)}function ev(t,n){return cp(t.getUTCSeconds(),n,2)}function rv(t){var n=t.getUTCDay();return 0===n?7:n}function iv(t,n){return cp(qd.count(Qd(t),t),n,2)}function ov(t,n){var e=t.getUTCDay();return t=e>=4||0===e?Bd(t):Bd.ceil(t),cp(Bd.count(Qd(t),t)+(4===Qd(t).getUTCDay()),n,2)}function av(t){return t.getUTCDay()}function uv(t,n){return cp(Ld.count(Qd(t),t),n,2)}function cv(t,n){return cp(t.getUTCFullYear()%100,n,2)}function fv(t,n){return cp(t.getUTCFullYear()%1e4,n,4)}function sv(){return"+0000"}function lv(){return"%"}function hv(t){return+t}function dv(t){return Math.floor(+t/1e3)}function pv(n){return rp=ep(n),t.timeFormat=rp.format,t.timeParse=rp.parse,t.utcFormat=rp.utcFormat,t.utcParse=rp.utcParse,rp}pv({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var vv=Date.prototype.toISOString?function(t){return t.toISOString()}:t.utcFormat("%Y-%m-%dT%H:%M:%S.%LZ");var gv=+new Date("2000-01-01T00:00:00.000Z")?function(t){var n=new Date(t);return isNaN(n)?null:n}:t.utcParse("%Y-%m-%dT%H:%M:%S.%LZ"),yv=1e3,_v=60*yv,bv=60*_v,mv=24*bv,xv=7*mv,wv=30*mv,Mv=365*mv;function Nv(t){return new Date(t)}function Av(t){return t instanceof Date?+t:+new Date(+t)}function Tv(t,n,r,i,o,a,u,c,f){var s=Eh(wh,wh),l=s.invert,h=s.domain,d=f(".%L"),p=f(":%S"),v=f("%I:%M"),g=f("%I %p"),y=f("%a %d"),_=f("%b %d"),b=f("%B"),m=f("%Y"),x=[[u,1,yv],[u,5,5*yv],[u,15,15*yv],[u,30,30*yv],[a,1,_v],[a,5,5*_v],[a,15,15*_v],[a,30,30*_v],[o,1,bv],[o,3,3*bv],[o,6,6*bv],[o,12,12*bv],[i,1,mv],[i,2,2*mv],[r,1,xv],[n,1,wv],[n,3,3*wv],[t,1,Mv]];function M(e){return(u(e)<e?d:a(e)<e?p:o(e)<e?v:i(e)<e?g:n(e)<e?r(e)<e?y:_:t(e)<e?b:m)(e)}function N(n,r,i,o){if(null==n&&(n=10),"number"==typeof n){var a=Math.abs(i-r)/n,u=e(function(t){return t[2]}).right(x,a);u===x.length?(o=w(r/Mv,i/Mv,n),n=t):u?(o=(u=x[a/x[u-1][2]<x[u][2]/a?u-1:u])[1],n=u[0]):(o=Math.max(w(r,i,n),1),n=c)}return null==o?n:n.every(o)}return s.invert=function(t){return new Date(l(t))},s.domain=function(t){return arguments.length?h(vh.call(t,Av)):h().map(Nv)},s.ticks=function(t,n){var e,r=h(),i=r[0],o=r[r.length-1],a=o<i;return a&&(e=i,i=o,o=e),e=(e=N(t,i,o,n))?e.range(i,o+1):[],a?e.reverse():e},s.tickFormat=function(t,n){return null==n?M:f(n)},s.nice=function(t,n){var e=h();return(t=N(t,e[0],e[e.length-1],n))?h(zh(e,t)):s},s.copy=function(){return Sh(s,Tv(t,n,r,i,o,a,u,c,f))},s}function Sv(){var t,n,e,r,i,o=0,a=1,u=wh,c=!1;function f(n){return isNaN(n=+n)?i:u(0===e?.5:(n=(r(n)-t)*e,c?Math.max(0,Math.min(1,n)):n))}return f.domain=function(i){return arguments.length?(t=r(o=+i[0]),n=r(a=+i[1]),e=t===n?0:1/(n-t),f):[o,a]},f.clamp=function(t){return arguments.length?(c=!!t,f):c},f.interpolator=function(t){return arguments.length?(u=t,f):u},f.unknown=function(t){return arguments.length?(i=t,f):i},function(i){return r=i,t=i(o),n=i(a),e=t===n?0:1/(n-t),f}}function kv(t,n){return n.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function Ev(){var t=Gh(Sv());return t.copy=function(){return kv(t,Ev()).exponent(t.exponent())},dh.apply(t,arguments)}function Cv(){var t,n,e,r,i,o,a,u=0,c=.5,f=1,s=wh,l=!1;function h(t){return isNaN(t=+t)?a:(t=.5+((t=+o(t))-n)*(t<n?r:i),s(l?Math.max(0,Math.min(1,t)):t))}return h.domain=function(a){return arguments.length?(t=o(u=+a[0]),n=o(c=+a[1]),e=o(f=+a[2]),r=t===n?0:.5/(n-t),i=n===e?0:.5/(e-n),h):[u,c,f]},h.clamp=function(t){return arguments.length?(l=!!t,h):l},h.interpolator=function(t){return arguments.length?(s=t,h):s},h.unknown=function(t){return arguments.length?(a=t,h):a},function(a){return o=a,t=a(u),n=a(c),e=a(f),r=t===n?0:.5/(n-t),i=n===e?0:.5/(e-n),h}}function Pv(){var t=Gh(Cv());return t.copy=function(){return kv(t,Pv()).exponent(t.exponent())},dh.apply(t,arguments)}function zv(t){for(var n=t.length/6|0,e=new Array(n),r=0;r<n;)e[r]="#"+t.slice(6*r,6*++r);return e}var Rv=zv("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),Dv=zv("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),qv=zv("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),Lv=zv("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),Uv=zv("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),Ov=zv("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"),Bv=zv("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"),Yv=zv("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"),Fv=zv("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");function Iv(t){return fe(t[t.length-1])}var jv=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(zv),Hv=Iv(jv),Xv=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(zv),Gv=Iv(Xv),Vv=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(zv),$v=Iv(Vv),Wv=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(zv),Zv=Iv(Wv),Qv=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(zv),Jv=Iv(Qv),Kv=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(zv),tg=Iv(Kv),ng=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(zv),eg=Iv(ng),rg=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(zv),ig=Iv(rg),og=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(zv),ag=Iv(og),ug=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(zv),cg=Iv(ug),fg=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(zv),sg=Iv(fg),lg=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(zv),hg=Iv(lg),dg=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(zv),pg=Iv(dg),vg=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(zv),gg=Iv(vg),yg=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(zv),_g=Iv(yg),bg=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(zv),mg=Iv(bg),xg=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(zv),wg=Iv(xg),Mg=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(zv),Ng=Iv(Mg),Ag=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(zv),Tg=Iv(Ag),Sg=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(zv),kg=Iv(Sg),Eg=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(zv),Cg=Iv(Eg),Pg=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(zv),zg=Iv(Pg),Rg=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(zv),Dg=Iv(Rg),qg=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(zv),Lg=Iv(qg),Ug=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(zv),Og=Iv(Ug),Bg=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(zv),Yg=Iv(Bg),Fg=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(zv),Ig=Iv(Fg),jg=He(Qn(300,.5,0),Qn(-240,.5,1)),Hg=He(Qn(-100,.75,.35),Qn(80,1.5,.8)),Xg=He(Qn(260,.75,.35),Qn(80,1.5,.8)),Gg=Qn();var Vg=gn(),$g=Math.PI/3,Wg=2*Math.PI/3;function Zg(t){var n=t.length;return function(e){return t[Math.max(0,Math.min(n-1,Math.floor(e*n)))]}}var Qg=Zg(zv("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),Jg=Zg(zv("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),Kg=Zg(zv("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),ty=Zg(zv("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function ny(t){return function(){return t}}var ey=Math.abs,ry=Math.atan2,iy=Math.cos,oy=Math.max,ay=Math.min,uy=Math.sin,cy=Math.sqrt,fy=1e-12,sy=Math.PI,ly=sy/2,hy=2*sy;function dy(t){return t>=1?ly:t<=-1?-ly:Math.asin(t)}function py(t){return t.innerRadius}function vy(t){return t.outerRadius}function gy(t){return t.startAngle}function yy(t){return t.endAngle}function _y(t){return t&&t.padAngle}function by(t,n,e,r,i,o,a){var u=t-e,c=n-r,f=(a?o:-o)/cy(u*u+c*c),s=f*c,l=-f*u,h=t+s,d=n+l,p=e+s,v=r+l,g=(h+p)/2,y=(d+v)/2,_=p-h,b=v-d,m=_*_+b*b,x=i-o,w=h*v-p*d,M=(b<0?-1:1)*cy(oy(0,x*x*m-w*w)),N=(w*b-_*M)/m,A=(-w*_-b*M)/m,T=(w*b+_*M)/m,S=(-w*_+b*M)/m,k=N-g,E=A-y,C=T-g,P=S-y;return k*k+E*E>C*C+P*P&&(N=T,A=S),{cx:N,cy:A,x01:-s,y01:-l,x11:N*(i/x-1),y11:A*(i/x-1)}}function my(t){this._context=t}function xy(t){return new my(t)}function wy(t){return t[0]}function My(t){return t[1]}function Ny(){var t=wy,n=My,e=ny(!0),r=null,i=xy,o=null;function a(a){var u,c,f,s=a.length,l=!1;for(null==r&&(o=i(f=Xi())),u=0;u<=s;++u)!(u<s&&e(c=a[u],u,a))===l&&((l=!l)?o.lineStart():o.lineEnd()),l&&o.point(+t(c,u,a),+n(c,u,a));if(f)return o=null,f+""||null}return a.x=function(n){return arguments.length?(t="function"==typeof n?n:ny(+n),a):t},a.y=function(t){return arguments.length?(n="function"==typeof t?t:ny(+t),a):n},a.defined=function(t){return arguments.length?(e="function"==typeof t?t:ny(!!t),a):e},a.curve=function(t){return arguments.length?(i=t,null!=r&&(o=i(r)),a):i},a.context=function(t){return arguments.length?(null==t?r=o=null:o=i(r=t),a):r},a}function Ay(){var t=wy,n=null,e=ny(0),r=My,i=ny(!0),o=null,a=xy,u=null;function c(c){var f,s,l,h,d,p=c.length,v=!1,g=new Array(p),y=new Array(p);for(null==o&&(u=a(d=Xi())),f=0;f<=p;++f){if(!(f<p&&i(h=c[f],f,c))===v)if(v=!v)s=f,u.areaStart(),u.lineStart();else{for(u.lineEnd(),u.lineStart(),l=f-1;l>=s;--l)u.point(g[l],y[l]);u.lineEnd(),u.areaEnd()}v&&(g[f]=+t(h,f,c),y[f]=+e(h,f,c),u.point(n?+n(h,f,c):g[f],r?+r(h,f,c):y[f]))}if(d)return u=null,d+""||null}function f(){return Ny().defined(i).curve(a).context(o)}return c.x=function(e){return arguments.length?(t="function"==typeof e?e:ny(+e),n=null,c):t},c.x0=function(n){return arguments.length?(t="function"==typeof n?n:ny(+n),c):t},c.x1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:ny(+t),c):n},c.y=function(t){return arguments.length?(e="function"==typeof t?t:ny(+t),r=null,c):e},c.y0=function(t){return arguments.length?(e="function"==typeof t?t:ny(+t),c):e},c.y1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:ny(+t),c):r},c.lineX0=c.lineY0=function(){return f().x(t).y(e)},c.lineY1=function(){return f().x(t).y(r)},c.lineX1=function(){return f().x(n).y(e)},c.defined=function(t){return arguments.length?(i="function"==typeof t?t:ny(!!t),c):i},c.curve=function(t){return arguments.length?(a=t,null!=o&&(u=a(o)),c):a},c.context=function(t){return arguments.length?(null==t?o=u=null:u=a(o=t),c):o},c}function Ty(t,n){return n<t?-1:n>t?1:n>=t?0:NaN}function Sy(t){return t}my.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:this._context.lineTo(t,n)}}};var ky=Cy(xy);function Ey(t){this._curve=t}function Cy(t){function n(n){return new Ey(t(n))}return n._curve=t,n}function Py(t){var n=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?n(Cy(t)):n()._curve},t}function zy(){return Py(Ny().curve(ky))}function Ry(){var t=Ay().curve(ky),n=t.curve,e=t.lineX0,r=t.lineX1,i=t.lineY0,o=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return Py(e())},delete t.lineX0,t.lineEndAngle=function(){return Py(r())},delete t.lineX1,t.lineInnerRadius=function(){return Py(i())},delete t.lineY0,t.lineOuterRadius=function(){return Py(o())},delete t.lineY1,t.curve=function(t){return arguments.length?n(Cy(t)):n()._curve},t}function Dy(t,n){return[(n=+n)*Math.cos(t-=Math.PI/2),n*Math.sin(t)]}Ey.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,n){this._curve.point(n*Math.sin(t),n*-Math.cos(t))}};var qy=Array.prototype.slice;function Ly(t){return t.source}function Uy(t){return t.target}function Oy(t){var n=Ly,e=Uy,r=wy,i=My,o=null;function a(){var a,u=qy.call(arguments),c=n.apply(this,u),f=e.apply(this,u);if(o||(o=a=Xi()),t(o,+r.apply(this,(u[0]=c,u)),+i.apply(this,u),+r.apply(this,(u[0]=f,u)),+i.apply(this,u)),a)return o=null,a+""||null}return a.source=function(t){return arguments.length?(n=t,a):n},a.target=function(t){return arguments.length?(e=t,a):e},a.x=function(t){return arguments.length?(r="function"==typeof t?t:ny(+t),a):r},a.y=function(t){return arguments.length?(i="function"==typeof t?t:ny(+t),a):i},a.context=function(t){return arguments.length?(o=null==t?null:t,a):o},a}function By(t,n,e,r,i){t.moveTo(n,e),t.bezierCurveTo(n=(n+r)/2,e,n,i,r,i)}function Yy(t,n,e,r,i){t.moveTo(n,e),t.bezierCurveTo(n,e=(e+i)/2,r,e,r,i)}function Fy(t,n,e,r,i){var o=Dy(n,e),a=Dy(n,e=(e+i)/2),u=Dy(r,e),c=Dy(r,i);t.moveTo(o[0],o[1]),t.bezierCurveTo(a[0],a[1],u[0],u[1],c[0],c[1])}var Iy={draw:function(t,n){var e=Math.sqrt(n/sy);t.moveTo(e,0),t.arc(0,0,e,0,hy)}},jy={draw:function(t,n){var e=Math.sqrt(n/5)/2;t.moveTo(-3*e,-e),t.lineTo(-e,-e),t.lineTo(-e,-3*e),t.lineTo(e,-3*e),t.lineTo(e,-e),t.lineTo(3*e,-e),t.lineTo(3*e,e),t.lineTo(e,e),t.lineTo(e,3*e),t.lineTo(-e,3*e),t.lineTo(-e,e),t.lineTo(-3*e,e),t.closePath()}},Hy=Math.sqrt(1/3),Xy=2*Hy,Gy={draw:function(t,n){var e=Math.sqrt(n/Xy),r=e*Hy;t.moveTo(0,-e),t.lineTo(r,0),t.lineTo(0,e),t.lineTo(-r,0),t.closePath()}},Vy=Math.sin(sy/10)/Math.sin(7*sy/10),$y=Math.sin(hy/10)*Vy,Wy=-Math.cos(hy/10)*Vy,Zy={draw:function(t,n){var e=Math.sqrt(.8908130915292852*n),r=$y*e,i=Wy*e;t.moveTo(0,-e),t.lineTo(r,i);for(var o=1;o<5;++o){var a=hy*o/5,u=Math.cos(a),c=Math.sin(a);t.lineTo(c*e,-u*e),t.lineTo(u*r-c*i,c*r+u*i)}t.closePath()}},Qy={draw:function(t,n){var e=Math.sqrt(n),r=-e/2;t.rect(r,r,e,e)}},Jy=Math.sqrt(3),Ky={draw:function(t,n){var e=-Math.sqrt(n/(3*Jy));t.moveTo(0,2*e),t.lineTo(-Jy*e,-e),t.lineTo(Jy*e,-e),t.closePath()}},t_=Math.sqrt(3)/2,n_=1/Math.sqrt(12),e_=3*(n_/2+1),r_={draw:function(t,n){var e=Math.sqrt(n/e_),r=e/2,i=e*n_,o=r,a=e*n_+e,u=-o,c=a;t.moveTo(r,i),t.lineTo(o,a),t.lineTo(u,c),t.lineTo(-.5*r-t_*i,t_*r+-.5*i),t.lineTo(-.5*o-t_*a,t_*o+-.5*a),t.lineTo(-.5*u-t_*c,t_*u+-.5*c),t.lineTo(-.5*r+t_*i,-.5*i-t_*r),t.lineTo(-.5*o+t_*a,-.5*a-t_*o),t.lineTo(-.5*u+t_*c,-.5*c-t_*u),t.closePath()}},i_=[Iy,jy,Gy,Qy,Zy,Ky,r_];function o_(){}function a_(t,n,e){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+n)/6,(t._y0+4*t._y1+e)/6)}function u_(t){this._context=t}function c_(t){this._context=t}function f_(t){this._context=t}function s_(t,n){this._basis=new u_(t),this._beta=n}u_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:a_(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:a_(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},c_.prototype={areaStart:o_,areaEnd:o_,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x2=t,this._y2=n;break;case 1:this._point=2,this._x3=t,this._y3=n;break;case 2:this._point=3,this._x4=t,this._y4=n,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+n)/6);break;default:a_(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},f_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var e=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+n)/6;this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break;case 3:this._point=4;default:a_(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},s_.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,n=this._y,e=t.length-1;if(e>0)for(var r,i=t[0],o=n[0],a=t[e]-i,u=n[e]-o,c=-1;++c<=e;)r=c/e,this._basis.point(this._beta*t[c]+(1-this._beta)*(i+r*a),this._beta*n[c]+(1-this._beta)*(o+r*u));this._x=this._y=null,this._basis.lineEnd()},point:function(t,n){this._x.push(+t),this._y.push(+n)}};var l_=function t(n){function e(t){return 1===n?new u_(t):new s_(t,n)}return e.beta=function(n){return t(+n)},e}(.85);function h_(t,n,e){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-n),t._y2+t._k*(t._y1-e),t._x2,t._y2)}function d_(t,n){this._context=t,this._k=(1-n)/6}d_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:h_(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2,this._x1=t,this._y1=n;break;case 2:this._point=3;default:h_(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var p_=function t(n){function e(t){return new d_(t,n)}return e.tension=function(n){return t(+n)},e}(0);function v_(t,n){this._context=t,this._k=(1-n)/6}v_.prototype={areaStart:o_,areaEnd:o_,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:h_(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var g_=function t(n){function e(t){return new v_(t,n)}return e.tension=function(n){return t(+n)},e}(0);function y_(t,n){this._context=t,this._k=(1-n)/6}y_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:h_(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var __=function t(n){function e(t){return new y_(t,n)}return e.tension=function(n){return t(+n)},e}(0);function b_(t,n,e){var r=t._x1,i=t._y1,o=t._x2,a=t._y2;if(t._l01_a>fy){var u=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,c=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*u-t._x0*t._l12_2a+t._x2*t._l01_2a)/c,i=(i*u-t._y0*t._l12_2a+t._y2*t._l01_2a)/c}if(t._l23_a>fy){var f=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,s=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*f+t._x1*t._l23_2a-n*t._l12_2a)/s,a=(a*f+t._y1*t._l23_2a-e*t._l12_2a)/s}t._context.bezierCurveTo(r,i,o,a,t._x2,t._y2)}function m_(t,n){this._context=t,this._alpha=n}m_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3;default:b_(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var x_=function t(n){function e(t){return n?new m_(t,n):new d_(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function w_(t,n){this._context=t,this._alpha=n}w_.prototype={areaStart:o_,areaEnd:o_,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:b_(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var M_=function t(n){function e(t){return n?new w_(t,n):new v_(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function N_(t,n){this._context=t,this._alpha=n}N_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:b_(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var A_=function t(n){function e(t){return n?new N_(t,n):new y_(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function T_(t){this._context=t}function S_(t){return t<0?-1:1}function k_(t,n,e){var r=t._x1-t._x0,i=n-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),a=(e-t._y1)/(i||r<0&&-0),u=(o*i+a*r)/(r+i);return(S_(o)+S_(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(u))||0}function E_(t,n){var e=t._x1-t._x0;return e?(3*(t._y1-t._y0)/e-n)/2:n}function C_(t,n,e){var r=t._x0,i=t._y0,o=t._x1,a=t._y1,u=(o-r)/3;t._context.bezierCurveTo(r+u,i+u*n,o-u,a-u*e,o,a)}function P_(t){this._context=t}function z_(t){this._context=new R_(t)}function R_(t){this._context=t}function D_(t){this._context=t}function q_(t){var n,e,r=t.length-1,i=new Array(r),o=new Array(r),a=new Array(r);for(i[0]=0,o[0]=2,a[0]=t[0]+2*t[1],n=1;n<r-1;++n)i[n]=1,o[n]=4,a[n]=4*t[n]+2*t[n+1];for(i[r-1]=2,o[r-1]=7,a[r-1]=8*t[r-1]+t[r],n=1;n<r;++n)e=i[n]/o[n-1],o[n]-=e,a[n]-=e*a[n-1];for(i[r-1]=a[r-1]/o[r-1],n=r-2;n>=0;--n)i[n]=(a[n]-i[n+1])/o[n];for(o[r-1]=(t[r]+i[r-1])/2,n=0;n<r-1;++n)o[n]=2*t[n+1]-i[n+1];return[i,o]}function L_(t,n){this._context=t,this._t=n}function U_(t,n){if((i=t.length)>1)for(var e,r,i,o=1,a=t[n[0]],u=a.length;o<i;++o)for(r=a,a=t[n[o]],e=0;e<u;++e)a[e][1]+=a[e][0]=isNaN(r[e][1])?r[e][0]:r[e][1]}function O_(t){for(var n=t.length,e=new Array(n);--n>=0;)e[n]=n;return e}function B_(t,n){return t[n]}function Y_(t){var n=t.map(F_);return O_(t).sort(function(t,e){return n[t]-n[e]})}function F_(t){for(var n,e=-1,r=0,i=t.length,o=-1/0;++e<i;)(n=+t[e][1])>o&&(o=n,r=e);return r}function I_(t){var n=t.map(j_);return O_(t).sort(function(t,e){return n[t]-n[e]})}function j_(t){for(var n,e=0,r=-1,i=t.length;++r<i;)(n=+t[r][1])&&(e+=n);return e}function H_(t){return function(){return t}}function X_(t){return t[0]}function G_(t){return t[1]}function V_(){this._=null}function $_(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function W_(t,n){var e=n,r=n.R,i=e.U;i?i.L===e?i.L=r:i.R=r:t._=r,r.U=i,e.U=r,e.R=r.L,e.R&&(e.R.U=e),r.L=e}function Z_(t,n){var e=n,r=n.L,i=e.U;i?i.L===e?i.L=r:i.R=r:t._=r,r.U=i,e.U=r,e.L=r.R,e.L&&(e.L.U=e),r.R=e}function Q_(t){for(;t.L;)t=t.L;return t}function J_(t,n,e,r){var i=[null,null],o=wb.push(i)-1;return i.left=t,i.right=n,e&&tb(i,t,n,e),r&&tb(i,n,t,r),mb[t.index].halfedges.push(o),mb[n.index].halfedges.push(o),i}function K_(t,n,e){var r=[n,e];return r.left=t,r}function tb(t,n,e,r){t[0]||t[1]?t.left===e?t[1]=r:t[0]=r:(t[0]=r,t.left=n,t.right=e)}function nb(t,n,e,r,i){var o,a=t[0],u=t[1],c=a[0],f=a[1],s=0,l=1,h=u[0]-c,d=u[1]-f;if(o=n-c,h||!(o>0)){if(o/=h,h<0){if(o<s)return;o<l&&(l=o)}else if(h>0){if(o>l)return;o>s&&(s=o)}if(o=r-c,h||!(o<0)){if(o/=h,h<0){if(o>l)return;o>s&&(s=o)}else if(h>0){if(o<s)return;o<l&&(l=o)}if(o=e-f,d||!(o>0)){if(o/=d,d<0){if(o<s)return;o<l&&(l=o)}else if(d>0){if(o>l)return;o>s&&(s=o)}if(o=i-f,d||!(o<0)){if(o/=d,d<0){if(o>l)return;o>s&&(s=o)}else if(d>0){if(o<s)return;o<l&&(l=o)}return!(s>0||l<1)||(s>0&&(t[0]=[c+s*h,f+s*d]),l<1&&(t[1]=[c+l*h,f+l*d]),!0)}}}}}function eb(t,n,e,r,i){var o=t[1];if(o)return!0;var a,u,c=t[0],f=t.left,s=t.right,l=f[0],h=f[1],d=s[0],p=s[1],v=(l+d)/2,g=(h+p)/2;if(p===h){if(v<n||v>=r)return;if(l>d){if(c){if(c[1]>=i)return}else c=[v,e];o=[v,i]}else{if(c){if(c[1]<e)return}else c=[v,i];o=[v,e]}}else if(u=g-(a=(l-d)/(p-h))*v,a<-1||a>1)if(l>d){if(c){if(c[1]>=i)return}else c=[(e-u)/a,e];o=[(i-u)/a,i]}else{if(c){if(c[1]<e)return}else c=[(i-u)/a,i];o=[(e-u)/a,e]}else if(h<p){if(c){if(c[0]>=r)return}else c=[n,a*n+u];o=[r,a*r+u]}else{if(c){if(c[0]<n)return}else c=[r,a*r+u];o=[n,a*n+u]}return t[0]=c,t[1]=o,!0}function rb(t,n){var e=t.site,r=n.left,i=n.right;return e===i&&(i=r,r=e),i?Math.atan2(i[1]-r[1],i[0]-r[0]):(e===r?(r=n[1],i=n[0]):(r=n[0],i=n[1]),Math.atan2(r[0]-i[0],i[1]-r[1]))}function ib(t,n){return n[+(n.left!==t.site)]}function ob(t,n){return n[+(n.left===t.site)]}T_.prototype={areaStart:o_,areaEnd:o_,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,n){t=+t,n=+n,this._point?this._context.lineTo(t,n):(this._point=1,this._context.moveTo(t,n))}},P_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:C_(this,this._t0,E_(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){var e=NaN;if(n=+n,(t=+t)!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,C_(this,E_(this,e=k_(this,t,n)),e);break;default:C_(this,this._t0,e=k_(this,t,n))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n,this._t0=e}}},(z_.prototype=Object.create(P_.prototype)).point=function(t,n){P_.prototype.point.call(this,n,t)},R_.prototype={moveTo:function(t,n){this._context.moveTo(n,t)},closePath:function(){this._context.closePath()},lineTo:function(t,n){this._context.lineTo(n,t)},bezierCurveTo:function(t,n,e,r,i,o){this._context.bezierCurveTo(n,t,r,e,o,i)}},D_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,n=this._y,e=t.length;if(e)if(this._line?this._context.lineTo(t[0],n[0]):this._context.moveTo(t[0],n[0]),2===e)this._context.lineTo(t[1],n[1]);else for(var r=q_(t),i=q_(n),o=0,a=1;a<e;++o,++a)this._context.bezierCurveTo(r[0][o],i[0][o],r[1][o],i[1][o],t[a],n[a]);(this._line||0!==this._line&&1===e)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,n){this._x.push(+t),this._y.push(+n)}},L_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,n),this._context.lineTo(t,n);else{var e=this._x*(1-this._t)+t*this._t;this._context.lineTo(e,this._y),this._context.lineTo(e,n)}}this._x=t,this._y=n}},V_.prototype={constructor:V_,insert:function(t,n){var e,r,i;if(t){if(n.P=t,n.N=t.N,t.N&&(t.N.P=n),t.N=n,t.R){for(t=t.R;t.L;)t=t.L;t.L=n}else t.R=n;e=t}else this._?(t=Q_(this._),n.P=null,n.N=t,t.P=t.L=n,e=t):(n.P=n.N=null,this._=n,e=null);for(n.L=n.R=null,n.U=e,n.C=!0,t=n;e&&e.C;)e===(r=e.U).L?(i=r.R)&&i.C?(e.C=i.C=!1,r.C=!0,t=r):(t===e.R&&(W_(this,e),e=(t=e).U),e.C=!1,r.C=!0,Z_(this,r)):(i=r.L)&&i.C?(e.C=i.C=!1,r.C=!0,t=r):(t===e.L&&(Z_(this,e),e=(t=e).U),e.C=!1,r.C=!0,W_(this,r)),e=t.U;this._.C=!1},remove:function(t){t.N&&(t.N.P=t.P),t.P&&(t.P.N=t.N),t.N=t.P=null;var n,e,r,i=t.U,o=t.L,a=t.R;if(e=o?a?Q_(a):o:a,i?i.L===t?i.L=e:i.R=e:this._=e,o&&a?(r=e.C,e.C=t.C,e.L=o,o.U=e,e!==a?(i=e.U,e.U=t.U,t=e.R,i.L=t,e.R=a,a.U=e):(e.U=i,i=e,t=e.R)):(r=t.C,t=e),t&&(t.U=i),!r)if(t&&t.C)t.C=!1;else{do{if(t===this._)break;if(t===i.L){if((n=i.R).C&&(n.C=!1,i.C=!0,W_(this,i),n=i.R),n.L&&n.L.C||n.R&&n.R.C){n.R&&n.R.C||(n.L.C=!1,n.C=!0,Z_(this,n),n=i.R),n.C=i.C,i.C=n.R.C=!1,W_(this,i),t=this._;break}}else if((n=i.L).C&&(n.C=!1,i.C=!0,Z_(this,i),n=i.L),n.L&&n.L.C||n.R&&n.R.C){n.L&&n.L.C||(n.R.C=!1,n.C=!0,W_(this,n),n=i.L),n.C=i.C,i.C=n.L.C=!1,Z_(this,i),t=this._;break}n.C=!0,t=i,i=i.U}while(!t.C);t&&(t.C=!1)}}};var ab,ub=[];function cb(){$_(this),this.x=this.y=this.arc=this.site=this.cy=null}function fb(t){var n=t.P,e=t.N;if(n&&e){var r=n.site,i=t.site,o=e.site;if(r!==o){var a=i[0],u=i[1],c=r[0]-a,f=r[1]-u,s=o[0]-a,l=o[1]-u,h=2*(c*l-f*s);if(!(h>=-Nb)){var d=c*c+f*f,p=s*s+l*l,v=(l*d-f*p)/h,g=(c*p-s*d)/h,y=ub.pop()||new cb;y.arc=t,y.site=i,y.x=v+a,y.y=(y.cy=g+u)+Math.sqrt(v*v+g*g),t.circle=y;for(var _=null,b=xb._;b;)if(y.y<b.y||y.y===b.y&&y.x<=b.x){if(!b.L){_=b.P;break}b=b.L}else{if(!b.R){_=b;break}b=b.R}xb.insert(_,y),_||(ab=y)}}}}function sb(t){var n=t.circle;n&&(n.P||(ab=n.N),xb.remove(n),ub.push(n),$_(n),t.circle=null)}var lb=[];function hb(){$_(this),this.edge=this.site=this.circle=null}function db(t){var n=lb.pop()||new hb;return n.site=t,n}function pb(t){sb(t),bb.remove(t),lb.push(t),$_(t)}function vb(t){var n=t.circle,e=n.x,r=n.cy,i=[e,r],o=t.P,a=t.N,u=[t];pb(t);for(var c=o;c.circle&&Math.abs(e-c.circle.x)<Mb&&Math.abs(r-c.circle.cy)<Mb;)o=c.P,u.unshift(c),pb(c),c=o;u.unshift(c),sb(c);for(var f=a;f.circle&&Math.abs(e-f.circle.x)<Mb&&Math.abs(r-f.circle.cy)<Mb;)a=f.N,u.push(f),pb(f),f=a;u.push(f),sb(f);var s,l=u.length;for(s=1;s<l;++s)f=u[s],c=u[s-1],tb(f.edge,c.site,f.site,i);c=u[0],(f=u[l-1]).edge=J_(c.site,f.site,null,i),fb(c),fb(f)}function gb(t){for(var n,e,r,i,o=t[0],a=t[1],u=bb._;u;)if((r=yb(u,a)-o)>Mb)u=u.L;else{if(!((i=o-_b(u,a))>Mb)){r>-Mb?(n=u.P,e=u):i>-Mb?(n=u,e=u.N):n=e=u;break}if(!u.R){n=u;break}u=u.R}!function(t){mb[t.index]={site:t,halfedges:[]}}(t);var c=db(t);if(bb.insert(n,c),n||e){if(n===e)return sb(n),e=db(n.site),bb.insert(c,e),c.edge=e.edge=J_(n.site,c.site),fb(n),void fb(e);if(e){sb(n),sb(e);var f=n.site,s=f[0],l=f[1],h=t[0]-s,d=t[1]-l,p=e.site,v=p[0]-s,g=p[1]-l,y=2*(h*g-d*v),_=h*h+d*d,b=v*v+g*g,m=[(g*_-d*b)/y+s,(h*b-v*_)/y+l];tb(e.edge,f,p,m),c.edge=J_(f,t,null,m),e.edge=J_(t,p,null,m),fb(n),fb(e)}else c.edge=J_(n.site,c.site)}}function yb(t,n){var e=t.site,r=e[0],i=e[1],o=i-n;if(!o)return r;var a=t.P;if(!a)return-1/0;var u=(e=a.site)[0],c=e[1],f=c-n;if(!f)return u;var s=u-r,l=1/o-1/f,h=s/f;return l?(-h+Math.sqrt(h*h-2*l*(s*s/(-2*f)-c+f/2+i-o/2)))/l+r:(r+u)/2}function _b(t,n){var e=t.N;if(e)return yb(e,n);var r=t.site;return r[1]===n?r[0]:1/0}var bb,mb,xb,wb,Mb=1e-6,Nb=1e-12;function Ab(t,n){return n[1]-t[1]||n[0]-t[0]}function Tb(t,n){var e,r,i,o=t.sort(Ab).pop();for(wb=[],mb=new Array(t.length),bb=new V_,xb=new V_;;)if(i=ab,o&&(!i||o[1]<i.y||o[1]===i.y&&o[0]<i.x))o[0]===e&&o[1]===r||(gb(o),e=o[0],r=o[1]),o=t.pop();else{if(!i)break;vb(i.arc)}if(function(){for(var t,n,e,r,i=0,o=mb.length;i<o;++i)if((t=mb[i])&&(r=(n=t.halfedges).length)){var a=new Array(r),u=new Array(r);for(e=0;e<r;++e)a[e]=e,u[e]=rb(t,wb[n[e]]);for(a.sort(function(t,n){return u[n]-u[t]}),e=0;e<r;++e)u[e]=n[a[e]];for(e=0;e<r;++e)n[e]=u[e]}}(),n){var a=+n[0][0],u=+n[0][1],c=+n[1][0],f=+n[1][1];!function(t,n,e,r){for(var i,o=wb.length;o--;)eb(i=wb[o],t,n,e,r)&&nb(i,t,n,e,r)&&(Math.abs(i[0][0]-i[1][0])>Mb||Math.abs(i[0][1]-i[1][1])>Mb)||delete wb[o]}(a,u,c,f),function(t,n,e,r){var i,o,a,u,c,f,s,l,h,d,p,v,g=mb.length,y=!0;for(i=0;i<g;++i)if(o=mb[i]){for(a=o.site,u=(c=o.halfedges).length;u--;)wb[c[u]]||c.splice(u,1);for(u=0,f=c.length;u<f;)p=(d=ob(o,wb[c[u]]))[0],v=d[1],l=(s=ib(o,wb[c[++u%f]]))[0],h=s[1],(Math.abs(p-l)>Mb||Math.abs(v-h)>Mb)&&(c.splice(u,0,wb.push(K_(a,d,Math.abs(p-t)<Mb&&r-v>Mb?[t,Math.abs(l-t)<Mb?h:r]:Math.abs(v-r)<Mb&&e-p>Mb?[Math.abs(h-r)<Mb?l:e,r]:Math.abs(p-e)<Mb&&v-n>Mb?[e,Math.abs(l-e)<Mb?h:n]:Math.abs(v-n)<Mb&&p-t>Mb?[Math.abs(h-n)<Mb?l:t,n]:null))-1),++f);f&&(y=!1)}if(y){var _,b,m,x=1/0;for(i=0,y=null;i<g;++i)(o=mb[i])&&(m=(_=(a=o.site)[0]-t)*_+(b=a[1]-n)*b)<x&&(x=m,y=o);if(y){var w=[t,n],M=[t,r],N=[e,r],A=[e,n];y.halfedges.push(wb.push(K_(a=y.site,w,M))-1,wb.push(K_(a,M,N))-1,wb.push(K_(a,N,A))-1,wb.push(K_(a,A,w))-1)}}for(i=0;i<g;++i)(o=mb[i])&&(o.halfedges.length||delete mb[i])}(a,u,c,f)}this.edges=wb,this.cells=mb,bb=xb=wb=mb=null}function Sb(t){return function(){return t}}function kb(t,n,e){this.target=t,this.type=n,this.transform=e}function Eb(t,n,e){this.k=t,this.x=n,this.y=e}Tb.prototype={constructor:Tb,polygons:function(){var t=this.edges;return this.cells.map(function(n){var e=n.halfedges.map(function(e){return ib(n,t[e])});return e.data=n.site.data,e})},triangles:function(){var t=[],n=this.edges;return this.cells.forEach(function(e,r){if(o=(i=e.halfedges).length)for(var i,o,a,u,c,f,s=e.site,l=-1,h=n[i[o-1]],d=h.left===s?h.right:h.left;++l<o;)a=d,d=(h=n[i[l]]).left===s?h.right:h.left,a&&d&&r<a.index&&r<d.index&&(c=a,f=d,((u=s)[0]-f[0])*(c[1]-u[1])-(u[0]-c[0])*(f[1]-u[1])<0)&&t.push([s.data,a.data,d.data])}),t},links:function(){return this.edges.filter(function(t){return t.right}).map(function(t){return{source:t.left.data,target:t.right.data}})},find:function(t,n,e){for(var r,i,o=this,a=o._found||0,u=o.cells.length;!(i=o.cells[a]);)if(++a>=u)return null;var c=t-i.site[0],f=n-i.site[1],s=c*c+f*f;do{i=o.cells[r=a],a=null,i.halfedges.forEach(function(e){var r=o.edges[e],u=r.left;if(u!==i.site&&u||(u=r.right)){var c=t-u[0],f=n-u[1],l=c*c+f*f;l<s&&(s=l,a=u.index)}})}while(null!==a);return o._found=r,null==e||s<=e*e?i.site:null}},Eb.prototype={constructor:Eb,scale:function(t){return 1===t?this:new Eb(this.k*t,this.x,this.y)},translate:function(t,n){return 0===t&0===n?this:new Eb(this.k,this.x+this.k*t,this.y+this.k*n)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Cb=new Eb(1,0,0);function Pb(t){return t.__zoom||Cb}function zb(){t.event.stopImmediatePropagation()}function Rb(){t.event.preventDefault(),t.event.stopImmediatePropagation()}function Db(){return!t.event.button}function qb(){var t,n,e=this;return e instanceof SVGElement?(t=(e=e.ownerSVGElement||e).width.baseVal.value,n=e.height.baseVal.value):(t=e.clientWidth,n=e.clientHeight),[[0,0],[t,n]]}function Lb(){return this.__zoom||Cb}function Ub(){return-t.event.deltaY*(t.event.deltaMode?120:1)/500}function Ob(){return"ontouchstart"in this}function Bb(t,n,e){var r=t.invertX(n[0][0])-e[0][0],i=t.invertX(n[1][0])-e[1][0],o=t.invertY(n[0][1])-e[0][1],a=t.invertY(n[1][1])-e[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}Pb.prototype=Eb.prototype,t.version="5.9.7",t.bisect=i,t.bisectRight=i,t.bisectLeft=o,t.ascending=n,t.bisector=e,t.cross=function(t,n,e){var r,i,o,u,c=t.length,f=n.length,s=new Array(c*f);for(null==e&&(e=a),r=o=0;r<c;++r)for(u=t[r],i=0;i<f;++i,++o)s[o]=e(u,n[i]);return s},t.descending=function(t,n){return n<t?-1:n>t?1:n>=t?0:NaN},t.deviation=f,t.extent=s,t.histogram=function(){var t=v,n=s,e=M;function r(r){var o,a,u=r.length,c=new Array(u);for(o=0;o<u;++o)c[o]=t(r[o],o,r);var f=n(c),s=f[0],l=f[1],h=e(c,s,l);Array.isArray(h)||(h=w(s,l,h),h=g(Math.ceil(s/h)*h,l,h));for(var d=h.length;h[0]<=s;)h.shift(),--d;for(;h[d-1]>l;)h.pop(),--d;var p,v=new Array(d+1);for(o=0;o<=d;++o)(p=v[o]=[]).x0=o>0?h[o-1]:s,p.x1=o<d?h[o]:l;for(o=0;o<u;++o)s<=(a=c[o])&&a<=l&&v[i(h,a,0,d)].push(r[o]);return v}return r.value=function(n){return arguments.length?(t="function"==typeof n?n:p(n),r):t},r.domain=function(t){return arguments.length?(n="function"==typeof t?t:p([t[0],t[1]]),r):n},r.thresholds=function(t){return arguments.length?(e="function"==typeof t?t:Array.isArray(t)?p(h.call(t)):p(t),r):e},r},t.thresholdFreedmanDiaconis=function(t,e,r){return t=d.call(t,u).sort(n),Math.ceil((r-e)/(2*(N(t,.75)-N(t,.25))*Math.pow(t.length,-1/3)))},t.thresholdScott=function(t,n,e){return Math.ceil((e-n)/(3.5*f(t)*Math.pow(t.length,-1/3)))},t.thresholdSturges=M,t.max=A,t.mean=function(t,n){var e,r=t.length,i=r,o=-1,a=0;if(null==n)for(;++o<r;)isNaN(e=u(t[o]))?--i:a+=e;else for(;++o<r;)isNaN(e=u(n(t[o],o,t)))?--i:a+=e;if(i)return a/i},t.median=function(t,e){var r,i=t.length,o=-1,a=[];if(null==e)for(;++o<i;)isNaN(r=u(t[o]))||a.push(r);else for(;++o<i;)isNaN(r=u(e(t[o],o,t)))||a.push(r);return N(a.sort(n),.5)},t.merge=T,t.min=S,t.pairs=function(t,n){null==n&&(n=a);for(var e=0,r=t.length-1,i=t[0],o=new Array(r<0?0:r);e<r;)o[e]=n(i,i=t[++e]);return o},t.permute=function(t,n){for(var e=n.length,r=new Array(e);e--;)r[e]=t[n[e]];return r},t.quantile=N,t.range=g,t.scan=function(t,e){if(r=t.length){var r,i,o=0,a=0,u=t[a];for(null==e&&(e=n);++o<r;)(e(i=t[o],u)<0||0!==e(u,u))&&(u=i,a=o);return 0===e(u,u)?a:void 0}},t.shuffle=function(t,n,e){for(var r,i,o=(null==e?t.length:e)-(n=null==n?0:+n);o;)i=Math.random()*o--|0,r=t[o+n],t[o+n]=t[i+n],t[i+n]=r;return t},t.sum=function(t,n){var e,r=t.length,i=-1,o=0;if(null==n)for(;++i<r;)(e=+t[i])&&(o+=e);else for(;++i<r;)(e=+n(t[i],i,t))&&(o+=e);return o},t.ticks=m,t.tickIncrement=x,t.tickStep=w,t.transpose=k,t.variance=c,t.zip=function(){return k(arguments)},t.axisTop=function(t){return Y(z,t)},t.axisRight=function(t){return Y(R,t)},t.axisBottom=function(t){return Y(D,t)},t.axisLeft=function(t){return Y(q,t)},t.brush=function(){return zi(xi)},t.brushX=function(){return zi(bi)},t.brushY=function(){return zi(mi)},t.brushSelection=function(t){var n=t.__brush;return n?n.dim.output(n.selection):null},t.chord=function(){var t=0,n=null,e=null,r=null;function i(i){var o,a,u,c,f,s,l=i.length,h=[],d=g(l),p=[],v=[],y=v.groups=new Array(l),_=new Array(l*l);for(o=0,f=-1;++f<l;){for(a=0,s=-1;++s<l;)a+=i[f][s];h.push(a),p.push(g(l)),o+=a}for(n&&d.sort(function(t,e){return n(h[t],h[e])}),e&&p.forEach(function(t,n){t.sort(function(t,r){return e(i[n][t],i[n][r])})}),c=(o=Oi(0,Ui-t*l)/o)?t:Ui/l,a=0,f=-1;++f<l;){for(u=a,s=-1;++s<l;){var b=d[f],m=p[b][s],x=i[b][m],w=a,M=a+=x*o;_[m*l+b]={index:b,subindex:m,startAngle:w,endAngle:M,value:x}}y[b]={index:b,startAngle:u,endAngle:a,value:h[b]},a+=c}for(f=-1;++f<l;)for(s=f-1;++s<l;){var N=_[s*l+f],A=_[f*l+s];(N.value||A.value)&&v.push(N.value<A.value?{source:A,target:N}:{source:N,target:A})}return r?v.sort(r):v}return i.padAngle=function(n){return arguments.length?(t=Oi(0,n),i):t},i.sortGroups=function(t){return arguments.length?(n=t,i):n},i.sortSubgroups=function(t){return arguments.length?(e=t,i):e},i.sortChords=function(t){return arguments.length?(null==t?r=null:(n=t,r=function(t,e){return n(t.source.value+t.target.value,e.source.value+e.target.value)})._=t,i):r&&r._;var n},i},t.ribbon=function(){var t=Gi,n=Vi,e=$i,r=Wi,i=Zi,o=null;function a(){var a,u=Bi.call(arguments),c=t.apply(this,u),f=n.apply(this,u),s=+e.apply(this,(u[0]=c,u)),l=r.apply(this,u)-Li,h=i.apply(this,u)-Li,d=s*Ri(l),p=s*Di(l),v=+e.apply(this,(u[0]=f,u)),g=r.apply(this,u)-Li,y=i.apply(this,u)-Li;if(o||(o=a=Xi()),o.moveTo(d,p),o.arc(0,0,s,l,h),l===g&&h===y||(o.quadraticCurveTo(0,0,v*Ri(g),v*Di(g)),o.arc(0,0,v,g,y)),o.quadraticCurveTo(0,0,d,p),o.closePath(),a)return o=null,a+""||null}return a.radius=function(t){return arguments.length?(e="function"==typeof t?t:Yi(+t),a):e},a.startAngle=function(t){return arguments.length?(r="function"==typeof t?t:Yi(+t),a):r},a.endAngle=function(t){return arguments.length?(i="function"==typeof t?t:Yi(+t),a):i},a.source=function(n){return arguments.length?(t=n,a):t},a.target=function(t){return arguments.length?(n=t,a):n},a.context=function(t){return arguments.length?(o=null==t?null:t,a):o},a},t.nest=function(){var t,n,e,r=[],i=[];function o(e,i,a,u){if(i>=r.length)return null!=t&&e.sort(t),null!=n?n(e):e;for(var c,f,s,l=-1,h=e.length,d=r[i++],p=Ji(),v=a();++l<h;)(s=p.get(c=d(f=e[l])+""))?s.push(f):p.set(c,[f]);return p.each(function(t,n){u(v,n,o(t,i,a,u))}),v}return e={object:function(t){return o(t,0,Ki,to)},map:function(t){return o(t,0,no,eo)},entries:function(t){return function t(e,o){if(++o>r.length)return e;var a,u=i[o-1];return null!=n&&o>=r.length?a=e.entries():(a=[],e.each(function(n,e){a.push({key:e,values:t(n,o)})})),null!=u?a.sort(function(t,n){return u(t.key,n.key)}):a}(o(t,0,no,eo),0)},key:function(t){return r.push(t),e},sortKeys:function(t){return i[r.length-1]=t,e},sortValues:function(n){return t=n,e},rollup:function(t){return n=t,e}}},t.set=oo,t.map=Ji,t.keys=function(t){var n=[];for(var e in t)n.push(e);return n},t.values=function(t){var n=[];for(var e in t)n.push(t[e]);return n},t.entries=function(t){var n=[];for(var e in t)n.push({key:e,value:t[e]});return n},t.color=hn,t.rgb=gn,t.hsl=mn,t.lab=Rn,t.hcl=Yn,t.lch=function(t,n,e,r){return 1===arguments.length?Bn(t):new Fn(e,n,t,null==r?1:r)},t.gray=function(t,n){return new Dn(t,0,0,null==n?1:n)},t.cubehelix=Qn,t.contours=vo,t.contourDensity=function(){var t=_o,n=bo,e=mo,r=960,i=500,o=20,a=2,u=3*o,c=r+2*u>>a,f=i+2*u>>a,s=co(20);function l(r){var i=new Float32Array(c*f),l=new Float32Array(c*f);r.forEach(function(r,o,s){var l=+t(r,o,s)+u>>a,h=+n(r,o,s)+u>>a,d=+e(r,o,s);l>=0&&l<c&&h>=0&&h<f&&(i[l+h*c]+=d)}),go({width:c,height:f,data:i},{width:c,height:f,data:l},o>>a),yo({width:c,height:f,data:l},{width:c,height:f,data:i},o>>a),go({width:c,height:f,data:i},{width:c,height:f,data:l},o>>a),yo({width:c,height:f,data:l},{width:c,height:f,data:i},o>>a),go({width:c,height:f,data:i},{width:c,height:f,data:l},o>>a),yo({width:c,height:f,data:l},{width:c,height:f,data:i},o>>a);var d=s(i);if(!Array.isArray(d)){var p=A(i);d=w(0,p,d),(d=g(0,Math.floor(p/d)*d,d)).shift()}return vo().thresholds(d).size([c,f])(i).map(h)}function h(t){return t.value*=Math.pow(2,-2*a),t.coordinates.forEach(d),t}function d(t){t.forEach(p)}function p(t){t.forEach(v)}function v(t){t[0]=t[0]*Math.pow(2,a)-u,t[1]=t[1]*Math.pow(2,a)-u}function y(){return c=r+2*(u=3*o)>>a,f=i+2*u>>a,l}return l.x=function(n){return arguments.length?(t="function"==typeof n?n:co(+n),l):t},l.y=function(t){return arguments.length?(n="function"==typeof t?t:co(+t),l):n},l.weight=function(t){return arguments.length?(e="function"==typeof t?t:co(+t),l):e},l.size=function(t){if(!arguments.length)return[r,i];var n=Math.ceil(t[0]),e=Math.ceil(t[1]);if(!(n>=0||n>=0))throw new Error("invalid size");return r=n,i=e,y()},l.cellSize=function(t){if(!arguments.length)return 1<<a;if(!((t=+t)>=1))throw new Error("invalid cell size");return a=Math.floor(Math.log(t)/Math.LN2),y()},l.thresholds=function(t){return arguments.length?(s="function"==typeof t?t:Array.isArray(t)?co(ao.call(t)):co(t),l):s},l.bandwidth=function(t){if(!arguments.length)return Math.sqrt(o*(o+1));if(!((t=+t)>=0))throw new Error("invalid bandwidth");return o=Math.round((Math.sqrt(4*t*t+1)-1)/2),y()},l},t.dispatch=I,t.drag=function(){var n,e,r,i,o=Gt,a=Vt,u=$t,c=Wt,f={},s=I("start","drag","end"),l=0,h=0;function d(t){t.on("mousedown.drag",p).filter(c).on("touchstart.drag",y).on("touchmove.drag",_).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(){if(!i&&o.apply(this,arguments)){var u=m("mouse",a.apply(this,arguments),Ot,this,arguments);u&&(zt(t.event.view).on("mousemove.drag",v,!0).on("mouseup.drag",g,!0),It(t.event.view),Yt(),r=!1,n=t.event.clientX,e=t.event.clientY,u("start"))}}function v(){if(Ft(),!r){var i=t.event.clientX-n,o=t.event.clientY-e;r=i*i+o*o>h}f.mouse("drag")}function g(){zt(t.event.view).on("mousemove.drag mouseup.drag",null),jt(t.event.view,r),Ft(),f.mouse("end")}function y(){if(o.apply(this,arguments)){var n,e,r=t.event.changedTouches,i=a.apply(this,arguments),u=r.length;for(n=0;n<u;++n)(e=m(r[n].identifier,i,Bt,this,arguments))&&(Yt(),e("start"))}}function _(){var n,e,r=t.event.changedTouches,i=r.length;for(n=0;n<i;++n)(e=f[r[n].identifier])&&(Ft(),e("drag"))}function b(){var n,e,r=t.event.changedTouches,o=r.length;for(i&&clearTimeout(i),i=setTimeout(function(){i=null},500),n=0;n<o;++n)(e=f[r[n].identifier])&&(Yt(),e("end"))}function m(n,e,r,i,o){var a,c,h,p=r(e,n),v=s.copy();if(St(new Xt(d,"beforestart",a,n,l,p[0],p[1],0,0,v),function(){return null!=(t.event.subject=a=u.apply(i,o))&&(c=a.x-p[0]||0,h=a.y-p[1]||0,!0)}))return function t(u){var s,g=p;switch(u){case"start":f[n]=t,s=l++;break;case"end":delete f[n],--l;case"drag":p=r(e,n),s=l}St(new Xt(d,u,a,n,s,p[0]+c,p[1]+h,p[0]-g[0],p[1]-g[1],v),v.apply,v,[u,i,o])}}return d.filter=function(t){return arguments.length?(o="function"==typeof t?t:Ht(!!t),d):o},d.container=function(t){return arguments.length?(a="function"==typeof t?t:Ht(t),d):a},d.subject=function(t){return arguments.length?(u="function"==typeof t?t:Ht(t),d):u},d.touchable=function(t){return arguments.length?(c="function"==typeof t?t:Ht(!!t),d):c},d.on=function(){var t=s.on.apply(s,arguments);return t===s?d:t},d.clickDistance=function(t){return arguments.length?(h=(t=+t)*t,d):Math.sqrt(h)},d},t.dragDisable=It,t.dragEnable=jt,t.dsvFormat=Co,t.csvParse=zo,t.csvParseRows=Ro,t.csvFormat=Do,t.csvFormatBody=qo,t.csvFormatRows=Lo,t.tsvParse=Oo,t.tsvParseRows=Bo,t.tsvFormat=Yo,t.tsvFormatBody=Fo,t.tsvFormatRows=Io,t.autoType=function(t){for(var n in t){var e,r=t[n].trim();if(r)if("true"===r)r=!0;else if("false"===r)r=!1;else if("NaN"===r)r=NaN;else if(isNaN(e=+r)){if(!/^([-+]\d{2})?\d{4}(-\d{2}(-\d{2})?)?(T\d{2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|[-+]\d{2}:\d{2})?)?$/.test(r))continue;r=new Date(r)}else r=e;else r=null;t[n]=r}return t},t.easeLinear=function(t){return+t},t.easeQuad=Dr,t.easeQuadIn=function(t){return t*t},t.easeQuadOut=function(t){return t*(2-t)},t.easeQuadInOut=Dr,t.easeCubic=qr,t.easeCubicIn=function(t){return t*t*t},t.easeCubicOut=function(t){return--t*t*t+1},t.easeCubicInOut=qr,t.easePoly=Or,t.easePolyIn=Lr,t.easePolyOut=Ur,t.easePolyInOut=Or,t.easeSin=Fr,t.easeSinIn=function(t){return 1-Math.cos(t*Yr)},t.easeSinOut=function(t){return Math.sin(t*Yr)},t.easeSinInOut=Fr,t.easeExp=Ir,t.easeExpIn=function(t){return Math.pow(2,10*t-10)},t.easeExpOut=function(t){return 1-Math.pow(2,-10*t)},t.easeExpInOut=Ir,t.easeCircle=jr,t.easeCircleIn=function(t){return 1-Math.sqrt(1-t*t)},t.easeCircleOut=function(t){return Math.sqrt(1- --t*t)},t.easeCircleInOut=jr,t.easeBounce=ti,t.easeBounceIn=function(t){return 1-ti(1-t)},t.easeBounceOut=ti,t.easeBounceInOut=function(t){return((t*=2)<=1?1-ti(1-t):ti(t-1)+1)/2},t.easeBack=ri,t.easeBackIn=ni,t.easeBackOut=ei,t.easeBackInOut=ri,t.easeElastic=ai,t.easeElasticIn=oi,t.easeElasticOut=ai,t.easeElasticInOut=ui,t.blob=function(t,n){return fetch(t,n).then(jo)},t.buffer=function(t,n){return fetch(t,n).then(Ho)},t.dsv=function(t,n,e,r){3===arguments.length&&"function"==typeof e&&(r=e,e=void 0);var i=Co(t);return Go(n,e).then(function(t){return i.parse(t,r)})},t.csv=$o,t.tsv=Wo,t.image=function(t,n){return new Promise(function(e,r){var i=new Image;for(var o in n)i[o]=n[o];i.onerror=r,i.onload=function(){e(i)},i.src=t})},t.json=function(t,n){return fetch(t,n).then(Zo)},t.text=Go,t.xml=Jo,t.html=Ko,t.svg=ta,t.forceCenter=function(t,n){var e;function r(){var r,i,o=e.length,a=0,u=0;for(r=0;r<o;++r)a+=(i=e[r]).x,u+=i.y;for(a=a/o-t,u=u/o-n,r=0;r<o;++r)(i=e[r]).x-=a,i.y-=u}return null==t&&(t=0),null==n&&(n=0),r.initialize=function(t){e=t},r.x=function(n){return arguments.length?(t=+n,r):t},r.y=function(t){return arguments.length?(n=+t,r):n},r},t.forceCollide=function(t){var n,e,r=1,i=1;function o(){for(var t,o,u,c,f,s,l,h=n.length,d=0;d<i;++d)for(o=ua(n,la,ha).visitAfter(a),t=0;t<h;++t)u=n[t],s=e[u.index],l=s*s,c=u.x+u.vx,f=u.y+u.vy,o.visit(p);function p(t,n,e,i,o){var a=t.data,h=t.r,d=s+h;if(!a)return n>c+d||i<c-d||e>f+d||o<f-d;if(a.index>u.index){var p=c-a.x-a.vx,v=f-a.y-a.vy,g=p*p+v*v;g<d*d&&(0===p&&(g+=(p=ea())*p),0===v&&(g+=(v=ea())*v),g=(d-(g=Math.sqrt(g)))/g*r,u.vx+=(p*=g)*(d=(h*=h)/(l+h)),u.vy+=(v*=g)*d,a.vx-=p*(d=1-d),a.vy-=v*d)}}}function a(t){if(t.data)return t.r=e[t.data.index];for(var n=t.r=0;n<4;++n)t[n]&&t[n].r>t.r&&(t.r=t[n].r)}function u(){if(n){var r,i,o=n.length;for(e=new Array(o),r=0;r<o;++r)i=n[r],e[i.index]=+t(i,r,n)}}return"function"!=typeof t&&(t=na(null==t?1:+t)),o.initialize=function(t){n=t,u()},o.iterations=function(t){return arguments.length?(i=+t,o):i},o.strength=function(t){return arguments.length?(r=+t,o):r},o.radius=function(n){return arguments.length?(t="function"==typeof n?n:na(+n),u(),o):t},o},t.forceLink=function(t){var n,e,r,i,o,a=da,u=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},c=na(30),f=1;function s(r){for(var i=0,a=t.length;i<f;++i)for(var u,c,s,l,h,d,p,v=0;v<a;++v)c=(u=t[v]).source,l=(s=u.target).x+s.vx-c.x-c.vx||ea(),h=s.y+s.vy-c.y-c.vy||ea(),l*=d=((d=Math.sqrt(l*l+h*h))-e[v])/d*r*n[v],h*=d,s.vx-=l*(p=o[v]),s.vy-=h*p,c.vx+=l*(p=1-p),c.vy+=h*p}function l(){if(r){var u,c,f=r.length,s=t.length,l=Ji(r,a);for(u=0,i=new Array(f);u<s;++u)(c=t[u]).index=u,"object"!=typeof c.source&&(c.source=pa(l,c.source)),"object"!=typeof c.target&&(c.target=pa(l,c.target)),i[c.source.index]=(i[c.source.index]||0)+1,i[c.target.index]=(i[c.target.index]||0)+1;for(u=0,o=new Array(s);u<s;++u)c=t[u],o[u]=i[c.source.index]/(i[c.source.index]+i[c.target.index]);n=new Array(s),h(),e=new Array(s),d()}}function h(){if(r)for(var e=0,i=t.length;e<i;++e)n[e]=+u(t[e],e,t)}function d(){if(r)for(var n=0,i=t.length;n<i;++n)e[n]=+c(t[n],n,t)}return null==t&&(t=[]),s.initialize=function(t){r=t,l()},s.links=function(n){return arguments.length?(t=n,l(),s):t},s.id=function(t){return arguments.length?(a=t,s):a},s.iterations=function(t){return arguments.length?(f=+t,s):f},s.strength=function(t){return arguments.length?(u="function"==typeof t?t:na(+t),h(),s):u},s.distance=function(t){return arguments.length?(c="function"==typeof t?t:na(+t),d(),s):c},s},t.forceManyBody=function(){var t,n,e,r,i=na(-30),o=1,a=1/0,u=.81;function c(r){var i,o=t.length,a=ua(t,va,ga).visitAfter(s);for(e=r,i=0;i<o;++i)n=t[i],a.visit(l)}function f(){if(t){var n,e,o=t.length;for(r=new Array(o),n=0;n<o;++n)e=t[n],r[e.index]=+i(e,n,t)}}function s(t){var n,e,i,o,a,u=0,c=0;if(t.length){for(i=o=a=0;a<4;++a)(n=t[a])&&(e=Math.abs(n.value))&&(u+=n.value,c+=e,i+=e*n.x,o+=e*n.y);t.x=i/c,t.y=o/c}else{(n=t).x=n.data.x,n.y=n.data.y;do{u+=r[n.data.index]}while(n=n.next)}t.value=u}function l(t,i,c,f){if(!t.value)return!0;var s=t.x-n.x,l=t.y-n.y,h=f-i,d=s*s+l*l;if(h*h/u<d)return d<a&&(0===s&&(d+=(s=ea())*s),0===l&&(d+=(l=ea())*l),d<o&&(d=Math.sqrt(o*d)),n.vx+=s*t.value*e/d,n.vy+=l*t.value*e/d),!0;if(!(t.length||d>=a)){(t.data!==n||t.next)&&(0===s&&(d+=(s=ea())*s),0===l&&(d+=(l=ea())*l),d<o&&(d=Math.sqrt(o*d)));do{t.data!==n&&(h=r[t.data.index]*e/d,n.vx+=s*h,n.vy+=l*h)}while(t=t.next)}}return c.initialize=function(n){t=n,f()},c.strength=function(t){return arguments.length?(i="function"==typeof t?t:na(+t),f(),c):i},c.distanceMin=function(t){return arguments.length?(o=t*t,c):Math.sqrt(o)},c.distanceMax=function(t){return arguments.length?(a=t*t,c):Math.sqrt(a)},c.theta=function(t){return arguments.length?(u=t*t,c):Math.sqrt(u)},c},t.forceRadial=function(t,n,e){var r,i,o,a=na(.1);function u(t){for(var a=0,u=r.length;a<u;++a){var c=r[a],f=c.x-n||1e-6,s=c.y-e||1e-6,l=Math.sqrt(f*f+s*s),h=(o[a]-l)*i[a]*t/l;c.vx+=f*h,c.vy+=s*h}}function c(){if(r){var n,e=r.length;for(i=new Array(e),o=new Array(e),n=0;n<e;++n)o[n]=+t(r[n],n,r),i[n]=isNaN(o[n])?0:+a(r[n],n,r)}}return"function"!=typeof t&&(t=na(+t)),null==n&&(n=0),null==e&&(e=0),u.initialize=function(t){r=t,c()},u.strength=function(t){return arguments.length?(a="function"==typeof t?t:na(+t),c(),u):a},u.radius=function(n){return arguments.length?(t="function"==typeof n?n:na(+n),c(),u):t},u.x=function(t){return arguments.length?(n=+t,u):n},u.y=function(t){return arguments.length?(e=+t,u):e},u},t.forceSimulation=function(t){var n,e=1,r=.001,i=1-Math.pow(r,1/300),o=0,a=.6,u=Ji(),c=or(s),f=I("tick","end");function s(){l(),f.call("tick",n),e<r&&(c.stop(),f.call("end",n))}function l(r){var c,f,s=t.length;void 0===r&&(r=1);for(var l=0;l<r;++l)for(e+=(o-e)*i,u.each(function(t){t(e)}),c=0;c<s;++c)null==(f=t[c]).fx?f.x+=f.vx*=a:(f.x=f.fx,f.vx=0),null==f.fy?f.y+=f.vy*=a:(f.y=f.fy,f.vy=0);return n}function h(){for(var n,e=0,r=t.length;e<r;++e){if((n=t[e]).index=e,null!=n.fx&&(n.x=n.fx),null!=n.fy&&(n.y=n.fy),isNaN(n.x)||isNaN(n.y)){var i=ya*Math.sqrt(e),o=e*_a;n.x=i*Math.cos(o),n.y=i*Math.sin(o)}(isNaN(n.vx)||isNaN(n.vy))&&(n.vx=n.vy=0)}}function d(n){return n.initialize&&n.initialize(t),n}return null==t&&(t=[]),h(),n={tick:l,restart:function(){return c.restart(s),n},stop:function(){return c.stop(),n},nodes:function(e){return arguments.length?(t=e,h(),u.each(d),n):t},alpha:function(t){return arguments.length?(e=+t,n):e},alphaMin:function(t){return arguments.length?(r=+t,n):r},alphaDecay:function(t){return arguments.length?(i=+t,n):+i},alphaTarget:function(t){return arguments.length?(o=+t,n):o},velocityDecay:function(t){return arguments.length?(a=1-t,n):1-a},force:function(t,e){return arguments.length>1?(null==e?u.remove(t):u.set(t,d(e)),n):u.get(t)},find:function(n,e,r){var i,o,a,u,c,f=0,s=t.length;for(null==r?r=1/0:r*=r,f=0;f<s;++f)(a=(i=n-(u=t[f]).x)*i+(o=e-u.y)*o)<r&&(c=u,r=a);return c},on:function(t,e){return arguments.length>1?(f.on(t,e),n):f.on(t)}}},t.forceX=function(t){var n,e,r,i=na(.1);function o(t){for(var i,o=0,a=n.length;o<a;++o)(i=n[o]).vx+=(r[o]-i.x)*e[o]*t}function a(){if(n){var o,a=n.length;for(e=new Array(a),r=new Array(a),o=0;o<a;++o)e[o]=isNaN(r[o]=+t(n[o],o,n))?0:+i(n[o],o,n)}}return"function"!=typeof t&&(t=na(null==t?0:+t)),o.initialize=function(t){n=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:na(+t),a(),o):i},o.x=function(n){return arguments.length?(t="function"==typeof n?n:na(+n),a(),o):t},o},t.forceY=function(t){var n,e,r,i=na(.1);function o(t){for(var i,o=0,a=n.length;o<a;++o)(i=n[o]).vy+=(r[o]-i.y)*e[o]*t}function a(){if(n){var o,a=n.length;for(e=new Array(a),r=new Array(a),o=0;o<a;++o)e[o]=isNaN(r[o]=+t(n[o],o,n))?0:+i(n[o],o,n)}}return"function"!=typeof t&&(t=na(null==t?0:+t)),o.initialize=function(t){n=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:na(+t),a(),o):i},o.y=function(n){return arguments.length?(t="function"==typeof n?n:na(+n),a(),o):t},o},t.formatDefaultLocale=Pa,t.formatLocale=Ca,t.formatSpecifier=Ma,t.precisionFixed=za,t.precisionPrefix=Ra,t.precisionRound=Da,t.geoArea=function(t){return xu.reset(),pu(t,wu),2*xu},t.geoBounds=function(t){var n,e,r,i,o,a,u;if(Uu=Lu=-(Du=qu=1/0),Iu=[],pu(t,uc),e=Iu.length){for(Iu.sort(gc),n=1,o=[r=Iu[0]];n<e;++n)yc(r,(i=Iu[n])[0])||yc(r,i[1])?(vc(r[0],i[1])>vc(r[0],r[1])&&(r[1]=i[1]),vc(i[0],r[1])>vc(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,n=0,r=o[e=o.length-1];n<=e;r=i,++n)i=o[n],(u=vc(r[1],i[0]))>a&&(a=u,Du=i[0],Lu=r[1])}return Iu=ju=null,Du===1/0||qu===1/0?[[NaN,NaN],[NaN,NaN]]:[[Du,qu],[Lu,Uu]]},t.geoCentroid=function(t){Hu=Xu=Gu=Vu=$u=Wu=Zu=Qu=Ju=Ku=tc=0,pu(t,_c);var n=Ju,e=Ku,r=tc,i=n*n+e*e+r*r;return i<Ya&&(n=Wu,e=Zu,r=Qu,Xu<Ba&&(n=Gu,e=Vu,r=$u),(i=n*n+e*e+r*r)<Ya)?[NaN,NaN]:[Wa(e,n)*Xa,au(r/ru(i))*Xa]},t.geoCircle=function(){var t,n,e=Ec([0,0]),r=Ec(90),i=Ec(6),o={point:function(e,r){t.push(e=n(e,r)),e[0]*=Xa,e[1]*=Xa}};function a(){var a=e.apply(this,arguments),u=r.apply(this,arguments)*Ga,c=i.apply(this,arguments)*Ga;return t=[],n=zc(-a[0]*Ga,-a[1]*Ga,0).invert,Uc(o,u,c,1),a={type:"Polygon",coordinates:[t]},t=n=null,a}return a.center=function(t){return arguments.length?(e="function"==typeof t?t:Ec([+t[0],+t[1]]),a):e},a.radius=function(t){return arguments.length?(r="function"==typeof t?t:Ec(+t),a):r},a.precision=function(t){return arguments.length?(i="function"==typeof t?t:Ec(+t),a):i},a},t.geoClipAntimeridian=Zc,t.geoClipCircle=Qc,t.geoClipExtent=function(){var t,n,e,r=0,i=0,o=960,a=500;return e={stream:function(e){return t&&n===e?t:t=tf(r,i,o,a)(n=e)},extent:function(u){return arguments.length?(r=+u[0][0],i=+u[0][1],o=+u[1][0],a=+u[1][1],t=n=null,e):[[r,i],[o,a]]}}},t.geoClipRectangle=tf,t.geoContains=function(t,n){return(t&&pf.hasOwnProperty(t.type)?pf[t.type]:gf)(t,n)},t.geoDistance=df,t.geoGraticule=Nf,t.geoGraticule10=function(){return Nf()()},t.geoInterpolate=function(t,n){var e=t[0]*Ga,r=t[1]*Ga,i=n[0]*Ga,o=n[1]*Ga,a=Za(r),u=nu(r),c=Za(o),f=nu(o),s=a*Za(e),l=a*nu(e),h=c*Za(i),d=c*nu(i),p=2*au(ru(uu(o-r)+a*c*uu(i-e))),v=nu(p),g=p?function(t){var n=nu(t*=p)/v,e=nu(p-t)/v,r=e*s+n*h,i=e*l+n*d,o=e*u+n*f;return[Wa(i,r)*Xa,Wa(o,ru(r*r+i*i))*Xa]}:function(){return[e*Xa,r*Xa]};return g.distance=p,g},t.geoLength=sf,t.geoPath=function(t,n){var e,r,i=4.5;function o(t){return t&&("function"==typeof i&&r.pointRadius(+i.apply(this,arguments)),pu(t,e(r))),r.result()}return o.area=function(t){return pu(t,e(zf)),zf.result()},o.measure=function(t){return pu(t,e(_s)),_s.result()},o.bounds=function(t){return pu(t,e(Ff)),Ff.result()},o.centroid=function(t){return pu(t,e(ns)),ns.result()},o.projection=function(n){return arguments.length?(e=null==n?(t=null,Af):(t=n).stream,o):t},o.context=function(t){return arguments.length?(r=null==t?(n=null,new xs):new ls(n=t),"function"!=typeof i&&r.pointRadius(i),o):n},o.pointRadius=function(t){return arguments.length?(i="function"==typeof t?t:(r.pointRadius(+t),+t),o):i},o.projection(t).context(n)},t.geoAlbers=Ys,t.geoAlbersUsa=function(){var t,n,e,r,i,o,a=Ys(),u=Bs().rotate([154,0]).center([-2,58.5]).parallels([55,65]),c=Bs().rotate([157,0]).center([-3,19.9]).parallels([8,18]),f={point:function(t,n){o=[t,n]}};function s(t){var n=t[0],a=t[1];return o=null,e.point(n,a),o||(r.point(n,a),o)||(i.point(n,a),o)}function l(){return t=n=null,s}return s.invert=function(t){var n=a.scale(),e=a.translate(),r=(t[0]-e[0])/n,i=(t[1]-e[1])/n;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?u:i>=.166&&i<.234&&r>=-.214&&r<-.115?c:a).invert(t)},s.stream=function(e){return t&&n===e?t:(r=[a.stream(n=e),u.stream(e),c.stream(e)],i=r.length,t={point:function(t,n){for(var e=-1;++e<i;)r[e].point(t,n)},sphere:function(){for(var t=-1;++t<i;)r[t].sphere()},lineStart:function(){for(var t=-1;++t<i;)r[t].lineStart()},lineEnd:function(){for(var t=-1;++t<i;)r[t].lineEnd()},polygonStart:function(){for(var t=-1;++t<i;)r[t].polygonStart()},polygonEnd:function(){for(var t=-1;++t<i;)r[t].polygonEnd()}});var r,i},s.precision=function(t){return arguments.length?(a.precision(t),u.precision(t),c.precision(t),l()):a.precision()},s.scale=function(t){return arguments.length?(a.scale(t),u.scale(.35*t),c.scale(t),s.translate(a.translate())):a.scale()},s.translate=function(t){if(!arguments.length)return a.translate();var n=a.scale(),o=+t[0],s=+t[1];return e=a.translate(t).clipExtent([[o-.455*n,s-.238*n],[o+.455*n,s+.238*n]]).stream(f),r=u.translate([o-.307*n,s+.201*n]).clipExtent([[o-.425*n+Ba,s+.12*n+Ba],[o-.214*n-Ba,s+.234*n-Ba]]).stream(f),i=c.translate([o-.205*n,s+.212*n]).clipExtent([[o-.214*n+Ba,s+.166*n+Ba],[o-.115*n-Ba,s+.234*n-Ba]]).stream(f),l()},s.fitExtent=function(t,n){return Ts(s,t,n)},s.fitSize=function(t,n){return Ss(s,t,n)},s.fitWidth=function(t,n){return ks(s,t,n)},s.fitHeight=function(t,n){return Es(s,t,n)},s.scale(1070)},t.geoAzimuthalEqualArea=function(){return qs(js).scale(124.75).clipAngle(179.999)},t.geoAzimuthalEqualAreaRaw=js,t.geoAzimuthalEquidistant=function(){return qs(Hs).scale(79.4188).clipAngle(179.999)},t.geoAzimuthalEquidistantRaw=Hs,t.geoConicConformal=function(){return Us($s).scale(109.5).parallels([30,30])},t.geoConicConformalRaw=$s,t.geoConicEqualArea=Bs,t.geoConicEqualAreaRaw=Os,t.geoConicEquidistant=function(){return Us(Zs).scale(131.154).center([0,13.9389])},t.geoConicEquidistantRaw=Zs,t.geoEqualEarth=function(){return qs(el).scale(177.158)},t.geoEqualEarthRaw=el,t.geoEquirectangular=function(){return qs(Ws).scale(152.63)},t.geoEquirectangularRaw=Ws,t.geoGnomonic=function(){return qs(rl).scale(144.049).clipAngle(60)},t.geoGnomonicRaw=rl,t.geoIdentity=function(){var t,n,e,r,i,o,a=1,u=0,c=0,f=1,s=1,l=Af,h=null,d=Af;function p(){return r=i=null,o}return o={stream:function(t){return r&&i===t?r:r=l(d(i=t))},postclip:function(r){return arguments.length?(d=r,h=t=n=e=null,p()):d},clipExtent:function(r){return arguments.length?(d=null==r?(h=t=n=e=null,Af):tf(h=+r[0][0],t=+r[0][1],n=+r[1][0],e=+r[1][1]),p()):null==h?null:[[h,t],[n,e]]},scale:function(t){return arguments.length?(l=il((a=+t)*f,a*s,u,c),p()):a},translate:function(t){return arguments.length?(l=il(a*f,a*s,u=+t[0],c=+t[1]),p()):[u,c]},reflectX:function(t){return arguments.length?(l=il(a*(f=t?-1:1),a*s,u,c),p()):f<0},reflectY:function(t){return arguments.length?(l=il(a*f,a*(s=t?-1:1),u,c),p()):s<0},fitExtent:function(t,n){return Ts(o,t,n)},fitSize:function(t,n){return Ss(o,t,n)},fitWidth:function(t,n){return ks(o,t,n)},fitHeight:function(t,n){return Es(o,t,n)}}},t.geoProjection=qs,t.geoProjectionMutator=Ls,t.geoMercator=function(){return Gs(Xs).scale(961/Ha)},t.geoMercatorRaw=Xs,t.geoNaturalEarth1=function(){return qs(ol).scale(175.295)},t.geoNaturalEarth1Raw=ol,t.geoOrthographic=function(){return qs(al).scale(249.5).clipAngle(90+Ba)},t.geoOrthographicRaw=al,t.geoStereographic=function(){return qs(ul).scale(250).clipAngle(142)},t.geoStereographicRaw=ul,t.geoTransverseMercator=function(){var t=Gs(cl),n=t.center,e=t.rotate;return t.center=function(t){return arguments.length?n([-t[1],t[0]]):[(t=n())[1],-t[0]]},t.rotate=function(t){return arguments.length?e([t[0],t[1],t.length>2?t[2]+90:90]):[(t=e())[0],t[1],t[2]-90]},e([0,0,90]).scale(159.155)},t.geoTransverseMercatorRaw=cl,t.geoRotation=Lc,t.geoStream=pu,t.geoTransform=function(t){return{stream:Ms(t)}},t.cluster=function(){var t=fl,n=1,e=1,r=!1;function i(i){var o,a=0;i.eachAfter(function(n){var e=n.children;e?(n.x=function(t){return t.reduce(sl,0)/t.length}(e),n.y=function(t){return 1+t.reduce(ll,0)}(e)):(n.x=o?a+=t(n,o):0,n.y=0,o=n)});var u=function(t){for(var n;n=t.children;)t=n[0];return t}(i),c=function(t){for(var n;n=t.children;)t=n[n.length-1];return t}(i),f=u.x-t(u,c)/2,s=c.x+t(c,u)/2;return i.eachAfter(r?function(t){t.x=(t.x-i.x)*n,t.y=(i.y-t.y)*e}:function(t){t.x=(t.x-f)/(s-f)*n,t.y=(1-(i.y?t.y/i.y:1))*e})}return i.separation=function(n){return arguments.length?(t=n,i):t},i.size=function(t){return arguments.length?(r=!1,n=+t[0],e=+t[1],i):r?null:[n,e]},i.nodeSize=function(t){return arguments.length?(r=!0,n=+t[0],e=+t[1],i):r?[n,e]:null},i},t.hierarchy=dl,t.pack=function(){var t=null,n=1,e=1,r=Rl;function i(i){return i.x=n/2,i.y=e/2,t?i.eachBefore(Ll(t)).eachAfter(Ul(r,.5)).eachBefore(Ol(1)):i.eachBefore(Ll(ql)).eachAfter(Ul(Rl,1)).eachAfter(Ul(r,i.r/Math.min(n,e))).eachBefore(Ol(Math.min(n,e)/(2*i.r))),i}return i.radius=function(n){return arguments.length?(t=null==(e=n)?null:zl(e),i):t;var e},i.size=function(t){return arguments.length?(n=+t[0],e=+t[1],i):[n,e]},i.padding=function(t){return arguments.length?(r="function"==typeof t?t:Dl(+t),i):r},i},t.packSiblings=function(t){return Pl(t),t},t.packEnclose=bl,t.partition=function(){var t=1,n=1,e=0,r=!1;function i(i){var o=i.height+1;return i.x0=i.y0=e,i.x1=t,i.y1=n/o,i.eachBefore(function(t,n){return function(r){r.children&&Yl(r,r.x0,t*(r.depth+1)/n,r.x1,t*(r.depth+2)/n);var i=r.x0,o=r.y0,a=r.x1-e,u=r.y1-e;a<i&&(i=a=(i+a)/2),u<o&&(o=u=(o+u)/2),r.x0=i,r.y0=o,r.x1=a,r.y1=u}}(n,o)),r&&i.eachBefore(Bl),i}return i.round=function(t){return arguments.length?(r=!!t,i):r},i.size=function(e){return arguments.length?(t=+e[0],n=+e[1],i):[t,n]},i.padding=function(t){return arguments.length?(e=+t,i):e},i},t.stratify=function(){var t=Hl,n=Xl;function e(e){var r,i,o,a,u,c,f,s=e.length,l=new Array(s),h={};for(i=0;i<s;++i)r=e[i],u=l[i]=new yl(r),null!=(c=t(r,i,e))&&(c+="")&&(h[f=Fl+(u.id=c)]=f in h?jl:u);for(i=0;i<s;++i)if(u=l[i],null!=(c=n(e[i],i,e))&&(c+="")){if(!(a=h[Fl+c]))throw new Error("missing: "+c);if(a===jl)throw new Error("ambiguous: "+c);a.children?a.children.push(u):a.children=[u],u.parent=a}else{if(o)throw new Error("multiple roots");o=u}if(!o)throw new Error("no root");if(o.parent=Il,o.eachBefore(function(t){t.depth=t.parent.depth+1,--s}).eachBefore(gl),o.parent=null,s>0)throw new Error("cycle");return o}return e.id=function(n){return arguments.length?(t=zl(n),e):t},e.parentId=function(t){return arguments.length?(n=zl(t),e):n},e},t.tree=function(){var t=Gl,n=1,e=1,r=null;function i(i){var c=function(t){for(var n,e,r,i,o,a=new Ql(t,0),u=[a];n=u.pop();)if(r=n._.children)for(n.children=new Array(o=r.length),i=o-1;i>=0;--i)u.push(e=n.children[i]=new Ql(r[i],i)),e.parent=n;return(a.parent=new Ql(null,0)).children=[a],a}(i);if(c.eachAfter(o),c.parent.m=-c.z,c.eachBefore(a),r)i.eachBefore(u);else{var f=i,s=i,l=i;i.eachBefore(function(t){t.x<f.x&&(f=t),t.x>s.x&&(s=t),t.depth>l.depth&&(l=t)});var h=f===s?1:t(f,s)/2,d=h-f.x,p=n/(s.x+h+d),v=e/(l.depth||1);i.eachBefore(function(t){t.x=(t.x+d)*p,t.y=t.depth*v})}return i}function o(n){var e=n.children,r=n.parent.children,i=n.i?r[n.i-1]:null;if(e){!function(t){for(var n,e=0,r=0,i=t.children,o=i.length;--o>=0;)(n=i[o]).z+=e,n.m+=e,e+=n.s+(r+=n.c)}(n);var o=(e[0].z+e[e.length-1].z)/2;i?(n.z=i.z+t(n._,i._),n.m=n.z-o):n.z=o}else i&&(n.z=i.z+t(n._,i._));n.parent.A=function(n,e,r){if(e){for(var i,o=n,a=n,u=e,c=o.parent.children[0],f=o.m,s=a.m,l=u.m,h=c.m;u=$l(u),o=Vl(o),u&&o;)c=Vl(c),(a=$l(a)).a=n,(i=u.z+l-o.z-f+t(u._,o._))>0&&(Wl(Zl(u,n,r),n,i),f+=i,s+=i),l+=u.m,f+=o.m,h+=c.m,s+=a.m;u&&!$l(a)&&(a.t=u,a.m+=l-s),o&&!Vl(c)&&(c.t=o,c.m+=f-h,r=n)}return r}(n,i,n.parent.A||r[0])}function a(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function u(t){t.x*=n,t.y=t.depth*e}return i.separation=function(n){return arguments.length?(t=n,i):t},i.size=function(t){return arguments.length?(r=!1,n=+t[0],e=+t[1],i):r?null:[n,e]},i.nodeSize=function(t){return arguments.length?(r=!0,n=+t[0],e=+t[1],i):r?[n,e]:null},i},t.treemap=function(){var t=nh,n=!1,e=1,r=1,i=[0],o=Rl,a=Rl,u=Rl,c=Rl,f=Rl;function s(t){return t.x0=t.y0=0,t.x1=e,t.y1=r,t.eachBefore(l),i=[0],n&&t.eachBefore(Bl),t}function l(n){var e=i[n.depth],r=n.x0+e,s=n.y0+e,l=n.x1-e,h=n.y1-e;l<r&&(r=l=(r+l)/2),h<s&&(s=h=(s+h)/2),n.x0=r,n.y0=s,n.x1=l,n.y1=h,n.children&&(e=i[n.depth+1]=o(n)/2,r+=f(n)-e,s+=a(n)-e,(l-=u(n)-e)<r&&(r=l=(r+l)/2),(h-=c(n)-e)<s&&(s=h=(s+h)/2),t(n,r,s,l,h))}return s.round=function(t){return arguments.length?(n=!!t,s):n},s.size=function(t){return arguments.length?(e=+t[0],r=+t[1],s):[e,r]},s.tile=function(n){return arguments.length?(t=zl(n),s):t},s.padding=function(t){return arguments.length?s.paddingInner(t).paddingOuter(t):s.paddingInner()},s.paddingInner=function(t){return arguments.length?(o="function"==typeof t?t:Dl(+t),s):o},s.paddingOuter=function(t){return arguments.length?s.paddingTop(t).paddingRight(t).paddingBottom(t).paddingLeft(t):s.paddingTop()},s.paddingTop=function(t){return arguments.length?(a="function"==typeof t?t:Dl(+t),s):a},s.paddingRight=function(t){return arguments.length?(u="function"==typeof t?t:Dl(+t),s):u},s.paddingBottom=function(t){return arguments.length?(c="function"==typeof t?t:Dl(+t),s):c},s.paddingLeft=function(t){return arguments.length?(f="function"==typeof t?t:Dl(+t),s):f},s},t.treemapBinary=function(t,n,e,r,i){var o,a,u=t.children,c=u.length,f=new Array(c+1);for(f[0]=a=o=0;o<c;++o)f[o+1]=a+=u[o].value;!function t(n,e,r,i,o,a,c){if(n>=e-1){var s=u[n];return s.x0=i,s.y0=o,s.x1=a,void(s.y1=c)}for(var l=f[n],h=r/2+l,d=n+1,p=e-1;d<p;){var v=d+p>>>1;f[v]<h?d=v+1:p=v}h-f[d-1]<f[d]-h&&n+1<d&&--d;var g=f[d]-l,y=r-g;if(a-i>c-o){var _=(i*y+a*g)/r;t(n,d,g,i,o,_,c),t(d,e,y,_,o,a,c)}else{var b=(o*y+c*g)/r;t(n,d,g,i,o,a,b),t(d,e,y,i,b,a,c)}}(0,c,t.value,n,e,r,i)},t.treemapDice=Yl,t.treemapSlice=Jl,t.treemapSliceDice=function(t,n,e,r,i){(1&t.depth?Jl:Yl)(t,n,e,r,i)},t.treemapSquarify=nh,t.treemapResquarify=eh,t.interpolate=_e,t.interpolateArray=le,t.interpolateBasis=te,t.interpolateBasisClosed=ne,t.interpolateDate=he,t.interpolateDiscrete=function(t){var n=t.length;return function(e){return t[Math.max(0,Math.min(n-1,Math.floor(e*n)))]}},t.interpolateHue=function(t,n){var e=ie(+t,+n);return function(t){var n=e(t);return n-360*Math.floor(n/360)}},t.interpolateNumber=de,t.interpolateObject=pe,t.interpolateRound=be,t.interpolateString=ye,t.interpolateTransformCss=ke,t.interpolateTransformSvg=Ee,t.interpolateZoom=qe,t.interpolateRgb=ue,t.interpolateRgbBasis=fe,t.interpolateRgbBasisClosed=se,t.interpolateHsl=Ue,t.interpolateHslLong=Oe,t.interpolateLab=function(t,n){var e=ae((t=Rn(t)).l,(n=Rn(n)).l),r=ae(t.a,n.a),i=ae(t.b,n.b),o=ae(t.opacity,n.opacity);return function(n){return t.l=e(n),t.a=r(n),t.b=i(n),t.opacity=o(n),t+""}},t.interpolateHcl=Ye,t.interpolateHclLong=Fe,t.interpolateCubehelix=je,t.interpolateCubehelixLong=He,t.piecewise=function(t,n){for(var e=0,r=n.length-1,i=n[0],o=new Array(r<0?0:r);e<r;)o[e]=t(i,i=n[++e]);return function(t){var n=Math.max(0,Math.min(r-1,Math.floor(t*=r)));return o[n](t-n)}},t.quantize=function(t,n){for(var e=new Array(n),r=0;r<n;++r)e[r]=t(r/(n-1));return e},t.path=Xi,t.polygonArea=function(t){for(var n,e=-1,r=t.length,i=t[r-1],o=0;++e<r;)n=i,i=t[e],o+=n[1]*i[0]-n[0]*i[1];return o/2},t.polygonCentroid=function(t){for(var n,e,r=-1,i=t.length,o=0,a=0,u=t[i-1],c=0;++r<i;)n=u,u=t[r],c+=e=n[0]*u[1]-u[0]*n[1],o+=(n[0]+u[0])*e,a+=(n[1]+u[1])*e;return[o/(c*=3),a/c]},t.polygonHull=function(t){if((e=t.length)<3)return null;var n,e,r=new Array(e),i=new Array(e);for(n=0;n<e;++n)r[n]=[+t[n][0],+t[n][1],n];for(r.sort(rh),n=0;n<e;++n)i[n]=[r[n][0],-r[n][1]];var o=ih(r),a=ih(i),u=a[0]===o[0],c=a[a.length-1]===o[o.length-1],f=[];for(n=o.length-1;n>=0;--n)f.push(t[r[o[n]][2]]);for(n=+u;n<a.length-c;++n)f.push(t[r[a[n]][2]]);return f},t.polygonContains=function(t,n){for(var e,r,i=t.length,o=t[i-1],a=n[0],u=n[1],c=o[0],f=o[1],s=!1,l=0;l<i;++l)e=(o=t[l])[0],(r=o[1])>u!=f>u&&a<(c-e)*(u-r)/(f-r)+e&&(s=!s),c=e,f=r;return s},t.polygonLength=function(t){for(var n,e,r=-1,i=t.length,o=t[i-1],a=o[0],u=o[1],c=0;++r<i;)n=a,e=u,n-=a=(o=t[r])[0],e-=u=o[1],c+=Math.sqrt(n*n+e*e);return c},t.quadtree=ua,t.randomUniform=ah,t.randomNormal=uh,t.randomLogNormal=ch,t.randomBates=sh,t.randomIrwinHall=fh,t.randomExponential=lh,t.scaleBand=bh,t.scalePoint=function(){return function t(n){var e=n.copy;return n.padding=n.paddingOuter,delete n.paddingInner,delete n.paddingOuter,n.copy=function(){return t(e())},n}(bh.apply(null,arguments).paddingInner(1))},t.scaleIdentity=function t(n){var e;function r(t){return isNaN(t=+t)?e:t}return r.invert=r,r.domain=r.range=function(t){return arguments.length?(n=vh.call(t,mh),r):n.slice()},r.unknown=function(t){return arguments.length?(e=t,r):e},r.copy=function(){return t(n).unknown(e)},n=arguments.length?vh.call(n,mh):[0,1],Ph(r)},t.scaleLinear=function t(){var n=Eh(wh,wh);return n.copy=function(){return Sh(n,t())},hh.apply(n,arguments),Ph(n)},t.scaleLog=function t(){var n=Bh(kh()).domain([1,10]);return n.copy=function(){return Sh(n,t()).base(n.base())},hh.apply(n,arguments),n},t.scaleSymlog=function t(){var n=Ih(kh());return n.copy=function(){return Sh(n,t()).constant(n.constant())},hh.apply(n,arguments)},t.scaleOrdinal=_h,t.scaleImplicit=yh,t.scalePow=Vh,t.scaleSqrt=function(){return Vh.apply(null,arguments).exponent(.5)},t.scaleQuantile=function t(){var e,r=[],o=[],a=[];function u(){var t=0,n=Math.max(1,o.length);for(a=new Array(n-1);++t<n;)a[t-1]=N(r,t/n);return c}function c(t){return isNaN(t=+t)?e:o[i(a,t)]}return c.invertExtent=function(t){var n=o.indexOf(t);return n<0?[NaN,NaN]:[n>0?a[n-1]:r[0],n<a.length?a[n]:r[r.length-1]]},c.domain=function(t){if(!arguments.length)return r.slice();r=[];for(var e,i=0,o=t.length;i<o;++i)null==(e=t[i])||isNaN(e=+e)||r.push(e);return r.sort(n),u()},c.range=function(t){return arguments.length?(o=gh.call(t),u()):o.slice()},c.unknown=function(t){return arguments.length?(e=t,c):e},c.quantiles=function(){return a.slice()},c.copy=function(){return t().domain(r).range(o).unknown(e)},hh.apply(c,arguments)},t.scaleQuantize=function t(){var n,e=0,r=1,o=1,a=[.5],u=[0,1];function c(t){return t<=t?u[i(a,t,0,o)]:n}function f(){var t=-1;for(a=new Array(o);++t<o;)a[t]=((t+1)*r-(t-o)*e)/(o+1);return c}return c.domain=function(t){return arguments.length?(e=+t[0],r=+t[1],f()):[e,r]},c.range=function(t){return arguments.length?(o=(u=gh.call(t)).length-1,f()):u.slice()},c.invertExtent=function(t){var n=u.indexOf(t);return n<0?[NaN,NaN]:n<1?[e,a[0]]:n>=o?[a[o-1],r]:[a[n-1],a[n]]},c.unknown=function(t){return arguments.length?(n=t,c):c},c.thresholds=function(){return a.slice()},c.copy=function(){return t().domain([e,r]).range(u).unknown(n)},hh.apply(Ph(c),arguments)},t.scaleThreshold=function t(){var n,e=[.5],r=[0,1],o=1;function a(t){return t<=t?r[i(e,t,0,o)]:n}return a.domain=function(t){return arguments.length?(e=gh.call(t),o=Math.min(e.length,r.length-1),a):e.slice()},a.range=function(t){return arguments.length?(r=gh.call(t),o=Math.min(e.length,r.length-1),a):r.slice()},a.invertExtent=function(t){var n=r.indexOf(t);return[e[n-1],e[n]]},a.unknown=function(t){return arguments.length?(n=t,a):n},a.copy=function(){return t().domain(e).range(r).unknown(n)},hh.apply(a,arguments)},t.scaleTime=function(){return hh.apply(Tv(Td,Nd,sd,ud,od,rd,nd,Qh,t.timeFormat).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)},t.scaleUtc=function(){return hh.apply(Tv(Qd,Wd,qd,zd,Cd,kd,nd,Qh,t.utcFormat).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)},t.scaleSequential=function t(){var n=Ph(Sv()(wh));return n.copy=function(){return kv(n,t())},dh.apply(n,arguments)},t.scaleSequentialLog=function t(){var n=Bh(Sv()).domain([1,10]);return n.copy=function(){return kv(n,t()).base(n.base())},dh.apply(n,arguments)},t.scaleSequentialPow=Ev,t.scaleSequentialSqrt=function(){return Ev.apply(null,arguments).exponent(.5)},t.scaleSequentialSymlog=function t(){var n=Ih(Sv());return n.copy=function(){return kv(n,t()).constant(n.constant())},dh.apply(n,arguments)},t.scaleSequentialQuantile=function t(){var e=[],r=wh;function o(t){if(!isNaN(t=+t))return r((i(e,t)-1)/(e.length-1))}return o.domain=function(t){if(!arguments.length)return e.slice();e=[];for(var r,i=0,a=t.length;i<a;++i)null==(r=t[i])||isNaN(r=+r)||e.push(r);return e.sort(n),o},o.interpolator=function(t){return arguments.length?(r=t,o):r},o.copy=function(){return t(r).domain(e)},dh.apply(o,arguments)},t.scaleDiverging=function t(){var n=Ph(Cv()(wh));return n.copy=function(){return kv(n,t())},dh.apply(n,arguments)},t.scaleDivergingLog=function t(){var n=Bh(Cv()).domain([.1,1,10]);return n.copy=function(){return kv(n,t()).base(n.base())},dh.apply(n,arguments)},t.scaleDivergingPow=Pv,t.scaleDivergingSqrt=function(){return Pv.apply(null,arguments).exponent(.5)},t.scaleDivergingSymlog=function t(){var n=Ih(Cv());return n.copy=function(){return kv(n,t()).constant(n.constant())},dh.apply(n,arguments)},t.tickFormat=Ch,t.schemeCategory10=Rv,t.schemeAccent=Dv,t.schemeDark2=qv,t.schemePaired=Lv,t.schemePastel1=Uv,t.schemePastel2=Ov,t.schemeSet1=Bv,t.schemeSet2=Yv,t.schemeSet3=Fv,t.interpolateBrBG=Hv,t.schemeBrBG=jv,t.interpolatePRGn=Gv,t.schemePRGn=Xv,t.interpolatePiYG=$v,t.schemePiYG=Vv,t.interpolatePuOr=Zv,t.schemePuOr=Wv,t.interpolateRdBu=Jv,t.schemeRdBu=Qv,t.interpolateRdGy=tg,t.schemeRdGy=Kv,t.interpolateRdYlBu=eg,t.schemeRdYlBu=ng,t.interpolateRdYlGn=ig,t.schemeRdYlGn=rg,t.interpolateSpectral=ag,t.schemeSpectral=og,t.interpolateBuGn=cg,t.schemeBuGn=ug,t.interpolateBuPu=sg,t.schemeBuPu=fg,t.interpolateGnBu=hg,t.schemeGnBu=lg,t.interpolateOrRd=pg,t.schemeOrRd=dg,t.interpolatePuBuGn=gg,t.schemePuBuGn=vg,t.interpolatePuBu=_g,t.schemePuBu=yg,t.interpolatePuRd=mg,t.schemePuRd=bg,t.interpolateRdPu=wg,t.schemeRdPu=xg,t.interpolateYlGnBu=Ng,t.schemeYlGnBu=Mg,t.interpolateYlGn=Tg,t.schemeYlGn=Ag,t.interpolateYlOrBr=kg,t.schemeYlOrBr=Sg,t.interpolateYlOrRd=Cg,t.schemeYlOrRd=Eg,t.interpolateBlues=zg,t.schemeBlues=Pg,t.interpolateGreens=Dg,t.schemeGreens=Rg,t.interpolateGreys=Lg,t.schemeGreys=qg,t.interpolatePurples=Og,t.schemePurples=Ug,t.interpolateReds=Yg,t.schemeReds=Bg,t.interpolateOranges=Ig,t.schemeOranges=Fg,t.interpolateCubehelixDefault=jg,t.interpolateRainbow=function(t){(t<0||t>1)&&(t-=Math.floor(t));var n=Math.abs(t-.5);return Gg.h=360*t-100,Gg.s=1.5-1.5*n,Gg.l=.8-.9*n,Gg+""},t.interpolateWarm=Hg,t.interpolateCool=Xg,t.interpolateSinebow=function(t){var n;return t=(.5-t)*Math.PI,Vg.r=255*(n=Math.sin(t))*n,Vg.g=255*(n=Math.sin(t+$g))*n,Vg.b=255*(n=Math.sin(t+Wg))*n,Vg+""},t.interpolateViridis=Qg,t.interpolateMagma=Jg,t.interpolateInferno=Kg,t.interpolatePlasma=ty,t.create=function(t){return zt(W(t).call(document.documentElement))},t.creator=W,t.local=Dt,t.matcher=tt,t.mouse=Ot,t.namespace=$,t.namespaces=V,t.clientPoint=Ut,t.select=zt,t.selectAll=function(t){return"string"==typeof t?new Ct([document.querySelectorAll(t)],[document.documentElement]):new Ct([null==t?[]:t],Et)},t.selection=Pt,t.selector=Q,t.selectorAll=K,t.style=ct,t.touch=Bt,t.touches=function(t,n){null==n&&(n=Lt().touches);for(var e=0,r=n?n.length:0,i=new Array(r);e<r;++e)i[e]=Ut(t,n[e]);return i},t.window=ut,t.customEvent=St,t.arc=function(){var t=py,n=vy,e=ny(0),r=null,i=gy,o=yy,a=_y,u=null;function c(){var c,f,s,l=+t.apply(this,arguments),h=+n.apply(this,arguments),d=i.apply(this,arguments)-ly,p=o.apply(this,arguments)-ly,v=ey(p-d),g=p>d;if(u||(u=c=Xi()),h<l&&(f=h,h=l,l=f),h>fy)if(v>hy-fy)u.moveTo(h*iy(d),h*uy(d)),u.arc(0,0,h,d,p,!g),l>fy&&(u.moveTo(l*iy(p),l*uy(p)),u.arc(0,0,l,p,d,g));else{var y,_,b=d,m=p,x=d,w=p,M=v,N=v,A=a.apply(this,arguments)/2,T=A>fy&&(r?+r.apply(this,arguments):cy(l*l+h*h)),S=ay(ey(h-l)/2,+e.apply(this,arguments)),k=S,E=S;if(T>fy){var C=dy(T/l*uy(A)),P=dy(T/h*uy(A));(M-=2*C)>fy?(x+=C*=g?1:-1,w-=C):(M=0,x=w=(d+p)/2),(N-=2*P)>fy?(b+=P*=g?1:-1,m-=P):(N=0,b=m=(d+p)/2)}var z=h*iy(b),R=h*uy(b),D=l*iy(w),q=l*uy(w);if(S>fy){var L,U=h*iy(m),O=h*uy(m),B=l*iy(x),Y=l*uy(x);if(v<sy&&(L=function(t,n,e,r,i,o,a,u){var c=e-t,f=r-n,s=a-i,l=u-o,h=l*c-s*f;if(!(h*h<fy))return[t+(h=(s*(n-o)-l*(t-i))/h)*c,n+h*f]}(z,R,B,Y,U,O,D,q))){var F=z-L[0],I=R-L[1],j=U-L[0],H=O-L[1],X=1/uy(((s=(F*j+I*H)/(cy(F*F+I*I)*cy(j*j+H*H)))>1?0:s<-1?sy:Math.acos(s))/2),G=cy(L[0]*L[0]+L[1]*L[1]);k=ay(S,(l-G)/(X-1)),E=ay(S,(h-G)/(X+1))}}N>fy?E>fy?(y=by(B,Y,z,R,h,E,g),_=by(U,O,D,q,h,E,g),u.moveTo(y.cx+y.x01,y.cy+y.y01),E<S?u.arc(y.cx,y.cy,E,ry(y.y01,y.x01),ry(_.y01,_.x01),!g):(u.arc(y.cx,y.cy,E,ry(y.y01,y.x01),ry(y.y11,y.x11),!g),u.arc(0,0,h,ry(y.cy+y.y11,y.cx+y.x11),ry(_.cy+_.y11,_.cx+_.x11),!g),u.arc(_.cx,_.cy,E,ry(_.y11,_.x11),ry(_.y01,_.x01),!g))):(u.moveTo(z,R),u.arc(0,0,h,b,m,!g)):u.moveTo(z,R),l>fy&&M>fy?k>fy?(y=by(D,q,U,O,l,-k,g),_=by(z,R,B,Y,l,-k,g),u.lineTo(y.cx+y.x01,y.cy+y.y01),k<S?u.arc(y.cx,y.cy,k,ry(y.y01,y.x01),ry(_.y01,_.x01),!g):(u.arc(y.cx,y.cy,k,ry(y.y01,y.x01),ry(y.y11,y.x11),!g),u.arc(0,0,l,ry(y.cy+y.y11,y.cx+y.x11),ry(_.cy+_.y11,_.cx+_.x11),g),u.arc(_.cx,_.cy,k,ry(_.y11,_.x11),ry(_.y01,_.x01),!g))):u.arc(0,0,l,w,x,g):u.lineTo(D,q)}else u.moveTo(0,0);if(u.closePath(),c)return u=null,c+""||null}return c.centroid=function(){var e=(+t.apply(this,arguments)+ +n.apply(this,arguments))/2,r=(+i.apply(this,arguments)+ +o.apply(this,arguments))/2-sy/2;return[iy(r)*e,uy(r)*e]},c.innerRadius=function(n){return arguments.length?(t="function"==typeof n?n:ny(+n),c):t},c.outerRadius=function(t){return arguments.length?(n="function"==typeof t?t:ny(+t),c):n},c.cornerRadius=function(t){return arguments.length?(e="function"==typeof t?t:ny(+t),c):e},c.padRadius=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:ny(+t),c):r},c.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:ny(+t),c):i},c.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:ny(+t),c):o},c.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:ny(+t),c):a},c.context=function(t){return arguments.length?(u=null==t?null:t,c):u},c},t.area=Ay,t.line=Ny,t.pie=function(){var t=Sy,n=Ty,e=null,r=ny(0),i=ny(hy),o=ny(0);function a(a){var u,c,f,s,l,h=a.length,d=0,p=new Array(h),v=new Array(h),g=+r.apply(this,arguments),y=Math.min(hy,Math.max(-hy,i.apply(this,arguments)-g)),_=Math.min(Math.abs(y)/h,o.apply(this,arguments)),b=_*(y<0?-1:1);for(u=0;u<h;++u)(l=v[p[u]=u]=+t(a[u],u,a))>0&&(d+=l);for(null!=n?p.sort(function(t,e){return n(v[t],v[e])}):null!=e&&p.sort(function(t,n){return e(a[t],a[n])}),u=0,f=d?(y-h*b)/d:0;u<h;++u,g=s)c=p[u],s=g+((l=v[c])>0?l*f:0)+b,v[c]={data:a[c],index:u,value:l,startAngle:g,endAngle:s,padAngle:_};return v}return a.value=function(n){return arguments.length?(t="function"==typeof n?n:ny(+n),a):t},a.sortValues=function(t){return arguments.length?(n=t,e=null,a):n},a.sort=function(t){return arguments.length?(e=t,n=null,a):e},a.startAngle=function(t){return arguments.length?(r="function"==typeof t?t:ny(+t),a):r},a.endAngle=function(t){return arguments.length?(i="function"==typeof t?t:ny(+t),a):i},a.padAngle=function(t){return arguments.length?(o="function"==typeof t?t:ny(+t),a):o},a},t.areaRadial=Ry,t.radialArea=Ry,t.lineRadial=zy,t.radialLine=zy,t.pointRadial=Dy,t.linkHorizontal=function(){return Oy(By)},t.linkVertical=function(){return Oy(Yy)},t.linkRadial=function(){var t=Oy(Fy);return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t},t.symbol=function(){var t=ny(Iy),n=ny(64),e=null;function r(){var r;if(e||(e=r=Xi()),t.apply(this,arguments).draw(e,+n.apply(this,arguments)),r)return e=null,r+""||null}return r.type=function(n){return arguments.length?(t="function"==typeof n?n:ny(n),r):t},r.size=function(t){return arguments.length?(n="function"==typeof t?t:ny(+t),r):n},r.context=function(t){return arguments.length?(e=null==t?null:t,r):e},r},t.symbols=i_,t.symbolCircle=Iy,t.symbolCross=jy,t.symbolDiamond=Gy,t.symbolSquare=Qy,t.symbolStar=Zy,t.symbolTriangle=Ky,t.symbolWye=r_,t.curveBasisClosed=function(t){return new c_(t)},t.curveBasisOpen=function(t){return new f_(t)},t.curveBasis=function(t){return new u_(t)},t.curveBundle=l_,t.curveCardinalClosed=g_,t.curveCardinalOpen=__,t.curveCardinal=p_,t.curveCatmullRomClosed=M_,t.curveCatmullRomOpen=A_,t.curveCatmullRom=x_,t.curveLinearClosed=function(t){return new T_(t)},t.curveLinear=xy,t.curveMonotoneX=function(t){return new P_(t)},t.curveMonotoneY=function(t){return new z_(t)},t.curveNatural=function(t){return new D_(t)},t.curveStep=function(t){return new L_(t,.5)},t.curveStepAfter=function(t){return new L_(t,1)},t.curveStepBefore=function(t){return new L_(t,0)},t.stack=function(){var t=ny([]),n=O_,e=U_,r=B_;function i(i){var o,a,u=t.apply(this,arguments),c=i.length,f=u.length,s=new Array(f);for(o=0;o<f;++o){for(var l,h=u[o],d=s[o]=new Array(c),p=0;p<c;++p)d[p]=l=[0,+r(i[p],h,p,i)],l.data=i[p];d.key=h}for(o=0,a=n(s);o<f;++o)s[a[o]].index=o;return e(s,a),s}return i.keys=function(n){return arguments.length?(t="function"==typeof n?n:ny(qy.call(n)),i):t},i.value=function(t){return arguments.length?(r="function"==typeof t?t:ny(+t),i):r},i.order=function(t){return arguments.length?(n=null==t?O_:"function"==typeof t?t:ny(qy.call(t)),i):n},i.offset=function(t){return arguments.length?(e=null==t?U_:t,i):e},i},t.stackOffsetExpand=function(t,n){if((r=t.length)>0){for(var e,r,i,o=0,a=t[0].length;o<a;++o){for(i=e=0;e<r;++e)i+=t[e][o][1]||0;if(i)for(e=0;e<r;++e)t[e][o][1]/=i}U_(t,n)}},t.stackOffsetDiverging=function(t,n){if((u=t.length)>0)for(var e,r,i,o,a,u,c=0,f=t[n[0]].length;c<f;++c)for(o=a=0,e=0;e<u;++e)(i=(r=t[n[e]][c])[1]-r[0])>=0?(r[0]=o,r[1]=o+=i):i<0?(r[1]=a,r[0]=a+=i):r[0]=o},t.stackOffsetNone=U_,t.stackOffsetSilhouette=function(t,n){if((e=t.length)>0){for(var e,r=0,i=t[n[0]],o=i.length;r<o;++r){for(var a=0,u=0;a<e;++a)u+=t[a][r][1]||0;i[r][1]+=i[r][0]=-u/2}U_(t,n)}},t.stackOffsetWiggle=function(t,n){if((i=t.length)>0&&(r=(e=t[n[0]]).length)>0){for(var e,r,i,o=0,a=1;a<r;++a){for(var u=0,c=0,f=0;u<i;++u){for(var s=t[n[u]],l=s[a][1]||0,h=(l-(s[a-1][1]||0))/2,d=0;d<u;++d){var p=t[n[d]];h+=(p[a][1]||0)-(p[a-1][1]||0)}c+=l,f+=h*l}e[a-1][1]+=e[a-1][0]=o,c&&(o-=f/c)}e[a-1][1]+=e[a-1][0]=o,U_(t,n)}},t.stackOrderAppearance=Y_,t.stackOrderAscending=I_,t.stackOrderDescending=function(t){return I_(t).reverse()},t.stackOrderInsideOut=function(t){var n,e,r=t.length,i=t.map(j_),o=Y_(t),a=0,u=0,c=[],f=[];for(n=0;n<r;++n)e=o[n],a<u?(a+=i[e],c.push(e)):(u+=i[e],f.push(e));return f.reverse().concat(c)},t.stackOrderNone=O_,t.stackOrderReverse=function(t){return O_(t).reverse()},t.timeInterval=Zh,t.timeMillisecond=Qh,t.timeMilliseconds=Jh,t.utcMillisecond=Qh,t.utcMilliseconds=Jh,t.timeSecond=nd,t.timeSeconds=ed,t.utcSecond=nd,t.utcSeconds=ed,t.timeMinute=rd,t.timeMinutes=id,t.timeHour=od,t.timeHours=ad,t.timeDay=ud,t.timeDays=cd,t.timeWeek=sd,t.timeWeeks=yd,t.timeSunday=sd,t.timeSundays=yd,t.timeMonday=ld,t.timeMondays=_d,t.timeTuesday=hd,t.timeTuesdays=bd,t.timeWednesday=dd,t.timeWednesdays=md,t.timeThursday=pd,t.timeThursdays=xd,t.timeFriday=vd,t.timeFridays=wd,t.timeSaturday=gd,t.timeSaturdays=Md,t.timeMonth=Nd,t.timeMonths=Ad,t.timeYear=Td,t.timeYears=Sd,t.utcMinute=kd,t.utcMinutes=Ed,t.utcHour=Cd,t.utcHours=Pd,t.utcDay=zd,t.utcDays=Rd,t.utcWeek=qd,t.utcWeeks=Id,t.utcSunday=qd,t.utcSundays=Id,t.utcMonday=Ld,t.utcMondays=jd,t.utcTuesday=Ud,t.utcTuesdays=Hd,t.utcWednesday=Od,t.utcWednesdays=Xd,t.utcThursday=Bd,t.utcThursdays=Gd,t.utcFriday=Yd,t.utcFridays=Vd,t.utcSaturday=Fd,t.utcSaturdays=$d,t.utcMonth=Wd,t.utcMonths=Zd,t.utcYear=Qd,t.utcYears=Jd,t.timeFormatDefaultLocale=pv,t.timeFormatLocale=ep,t.isoFormat=vv,t.isoParse=gv,t.now=er,t.timer=or,t.timerFlush=ar,t.timeout=sr,t.interval=function(t,n,e){var r=new ir,i=n;return null==n?(r.restart(t,n,e),r):(n=+n,e=null==e?er():+e,r.restart(function o(a){a+=i,r.restart(o,i+=n,e),t(a)},n,e),r)},t.transition=Pr,t.active=function(t,n){var e,r,i=t.__transition;if(i)for(r in n=null==n?null:n+"",i)if((e=i[r]).state>pr&&e.name===n)return new Cr([[t]],si,n,+r);return null},t.interrupt=Nr,t.voronoi=function(){var t=X_,n=G_,e=null;function r(r){return new Tb(r.map(function(e,i){var o=[Math.round(t(e,i,r)/Mb)*Mb,Math.round(n(e,i,r)/Mb)*Mb];return o.index=i,o.data=e,o}),e)}return r.polygons=function(t){return r(t).polygons()},r.links=function(t){return r(t).links()},r.triangles=function(t){return r(t).triangles()},r.x=function(n){return arguments.length?(t="function"==typeof n?n:H_(+n),r):t},r.y=function(t){return arguments.length?(n="function"==typeof t?t:H_(+t),r):n},r.extent=function(t){return arguments.length?(e=null==t?null:[[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]],r):e&&[[e[0][0],e[0][1]],[e[1][0],e[1][1]]]},r.size=function(t){return arguments.length?(e=null==t?null:[[0,0],[+t[0],+t[1]]],r):e&&[e[1][0]-e[0][0],e[1][1]-e[0][1]]},r},t.zoom=function(){var n,e,r=Db,i=qb,o=Bb,a=Ub,u=Ob,c=[0,1/0],f=[[-1/0,-1/0],[1/0,1/0]],s=250,l=qe,h=[],d=I("start","zoom","end"),p=500,v=150,g=0;function y(t){t.property("__zoom",Lb).on("wheel.zoom",N).on("mousedown.zoom",A).on("dblclick.zoom",T).filter(u).on("touchstart.zoom",S).on("touchmove.zoom",k).on("touchend.zoom touchcancel.zoom",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function _(t,n){return(n=Math.max(c[0],Math.min(c[1],n)))===t.k?t:new Eb(n,t.x,t.y)}function b(t,n,e){var r=n[0]-e[0]*t.k,i=n[1]-e[1]*t.k;return r===t.x&&i===t.y?t:new Eb(t.k,r,i)}function m(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function x(t,n,e){t.on("start.zoom",function(){w(this,arguments).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).end()}).tween("zoom",function(){var t=arguments,r=w(this,t),o=i.apply(this,t),a=e||m(o),u=Math.max(o[1][0]-o[0][0],o[1][1]-o[0][1]),c=this.__zoom,f="function"==typeof n?n.apply(this,t):n,s=l(c.invert(a).concat(u/c.k),f.invert(a).concat(u/f.k));return function(t){if(1===t)t=f;else{var n=s(t),e=u/n[2];t=new Eb(e,a[0]-n[0]*e,a[1]-n[1]*e)}r.zoom(null,t)}})}function w(t,n){for(var e,r=0,i=h.length;r<i;++r)if((e=h[r]).that===t)return e;return new M(t,n)}function M(t,n){this.that=t,this.args=n,this.index=-1,this.active=0,this.extent=i.apply(t,n)}function N(){if(r.apply(this,arguments)){var t=w(this,arguments),n=this.__zoom,e=Math.max(c[0],Math.min(c[1],n.k*Math.pow(2,a.apply(this,arguments)))),i=Ot(this);if(t.wheel)t.mouse[0][0]===i[0]&&t.mouse[0][1]===i[1]||(t.mouse[1]=n.invert(t.mouse[0]=i)),clearTimeout(t.wheel);else{if(n.k===e)return;t.mouse=[i,n.invert(i)],Nr(this),t.start()}Rb(),t.wheel=setTimeout(function(){t.wheel=null,t.end()},v),t.zoom("mouse",o(b(_(n,e),t.mouse[0],t.mouse[1]),t.extent,f))}}function A(){if(!e&&r.apply(this,arguments)){var n=w(this,arguments),i=zt(t.event.view).on("mousemove.zoom",function(){if(Rb(),!n.moved){var e=t.event.clientX-u,r=t.event.clientY-c;n.moved=e*e+r*r>g}n.zoom("mouse",o(b(n.that.__zoom,n.mouse[0]=Ot(n.that),n.mouse[1]),n.extent,f))},!0).on("mouseup.zoom",function(){i.on("mousemove.zoom mouseup.zoom",null),jt(t.event.view,n.moved),Rb(),n.end()},!0),a=Ot(this),u=t.event.clientX,c=t.event.clientY;It(t.event.view),zb(),n.mouse=[a,this.__zoom.invert(a)],Nr(this),n.start()}}function T(){if(r.apply(this,arguments)){var n=this.__zoom,e=Ot(this),a=n.invert(e),u=n.k*(t.event.shiftKey?.5:2),c=o(b(_(n,u),e,a),i.apply(this,arguments),f);Rb(),s>0?zt(this).transition().duration(s).call(x,c,e):zt(this).call(y.transform,c)}}function S(){if(r.apply(this,arguments)){var e,i,o,a,u=w(this,arguments),c=t.event.changedTouches,f=c.length;for(zb(),i=0;i<f;++i)a=[a=Bt(this,c,(o=c[i]).identifier),this.__zoom.invert(a),o.identifier],u.touch0?u.touch1||(u.touch1=a):(u.touch0=a,e=!0);if(n&&(n=clearTimeout(n),!u.touch1))return u.end(),void((a=zt(this).on("dblclick.zoom"))&&a.apply(this,arguments));e&&(n=setTimeout(function(){n=null},p),Nr(this),u.start())}}function k(){var e,r,i,a,u=w(this,arguments),c=t.event.changedTouches,s=c.length;for(Rb(),n&&(n=clearTimeout(n)),e=0;e<s;++e)i=Bt(this,c,(r=c[e]).identifier),u.touch0&&u.touch0[2]===r.identifier?u.touch0[0]=i:u.touch1&&u.touch1[2]===r.identifier&&(u.touch1[0]=i);if(r=u.that.__zoom,u.touch1){var l=u.touch0[0],h=u.touch0[1],d=u.touch1[0],p=u.touch1[1],v=(v=d[0]-l[0])*v+(v=d[1]-l[1])*v,g=(g=p[0]-h[0])*g+(g=p[1]-h[1])*g;r=_(r,Math.sqrt(v/g)),i=[(l[0]+d[0])/2,(l[1]+d[1])/2],a=[(h[0]+p[0])/2,(h[1]+p[1])/2]}else{if(!u.touch0)return;i=u.touch0[0],a=u.touch0[1]}u.zoom("touch",o(b(r,i,a),u.extent,f))}function E(){var n,r,i=w(this,arguments),o=t.event.changedTouches,a=o.length;for(zb(),e&&clearTimeout(e),e=setTimeout(function(){e=null},p),n=0;n<a;++n)r=o[n],i.touch0&&i.touch0[2]===r.identifier?delete i.touch0:i.touch1&&i.touch1[2]===r.identifier&&delete i.touch1;i.touch1&&!i.touch0&&(i.touch0=i.touch1,delete i.touch1),i.touch0?i.touch0[1]=this.__zoom.invert(i.touch0[0]):i.end()}return y.transform=function(t,n){var e=t.selection?t.selection():t;e.property("__zoom",Lb),t!==e?x(t,n):e.interrupt().each(function(){w(this,arguments).start().zoom(null,"function"==typeof n?n.apply(this,arguments):n).end()})},y.scaleBy=function(t,n){y.scaleTo(t,function(){return this.__zoom.k*("function"==typeof n?n.apply(this,arguments):n)})},y.scaleTo=function(t,n){y.transform(t,function(){var t=i.apply(this,arguments),e=this.__zoom,r=m(t),a=e.invert(r),u="function"==typeof n?n.apply(this,arguments):n;return o(b(_(e,u),r,a),t,f)})},y.translateBy=function(t,n,e){y.transform(t,function(){return o(this.__zoom.translate("function"==typeof n?n.apply(this,arguments):n,"function"==typeof e?e.apply(this,arguments):e),i.apply(this,arguments),f)})},y.translateTo=function(t,n,e){y.transform(t,function(){var t=i.apply(this,arguments),r=this.__zoom,a=m(t);return o(Cb.translate(a[0],a[1]).scale(r.k).translate("function"==typeof n?-n.apply(this,arguments):-n,"function"==typeof e?-e.apply(this,arguments):-e),t,f)})},M.prototype={start:function(){return 1==++this.active&&(this.index=h.push(this)-1,this.emit("start")),this},zoom:function(t,n){return this.mouse&&"mouse"!==t&&(this.mouse[1]=n.invert(this.mouse[0])),this.touch0&&"touch"!==t&&(this.touch0[1]=n.invert(this.touch0[0])),this.touch1&&"touch"!==t&&(this.touch1[1]=n.invert(this.touch1[0])),this.that.__zoom=n,this.emit("zoom"),this},end:function(){return 0==--this.active&&(h.splice(this.index,1),this.index=-1,this.emit("end")),this},emit:function(t){St(new kb(y,t,this.that.__zoom),d.apply,d,[t,this.that,this.args])}},y.wheelDelta=function(t){return arguments.length?(a="function"==typeof t?t:Sb(+t),y):a},y.filter=function(t){return arguments.length?(r="function"==typeof t?t:Sb(!!t),y):r},y.touchable=function(t){return arguments.length?(u="function"==typeof t?t:Sb(!!t),y):u},y.extent=function(t){return arguments.length?(i="function"==typeof t?t:Sb([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),y):i},y.scaleExtent=function(t){return arguments.length?(c[0]=+t[0],c[1]=+t[1],y):[c[0],c[1]]},y.translateExtent=function(t){return arguments.length?(f[0][0]=+t[0][0],f[1][0]=+t[1][0],f[0][1]=+t[0][1],f[1][1]=+t[1][1],y):[[f[0][0],f[0][1]],[f[1][0],f[1][1]]]},y.constrain=function(t){return arguments.length?(o=t,y):o},y.duration=function(t){return arguments.length?(s=+t,y):s},y.interpolate=function(t){return arguments.length?(l=t,y):l},y.on=function(){var t=d.on.apply(d,arguments);return t===d?y:t},y.clickDistance=function(t){return arguments.length?(g=(t=+t)*t,y):Math.sqrt(g)},y},t.zoomTransform=Pb,t.zoomIdentity=Cb,Object.defineProperty(t,"__esModule",{value:!0})});
/**
* math.js
* https://github.com/josdejong/mathjs
*
* Math.js is an extensive math library for JavaScript and Node.js,
* It features real and complex numbers, units, matrices, a large set of
* mathematical functions, and a flexible expression parser.
*
* @version 6.1.0
* @date 2019-08-17
*
* @license
* Copyright (C) 2013-2019 Jos de Jong <wjosdejong@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.math=t():e.math=t()}(this,function(){return n={},i.m=r=[function(e,t,r){"use strict";r.d(t,"a",function(){return n}),r.d(t,"b",function(){return i}),r.d(t,"c",function(){return o});r(2);var a=r(3);function n(r,n,i,e){function t(e){var t=Object(a.j)(e,n.map(o));return function(e,t,r){if(!t.filter(function(e){return!function(e){return e&&"?"===e[0]}(e)}).every(function(e){return void 0!==r[e]})){var n=t.filter(function(e){return void 0===r[e]});throw new Error('Cannot create function "'.concat(e,'", ')+"some dependencies are missing: ".concat(n.map(function(e){return'"'.concat(e,'"')}).join(", "),"."))}}(r,n,e),i(t)}return t.isFactory=!0,t.fn=r,t.dependencies=n.slice().sort(),e&&(t.meta=e),t}function i(e){return"function"==typeof e&&"string"==typeof e.fn&&Array.isArray(e.dependencies)}function o(e){return e&&"?"===e[0]?e.slice(1):e}},function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e){return"number"==typeof e}function a(e){return e&&!0===e.constructor.prototype.isBigNumber||!1}function o(e){return e&&"object"===n(e)&&!0===Object.getPrototypeOf(e).isComplex||!1}function s(e){return e&&"object"===n(e)&&!0===Object.getPrototypeOf(e).isFraction||!1}function u(e){return e&&!0===e.constructor.prototype.isUnit||!1}function c(e){return"string"==typeof e}r.d(t,"y",function(){return i}),r.d(t,"e",function(){return a}),r.d(t,"j",function(){return o}),r.d(t,"o",function(){return s}),r.d(t,"L",function(){return u}),r.d(t,"I",function(){return c}),r.d(t,"b",function(){return f}),r.d(t,"v",function(){return l}),r.d(t,"i",function(){return p}),r.d(t,"n",function(){return m}),r.d(t,"H",function(){return h}),r.d(t,"D",function(){return d}),r.d(t,"t",function(){return y}),r.d(t,"g",function(){return g}),r.d(t,"G",function(){return v}),r.d(t,"s",function(){return b}),r.d(t,"p",function(){return x}),r.d(t,"m",function(){return w}),r.d(t,"F",function(){return N}),r.d(t,"z",function(){return O}),r.d(t,"x",function(){return M}),r.d(t,"K",function(){return E}),r.d(t,"a",function(){return j}),r.d(t,"c",function(){return S}),r.d(t,"d",function(){return A}),r.d(t,"f",function(){return C}),r.d(t,"k",function(){return T}),r.d(t,"l",function(){return _}),r.d(t,"q",function(){return I}),r.d(t,"r",function(){return B}),r.d(t,"u",function(){return q}),r.d(t,"w",function(){return k}),r.d(t,"A",function(){return z}),r.d(t,"B",function(){return D}),r.d(t,"C",function(){return R}),r.d(t,"E",function(){return P}),r.d(t,"J",function(){return F}),r.d(t,"h",function(){return U}),r.d(t,"M",function(){return L});var f=Array.isArray;function l(e){return e&&!0===e.constructor.prototype.isMatrix||!1}function p(e){return Array.isArray(e)||l(e)}function m(e){return e&&e.isDenseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function h(e){return e&&e.isSparseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function d(e){return e&&!0===e.constructor.prototype.isRange||!1}function y(e){return e&&!0===e.constructor.prototype.isIndex||!1}function g(e){return"boolean"==typeof e}function v(e){return e&&!0===e.constructor.prototype.isResultSet||!1}function b(e){return e&&!0===e.constructor.prototype.isHelp||!1}function x(e){return"function"==typeof e}function w(e){return e instanceof Date}function N(e){return e instanceof RegExp}function O(e){return!(!e||"object"!==n(e)||e.constructor!==Object||o(e)||s(e))}function M(e){return null===e}function E(e){return void 0===e}function j(e){return e&&!0===e.isAccessorNode&&!0===e.constructor.prototype.isNode||!1}function S(e){return e&&!0===e.isArrayNode&&!0===e.constructor.prototype.isNode||!1}function A(e){return e&&!0===e.isAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function C(e){return e&&!0===e.isBlockNode&&!0===e.constructor.prototype.isNode||!1}function T(e){return e&&!0===e.isConditionalNode&&!0===e.constructor.prototype.isNode||!1}function _(e){return e&&!0===e.isConstantNode&&!0===e.constructor.prototype.isNode||!1}function I(e){return e&&!0===e.isFunctionAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function B(e){return e&&!0===e.isFunctionNode&&!0===e.constructor.prototype.isNode||!1}function q(e){return e&&!0===e.isIndexNode&&!0===e.constructor.prototype.isNode||!1}function k(e){return e&&!0===e.isNode&&!0===e.constructor.prototype.isNode||!1}function z(e){return e&&!0===e.isObjectNode&&!0===e.constructor.prototype.isNode||!1}function D(e){return e&&!0===e.isOperatorNode&&!0===e.constructor.prototype.isNode||!1}function R(e){return e&&!0===e.isParenthesisNode&&!0===e.constructor.prototype.isNode||!1}function P(e){return e&&!0===e.isRangeNode&&!0===e.constructor.prototype.isNode||!1}function F(e){return e&&!0===e.isSymbolNode&&!0===e.constructor.prototype.isNode||!1}function U(e){return e&&!0===e.constructor.prototype.isChain||!1}function L(e){var t=n(e);return"object"===t?null===e?"null":Array.isArray(e)?"Array":e instanceof Date?"Date":e instanceof RegExp?"RegExp":a(e)?"BigNumber":o(e)?"Complex":s(e)?"Fraction":l(e)?"Matrix":u(e)?"Unit":y(e)?"Index":d(e)?"Range":v(e)?"ResultSet":k(e)?e.type:U(e)?"Chain":b(e)?"Help":"Object":"function"===t?"Function":t}},function(e,t,r){"use strict";r.d(t,"a",function(){return s}),r.d(t,"r",function(){return c}),r.d(t,"s",function(){return f}),r.d(t,"o",function(){return l}),r.d(t,"n",function(){return p}),r.d(t,"p",function(){return m}),r.d(t,"q",function(){return h}),r.d(t,"e",function(){return d}),r.d(t,"m",function(){return y}),r.d(t,"f",function(){return g}),r.d(t,"c",function(){return v}),r.d(t,"d",function(){return b}),r.d(t,"k",function(){return x}),r.d(t,"i",function(){return w}),r.d(t,"g",function(){return N}),r.d(t,"h",function(){return O}),r.d(t,"l",function(){return M}),r.d(t,"j",function(){return E}),r.d(t,"b",function(){return j});var n=r(4),i=r(1),a=r(5),u=r(6),o=r(10);function s(e){for(var t=[];Array.isArray(e);)t.push(e.length),e=e[0];return t}function c(e,t){if(0===t.length){if(Array.isArray(e))throw new u.a(e.length,0)}else!function e(t,r,n){var i,a=t.length;if(a!==r[n])throw new u.a(a,r[n]);if(n<r.length-1){var o=n+1;for(i=0;i<a;i++){var s=t[i];if(!Array.isArray(s))throw new u.a(r.length-1,r.length,"<");e(t[i],r,o)}}else for(i=0;i<a;i++)if(Array.isArray(t[i]))throw new u.a(r.length+1,r.length,">")}(e,t,0)}function f(e,t){if(!Object(i.y)(e)||!Object(n.i)(e))throw new TypeError("Index must be an integer (value: "+e+")");if(e<0||"number"==typeof t&&t<=e)throw new o.a(e,t)}function l(e,t,r){if(!Array.isArray(e)||!Array.isArray(t))throw new TypeError("Array expected");if(0===t.length)throw new Error("Resizing to scalar is not supported");return t.forEach(function(e){if(!Object(i.y)(e)||!Object(n.i)(e)||e<0)throw new TypeError("Invalid size, must contain positive integers (size: "+Object(a.d)(t)+")")}),function e(t,r,n,i){var a;var o;var s=t.length;var u=r[n];var c=Math.min(s,u);t.length=u;if(n<r.length-1){var f=n+1;for(a=0;a<c;a++)o=t[a],Array.isArray(o)||(o=[o],t[a]=o),e(o,r,f,i);for(a=c;a<u;a++)o=[],t[a]=o,e(o,r,f,i)}else{for(a=0;a<c;a++)for(;Array.isArray(t[a]);)t[a]=t[a][0];for(a=c;a<u;a++)t[a]=i}}(e,t,0,void 0!==r?r:0),e}function p(t,r){var e,n=d(t);function i(e){return e.reduce(function(e,t){return e*t})}if(!Array.isArray(t)||!Array.isArray(r))throw new TypeError("Array expected");if(0===r.length)throw new u.a(0,i(s(t)),"!=");for(var a=1,o=0;o<r.length;o++)a*=r[o];if(n.length!==a)throw new u.a(i(r),i(s(t)),"!=");try{e=function(e,t){for(var r,n=e,i=t.length-1;0<i;i--){var a=t[i];r=[];for(var o=n.length/a,s=0;s<o;s++)r.push(n.slice(s*a,(s+1)*a));n=r}return n}(n,r)}catch(e){if(e instanceof u.a)throw new u.a(i(r),i(s(t)),"!=");throw e}return e}function m(e,t){for(var r=t||s(e);Array.isArray(e)&&1===e.length;)e=e[0],r.shift();for(var n=r.length;1===r[n-1];)n--;return n<r.length&&(e=function e(t,r,n){var i,a;if(n<r){var o=n+1;for(i=0,a=t.length;i<a;i++)t[i]=e(t[i],r,o)}else for(;Array.isArray(t);)t=t[0];return t}(e,n,0),r.length=n),e}function h(e,t,r,n){var i=n||s(e);if(r)for(var a=0;a<r;a++)e=[e],i.unshift(1);for(e=function e(t,r,n){var i,a;if(Array.isArray(t)){var o=n+1;for(i=0,a=t.length;i<a;i++)t[i]=e(t[i],r,o)}else for(var s=n;s<r;s++)t=[t];return t}(e,t,0);i.length<t;)i.push(1);return e}function d(e){if(!Array.isArray(e))return e;var r=[];return e.forEach(function e(t){Array.isArray(t)?t.forEach(e):r.push(t)}),r}function y(e,t){return Array.prototype.map.call(e,t)}function g(e,t){Array.prototype.forEach.call(e,t)}function v(e,t){if(1!==s(e).length)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(e,t)}function b(e,t){if(1!==s(e).length)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(e,function(e){return t.test(e)})}function x(e,t){return Array.prototype.join.call(e,t)}function w(e){if(!Array.isArray(e))throw new TypeError("Array input expected");if(0===e.length)return e;var t=[],r=0;t[0]={value:e[0],identifier:0};for(var n=1;n<e.length;n++)e[n]===e[n-1]?r++:r=0,t.push({value:e[n],identifier:r});return t}function N(e){if(!Array.isArray(e))throw new TypeError("Array input expected");if(0===e.length)return e;for(var t=[],r=0;r<e.length;r++)t.push(e[r].value);return t}function O(e,t){for(var r,n=0,i=0;i<e.length;i++){var a=e[i],o=Array.isArray(a);if(0===i&&o&&(n=a.length),o&&a.length!==n)return;var s=o?O(a,t):t(a);if(void 0===r)r=s;else if(r!==s)return"mixed"}return r}function M(e){return e[e.length-1]}function E(e){return e.slice(0,e.length-1)}function j(e,t){return-1!==e.indexOf(t)}},function(e,t,r){"use strict";r.d(t,"a",function(){return i}),r.d(t,"i",function(){return o}),r.d(t,"e",function(){return s}),r.d(t,"b",function(){return u}),r.d(t,"d",function(){return c}),r.d(t,"c",function(){return f}),r.d(t,"h",function(){return l}),r.d(t,"k",function(){return p}),r.d(t,"f",function(){return m}),r.d(t,"g",function(){return h}),r.d(t,"j",function(){return d}),r.d(t,"l",function(){return y});var n=r(1);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e){var t=a(e);if("number"===t||"string"===t||"boolean"===t||null==e)return e;if("function"==typeof e.clone)return e.clone();if(Array.isArray(e))return e.map(function(e){return i(e)});if(e instanceof Date)return new Date(e.valueOf());if(Object(n.e)(e))return e;if(e instanceof RegExp)throw new TypeError("Cannot clone "+e);return o(e,i)}function o(e,t){var r={};for(var n in e)m(e,n)&&(r[n]=t(e[n]));return r}function s(e,t){for(var r in t)m(t,r)&&(e[r]=t[r]);return e}function u(e,t){if(Array.isArray(t))throw new TypeError("Arrays are not supported by deepExtend");for(var r in t)if(m(t,r))if(t[r]&&t[r].constructor===Object)void 0===e[r]&&(e[r]={}),e[r]&&e[r].constructor===Object?u(e[r],t[r]):e[r]=t[r];else{if(Array.isArray(t[r]))throw new TypeError("Arrays are not supported by deepExtend");e[r]=t[r]}return e}function c(e,t){var r,n,i;if(Array.isArray(e)){if(!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(n=0,i=e.length;n<i;n++)if(!c(e[n],t[n]))return!1;return!0}if("function"==typeof e)return e===t;if(e instanceof Object){if(Array.isArray(t)||!(t instanceof Object))return!1;for(r in e)if(!(r in t&&c(e[r],t[r])))return!1;for(r in t)if(!(r in e&&c(e[r],t[r])))return!1;return!0}return e===t}function f(e){var t={};return function e(t,r){for(var n in t)if(m(t,n)){var i=t[n];"object"===a(i)&&null!==i?e(i,r):r[n]=i}}(e,t),t}function l(e,t,r){var n,i=!0;Object.defineProperty(e,t,{get:function(){return i&&(n=r(),i=!1),n},set:function(e){n=e,i=!1},configurable:!0,enumerable:!0})}function p(e,t){if(t&&"string"==typeof t)return p(e,t.split("."));var r=e;if(t)for(var n=0;n<t.length;n++){var i=t[n];i in r||(r[i]={}),r=r[i]}return r}function m(e,t){return e&&Object.hasOwnProperty.call(e,t)}function h(e){return e&&"function"==typeof e.factory}function d(e,t){for(var r={},n=0;n<t.length;n++){var i=t[n],a=e[i];void 0!==a&&(r[i]=a)}return r}function y(t){return Object.keys(t).map(function(e){return t[e]})}},function(e,t,r){"use strict";r.d(t,"i",function(){return n}),r.d(t,"n",function(){return i}),r.d(t,"l",function(){return o}),r.d(t,"j",function(){return s}),r.d(t,"k",function(){return u}),r.d(t,"d",function(){return c}),r.d(t,"g",function(){return f}),r.d(t,"h",function(){return l}),r.d(t,"q",function(){return h}),r.d(t,"f",function(){return b}),r.d(t,"m",function(){return w}),r.d(t,"a",function(){return N}),r.d(t,"b",function(){return O}),r.d(t,"c",function(){return M}),r.d(t,"e",function(){return E}),r.d(t,"o",function(){return j}),r.d(t,"p",function(){return S});var a=r(3),p=r(1);function n(e){return"boolean"==typeof e||!!isFinite(e)&&e===Math.round(e)}var i=Math.sign||function(e){return 0<e?1:e<0?-1:0},o=Math.log2||function(e){return Math.log(e)/Math.LN2},s=Math.log10||function(e){return Math.log(e)/Math.LN10},u=Math.log1p||function(e){return Math.log(e+1)},c=Math.cbrt||function(e){if(0===e)return e;var t,r=e<0;return r&&(e=-e),t=isFinite(e)?(e/((t=Math.exp(Math.log(e)/3))*t)+2*t)/3:e,r?-t:t},f=Math.expm1||function(e){return 2e-4<=e||e<=-2e-4?Math.exp(e)-1:e+e*e/2+e*e*e/6};function l(e,t){if("function"==typeof t)return t(e);if(e===1/0)return"Infinity";if(e===-1/0)return"-Infinity";if(isNaN(e))return"NaN";var r,n="auto";switch(t&&(t.notation&&(n=t.notation),Object(p.y)(t)?r=t:Object(p.y)(t.precision)&&(r=t.precision)),n){case"fixed":return h(e,r);case"exponential":return d(e,r);case"engineering":return function(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=g(m(e),t),n=r.exponent,i=r.coefficients,a=n%3==0?n:n<0?n-3-n%3:n-n%3;if(Object(p.y)(t))for(;t>i.length||n-a+1>i.length;)i.push(0);else for(var o=0<=n?n:Math.abs(a);i.length-1<o;)i.push(0);var s=Math.abs(n-a),u=1;for(;0<s;)u++,s--;var c=i.slice(u).join(""),f=Object(p.y)(t)&&c.length||c.match(/[1-9]/)?"."+c:"",l=i.slice(0,u).join("")+f+"e"+(0<=n?"+":"")+a.toString();return r.sign+l}(e,r);case"auto":if(!t||!t.exponential||void 0===t.exponential.lower&&void 0===t.exponential.upper)return y(e,r,t&&t).replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],t=arguments[4];return"."!==e?e+t:t});var i=Object(a.i)(t,function(e){return e});return(i.exponential=void 0)!==t.exponential.lower&&(i.lowerExp=Math.round(Math.log(t.exponential.lower)/Math.LN10)),void 0!==t.exponential.upper&&(i.upperExp=Math.round(Math.log(t.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(t)+" with "+JSON.stringify(i)),y(e,r,i);default:throw new Error('Unknown notation "'+n+'". Choose "auto", "exponential", or "fixed".')}}function m(e){var t=String(e).toLowerCase().match(/^0*?(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!t)throw new SyntaxError("Invalid number "+e);var r=t[1],n=t[2],i=parseFloat(t[4]||"0"),a=n.indexOf(".");i+=-1!==a?a-1:n.length-1;var o=n.replace(".","").replace(/^0*/,function(e){return i-=e.length,""}).replace(/0*$/,"").split("").map(function(e){return parseInt(e)});return 0===o.length&&(o.push(0),i++),{sign:r,coefficients:o,exponent:i}}function h(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=m(e),n="number"==typeof t?g(r,r.exponent+1+t):r,i=n.coefficients,a=n.exponent+1,o=a+(t||0);return i.length<o&&(i=i.concat(v(o-i.length))),a<0&&(i=v(1-a).concat(i),a=1),a<i.length&&i.splice(a,0,0===a?"0.":"."),n.sign+i.join("")}function d(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=m(e),n=t?g(r,t):r,i=n.coefficients,a=n.exponent;i.length<t&&(i=i.concat(v(t-i.length)));var o=i.shift();return n.sign+o+(0<i.length?"."+i.join(""):"")+"e"+(0<=a?"+":"")+a}function y(e,t,r){if(isNaN(e)||!isFinite(e))return String(e);var n=r&&void 0!==r.lowerExp?r.lowerExp:-3,i=r&&void 0!==r.upperExp?r.upperExp:5,a=m(e),o=t?g(a,t):a;if(o.exponent<n||o.exponent>=i)return d(e,t);var s=o.coefficients,u=o.exponent;s.length<t&&(s=s.concat(v(t-s.length))),s=s.concat(v(u-s.length+1+(s.length<t?t-s.length:0)));var c=0<u?u:0;return c<(s=v(-u).concat(s)).length-1&&s.splice(c+1,0,"."),o.sign+s.join("")}function g(e,t){for(var r={sign:e.sign,coefficients:e.coefficients,exponent:e.exponent},n=r.coefficients;t<=0;)n.unshift(0),r.exponent++,t++;if(n.length>t&&5<=n.splice(t,n.length-t)[0]){var i=t-1;for(n[i]++;10===n[i];)n.pop(),0===i&&(n.unshift(0),r.exponent++,i++),n[--i]++}return r}function v(e){for(var t=[],r=0;r<e;r++)t.push(0);return t}function b(e){return e.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length}var x=Number.EPSILON||2220446049250313e-31;function w(e,t,r){if(null==r)return e===t;if(e===t)return!0;if(isNaN(e)||isNaN(t))return!1;if(isFinite(e)&&isFinite(t)){var n=Math.abs(e-t);return n<x||n<=Math.max(Math.abs(e),Math.abs(t))*r}return!1}var N=Math.acosh||function(e){return Math.log(Math.sqrt(e*e-1)+e)},O=Math.asinh||function(e){return Math.log(Math.sqrt(e*e+1)+e)},M=Math.atanh||function(e){return Math.log((1+e)/(1-e))/2},E=Math.cosh||function(e){return(Math.exp(e)+Math.exp(-e))/2},j=Math.sinh||function(e){return(Math.exp(e)-Math.exp(-e))/2},S=Math.tanh||function(e){var t=Math.exp(2*e);return(t-1)/(t+1)}},function(e,t,r){"use strict";var n=r(1),i=r(4),c=r(3);function f(e,t){if("function"==typeof t)return t(e);if(!e.isFinite())return e.isNaN()?"NaN":e.gt(0)?"Infinity":"-Infinity";var r,n="auto";switch(void 0!==t&&(t.notation&&(n=t.notation),"number"==typeof t?r=t:t.precision&&(r=t.precision)),n){case"fixed":return function(e,t){return e.toFixed(t)}(e,r);case"exponential":return l(e,r);case"engineering":return function(e,t){var r=e.e,n=r%3==0?r:r<0?r-3-r%3:r-r%3,i=e.mul(Math.pow(10,-n)),a=i.toPrecision(t);-1!==a.indexOf("e")&&(a=i.toString());return a+"e"+(0<=r?"+":"")+n.toString()}(e,r);case"auto":if(t&&t.exponential&&(void 0!==t.exponential.lower||void 0!==t.exponential.upper)){var i=Object(c.i)(t,function(e){return e});return(i.exponential=void 0)!==t.exponential.lower&&(i.lowerExp=Math.round(Math.log(t.exponential.lower)/Math.LN10)),void 0!==t.exponential.upper&&(i.upperExp=Math.round(Math.log(t.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(t)+" with "+JSON.stringify(i)),f(e,i)}var a=t&&void 0!==t.lowerExp?t.lowerExp:-3,o=t&&void 0!==t.upperExp?t.upperExp:5;if(e.isZero())return"0";var s=e.toSignificantDigits(r),u=s.e;return(a<=u&&u<o?s.toFixed():l(e,r)).replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],t=arguments[4];return"."!==e?e+t:t});default:throw new Error('Unknown notation "'+n+'". Choose "auto", "exponential", or "fixed".')}}function l(e,t){return void 0!==t?e.toExponential(t-1):e.toExponential()}function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){var r=e.length-t.length,n=e.length;return e.substring(r,n)===t}function s(t,r){return"number"==typeof t?Object(i.h)(t,r):Object(n.e)(t)?f(t,r):function(e){return e&&"object"===a(e)&&"number"==typeof e.s&&"number"==typeof e.n&&"number"==typeof e.d||!1}(t)?r&&"decimal"===r.fraction?t.toString():t.s*t.n+"/"+t.d:Array.isArray(t)?function e(t,r){{if(Array.isArray(t)){for(var n="[",i=t.length,a=0;a<i;a++)0!==a&&(n+=", "),n+=e(t[a],r);return n+="]"}return s(t,r)}}(t,r):Object(n.I)(t)?'"'+t+'"':"function"==typeof t?t.syntax?String(t.syntax):"function":t&&"object"===a(t)?"function"==typeof t.format?t.format(r):t&&t.toString()!=={}.toString()?t.toString():"{"+Object.keys(t).map(function(e){return'"'+e+'": '+s(t[e],r)}).join(", ")+"}":String(t)}function u(e){for(var t=String(e),r="",n=0;n<t.length;){var i=t.charAt(n);"\\"===i?(r+=i,n++,""!==(i=t.charAt(n))&&-1!=='"\\/bfnrtu'.indexOf(i)||(r+="\\"),r+=i):r+='"'===i?'\\"':i,n++}return'"'+r+'"'}function p(e){var t=String(e);return t=t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function m(e,t){if(!Object(n.I)(e))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+Object(n.M)(e)+", index: 0)");if(!Object(n.I)(t))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+Object(n.M)(t)+", index: 1)");return e===t?0:t<e?1:-1}r.d(t,"b",function(){return o}),r.d(t,"d",function(){return s}),r.d(t,"e",function(){return u}),r.d(t,"c",function(){return p}),r.d(t,"a",function(){return m})},function(e,t,r){"use strict";function n(e,t,r){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");this.actual=e,this.expected=t,this.relation=r,this.message="Dimension mismatch ("+(Array.isArray(e)?"["+e.join(", ")+"]":e)+" "+(this.relation||"!=")+" "+(Array.isArray(t)?"["+t.join(", ")+"]":t)+")",this.stack=(new Error).stack}r.d(t,"a",function(){return n}),(n.prototype=new RangeError).constructor=RangeError,n.prototype.name="DimensionError",n.prototype.isDimensionError=!0},,function(e,t,r){"use strict";r.d(t,"a",function(){return n});var a,n=(a={},function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n,i=t.join(", ");a[i]||(a[i]=!0,(n=console).warn.apply(n,["Warning:"].concat(t)))})},function(e,t,r){var o;
/**
* @license Complex.js v2.0.11 11/02/2016
*
* Copyright (c) 2016, Robert Eisele (robert@xarg.org)
* Dual licensed under the MIT or GPL Version 2 licenses.
**/
/**
* @license Complex.js v2.0.11 11/02/2016
*
* Copyright (c) 2016, Robert Eisele (robert@xarg.org)
* Dual licensed under the MIT or GPL Version 2 licenses.
**/
!function(){"use strict";function n(e){return.5*(Math.exp(e)+Math.exp(-e))}function i(e){return.5*(Math.exp(e)-Math.exp(-e))}function u(){throw SyntaxError("Invalid Param")}function c(e,t){var r=Math.abs(e),n=Math.abs(t);return 0===e?Math.log(n):0===t?Math.log(r):r<3e3&&n<3e3?.5*Math.log(e*e+t*t):Math.log(e/Math.cos(Math.atan2(t,e)))}var a=function(e,t){var r={re:0,im:0};if(null==e)r.re=r.im=0;else if(void 0!==t)r.re=e,r.im=t;else switch(typeof e){case"object":if("im"in e&&"re"in e)r.re=e.re,r.im=e.im;else if("abs"in e&&"arg"in e){if(!Number.isFinite(e.abs)&&Number.isFinite(e.arg))return f.INFINITY;r.re=e.abs*Math.cos(e.arg),r.im=e.abs*Math.sin(e.arg)}else if("r"in e&&"phi"in e){if(!Number.isFinite(e.r)&&Number.isFinite(e.phi))return f.INFINITY;r.re=e.r*Math.cos(e.phi),r.im=e.r*Math.sin(e.phi)}else 2===e.length?(r.re=e[0],r.im=e[1]):u();break;case"string":r.im=r.re=0;var n=e.match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),i=1,a=0;null===n&&u();for(var o=0;o<n.length;o++){var s=n[o];" "===s||"\t"===s||"\n"===s||("+"===s?i++:"-"===s?a++:i=a=("i"===s||"I"===s?(i+a===0&&u()," "===n[o+1]||isNaN(n[o+1])?r.im+=parseFloat((a%2?"-":"")+"1"):(r.im+=parseFloat((a%2?"-":"")+n[o+1]),o++)):(i+a!==0&&!isNaN(s)||u(),"i"===n[o+1]||"I"===n[o+1]?(r.im+=parseFloat((a%2?"-":"")+s),o++):r.re+=parseFloat((a%2?"-":"")+s)),0))}0<i+a&&u();break;case"number":r.im=0,r.re=e;break;default:u()}return isNaN(r.re)||isNaN(r.im),r};function f(e,t){if(!(this instanceof f))return new f(e,t);var r=a(e,t);this.re=r.re,this.im=r.im}f.prototype={re:0,im:0,sign:function(){var e=this.abs();return new f(this.re/e,this.im/e)},add:function(e,t){var r=new f(e,t);return this.isInfinite()&&r.isInfinite()?f.NAN:this.isInfinite()||r.isInfinite()?f.INFINITY:new f(this.re+r.re,this.im+r.im)},sub:function(e,t){var r=new f(e,t);return this.isInfinite()&&r.isInfinite()?f.NAN:this.isInfinite()||r.isInfinite()?f.INFINITY:new f(this.re-r.re,this.im-r.im)},mul:function(e,t){var r=new f(e,t);return this.isInfinite()&&r.isZero()||this.isZero()&&r.isInfinite()?f.NAN:this.isInfinite()||r.isInfinite()?f.INFINITY:0===r.im&&0===this.im?new f(this.re*r.re,0):new f(this.re*r.re-this.im*r.im,this.re*r.im+this.im*r.re)},div:function(e,t){var r=new f(e,t);if(this.isZero()&&r.isZero()||this.isInfinite()&&r.isInfinite())return f.NAN;if(this.isInfinite()||r.isZero())return f.INFINITY;if(this.isZero()||r.isInfinite())return f.ZERO;e=this.re,t=this.im;var n,i,a=r.re,o=r.im;return 0===o?new f(e/a,t/a):Math.abs(a)<Math.abs(o)?new f((e*(i=a/o)+t)/(n=a*i+o),(t*i-e)/n):new f((e+t*(i=o/a))/(n=o*i+a),(t-e*i)/n)},pow:function(e,t){var r=new f(e,t);if(e=this.re,t=this.im,r.isZero())return f.ONE;if(0===r.im){if(0===t&&0<=e)return new f(Math.pow(e,r.re),0);if(0===e)switch((r.re%4+4)%4){case 0:return new f(Math.pow(t,r.re),0);case 1:return new f(0,Math.pow(t,r.re));case 2:return new f(-Math.pow(t,r.re),0);case 3:return new f(0,-Math.pow(t,r.re))}}if(0===e&&0===t&&0<r.re&&0<=r.im)return f.ZERO;var n=Math.atan2(t,e),i=c(e,t);return e=Math.exp(r.re*i-r.im*n),t=r.im*i+r.re*n,new f(e*Math.cos(t),e*Math.sin(t))},sqrt:function(){var e,t,r=this.re,n=this.im,i=this.abs();if(0<=r){if(0===n)return new f(Math.sqrt(r),0);e=.5*Math.sqrt(2*(i+r))}else e=Math.abs(n)/Math.sqrt(2*(i-r));return t=r<=0?.5*Math.sqrt(2*(i-r)):Math.abs(n)/Math.sqrt(2*(i+r)),new f(e,n<0?-t:t)},exp:function(){var e=Math.exp(this.re);return this.im,new f(e*Math.cos(this.im),e*Math.sin(this.im))},expm1:function(){var e=this.re,t=this.im;return new f(Math.expm1(e)*Math.cos(t)+function(e){var t=Math.PI/4;if(e<-t||t<e)return Math.cos(e)-1;var r=e*e;return r*(r*(1/24+r*(-1/720+r*(1/40320+r*(-1/3628800+r*(1/4790014600+r*(-1/87178291200+1/20922789888e3*r))))))-.5)}(t),Math.exp(e)*Math.sin(t))},log:function(){var e=this.re,t=this.im;return new f(c(e,t),Math.atan2(t,e))},abs:function(){return function(e,t){var r=Math.abs(e),n=Math.abs(t);return r<3e3&&n<3e3?Math.sqrt(r*r+n*n):(n=r<n?(r=n,e/t):t/e,r*Math.sqrt(1+n*n))}(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){var e=this.re,t=this.im;return new f(Math.sin(e)*n(t),Math.cos(e)*i(t))},cos:function(){var e=this.re,t=this.im;return new f(Math.cos(e)*n(t),-Math.sin(e)*i(t))},tan:function(){var e=2*this.re,t=2*this.im,r=Math.cos(e)+n(t);return new f(Math.sin(e)/r,i(t)/r)},cot:function(){var e=2*this.re,t=2*this.im,r=Math.cos(e)-n(t);return new f(-Math.sin(e)/r,i(t)/r)},sec:function(){var e=this.re,t=this.im,r=.5*n(2*t)+.5*Math.cos(2*e);return new f(Math.cos(e)*n(t)/r,Math.sin(e)*i(t)/r)},csc:function(){var e=this.re,t=this.im,r=.5*n(2*t)-.5*Math.cos(2*e);return new f(Math.sin(e)*n(t)/r,-Math.cos(e)*i(t)/r)},asin:function(){var e=this.re,t=this.im,r=new f(t*t-e*e+1,-2*e*t).sqrt(),n=new f(r.re-t,r.im+e).log();return new f(n.im,-n.re)},acos:function(){var e=this.re,t=this.im,r=new f(t*t-e*e+1,-2*e*t).sqrt(),n=new f(r.re-t,r.im+e).log();return new f(Math.PI/2-n.im,n.re)},atan:function(){var e=this.re,t=this.im;if(0===e){if(1===t)return new f(0,1/0);if(-1===t)return new f(0,-1/0)}var r=e*e+(1-t)*(1-t),n=new f((1-t*t-e*e)/r,-2*e/r).log();return new f(-.5*n.im,.5*n.re)},acot:function(){var e=this.re,t=this.im;if(0===t)return new f(Math.atan2(1,e),0);var r=e*e+t*t;return 0!=r?new f(e/r,-t/r).atan():new f(0!==e?e/0:0,0!==t?-t/0:0).atan()},asec:function(){var e=this.re,t=this.im;if(0===e&&0===t)return new f(0,1/0);var r=e*e+t*t;return 0!=r?new f(e/r,-t/r).acos():new f(0!==e?e/0:0,0!==t?-t/0:0).acos()},acsc:function(){var e=this.re,t=this.im;if(0===e&&0===t)return new f(Math.PI/2,1/0);var r=e*e+t*t;return 0!=r?new f(e/r,-t/r).asin():new f(0!==e?e/0:0,0!==t?-t/0:0).asin()},sinh:function(){var e=this.re,t=this.im;return new f(i(e)*Math.cos(t),n(e)*Math.sin(t))},cosh:function(){var e=this.re,t=this.im;return new f(n(e)*Math.cos(t),i(e)*Math.sin(t))},tanh:function(){var e=2*this.re,t=2*this.im,r=n(e)+Math.cos(t);return new f(i(e)/r,Math.sin(t)/r)},coth:function(){var e=2*this.re,t=2*this.im,r=n(e)-Math.cos(t);return new f(i(e)/r,-Math.sin(t)/r)},csch:function(){var e=this.re,t=this.im,r=Math.cos(2*t)-n(2*e);return new f(-2*i(e)*Math.cos(t)/r,2*n(e)*Math.sin(t)/r)},sech:function(){var e=this.re,t=this.im,r=Math.cos(2*t)+n(2*e);return new f(2*n(e)*Math.cos(t)/r,-2*i(e)*Math.sin(t)/r)},asinh:function(){var e=this.im;this.im=-this.re,this.re=e;var t=this.asin();return this.re=-this.im,this.im=e,e=t.re,t.re=-t.im,t.im=e,t},acosh:function(){var e=this.acos();if(e.im<=0){var t=e.re;e.re=-e.im,e.im=t}else{t=e.im;e.im=-e.re,e.re=t}return e},atanh:function(){var e=this.re,t=this.im,r=1<e&&0===t,n=1-e,i=1+e,a=n*n+t*t,o=0!=a?new f((i*n-t*t)/a,(t*n+i*t)/a):new f(-1!==e?e/0:0,0!==t?t/0:0),s=o.re;return o.re=c(o.re,o.im)/2,o.im=Math.atan2(o.im,s)/2,r&&(o.im=-o.im),o},acoth:function(){var e=this.re,t=this.im;if(0===e&&0===t)return new f(0,Math.PI/2);var r=e*e+t*t;return 0!=r?new f(e/r,-t/r).atanh():new f(0!==e?e/0:0,0!==t?-t/0:0).atanh()},acsch:function(){var e=this.re,t=this.im;if(0===t)return new f(0!==e?Math.log(e+Math.sqrt(e*e+1)):1/0,0);var r=e*e+t*t;return 0!=r?new f(e/r,-t/r).asinh():new f(0!==e?e/0:0,0!==t?-t/0:0).asinh()},asech:function(){var e=this.re,t=this.im;if(this.isZero())return f.INFINITY;var r=e*e+t*t;return 0!=r?new f(e/r,-t/r).acosh():new f(0!==e?e/0:0,0!==t?-t/0:0).acosh()},inverse:function(){if(this.isZero())return f.INFINITY;if(this.isInfinite())return f.ZERO;var e=this.re,t=this.im,r=e*e+t*t;return new f(e/r,-t/r)},conjugate:function(){return new f(this.re,-this.im)},neg:function(){return new f(-this.re,-this.im)},ceil:function(e){return e=Math.pow(10,e||0),new f(Math.ceil(this.re*e)/e,Math.ceil(this.im*e)/e)},floor:function(e){return e=Math.pow(10,e||0),new f(Math.floor(this.re*e)/e,Math.floor(this.im*e)/e)},round:function(e){return e=Math.pow(10,e||0),new f(Math.round(this.re*e)/e,Math.round(this.im*e)/e)},equals:function(e,t){var r=new f(e,t);return Math.abs(r.re-this.re)<=f.EPSILON&&Math.abs(r.im-this.im)<=f.EPSILON},clone:function(){return new f(this.re,this.im)},toString:function(){var e=this.re,t=this.im,r="";return this.isNaN()?"NaN":this.isZero()?"0":this.isInfinite()?"Infinity":(0!==e&&(r+=e),0!==t&&(0!==e?r+=t<0?" - ":" + ":t<0&&(r+="-"),1!==(t=Math.abs(t))&&(r+=t),r+="i"),r||"0")},toVector:function(){return[this.re,this.im]},valueOf:function(){return 0===this.im?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return!(0!==this.re&&-0!==this.re||0!==this.im&&-0!==this.im)},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!(this.isNaN()||this.isFinite())}},f.ZERO=new f(0,0),f.ONE=new f(1,0),f.I=new f(0,1),f.PI=new f(Math.PI,0),f.E=new f(Math.E,0),f.INFINITY=new f(1/0,1/0),f.NAN=new f(NaN,NaN),f.EPSILON=1e-16,void 0===(o=function(){return f}.apply(t,[]))||(e.exports=o)}()},function(e,t,r){"use strict";function n(e,t,r){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");this.index=e,arguments.length<3?(this.min=0,this.max=t):(this.min=t,this.max=r),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}r.d(t,"a",function(){return n}),(n.prototype=new RangeError).constructor=RangeError,n.prototype.name="IndexError",n.prototype.isIndexError=!0},function(r,i,e){var a;
/**
* @license Fraction.js v4.0.12 09/09/2015
* http://www.xarg.org/2014/03/rational-numbers-in-javascript/
*
* Copyright (c) 2015, Robert Eisele (robert@xarg.org)
* Dual licensed under the MIT or GPL Version 2 licenses.
**/
/**
* @license Fraction.js v4.0.12 09/09/2015
* http://www.xarg.org/2014/03/rational-numbers-in-javascript/
*
* Copyright (c) 2015, Robert Eisele (robert@xarg.org)
* Dual licensed under the MIT or GPL Version 2 licenses.
**/
!function(){"use strict";var d={s:1,n:0,d:1};function e(t){function e(){var e=Error.apply(this,arguments);e.name=this.name=t,this.stack=e.stack,this.message=e.message}function r(){}return r.prototype=Error.prototype,e.prototype=new r,e}var y=c.DivisionByZero=e("DivisionByZero"),t=c.InvalidParameter=e("InvalidParameter");function g(e,t){return isNaN(e=parseInt(e,10))&&v(),e*t}function v(){throw new t}var n=function(e,t){var r,n=0,i=1,a=1,o=0,s=0,u=0,c=1,f=1,l=0,p=1,m=1,h=1;if(null==e);else if(void 0!==t)a=(n=e)*(i=t);else switch(typeof e){case"object":"d"in e&&"n"in e?(n=e.n,i=e.d,"s"in e&&(n*=e.s)):0 in e?(n=e[0],1 in e&&(i=e[1])):v(),a=n*i;break;case"number":if(e<0&&(e=-(a=e)),e%1==0)n=e;else if(0<e){for(1<=e&&(e/=f=Math.pow(10,Math.floor(1+Math.log(e)/Math.LN10)));p<=1e7&&h<=1e7;){if(e===(r=(l+m)/(p+h))){i=p+h<=1e7?(n=l+m,p+h):p<h?(n=m,h):(n=l,p);break}r<e?(l+=m,p+=h):(m+=l,h+=p),i=1e7<p?(n=m,h):(n=l,p)}n*=f}else(isNaN(e)||isNaN(t))&&(i=n=NaN);break;case"string":if(null===(p=e.match(/\d+|./g))&&v(),"-"===p[l]?(a=-1,l++):"+"===p[l]&&l++,p.length===l+1?s=g(p[l++],a):"."===p[l+1]||"."===p[l]?("."!==p[l]&&(o=g(p[l++],a)),(++l+1===p.length||"("===p[l+1]&&")"===p[l+3]||"'"===p[l+1]&&"'"===p[l+3])&&(s=g(p[l],a),c=Math.pow(10,p[l].length),l++),("("===p[l]&&")"===p[l+2]||"'"===p[l]&&"'"===p[l+2])&&(u=g(p[l+1],a),f=Math.pow(10,p[l+1].length)-1,l+=3)):"/"===p[l+1]||":"===p[l+1]?(s=g(p[l],a),c=g(p[l+2],1),l+=3):"/"===p[l+3]&&" "===p[l+1]&&(o=g(p[l],a),s=g(p[l+2],a),c=g(p[l+4],1),l+=5),p.length<=l){a=n=u+(i=c*f)*o+f*s;break}default:v()}if(0===i)throw new y;d.s=a<0?-1:1,d.n=Math.abs(n),d.d=Math.abs(i)};function u(e,t){if(!e)return t;if(!t)return e;for(;;){if(!(e%=t))return t;if(!(t%=e))return e}}function c(e,t){if(!(this instanceof c))return new c(e,t);n(e,t),e=c.REDUCE?u(d.d,d.n):1,this.s=d.s,this.n=d.n/e,this.d=d.d/e}c.REDUCE=1,c.prototype={s:1,n:0,d:1,abs:function(){return new c(this.n,this.d)},neg:function(){return new c(-this.s*this.n,this.d)},add:function(e,t){return n(e,t),new c(this.s*this.n*d.d+d.s*this.d*d.n,this.d*d.d)},sub:function(e,t){return n(e,t),new c(this.s*this.n*d.d-d.s*this.d*d.n,this.d*d.d)},mul:function(e,t){return n(e,t),new c(this.s*d.s*this.n*d.n,this.d*d.d)},div:function(e,t){return n(e,t),new c(this.s*d.s*this.n*d.d,this.d*d.n)},clone:function(){return new c(this)},mod:function(e,t){return isNaN(this.n)||isNaN(this.d)?new c(NaN):void 0===e?new c(this.s*this.n%this.d,1):(n(e,t),0===d.n&&0===this.d&&c(0,0),new c(this.s*(d.d*this.n)%(d.n*this.d),d.d*this.d))},gcd:function(e,t){return n(e,t),new c(u(d.n,this.n)*u(d.d,this.d),d.d*this.d)},lcm:function(e,t){return n(e,t),0===d.n&&0===this.n?new c:new c(d.n*this.n,u(d.n,this.n)*u(d.d,this.d))},ceil:function(e){return e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d)?new c(NaN):new c(Math.ceil(e*this.s*this.n/this.d),e)},floor:function(e){return e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d)?new c(NaN):new c(Math.floor(e*this.s*this.n/this.d),e)},round:function(e){return e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d)?new c(NaN):new c(Math.round(e*this.s*this.n/this.d),e)},inverse:function(){return new c(this.s*this.d,this.n)},pow:function(e){return e<0?new c(Math.pow(this.s*this.d,-e),Math.pow(this.n,-e)):new c(Math.pow(this.s*this.n,e),Math.pow(this.d,e))},equals:function(e,t){return n(e,t),this.s*this.n*d.d==d.s*d.n*this.d},compare:function(e,t){n(e,t);var r=this.s*this.n*d.d-d.s*d.n*this.d;return(0<r)-(r<0)},simplify:function(e){if(isNaN(this.n)||isNaN(this.d))return this;var t=this.abs().toContinued();function r(e){return 1===e.length?new c(e[0]):r(e.slice(1)).inverse().add(e[0])}e=e||.001;for(var n=0;n<t.length;n++){var i=r(t.slice(0,n+1));if(i.sub(this.abs()).abs().valueOf()<e)return i.mul(this.s)}return this},divisible:function(e,t){return n(e,t),!(!(d.n*this.d)||this.n*d.d%(d.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(e){var t,r="",n=this.n,i=this.d;return this.s<0&&(r+="-"),1===i?r+=n:(e&&0<(t=Math.floor(n/i))&&(r+=t,r+=" ",n%=i),r+=n,r+="/",r+=i),r},toLatex:function(e){var t,r="",n=this.n,i=this.d;return this.s<0&&(r+="-"),1===i?r+=n:(e&&0<(t=Math.floor(n/i))&&(r+=t,n%=i),r+="\\frac{",r+=n,r+="}{",r+=i,r+="}"),r},toContinued:function(){var e,t=this.n,r=this.d,n=[];if(isNaN(this.n)||isNaN(this.d))return n;for(;n.push(Math.floor(t/r)),e=t%r,t=r,r=e,1!==t;);return n},toString:function(e){var t,r=this.n,n=this.d;if(isNaN(r)||isNaN(n))return"NaN";c.REDUCE||(r/=t=u(r,n),n/=t),e=e||15;var i=function(e,t){for(;t%2==0;t/=2);for(;t%5==0;t/=5);if(1===t)return 0;for(var r=10%t,n=1;1!==r;n++)if(r=10*r%t,2e3<n)return 0;return n}(0,n),a=function(e,t,r){for(var n=1,i=function(e,t,r){for(var n=1;0<t;e=e*e%r,t>>=1)1&t&&(n=n*e%r);return n}(10,r,t),a=0;a<300;a++){if(n===i)return a;n=10*n%t,i=10*i%t}return 0}(0,n,i),o=-1===this.s?"-":"";if(o+=r/n|0,r%=n,(r*=10)&&(o+="."),i){for(var s=a;s--;)o+=r/n|0,r%=n,r*=10;o+="(";for(s=i;s--;)o+=r/n|0,r%=n,r*=10;o+=")"}else for(s=e;r&&s--;)o+=r/n|0,r%=n,r*=10;return o}},void 0===(a=function(){return c}.apply(i,[]))||(r.exports=a)}()},function(e,t){e.exports=function t(e,r){"use strict";function n(e){return t.insensitive&&(""+e).toLowerCase()||""+e}var i,a,o=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,s=/(^[ ]*|[ ]*$)/g,u=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,c=/^0x[0-9a-f]+$/i,f=/^0/,l=n(e).replace(s,"")||"",p=n(r).replace(s,"")||"",m=l.replace(o,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),h=p.replace(o,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),d=parseInt(l.match(c),16)||1!==m.length&&l.match(u)&&Date.parse(l),y=parseInt(p.match(c),16)||d&&p.match(u)&&Date.parse(p)||null;if(y){if(d<y)return-1;if(y<d)return 1}for(var g=0,v=Math.max(m.length,h.length);g<v;g++){if(i=!(m[g]||"").match(f)&&parseFloat(m[g])||m[g]||0,a=!(h[g]||"").match(f)&&parseFloat(h[g])||h[g]||0,isNaN(i)!==isNaN(a))return isNaN(i)?1:-1;if(typeof i!=typeof a&&(i+="",a+=""),i<a)return-1;if(a<i)return 1}return 0}},function(e,t,r){"use strict";function i(e,t,r,n){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this.fn=e,this.count=t,this.min=r,this.max=n,this.message="Wrong number of arguments in function "+e+" ("+t+" provided, "+r+(null!=n?"-"+n:"")+" expected)",this.stack=(new Error).stack}r.d(t,"a",function(){return i}),(i.prototype=new Error).constructor=Error,i.prototype.name="ArgumentsError",i.prototype.isArgumentsError=!0},function(e,t,r){"use strict";var n,i,a;i=[],void 0===(a="function"==typeof(n=function(){function k(){return!0}function re(){return!1}function ne(){}return function e(){var t=[{name:"number",test:function(e){return"number"==typeof e}},{name:"string",test:function(e){return"string"==typeof e}},{name:"boolean",test:function(e){return"boolean"==typeof e}},{name:"Function",test:function(e){return"function"==typeof e}},{name:"Array",test:Array.isArray},{name:"Date",test:function(e){return e instanceof Date}},{name:"RegExp",test:function(e){return e instanceof RegExp}},{name:"Object",test:function(e){return"object"==typeof e&&e.constructor===Object}},{name:"null",test:function(e){return null===e}},{name:"undefined",test:function(e){return void 0===e}}];var n={name:"any",test:k};var r=[];var i=[];var U={types:t,conversions:i,ignore:r};function u(t){var e=ee(U.types,function(e){return e.name===t});if(e)return e;if("any"===t)return n;var r=ee(U.types,function(e){return e.name.toLowerCase()===t.toLowerCase()});throw new TypeError('Unknown type "'+t+'"'+(r?'. Did you mean "'+r.name+'"?':""))}function c(e){return e===n?999:U.types.indexOf(e)}function p(t){var e=ee(U.types,function(e){return e.test(t)});if(e)return e.name;throw new TypeError("Value has unknown type. Value: "+t)}function a(e,t){if(!e.signatures)throw new TypeError("Function is no typed-function");var r;if("string"==typeof t){r=t.split(",");for(var n=0;n<r.length;n++)r[n]=r[n].trim()}else{if(!Array.isArray(t))throw new TypeError("String array or a comma separated string expected");r=t}var i=r.join(","),a=e.signatures[i];if(a)return a;throw new TypeError("Signature not found (signature: "+(e.name||"unnamed")+"("+r.join(", ")+"))")}function o(e,t){var r=p(e);if(t===r)return e;for(var n=0;n<U.conversions.length;n++){var i=U.conversions[n];if(i.from===r&&i.to===t)return i.convert(e)}throw new Error("Cannot convert from "+r+" to "+t)}function L(e){return e.map(function(e){var t=e.types.map(h);return(e.restParam?"...":"")+t.join("|")}).join(",")}function s(e,r){var t=0===e.indexOf("..."),n=t?3<e.length?e.slice(3):"any":e,i=n.split("|").map(M).filter(E).filter(O),a=x(r,i),o=i.map(function(e){var t=u(e);return{name:e,typeIndex:c(t),test:t.test,conversion:null,conversionIndex:-1}}),s=a.map(function(e){var t=u(e.from);return{name:e.from,typeIndex:c(t),test:t.test,conversion:e,conversionIndex:r.indexOf(e)}});return{types:o.concat(s),restParam:t}}function H(e,t,i){var r=[];return""!==e.trim()&&(r=e.split(",").map(M).map(function(e,t,r){var n=s(e,i);if(n.restParam&&t!==r.length-1)throw new SyntaxError('Unexpected rest parameter "'+e+'": only allowed for the last parameter');return n})),r.some(j)?null:{params:r,fn:t}}function $(e){var t=A(e);return!!t&&t.restParam}function f(e){return e.types.some(function(e){return null!=e.conversion})}function G(e){if(e&&0!==e.types.length){if(1===e.types.length)return u(e.types[0].name).test;if(2===e.types.length){var t=u(e.types[0].name).test,r=u(e.types[1].name).test;return function(e){return t(e)||r(e)}}var n=e.types.map(function(e){return u(e.name).test});return function(e){for(var t=0;t<n.length;t++)if(n[t](e))return!0;return!1}}return k}function Z(e){var r,t,n;if($(e)){var i=(r=S(e).map(G)).length,a=G(A(e)),o=function(e){for(var t=i;t<e.length;t++)if(!a(e[t]))return!1;return!0};return function(e){for(var t=0;t<r.length;t++)if(!r[t](e[t]))return!1;return o(e)&&e.length>=i+1}}return 0===e.length?function(e){return 0===e.length}:1===e.length?(t=G(e[0]),function(e){return t(e[0])&&1===e.length}):2===e.length?(t=G(e[0]),n=G(e[1]),function(e){return t(e[0])&&n(e[1])&&2===e.length}):(r=e.map(G),function(e){for(var t=0;t<r.length;t++)if(!r[t](e[t]))return!1;return e.length===r.length})}function m(e,t){return t<e.params.length?e.params[t]:$(e.params)?A(e.params):null}function l(e,t,r){var n=m(e,t),i=n?r?n.types.filter(d):n.types:[];return i.map(h)}function h(e){return e.name}function d(e){return null===e.conversion||void 0===e.conversion}function y(e,t){var r=I(te(e,function(e){return l(e,t,!1)}));return-1!==r.indexOf("any")?["any"]:r}function V(e,r,t){var n,i,a,o=e||"unnamed",s=t;for(a=0;a<r.length;a++){var u=s.filter(function(e){var t=G(m(e,a));return(a<e.params.length||$(e.params))&&t(r[a])});if(0===u.length){if(0<(i=y(s,a)).length){var c=p(r[a]);return(n=new TypeError("Unexpected type of argument in function "+o+" (expected: "+i.join(" or ")+", actual: "+c+", index: "+a+")")).data={category:"wrongType",fn:o,index:a,actual:c,expected:i},n}}else s=u}var f=s.map(function(e){return $(e.params)?1/0:e.params.length});if(r.length<Math.min.apply(null,f))return i=y(s,a),(n=new TypeError("Too few arguments in function "+o+" (expected: "+i.join(" or ")+", index: "+r.length+")")).data={category:"tooFewArgs",fn:o,index:r.length,expected:i},n;var l=Math.max.apply(null,f);return r.length>l?(n=new TypeError("Too many arguments in function "+o+" (expected: "+l+", actual: "+r.length+")")).data={category:"tooManyArgs",fn:o,index:r.length,expectedLength:l}:(n=new TypeError('Arguments of type "'+r.join(", ")+'" do not match any of the defined signatures of function '+o+".")).data={category:"mismatch",actual:r.map(p)},n}function g(e){for(var t=999,r=0;r<e.types.length;r++)d(e.types[r])&&(t=Math.min(t,e.types[r].typeIndex));return t}function v(e){for(var t=999,r=0;r<e.types.length;r++)d(e.types[r])||(t=Math.min(t,e.types[r].conversionIndex));return t}function b(e,t){var r;return 0!==(r=e.restParam-t.restParam)?r:0!==(r=f(e)-f(t))?r:0!==(r=g(e)-g(t))?r:v(e)-v(t)}function J(e,t){var r,n,i=Math.min(e.params.length,t.params.length);if(0!==(n=e.params.some(f)-t.params.some(f)))return n;for(r=0;r<i;r++)if(0!==(n=f(e.params[r])-f(t.params[r])))return n;for(r=0;r<i;r++)if(0!==(n=b(e.params[r],t.params[r])))return n;return e.params.length-t.params.length}function x(e,t){var r={};return e.forEach(function(e){-1!==t.indexOf(e.from)||-1===t.indexOf(e.to)||r[e.from]||(r[e.from]=e)}),Object.keys(r).map(function(e){return r[e]})}function W(e,n){var t=n;if(e.some(f)){var i=$(e),a=e.map(w);t=function(){for(var e=[],t=i?arguments.length-1:arguments.length,r=0;r<t;r++)e[r]=a[r](arguments[r]);return i&&(e[t]=arguments[t].map(a[t])),n.apply(null,e)}}var r=t;if($(e)){var o=e.length-1;r=function(){return t.apply(null,C(arguments,0,o).concat([C(arguments,o)]))}}return r}function w(e){var t,r,n,i,a=[],o=[];switch(e.types.forEach(function(e){e.conversion&&(a.push(u(e.conversion.from).test),o.push(e.conversion.convert))}),o.length){case 0:return function(e){return e};case 1:return t=a[0],n=o[0],function(e){return t(e)?n(e):e};case 2:return t=a[0],r=a[1],n=o[0],i=o[1],function(e){return t(e)?n(e):r(e)?i(e):e};default:return function(e){for(var t=0;t<o.length;t++)if(a[t](e))return o[t](e);return e}}}function Y(e){var r={};return e.forEach(function(t){t.params.some(f)||X(t.params,!0).forEach(function(e){r[L(e)]=t.fn})}),r}function X(e,u){function c(r,t,n){if(t<r.length){var e,i=r[t],a=u?i.types.filter(d):i.types;if(i.restParam){var o=a.filter(d);e=o.length<a.length?[o,a]:[a]}else e=a.map(function(e){return[e]});return te(e,function(e){return c(r,t+1,n.concat([e]))})}var s=n.map(function(e,t){return{types:e,restParam:t===r.length-1&&$(r)}});return[s]}return c(e,0,[])}function Q(e,t){for(var r=Math.max(e.params.length,t.params.length),n=0;n<r;n++){var i=l(e,n,!0),a=l(t,n,!0);if(!_(i,a))return!1}var o=e.params.length,s=t.params.length,u=$(e.params),c=$(t.params);return u?c?o===s:o<=s:c?s<=o:o===s}function N(t,r){if(0===Object.keys(r).length)throw new SyntaxError("No signatures provided");var n=[];Object.keys(r).map(function(e){return H(e,r[e],U.conversions)}).filter(K).forEach(function(t){var e=ee(n,function(e){return Q(e,t)});if(e)throw new TypeError('Conflicting signatures "'+L(e.params)+'" and "'+L(t.params)+'".');n.push(t)});var i=te(n,function(t){var e=t?X(t.params,!1):[];return e.map(function(e){return{params:e,fn:t.fn}})}).filter(K);i.sort(J);var e=i[0]&&i[0].params.length<=2&&!$(i[0].params),a=i[1]&&i[1].params.length<=2&&!$(i[1].params),o=i[2]&&i[2].params.length<=2&&!$(i[2].params),s=i[3]&&i[3].params.length<=2&&!$(i[3].params),u=i[4]&&i[4].params.length<=2&&!$(i[4].params),c=i[5]&&i[5].params.length<=2&&!$(i[5].params),f=e&&a&&o&&s&&u&&c,l=i.map(function(e){return Z(e.params)}),p=e?G(i[0].params[0]):re,m=a?G(i[1].params[0]):re,h=o?G(i[2].params[0]):re,d=s?G(i[3].params[0]):re,y=u?G(i[4].params[0]):re,g=c?G(i[5].params[0]):re,v=e?G(i[0].params[1]):re,b=a?G(i[1].params[1]):re,x=o?G(i[2].params[1]):re,w=s?G(i[3].params[1]):re,N=u?G(i[4].params[1]):re,O=c?G(i[5].params[1]):re,M=i.map(function(e){return W(e.params,e.fn)}),E=e?M[0]:ne,j=a?M[1]:ne,S=o?M[2]:ne,A=s?M[3]:ne,C=u?M[4]:ne,T=c?M[5]:ne,_=e?i[0].params.length:-1,I=a?i[1].params.length:-1,B=o?i[2].params.length:-1,q=s?i[3].params.length:-1,k=u?i[4].params.length:-1,z=c?i[5].params.length:-1,D=f?6:0,R=i.length,P=function(){for(var e=D;e<R;e++)if(l[e](arguments))return M[e].apply(null,arguments);throw V(t,arguments,i)},F=function(e,t){return arguments.length===_&&p(e)&&v(t)?E.apply(null,arguments):arguments.length===I&&m(e)&&b(t)?j.apply(null,arguments):arguments.length===B&&h(e)&&x(t)?S.apply(null,arguments):arguments.length===q&&d(e)&&w(t)?A.apply(null,arguments):arguments.length===k&&y(e)&&N(t)?C.apply(null,arguments):arguments.length===z&&g(e)&&O(t)?T.apply(null,arguments):P.apply(null,arguments)};try{Object.defineProperty(F,"name",{value:t})}catch(e){}return F.signatures=Y(i),F}function O(e){return-1===U.ignore.indexOf(e)}function M(e){return e.trim()}function E(e){return!!e}function K(e){return null!==e}function j(e){return 0===e.types.length}function S(e){return e.slice(0,e.length-1)}function A(e){return e[e.length-1]}function C(e,t,r){return Array.prototype.slice.call(e,t,r)}function T(e,t){return-1!==e.indexOf(t)}function _(e,t){for(var r=0;r<e.length;r++)if(T(t,e[r]))return!0;return!1}function ee(e,t){for(var r=0;r<e.length;r++)if(t(e[r]))return e[r]}function I(e){for(var t={},r=0;r<e.length;r++)t[e[r]]=!0;return Object.keys(t)}function te(e,t){return Array.prototype.concat.apply([],e.map(t))}function B(e){for(var t="",r=0;r<e.length;r++){var n=e[r];if(("object"==typeof n.signatures||"string"==typeof n.signature)&&""!==n.name)if(""===t)t=n.name;else if(t!==n.name){var i=new Error("Function names do not match (expected: "+t+", actual: "+n.name+")");throw i.data={actual:n.name,expected:t},i}}return t}function q(e){var r,n={};function t(e,t){if(n.hasOwnProperty(e)&&t!==n[e])throw(r=new Error('Signature "'+e+'" is defined twice')).data={signature:e},r}for(var i=0;i<e.length;i++){var a=e[i];if("object"==typeof a.signatures)for(var o in a.signatures)a.signatures.hasOwnProperty(o)&&(t(o,a.signatures[o]),n[o]=a.signatures[o]);else{if("string"!=typeof a.signature)throw(r=new TypeError("Function is no typed-function (index: "+i+")")).data={index:i},r;t(a.signature,a),n[a.signature]=a}}return n}U=N("typed",{"string, Object":N,Object:function(e){var t=[];for(var r in e)e.hasOwnProperty(r)&&t.push(e[r]);var n=B(t);return N(n,e)},"...Function":function(e){return N(B(e),q(e))},"string, ...Function":function(e,t){return N(e,q(t))}});U.create=e;U.types=t;U.conversions=i;U.ignore=r;U.convert=o;U.find=a;U.addType=function(e,t){if(!e||"string"!=typeof e.name||"function"!=typeof e.test)throw new TypeError("Object with properties {name: string, test: function} expected");if(!1!==t)for(var r=0;r<U.types.length;r++)if("Object"===U.types[r].name)return void U.types.splice(r,0,e);U.types.push(e)};U.addConversion=function(e){if(!e||"string"!=typeof e.from||"string"!=typeof e.to||"function"!=typeof e.convert)throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");U.conversions.push(e)};return U}()})?n.apply(t,i):n)||(e.exports=a)},function(m,e,t){"use strict";(function(e){var s=256,i=[],a=void 0===e?window:e,o=Math.pow(s,6),u=Math.pow(2,52),c=2*u,t=Math.random;function f(e){var t,r=e.length,o=this,n=0,i=o.i=o.j=0,a=o.S=[];for(r||(e=[r++]);n<s;)a[n]=n++;for(n=0;n<s;n++)a[n]=a[i=255&i+e[n%r]+(t=a[n])],a[i]=t;(o.g=function(e){for(var t,r=0,n=o.i,i=o.j,a=o.S;e--;)t=a[n=255&n+1],r=r*s+a[255&(a[n]=a[i=255&i+t])+(a[i]=t)];return o.i=n,o.j=i,r})(s)}function l(e,t){for(var r,n=e+"",i=0;i<n.length;)t[255&i]=255&(r^=19*t[255&i])+n.charCodeAt(i++);return p(t)}function p(e){return String.fromCharCode.apply(0,e)}m.exports=function(e,t){if(t&&!0===t.global)return t.global=!1,Math.random=m.exports(e,t),t.global=!0,Math.random;var r=[],n=(l(function e(t,r){var n,i=[],a=(typeof t)[0];if(r&&"o"==a)for(n in t)try{i.push(e(t[n],r-1))}catch(e){}return i.length?i:"s"==a?t:t+"\0"}(t&&t.entropy||!1?[e,p(i)]:0 in arguments?e:function(e){try{return a.crypto.getRandomValues(e=new Uint8Array(s)),p(e)}catch(e){return[+new Date,a,a.navigator&&a.navigator.plugins,a.screen,p(i)]}}(),3),r),new f(r));return l(p(n.S),i),function(){for(var e=n.g(6),t=o,r=0;e<u;)e=(e+r)*s,t*=s,r=n.g(1);for(;c<=e;)e/=2,t/=2,r>>>=1;return(e+r)/t}},m.exports.resetGlobal=function(){Math.random=t},l(Math.random(),i)}).call(this,t(20))},function(t,De,Re){var Pe;!function(){"use strict";var l,T,o,s=9e15,d=1e9,y="0123456789abcdef",n="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",i="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",u={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-s,maxE:s,crypto:!1},b=!0,c="[DecimalError] ",g=c+"Invalid argument: ",a=c+"Precision limit exceeded",f=c+"crypto unavailable",_=Math.floor,v=Math.pow,p=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,m=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,h=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,x=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,I=1e7,B=7,w=n.length-1,N=i.length-1,O={name:"[object Decimal]"};function M(e){var t,r,n,i=e.length-1,a="",o=e[0];if(0<i){for(a+=o,t=1;t<i;t++)n=e[t]+"",(r=B-n.length)&&(a+=L(r)),a+=n;o=e[t],(r=B-(n=o+"").length)&&(a+=L(r))}else if(0===o)return"0";for(;o%10==0;)o/=10;return a+o}function E(e,t,r){if(e!==~~e||e<t||r<e)throw Error(g+e)}function j(e,t,r,n){var i,a,o;for(a=e[0];10<=a;a/=10)--t;return--t<0?(t+=B,i=0):(i=Math.ceil((t+1)/B),t%=B),a=v(10,B-t),o=e[i]%a|0,null==n?t<3?(0==t?o=o/100|0:1==t&&(o=o/10|0),r<4&&99999==o||3<r&&49999==o||5e4==o||0==o):(r<4&&o+1==a||3<r&&o+1==a/2)&&(e[i+1]/a/100|0)==v(10,t-2)-1||(o==a/2||0==o)&&0==(e[i+1]/a/100|0):t<4?(0==t?o=o/1e3|0:1==t?o=o/100|0:2==t&&(o=o/10|0),(n||r<4)&&9999==o||!n&&3<r&&4999==o):((n||r<4)&&o+1==a||!n&&3<r&&o+1==a/2)&&(e[i+1]/a/1e3|0)==v(10,t-3)-1}function S(e,t,r){for(var n,i,a=[0],o=0,s=e.length;o<s;){for(i=a.length;i--;)a[i]*=t;for(a[0]+=y.indexOf(e.charAt(o++)),n=0;n<a.length;n++)a[n]>r-1&&(void 0===a[n+1]&&(a[n+1]=0),a[n+1]+=a[n]/r|0,a[n]%=r)}return a.reverse()}O.absoluteValue=O.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),D(e)},O.ceil=function(){return D(new this.constructor(this),this.e+1,2)},O.comparedTo=O.cmp=function(e){var t,r,n,i,a=this,o=a.d,s=(e=new a.constructor(e)).d,u=a.s,c=e.s;if(!o||!s)return u&&c?u!==c?u:o===s?0:!o^u<0?1:-1:NaN;if(!o[0]||!s[0])return o[0]?u:s[0]?-c:0;if(u!==c)return u;if(a.e!==e.e)return a.e>e.e^u<0?1:-1;for(t=0,r=(n=o.length)<(i=s.length)?n:i;t<r;++t)if(o[t]!==s[t])return o[t]>s[t]^u<0?1:-1;return n===i?0:i<n^u<0?1:-1},O.cosine=O.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+B,n.rounding=1,r=function(e,t){var r,n,i=t.d.length;n=i<32?(r=Math.ceil(i/3),(1/Y(4,r)).toString()):(r=16,"2.3283064365386962890625e-10");e.precision+=r,t=W(e,1,t.times(n),new e(1));for(var a=r;a--;){var o=t.times(t);t=o.times(o).minus(o).times(8).plus(1)}return e.precision-=r,t}(n,X(n,r)),n.precision=e,n.rounding=t,D(2==o||3==o?r.neg():r,e,t,!0)):new n(1):new n(NaN)},O.cubeRoot=O.cbrt=function(){var e,t,r,n,i,a,o,s,u,c,f=this,l=f.constructor;if(!f.isFinite()||f.isZero())return new l(f);for(b=!1,(a=f.s*v(f.s*f,1/3))&&Math.abs(a)!=1/0?n=new l(a.toString()):(r=M(f.d),(a=((e=f.e)-r.length+1)%3)&&(r+=1==a||-2==a?"0":"00"),a=v(r,1/3),e=_((e+1)/3)-(e%3==(e<0?-1:2)),(n=new l(r=a==1/0?"5e"+e:(r=a.toExponential()).slice(0,r.indexOf("e")+1)+e)).s=f.s),o=(e=l.precision)+3;;)if(c=(u=(s=n).times(s).times(s)).plus(f),n=A(c.plus(f).times(s),c.plus(u),o+2,1),M(s.d).slice(0,o)===(r=M(n.d)).slice(0,o)){if("9999"!=(r=r.slice(o-3,o+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(D(n,e+1,1),t=!n.times(n).times(n).eq(f));break}if(!i&&(D(s,e+1,0),s.times(s).times(s).eq(f))){n=s;break}o+=4,i=1}return b=!0,D(n,e,l.rounding,t)},O.decimalPlaces=O.dp=function(){var e,t=this.d,r=NaN;if(t){if(r=((e=t.length-1)-_(this.e/B))*B,e=t[e])for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},O.dividedBy=O.div=function(e){return A(this,new this.constructor(e))},O.dividedToIntegerBy=O.divToInt=function(e){var t=this.constructor;return D(A(this,new t(e),0,1,1),t.precision,t.rounding)},O.equals=O.eq=function(e){return 0===this.cmp(e)},O.floor=function(){return D(new this.constructor(this),this.e+1,3)},O.greaterThan=O.gt=function(e){return 0<this.cmp(e)},O.greaterThanOrEqualTo=O.gte=function(e){var t=this.cmp(e);return 1==t||0===t},O.hyperbolicCosine=O.cosh=function(){var e,t,r,n,i,a=this,o=a.constructor,s=new o(1);if(!a.isFinite())return new o(a.s?1/0:NaN);if(a.isZero())return s;r=o.precision,n=o.rounding,o.precision=r+Math.max(a.e,a.sd())+4,o.rounding=1,t=(i=a.d.length)<32?(1/Y(4,e=Math.ceil(i/3))).toString():(e=16,"2.3283064365386962890625e-10"),a=W(o,1,a.times(t),new o(1),!0);for(var u,c=e,f=new o(8);c--;)u=a.times(a),a=s.minus(u.times(f.minus(u.times(f))));return D(a,o.precision=r,o.rounding=n,!0)},O.hyperbolicSine=O.sinh=function(){var e,t,r,n,i=this,a=i.constructor;if(!i.isFinite()||i.isZero())return new a(i);if(t=a.precision,r=a.rounding,a.precision=t+Math.max(i.e,i.sd())+4,a.rounding=1,(n=i.d.length)<3)i=W(a,2,i,i,!0);else{e=16<(e=1.4*Math.sqrt(n))?16:0|e,i=W(a,2,i=i.times(1/Y(5,e)),i,!0);for(var o,s=new a(5),u=new a(16),c=new a(20);e--;)o=i.times(i),i=i.times(s.plus(o.times(u.times(o).plus(c))))}return D(i,a.precision=t,a.rounding=r,!0)},O.hyperbolicTangent=O.tanh=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+7,n.rounding=1,A(r.sinh(),r.cosh(),n.precision=e,n.rounding=t)):new n(r.s)},O.inverseCosine=O.acos=function(){var e,t=this,r=t.constructor,n=t.abs().cmp(1),i=r.precision,a=r.rounding;return-1!==n?0===n?t.isNeg()?F(r,i,a):new r(0):new r(NaN):t.isZero()?F(r,i+4,a).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=F(r,i+4,a).times(.5),r.precision=i,r.rounding=a,e.minus(t))},O.inverseHyperbolicCosine=O.acosh=function(){var e,t,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(e=n.precision,t=n.rounding,n.precision=e+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,b=!1,r=r.times(r).minus(1).sqrt().plus(r),b=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},O.inverseHyperbolicSine=O.asinh=function(){var e,t,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,b=!1,r=r.times(r).plus(1).sqrt().plus(r),b=!0,n.precision=e,n.rounding=t,r.ln())},O.inverseHyperbolicTangent=O.atanh=function(){var e,t,r,n,i=this,a=i.constructor;return i.isFinite()?0<=i.e?new a(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=a.precision,t=a.rounding,n=i.sd(),Math.max(n,e)<2*-i.e-1?D(new a(i),e,t,!0):(a.precision=r=n-i.e,i=A(i.plus(1),new a(1).minus(i),r+e,1),a.precision=e+4,a.rounding=1,i=i.ln(),a.precision=e,a.rounding=t,i.times(.5))):new a(NaN)},O.inverseSine=O.asin=function(){var e,t,r,n,i=this,a=i.constructor;return i.isZero()?new a(i):(t=i.abs().cmp(1),r=a.precision,n=a.rounding,-1!==t?0===t?((e=F(a,r+4,n).times(.5)).s=i.s,e):new a(NaN):(a.precision=r+6,a.rounding=1,i=i.div(new a(1).minus(i.times(i)).sqrt().plus(1)).atan(),a.precision=r,a.rounding=n,i.times(2)))},O.inverseTangent=O.atan=function(){var e,t,r,n,i,a,o,s,u,c=this,f=c.constructor,l=f.precision,p=f.rounding;if(c.isFinite()){if(c.isZero())return new f(c);if(c.abs().eq(1)&&l+4<=N)return(o=F(f,l+4,p).times(.25)).s=c.s,o}else{if(!c.s)return new f(NaN);if(l+4<=N)return(o=F(f,l+4,p).times(.5)).s=c.s,o}for(f.precision=s=l+10,f.rounding=1,e=r=Math.min(28,s/B+2|0);e;--e)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(b=!1,t=Math.ceil(s/B),n=1,u=c.times(c),o=new f(c),i=c;-1!==e;)if(i=i.times(u),a=o.minus(i.div(n+=2)),i=i.times(u),void 0!==(o=a.plus(i.div(n+=2))).d[t])for(e=t;o.d[e]===a.d[e]&&e--;);return r&&(o=o.times(2<<r-1)),b=!0,D(o,f.precision=l,f.rounding=p,!0)},O.isFinite=function(){return!!this.d},O.isInteger=O.isInt=function(){return!!this.d&&_(this.e/B)>this.d.length-2},O.isNaN=function(){return!this.s},O.isNegative=O.isNeg=function(){return this.s<0},O.isPositive=O.isPos=function(){return 0<this.s},O.isZero=function(){return!!this.d&&0===this.d[0]},O.lessThan=O.lt=function(e){return this.cmp(e)<0},O.lessThanOrEqualTo=O.lte=function(e){return this.cmp(e)<1},O.logarithm=O.log=function(e){var t,r,n,i,a,o,s,u,c=this,f=c.constructor,l=f.precision,p=f.rounding;if(null==e)e=new f(10),t=!0;else{if(r=(e=new f(e)).d,e.s<0||!r||!r[0]||e.eq(1))return new f(NaN);t=e.eq(10)}if(r=c.d,c.s<0||!r||!r[0]||c.eq(1))return new f(r&&!r[0]?-1/0:1!=c.s?NaN:r?0:1/0);if(t)if(1<r.length)a=!0;else{for(i=r[0];i%10==0;)i/=10;a=1!==i}if(b=!1,o=Z(c,s=l+5),n=t?P(f,s+10):Z(e,s),j((u=A(o,n,s,1)).d,i=l,p))do{if(o=Z(c,s+=10),n=t?P(f,s+10):Z(e,s),u=A(o,n,s,1),!a){+M(u.d).slice(i+1,i+15)+1==1e14&&(u=D(u,l+1,0));break}}while(j(u.d,i+=10,p));return b=!0,D(u,l,p)},O.minus=O.sub=function(e){var t,r,n,i,a,o,s,u,c,f,l,p,m=this,h=m.constructor;if(e=new h(e),!m.d||!e.d)return m.s&&e.s?m.d?e.s=-e.s:e=new h(e.d||m.s!==e.s?m:NaN):e=new h(NaN),e;if(m.s!=e.s)return e.s=-e.s,m.plus(e);if(c=m.d,p=e.d,s=h.precision,u=h.rounding,!c[0]||!p[0]){if(p[0])e.s=-e.s;else{if(!c[0])return new h(3===u?-0:0);e=new h(m)}return b?D(e,s,u):e}if(r=_(e.e/B),f=_(m.e/B),c=c.slice(),a=f-r){for(o=(l=a<0)?(t=c,a=-a,p.length):(t=p,r=f,c.length),(n=Math.max(Math.ceil(s/B),o)+2)<a&&(a=n,t.length=1),t.reverse(),n=a;n--;)t.push(0);t.reverse()}else{for((l=(n=c.length)<(o=p.length))&&(o=n),n=0;n<o;n++)if(c[n]!=p[n]){l=c[n]<p[n];break}a=0}for(l&&(t=c,c=p,p=t,e.s=-e.s),o=c.length,n=p.length-o;0<n;--n)c[o++]=0;for(n=p.length;a<n;){if(c[--n]<p[n]){for(i=n;i&&0===c[--i];)c[i]=I-1;--c[i],c[n]+=I}c[n]-=p[n]}for(;0===c[--o];)c.pop();for(;0===c[0];c.shift())--r;return c[0]?(e.d=c,e.e=R(c,r),b?D(e,s,u):e):new h(3===u?-0:0)},O.modulo=O.mod=function(e){var t,r=this,n=r.constructor;return e=new n(e),!r.d||!e.s||e.d&&!e.d[0]?new n(NaN):!e.d||r.d&&!r.d[0]?D(new n(r),n.precision,n.rounding):(b=!1,9==n.modulo?(t=A(r,e.abs(),0,3,1)).s*=e.s:t=A(r,e,0,n.modulo,1),t=t.times(e),b=!0,r.minus(t))},O.naturalExponential=O.exp=function(){return G(this)},O.naturalLogarithm=O.ln=function(){return Z(this)},O.negated=O.neg=function(){var e=new this.constructor(this);return e.s=-e.s,D(e)},O.plus=O.add=function(e){var t,r,n,i,a,o,s,u,c,f,l=this,p=l.constructor;if(e=new p(e),!l.d||!e.d)return l.s&&e.s?l.d||(e=new p(e.d||l.s===e.s?l:NaN)):e=new p(NaN),e;if(l.s!=e.s)return e.s=-e.s,l.minus(e);if(c=l.d,f=e.d,s=p.precision,u=p.rounding,!c[0]||!f[0])return f[0]||(e=new p(l)),b?D(e,s,u):e;if(a=_(l.e/B),n=_(e.e/B),c=c.slice(),i=a-n){for((o=(o=i<0?(r=c,i=-i,f.length):(r=f,n=a,c.length))<(a=Math.ceil(s/B))?a+1:o+1)<i&&(i=o,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for((o=c.length)-(i=f.length)<0&&(i=o,r=f,f=c,c=r),t=0;i;)t=(c[--i]=c[i]+f[i]+t)/I|0,c[i]%=I;for(t&&(c.unshift(t),++n),o=c.length;0==c[--o];)c.pop();return e.d=c,e.e=R(c,n),b?D(e,s,u):e},O.precision=O.sd=function(e){var t;if(void 0!==e&&e!==!!e&&1!==e&&0!==e)throw Error(g+e);return this.d?(t=U(this.d),e&&this.e+1>t&&(t=this.e+1)):t=NaN,t},O.round=function(){var e=this.constructor;return D(new e(this),this.e+1,e.rounding)},O.sine=O.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+B,n.rounding=1,r=function(e,t){var r,n=t.d.length;if(n<3)return W(e,2,t,t);r=16<(r=1.4*Math.sqrt(n))?16:0|r,t=t.times(1/Y(5,r)),t=W(e,2,t,t);for(var i,a=new e(5),o=new e(16),s=new e(20);r--;)i=t.times(t),t=t.times(a.plus(i.times(o.times(i).minus(s))));return t}(n,X(n,r)),n.precision=e,n.rounding=t,D(2<o?r.neg():r,e,t,!0)):new n(NaN)},O.squareRoot=O.sqrt=function(){var e,t,r,n,i,a,o=this,s=o.d,u=o.e,c=o.s,f=o.constructor;if(1!==c||!s||!s[0])return new f(!c||c<0&&(!s||s[0])?NaN:s?o:1/0);for(b=!1,n=0==(c=Math.sqrt(+o))||c==1/0?(((t=M(s)).length+u)%2==0&&(t+="0"),c=Math.sqrt(t),u=_((u+1)/2)-(u<0||u%2),new f(t=c==1/0?"1e"+u:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+u)):new f(c.toString()),r=(u=f.precision)+3;;)if(n=(a=n).plus(A(o,a,r+2,1)).times(.5),M(a.d).slice(0,r)===(t=M(n.d)).slice(0,r)){if("9999"!=(t=t.slice(r-3,r+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(D(n,u+1,1),e=!n.times(n).eq(o));break}if(!i&&(D(a,u+1,0),a.times(a).eq(o))){n=a;break}r+=4,i=1}return b=!0,D(n,u,f.rounding,e)},O.tangent=O.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,(r=r.sin()).s=1,r=A(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,D(2==o||4==o?r.neg():r,e,t,!0)):new n(NaN)},O.times=O.mul=function(e){var t,r,n,i,a,o,s,u,c,f=this.constructor,l=this.d,p=(e=new f(e)).d;if(e.s*=this.s,!(l&&l[0]&&p&&p[0]))return new f(!e.s||l&&!l[0]&&!p||p&&!p[0]&&!l?NaN:l&&p?0*e.s:e.s/0);for(r=_(this.e/B)+_(e.e/B),(u=l.length)<(c=p.length)&&(a=l,l=p,p=a,o=u,u=c,c=o),a=[],n=o=u+c;n--;)a.push(0);for(n=c;0<=--n;){for(t=0,i=u+n;n<i;)s=a[i]+p[n]*l[i-n-1]+t,a[i--]=s%I|0,t=s/I|0;a[i]=(a[i]+t)%I|0}for(;!a[--o];)a.pop();return t?++r:a.shift(),e.d=a,e.e=R(a,r),b?D(e,f.precision,f.rounding):e},O.toBinary=function(e,t){return r(this,2,e,t)},O.toDecimalPlaces=O.toDP=function(e,t){var r=this,n=r.constructor;return r=new n(r),void 0===e?r:(E(e,0,d),void 0===t?t=n.rounding:E(t,0,8),D(r,e+r.e+1,t))},O.toExponential=function(e,t){var r,n=this,i=n.constructor;return r=void 0===e?C(n,!0):(E(e,0,d),void 0===t?t=i.rounding:E(t,0,8),C(n=D(new i(n),e+1,t),!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},O.toFixed=function(e,t){var r,n,i=this,a=i.constructor;return r=void 0===e?C(i):(E(e,0,d),void 0===t?t=a.rounding:E(t,0,8),C(n=D(new a(i),e+i.e+1,t),!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r},O.toFraction=function(e){var t,r,n,i,a,o,s,u,c,f,l,p,m=this,h=m.d,d=m.constructor;if(!h)return new d(m);if(c=r=new d(1),o=(a=(t=new d(n=u=new d(0))).e=U(h)-m.e-1)%B,t.d[0]=v(10,o<0?B+o:o),null==e)e=0<a?t:c;else{if(!(s=new d(e)).isInt()||s.lt(c))throw Error(g+s);e=s.gt(t)?0<a?t:c:s}for(b=!1,s=new d(M(h)),f=d.precision,d.precision=a=h.length*B*2;l=A(s,t,0,1,1),1!=(i=r.plus(l.times(n))).cmp(e);)r=n,n=i,i=c,c=u.plus(l.times(i)),u=i,i=t,t=s.minus(l.times(i)),s=i;return i=A(e.minus(r),n,0,1,1),u=u.plus(i.times(c)),r=r.plus(i.times(n)),u.s=c.s=m.s,p=A(c,n,a,1).minus(m).abs().cmp(A(u,r,a,1).minus(m).abs())<1?[c,n]:[u,r],d.precision=f,b=!0,p},O.toHexadecimal=O.toHex=function(e,t){return r(this,16,e,t)},O.toNearest=function(e,t){var r=this,n=r.constructor;if(r=new n(r),null==e){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),void 0===t?t=n.rounding:E(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(b=!1,r=A(r,e,0,t,1).times(e),b=!0,D(r)):(e.s=r.s,r=e),r},O.toNumber=function(){return+this},O.toOctal=function(e,t){return r(this,8,e,t)},O.toPower=O.pow=function(e){var t,r,n,i,a,o,s=this,u=s.constructor,c=+(e=new u(e));if(!(s.d&&e.d&&s.d[0]&&e.d[0]))return new u(v(+s,c));if((s=new u(s)).eq(1))return s;if(n=u.precision,a=u.rounding,e.eq(1))return D(s,n,a);if((t=_(e.e/B))>=e.d.length-1&&(r=c<0?-c:c)<=9007199254740991)return i=H(u,s,r,n),e.s<0?new u(1).div(i):D(i,n,a);if((o=s.s)<0){if(t<e.d.length-1)return new u(NaN);if(0==(1&e.d[t])&&(o=1),0==s.e&&1==s.d[0]&&1==s.d.length)return s.s=o,s}return(t=0!=(r=v(+s,c))&&isFinite(r)?new u(r+"").e:_(c*(Math.log("0."+M(s.d))/Math.LN10+s.e+1)))>u.maxE+1||t<u.minE-1?new u(0<t?o/0:0):(b=!1,u.rounding=s.s=1,r=Math.min(12,(t+"").length),(i=G(e.times(Z(s,n+r)),n)).d&&j((i=D(i,n+5,1)).d,n,a)&&(t=n+10,+M((i=D(G(e.times(Z(s,t+r)),t),t+5,1)).d).slice(n+1,n+15)+1==1e14&&(i=D(i,n+1,0))),i.s=o,b=!0,D(i,n,u.rounding=a))},O.toPrecision=function(e,t){var r,n=this,i=n.constructor;return r=void 0===e?C(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(E(e,1,d),void 0===t?t=i.rounding:E(t,0,8),C(n=D(new i(n),e,t),e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r},O.toSignificantDigits=O.toSD=function(e,t){var r=this.constructor;return void 0===e?(e=r.precision,t=r.rounding):(E(e,1,d),void 0===t?t=r.rounding:E(t,0,8)),D(new r(this),e,t)},O.toString=function(){var e=this,t=e.constructor,r=C(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r},O.truncated=O.trunc=function(){return D(new this.constructor(this),this.e+1,1)},O.valueOf=O.toJSON=function(){var e=this,t=e.constructor,r=C(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};var A=function(e,t,r,n,i,a){var o,s,u,c,f,l,p,m,h,d,y,g,v,b,x,w,N,O,M,E,j=e.constructor,S=e.s==t.s?1:-1,A=e.d,C=t.d;if(!(A&&A[0]&&C&&C[0]))return new j(e.s&&t.s&&(A?!C||A[0]!=C[0]:C)?A&&0==A[0]||!C?0*S:S/0:NaN);for(s=a?(f=1,e.e-t.e):(a=I,f=B,_(e.e/f)-_(t.e/f)),M=C.length,N=A.length,d=(h=new j(S)).d=[],u=0;C[u]==(A[u]||0);u++);if(C[u]>(A[u]||0)&&s--,null==r?(b=r=j.precision,n=j.rounding):b=i?r+(e.e-t.e)+1:r,b<0)d.push(1),l=!0;else{if(b=b/f+2|0,u=0,1==M){for(C=C[c=0],b++;(u<N||c)&&b--;u++)x=c*a+(A[u]||0),d[u]=x/C|0,c=x%C|0;l=c||u<N}else{for(1<(c=a/(C[0]+1)|0)&&(C=q(C,c,a),A=q(A,c,a),M=C.length,N=A.length),w=M,g=(y=A.slice(0,M)).length;g<M;)y[g++]=0;for((E=C.slice()).unshift(0),O=C[0],C[1]>=a/2&&++O;c=0,(o=k(C,y,M,g))<0?(v=y[0],M!=g&&(v=v*a+(y[1]||0)),1<(c=v/O|0)?(a<=c&&(c=a-1),1==(o=k(p=q(C,c,a),y,m=p.length,g=y.length))&&(c--,z(p,M<m?E:C,m,a))):(0==c&&(o=c=1),p=C.slice()),(m=p.length)<g&&p.unshift(0),z(y,p,g,a),-1==o&&(o=k(C,y,M,g=y.length))<1&&(c++,z(y,M<g?E:C,g,a)),g=y.length):0===o&&(c++,y=[0]),d[u++]=c,o&&y[0]?y[g++]=A[w]||0:(y=[A[w]],g=1),(w++<N||void 0!==y[0])&&b--;);l=void 0!==y[0]}d[0]||d.shift()}if(1==f)h.e=s,T=l;else{for(u=1,c=d[0];10<=c;c/=10)u++;h.e=u+s*f-1,D(h,i?r+h.e+1:r,n,l)}return h};function q(e,t,r){var n,i=0,a=e.length;for(e=e.slice();a--;)n=e[a]*t+i,e[a]=n%r|0,i=n/r|0;return i&&e.unshift(i),e}function k(e,t,r,n){var i,a;if(r!=n)a=n<r?1:-1;else for(i=a=0;i<r;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function z(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&1<e.length;)e.shift()}function D(e,t,r,n){var i,a,o,s,u,c,f,l,p,m=e.constructor;e:if(null!=t){if(!(l=e.d))return e;for(i=1,s=l[0];10<=s;s/=10)i++;if((a=t-i)<0)a+=B,o=t,u=(f=l[p=0])/v(10,i-o-1)%10|0;else if(p=Math.ceil((a+1)/B),(s=l.length)<=p){if(!n)break e;for(;s++<=p;)l.push(0);f=u=0,o=(a%=B)-B+(i=1)}else{for(f=s=l[p],i=1;10<=s;s/=10)i++;u=(o=(a%=B)-B+i)<0?0:f/v(10,i-o-1)%10|0}if(n=n||t<0||void 0!==l[p+1]||(o<0?f:f%v(10,i-o-1)),c=r<4?(u||n)&&(0==r||r==(e.s<0?3:2)):5<u||5==u&&(4==r||n||6==r&&(0<a?0<o?f/v(10,i-o):0:l[p-1])%10&1||r==(e.s<0?8:7)),t<1||!l[0])return l.length=0,c?(t-=e.e+1,l[0]=v(10,(B-t%B)%B),e.e=-t||0):l[0]=e.e=0,e;if(0==a?(l.length=p,s=1,p--):(l.length=p+1,s=v(10,B-a),l[p]=0<o?(f/v(10,i-o)%v(10,o)|0)*s:0),c)for(;;){if(0==p){for(a=1,o=l[0];10<=o;o/=10)a++;for(o=l[0]+=s,s=1;10<=o;o/=10)s++;a!=s&&(e.e++,l[0]==I&&(l[0]=1));break}if(l[p]+=s,l[p]!=I)break;l[p--]=0,s=1}for(a=l.length;0===l[--a];)l.pop()}return b&&(e.e>m.maxE?(e.d=null,e.e=NaN):e.e<m.minE&&(e.e=0,e.d=[0])),e}function C(e,t,r){if(!e.isFinite())return V(e);var n,i=e.e,a=M(e.d),o=a.length;return t?(r&&0<(n=r-o)?a=a.charAt(0)+"."+a.slice(1)+L(n):1<o&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(e.e<0?"e":"e+")+e.e):i<0?(a="0."+L(-i-1)+a,r&&0<(n=r-o)&&(a+=L(n))):o<=i?(a+=L(i+1-o),r&&0<(n=r-i-1)&&(a=a+"."+L(n))):((n=i+1)<o&&(a=a.slice(0,n)+"."+a.slice(n)),r&&0<(n=r-o)&&(i+1===o&&(a+="."),a+=L(n))),a}function R(e,t){var r=e[0];for(t*=B;10<=r;r/=10)t++;return t}function P(e,t,r){if(w<t)throw b=!0,r&&(e.precision=r),Error(a);return D(new e(n),t,1,!0)}function F(e,t,r){if(N<t)throw Error(a);return D(new e(i),t,r,!0)}function U(e){var t=e.length-1,r=t*B+1;if(t=e[t]){for(;t%10==0;t/=10)r--;for(t=e[0];10<=t;t/=10)r++}return r}function L(e){for(var t="";e--;)t+="0";return t}function H(e,t,r,n){var i,a=new e(1),o=Math.ceil(n/B+4);for(b=!1;;){if(r%2&&Q((a=a.times(t)).d,o)&&(i=!0),0===(r=_(r/2))){r=a.d.length-1,i&&0===a.d[r]&&++a.d[r];break}Q((t=t.times(t)).d,o)}return b=!0,a}function $(e){return 1&e.d[e.d.length-1]}function e(e,t,r){for(var n,i=new e(t[0]),a=0;++a<t.length;){if(!(n=new e(t[a])).s){i=n;break}i[r](n)&&(i=n)}return i}function G(e,t){var r,n,i,a,o,s,u,c=0,f=0,l=0,p=e.constructor,m=p.rounding,h=p.precision;if(!e.d||!e.d[0]||17<e.e)return new p(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(u=null==t?(b=!1,h):t,s=new p(.03125);-2<e.e;)e=e.times(s),l+=5;for(u+=n=Math.log(v(2,l))/Math.LN10*2+5|0,r=a=o=new p(1),p.precision=u;;){if(a=D(a.times(e),u,1),r=r.times(++f),M((s=o.plus(A(a,r,u,1))).d).slice(0,u)===M(o.d).slice(0,u)){for(i=l;i--;)o=D(o.times(o),u,1);if(null!=t)return p.precision=h,o;if(!(c<3&&j(o.d,u-n,m,c)))return D(o,p.precision=h,m,b=!0);p.precision=u+=10,r=a=s=new p(1),f=0,c++}o=s}}function Z(e,t){var r,n,i,a,o,s,u,c,f,l,p,m=1,h=e,d=h.d,y=h.constructor,g=y.rounding,v=y.precision;if(h.s<0||!d||!d[0]||!h.e&&1==d[0]&&1==d.length)return new y(d&&!d[0]?-1/0:1!=h.s?NaN:d?0:h);if(f=null==t?(b=!1,v):t,y.precision=f+=10,n=(r=M(d)).charAt(0),!(Math.abs(a=h.e)<15e14))return c=P(y,f+2,v).times(a+""),h=Z(new y(n+"."+r.slice(1)),f-10).plus(c),y.precision=v,null==t?D(h,v,g,b=!0):h;for(;n<7&&1!=n||1==n&&3<r.charAt(1);)n=(r=M((h=h.times(e)).d)).charAt(0),m++;for(a=h.e,1<n?(h=new y("0."+r),a++):h=new y(n+"."+r.slice(1)),u=o=h=A((l=h).minus(1),h.plus(1),f,1),p=D(h.times(h),f,1),i=3;;){if(o=D(o.times(p),f,1),M((c=u.plus(A(o,new y(i),f,1))).d).slice(0,f)===M(u.d).slice(0,f)){if(u=u.times(2),0!==a&&(u=u.plus(P(y,f+2,v).times(a+""))),u=A(u,new y(m),f,1),null!=t)return y.precision=v,u;if(!j(u.d,f-10,g,s))return D(u,y.precision=v,g,b=!0);y.precision=f+=10,c=o=h=A(l.minus(1),l.plus(1),f,1),p=D(h.times(h),f,1),i=s=1}u=c,i+=2}}function V(e){return String(e.s*e.s/0)}function J(e,t){var r,n,i;for(-1<(r=t.indexOf("."))&&(t=t.replace(".","")),0<(n=t.search(/e/i))?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;48===t.charCodeAt(n);n++);for(i=t.length;48===t.charCodeAt(i-1);--i);if(t=t.slice(n,i)){if(i-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%B,r<0&&(n+=B),n<i){for(n&&e.d.push(+t.slice(0,n)),i-=B;n<i;)e.d.push(+t.slice(n,n+=B));t=t.slice(n),n=B-t.length}else n-=i;for(;n--;)t+="0";e.d.push(+t),b&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function W(e,t,r,n,i){var a,o,s,u,c=e.precision,f=Math.ceil(c/B);for(b=!1,u=r.times(r),s=new e(n);;){if(o=A(s.times(u),new e(t++*t++),c,1),s=i?n.plus(o):n.minus(o),n=A(o.times(u),new e(t++*t++),c,1),void 0!==(o=s.plus(n)).d[f]){for(a=f;o.d[a]===s.d[a]&&a--;);if(-1==a)break}a=s,s=n,n=o,o=a,0}return b=!0,o.d.length=f+1,o}function Y(e,t){for(var r=e;--t;)r*=e;return r}function X(e,t){var r,n=t.s<0,i=F(e,e.precision,1),a=i.times(.5);if((t=t.abs()).lte(a))return o=n?4:1,t;if((r=t.divToInt(i)).isZero())o=n?3:2;else{if((t=t.minus(r.times(i))).lte(a))return o=$(r)?n?2:3:n?4:1,t;o=$(r)?n?1:4:n?3:2}return t.minus(i).abs()}function r(e,t,r,n){var i,a,o,s,u,c,f,l,p,m=e.constructor,h=void 0!==r;if(h?(E(r,1,d),void 0===n?n=m.rounding:E(n,0,8)):(r=m.precision,n=m.rounding),e.isFinite()){for(h?(i=2,16==t?r=4*r-3:8==t&&(r=3*r-2)):i=t,0<=(o=(f=C(e)).indexOf("."))&&(f=f.replace(".",""),(p=new m(1)).e=f.length-o,p.d=S(C(p),10,i),p.e=p.d.length),a=u=(l=S(f,10,i)).length;0==l[--u];)l.pop();if(l[0]){if(o<0?a--:((e=new m(e)).d=l,e.e=a,l=(e=A(e,p,r,n,0,i)).d,a=e.e,c=T),o=l[r],s=i/2,c=c||void 0!==l[r+1],c=n<4?(void 0!==o||c)&&(0===n||n===(e.s<0?3:2)):s<o||o===s&&(4===n||c||6===n&&1&l[r-1]||n===(e.s<0?8:7)),l.length=r,c)for(;++l[--r]>i-1;)l[r]=0,r||(++a,l.unshift(1));for(u=l.length;!l[u-1];--u);for(o=0,f="";o<u;o++)f+=y.charAt(l[o]);if(h){if(1<u)if(16==t||8==t){for(o=16==t?4:3,--u;u%o;u++)f+="0";for(u=(l=S(f,i,t)).length;!l[u-1];--u);for(o=1,f="1.";o<u;o++)f+=y.charAt(l[o])}else f=f.charAt(0)+"."+f.slice(1);f=f+(a<0?"p":"p+")+a}else if(a<0){for(;++a;)f="0"+f;f="0."+f}else if(++a>u)for(a-=u;a--;)f+="0";else a<u&&(f=f.slice(0,a)+"."+f.slice(a))}else f=h?"0p+0":"0";f=(16==t?"0x":2==t?"0b":8==t?"0o":"")+f}else f=V(e);return e.s<0?"-"+f:f}function Q(e,t){if(e.length>t)return e.length=t,!0}function K(e){return new this(e).abs()}function ee(e){return new this(e).acos()}function te(e){return new this(e).acosh()}function re(e,t){return new this(e).plus(t)}function ne(e){return new this(e).asin()}function ie(e){return new this(e).asinh()}function ae(e){return new this(e).atan()}function oe(e){return new this(e).atanh()}function se(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,a=n+4;return e.s&&t.s?e.d||t.d?!t.d||e.isZero()?(r=t.s<0?F(this,n,i):new this(0)).s=e.s:!e.d||t.isZero()?(r=F(this,a,1).times(.5)).s=e.s:r=t.s<0?(this.precision=a,this.rounding=1,r=this.atan(A(e,t,a,1)),t=F(this,a,1),this.precision=n,this.rounding=i,e.s<0?r.minus(t):r.plus(t)):this.atan(A(e,t,a,1)):(r=F(this,a,1).times(0<t.s?.25:.75)).s=e.s:r=new this(NaN),r}function ue(e){return new this(e).cbrt()}function ce(e){return D(e=new this(e),e.e+1,2)}function fe(e){if(!e||"object"!=typeof e)throw Error(c+"Object expected");var t,r,n,i=!0===e.defaults,a=["precision",1,d,"rounding",0,8,"toExpNeg",-s,0,"toExpPos",0,s,"maxE",0,s,"minE",-s,0,"modulo",0,9];for(t=0;t<a.length;t+=3)if(r=a[t],i&&(this[r]=u[r]),void 0!==(n=e[r])){if(!(_(n)===n&&a[t+1]<=n&&n<=a[t+2]))throw Error(g+r+": "+n);this[r]=n}if(r="crypto",i&&(this[r]=u[r]),void 0!==(n=e[r])){if(!0!==n&&!1!==n&&0!==n&&1!==n)throw Error(g+r+": "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(f);this[r]=!0}else this[r]=!1}return this}function le(e){return new this(e).cos()}function pe(e){return new this(e).cosh()}function me(e,t){return new this(e).div(t)}function he(e){return new this(e).exp()}function de(e){return D(e=new this(e),e.e+1,3)}function ye(){var e,t,r=new this(0);for(b=!1,e=0;e<arguments.length;)if((t=new this(arguments[e++])).d)r.d&&(r=r.plus(t.times(t)));else{if(t.s)return b=!0,new this(1/0);r=t}return b=!0,r.sqrt()}function ge(e){return e instanceof l||e&&"[object Decimal]"===e.name||!1}function ve(e){return new this(e).ln()}function be(e,t){return new this(e).log(t)}function xe(e){return new this(e).log(2)}function we(e){return new this(e).log(10)}function Ne(){return e(this,arguments,"lt")}function Oe(){return e(this,arguments,"gt")}function Me(e,t){return new this(e).mod(t)}function Ee(e,t){return new this(e).mul(t)}function je(e,t){return new this(e).pow(t)}function Se(e){var t,r,n,i,a=0,o=new this(1),s=[];if(void 0===e?e=this.precision:E(e,1,d),n=Math.ceil(e/B),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(n));a<n;)429e7<=(i=t[a])?t[a]=crypto.getRandomValues(new Uint32Array(1))[0]:s[a++]=i%1e7;else{if(!crypto.randomBytes)throw Error(f);for(t=crypto.randomBytes(n*=4);a<n;)214e7<=(i=t[a]+(t[a+1]<<8)+(t[a+2]<<16)+((127&t[a+3])<<24))?crypto.randomBytes(4).copy(t,a):(s.push(i%1e7),a+=4);a=n/4}else for(;a<n;)s[a++]=1e7*Math.random()|0;for(n=s[--a],e%=B,n&&e&&(i=v(10,B-e),s[a]=(n/i|0)*i);0===s[a];a--)s.pop();if(a<0)s=[r=0];else{for(r=-1;0===s[0];r-=B)s.shift();for(n=1,i=s[0];10<=i;i/=10)n++;n<B&&(r-=B-n)}return o.e=r,o.d=s,o}function Ae(e){return D(e=new this(e),e.e+1,this.rounding)}function Ce(e){return(e=new this(e)).d?e.d[0]?e.s:0*e.s:e.s||NaN}function Te(e){return new this(e).sin()}function _e(e){return new this(e).sinh()}function Ie(e){return new this(e).sqrt()}function Be(e,t){return new this(e).sub(t)}function qe(e){return new this(e).tan()}function ke(e){return new this(e).tanh()}function ze(e){return D(e=new this(e),e.e+1,1)}(l=function e(t){var r,n,i;function a(e){var t,r,n,i=this;if(!(i instanceof a))return new a(e);if(e instanceof(i.constructor=a))return i.s=e.s,void(b?!e.d||e.e>a.maxE?(i.e=NaN,i.d=null):e.e<a.minE?(i.e=0,i.d=[0]):(i.e=e.e,i.d=e.d.slice()):(i.e=e.e,i.d=e.d?e.d.slice():e.d));if("number"==(n=typeof e)){if(0===e)return i.s=1/e<0?-1:1,i.e=0,void(i.d=[0]);if(i.s=e<0?(e=-e,-1):1,e===~~e&&e<1e7){for(t=0,r=e;10<=r;r/=10)t++;return void(b?a.maxE<t?(i.e=NaN,i.d=null):t<a.minE?(i.e=0,i.d=[0]):(i.e=t,i.d=[e]):(i.e=t,i.d=[e]))}return 0*e!=0?(e||(i.s=NaN),i.e=NaN,void(i.d=null)):J(i,e.toString())}if("string"!=n)throw Error(g+e);return 45===(r=e.charCodeAt(0))?(e=e.slice(1),i.s=-1):(43===r&&(e=e.slice(1)),i.s=1),x.test(e)?J(i,e):function(e,t){var r,n,i,a,o,s,u,c,f;if("Infinity"===t||"NaN"===t)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(m.test(t))r=16,t=t.toLowerCase();else if(p.test(t))r=2;else{if(!h.test(t))throw Error(g+t);r=8}for(o=0<=(a=(t=0<(a=t.search(/p/i))?(u=+t.slice(a+1),t.substring(2,a)):t.slice(2)).indexOf(".")),n=e.constructor,o&&(a=(s=(t=t.replace(".","")).length)-a,i=H(n,new n(r),a,2*a)),a=f=(c=S(t,r,I)).length-1;0===c[a];--a)c.pop();return a<0?new n(0*e.s):(e.e=R(c,f),e.d=c,b=!1,o&&(e=A(e,i,4*s)),u&&(e=e.times(Math.abs(u)<54?v(2,u):l.pow(2,u))),b=!0,e)}(i,e)}if(a.prototype=O,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.EUCLID=9,a.config=a.set=fe,a.clone=e,a.isDecimal=ge,a.abs=K,a.acos=ee,a.acosh=te,a.add=re,a.asin=ne,a.asinh=ie,a.atan=ae,a.atanh=oe,a.atan2=se,a.cbrt=ue,a.ceil=ce,a.cos=le,a.cosh=pe,a.div=me,a.exp=he,a.floor=de,a.hypot=ye,a.ln=ve,a.log=be,a.log10=we,a.log2=xe,a.max=Ne,a.min=Oe,a.mod=Me,a.mul=Ee,a.pow=je,a.random=Se,a.round=Ae,a.sign=Ce,a.sin=Te,a.sinh=_e,a.sqrt=Ie,a.sub=Be,a.tan=qe,a.tanh=ke,a.trunc=ze,void 0===t&&(t={}),t&&!0!==t.defaults)for(i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],r=0;r<i.length;)t.hasOwnProperty(n=i[r++])||(t[n]=this[n]);return a.config(t),a}(u)).default=l.Decimal=l,n=new l(n),i=new l(i),void 0===(Pe=function(){return l}.call(De,Re,De,t))||(t.exports=Pe)}()},function(e,t,r){"use strict";function l(e,t){return p({},e,t)}var p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},m={"{":"\\{","}":"\\}","\\":"\\textbackslash{}","#":"\\#",$:"\\$","%":"\\%","&":"\\&","^":"\\textasciicircum{}",_:"\\_","~":"\\textasciitilde{}"},h={"":"\\--","—":"\\---"," ":"~","\t":"\\qquad{}","\r\n":"\\newline{}","\n":"\\newline{}"};e.exports=function(e){for(var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=t.preserveFormatting,n=void 0!==r&&r,i=t.escapeMapFn,a=void 0===i?l:i,o=String(e),s="",u=a(p({},m),n?p({},h):{}),c=Object.keys(u),f=function(){var r=!1;c.forEach(function(e,t){r||o.length>=e.length&&o.slice(0,e.length)===e&&(s+=u[c[t]],o=o.slice(e.length,o.length),r=!0)}),r||(s+=o.slice(0,1),o=o.slice(1,o.length))};o;)f();return s}},function(e,t){function r(){}r.prototype={on:function(e,t,r){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:t,ctx:r}),this},once:function(e,t,r){var n=this;function i(){n.off(e,i),t.apply(r,arguments)}return i._=t,this.on(e,i,r)},emit:function(e){for(var t=[].slice.call(arguments,1),r=((this.e||(this.e={}))[e]||[]).slice(),n=0,i=r.length;n<i;n++)r[n].fn.apply(r[n].ctx,t);return this},off:function(e,t){var r=this.e||(this.e={}),n=r[e],i=[];if(n&&t)for(var a=0,o=n.length;a<o;a++)n[a].fn!==t&&n[a].fn._!==t&&i.push(n[a]);return i.length?r[e]=i:delete r[e],this}},e.exports=r,e.exports.TinyEmitter=r},function(e,t,r){var n=r(21),i=(0,r(22).create)(n);e.exports=i},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";r.r(t);var ie=r(1),n=r(14),i=r.n(n),j=r(4),s=r(0),o=function(){return o=i.a.create,i.a},a=["?BigNumber","?Complex","?DenseMatrix","?Fraction"],u=Object(s.a)("typed",a,function(e){var r=e.BigNumber,n=e.Complex,t=e.DenseMatrix,i=e.Fraction,a=o();return a.types=[{name:"number",test:ie.y},{name:"Complex",test:ie.j},{name:"BigNumber",test:ie.e},{name:"Fraction",test:ie.o},{name:"Unit",test:ie.L},{name:"string",test:ie.I},{name:"Chain",test:ie.h},{name:"Array",test:ie.b},{name:"Matrix",test:ie.v},{name:"DenseMatrix",test:ie.n},{name:"SparseMatrix",test:ie.H},{name:"Range",test:ie.D},{name:"Index",test:ie.t},{name:"boolean",test:ie.g},{name:"ResultSet",test:ie.G},{name:"Help",test:ie.s},{name:"function",test:ie.p},{name:"Date",test:ie.m},{name:"RegExp",test:ie.F},{name:"null",test:ie.x},{name:"undefined",test:ie.K},{name:"AccessorNode",test:ie.a},{name:"ArrayNode",test:ie.c},{name:"AssignmentNode",test:ie.d},{name:"BlockNode",test:ie.f},{name:"ConditionalNode",test:ie.k},{name:"ConstantNode",test:ie.l},{name:"FunctionNode",test:ie.r},{name:"FunctionAssignmentNode",test:ie.q},{name:"IndexNode",test:ie.u},{name:"Node",test:ie.w},{name:"ObjectNode",test:ie.A},{name:"OperatorNode",test:ie.B},{name:"ParenthesisNode",test:ie.C},{name:"RangeNode",test:ie.E},{name:"SymbolNode",test:ie.J},{name:"Object",test:ie.z}],a.conversions=[{from:"number",to:"BigNumber",convert:function(e){if(r||c(e),15<Object(j.f)(e))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 r(e)}},{from:"number",to:"Complex",convert:function(e){return n||f(e),new n(e,0)}},{from:"number",to:"string",convert:function(e){return e+""}},{from:"BigNumber",to:"Complex",convert:function(e){return n||f(e),new n(e.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(e){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 n||f(e),new n(e.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(e){i||l(e);var t=new i(e);if(t.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 t}},{from:"string",to:"number",convert:function(e){var t=Number(e);if(isNaN(t))throw new Error('Cannot convert "'+e+'" to a number');return t}},{from:"string",to:"BigNumber",convert:function(t){r||c(t);try{return new r(t)}catch(e){throw new Error('Cannot convert "'+t+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(t){i||l(t);try{return new i(t)}catch(e){throw new Error('Cannot convert "'+t+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(t){n||f(t);try{return new n(t)}catch(e){throw new Error('Cannot convert "'+t+'" to Complex')}}},{from:"boolean",to:"number",convert:function(e){return+e}},{from:"boolean",to:"BigNumber",convert:function(e){return r||c(e),new r(+e)}},{from:"boolean",to:"Fraction",convert:function(e){return i||l(e),new i(+e)}},{from:"boolean",to:"string",convert:function(e){return String(e)}},{from:"Array",to:"Matrix",convert:function(e){return t||function(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}(),new t(e)}},{from:"Matrix",to:"Array",convert:function(e){return e.valueOf()}}],a});function c(e){throw new Error("Cannot convert value ".concat(e," into a BigNumber: no class 'BigNumber' provided"))}function f(e){throw new Error("Cannot convert value ".concat(e," into a Complex number: no class 'Complex' provided"))}function l(e){throw new Error("Cannot convert value ".concat(e," into a Fraction, no class 'Fraction' provided."))}var p=[],m=Object(s.a)("ResultSet",p,function(){function t(e){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");this.entries=e||[]}return t.prototype.type="ResultSet",t.prototype.isResultSet=!0,t.prototype.valueOf=function(){return this.entries},t.prototype.toString=function(){return"["+this.entries.join(", ")+"]"},t.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},t.fromJSON=function(e){return new t(e.entries)},t},{isClass:!0}),h=r(16),d=r.n(h),y=["?on","config"],g=Object(s.a)("BigNumber",y,function(e){var t=e.on,r=e.config,n=d.a.clone({precision:r.precision});return n.prototype.type="BigNumber",n.prototype.isBigNumber=!0,n.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},n.fromJSON=function(e){return new n(e.value)},t&&t("config",function(e,t){e.precision!==t.precision&&n.config({precision:e.precision})}),n},{isClass:!0}),v=r(9),b=r.n(v);function x(e){return(x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var w=[],N=Object(s.a)("Complex",w,function(){return b.a.prototype.type="Complex",b.a.prototype.isComplex=!0,b.a.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},b.a.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},b.a.prototype.format=function(e){var t=this.im,r=this.re,n=Object(j.h)(this.re,e),i=Object(j.h)(this.im,e),a=Object(ie.y)(e)?e:e?e.precision:null;if(null!==a){var o=Math.pow(10,-a);Math.abs(r/t)<o&&(r=0),Math.abs(t/r)<o&&(t=0)}return 0===t?n:0===r?1===t?"i":-1===t?"-i":i+"i":t<0?-1===t?n+" - i":n+" - "+i.substring(1)+"i":1===t?n+" + i":n+" + "+i+"i"},b.a.fromPolar=function(e){switch(arguments.length){case 1:var t=e;if("object"===x(t))return b()(t);throw new TypeError("Input has to be an object with r and phi keys.");case 2:var r=e,n=arguments[1];if(Object(ie.y)(r)){if(Object(ie.L)(n)&&n.hasBase("ANGLE")&&(n=n.toNumber("rad")),Object(ie.y)(n))return new b.a({r:r,phi:n});throw new TypeError("Phi is not a number nor an angle unit.")}throw new TypeError("Radius r is not a number.");default:throw new SyntaxError("Wrong number of arguments in function fromPolar")}},b.a.prototype.valueOf=b.a.prototype.toString,b.a.fromJSON=function(e){return new b.a(e)},b.a.compare=function(e,t){return e.re>t.re?1:e.re<t.re?-1:e.im>t.im?1:e.im<t.im?-1:0},b.a},{isClass:!0}),O=r(11),M=r.n(O),E=[],S=Object(s.a)("Fraction",E,function(){return M.a.prototype.type="Fraction",M.a.prototype.isFraction=!0,M.a.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},M.a.fromJSON=function(e){return new M.a(e)},M.a},{isClass:!0}),A=[],C=Object(s.a)("Range",A,function(){function o(e,t,r){if(!(this instanceof o))throw new SyntaxError("Constructor must be called with the new operator");var n=null!=e,i=null!=t,a=null!=r;if(n)if(Object(ie.e)(e))e=e.toNumber();else if("number"!=typeof e)throw new TypeError("Parameter start must be a number");if(i)if(Object(ie.e)(t))t=t.toNumber();else if("number"!=typeof t)throw new TypeError("Parameter end must be a number");if(a)if(Object(ie.e)(r))r=r.toNumber();else if("number"!=typeof r)throw new TypeError("Parameter step must be a number");this.start=n?parseFloat(e):0,this.end=i?parseFloat(t):0,this.step=a?parseFloat(r):1}return o.prototype.type="Range",o.prototype.isRange=!0,o.parse=function(e){if("string"!=typeof e)return null;var t=e.split(":").map(function(e){return parseFloat(e)});if(t.some(function(e){return isNaN(e)}))return null;switch(t.length){case 2:return new o(t[0],t[1]);case 3:return new o(t[0],t[2],t[1]);default:return null}},o.prototype.clone=function(){return new o(this.start,this.end,this.step)},o.prototype.size=function(){var e=0,t=this.start,r=this.step,n=this.end-t;return Object(j.n)(r)===Object(j.n)(n)?e=Math.ceil(n/r):0==n&&(e=0),isNaN(e)&&(e=0),[e]},o.prototype.min=function(){var e=this.size()[0];return 0<e?0<this.step?this.start:this.start+(e-1)*this.step:void 0},o.prototype.max=function(){var e=this.size()[0];return 0<e?0<this.step?this.start+(e-1)*this.step:this.start:void 0},o.prototype.forEach=function(e){var t=this.start,r=this.step,n=this.end,i=0;if(0<r)for(;t<n;)e(t,[i],this),t+=r,i++;else if(r<0)for(;n<t;)e(t,[i],this),t+=r,i++},o.prototype.map=function(n){var i=[];return this.forEach(function(e,t,r){i[t[0]]=n(e,t,r)}),i},o.prototype.toArray=function(){var r=[];return this.forEach(function(e,t){r[t[0]]=e}),r},o.prototype.valueOf=function(){return this.toArray()},o.prototype.format=function(e){var t=Object(j.h)(this.start,e);return 1!==this.step&&(t+=":"+Object(j.h)(this.step,e)),t+=":"+Object(j.h)(this.end,e)},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(e){return new o(e.start,e.end,e.step)},o},{isClass:!0}),T=[],_=Object(s.a)("Matrix",T,function(){function e(){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator")}return e.prototype.type="Matrix",e.prototype.isMatrix=!0,e.storage=function(e){throw new Error("Matrix.storage is deprecated since v6.0.0. Use the factory function math.matrix instead.")},e.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},e.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},e.prototype.create=function(e,t){throw new Error("Cannot invoke create on a Matrix interface")},e.prototype.subset=function(e,t,r){throw new Error("Cannot invoke subset on a Matrix interface")},e.prototype.get=function(e){throw new Error("Cannot invoke get on a Matrix interface")},e.prototype.set=function(e,t,r){throw new Error("Cannot invoke set on a Matrix interface")},e.prototype.resize=function(e,t){throw new Error("Cannot invoke resize on a Matrix interface")},e.prototype.reshape=function(e,t){throw new Error("Cannot invoke reshape on a Matrix interface")},e.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},e.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},e.prototype.map=function(e,t){throw new Error("Cannot invoke map on a Matrix interface")},e.prototype.forEach=function(e){throw new Error("Cannot invoke forEach on a Matrix interface")},e.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},e.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},e.prototype.format=function(e){throw new Error("Cannot invoke format on a Matrix interface")},e.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},e},{isClass:!0}),I=r(2),J=r(5),ae=r(3),D=r(6),B=["Matrix"],q=Object(s.a)("DenseMatrix",B,function(e){var t=e.Matrix;function m(e,t){if(!(this instanceof m))throw new SyntaxError("Constructor must be called with the new operator");if(t&&!Object(ie.I)(t))throw new Error("Invalid datatype: "+t);if(Object(ie.v)(e))"DenseMatrix"===e.type?(this._data=Object(ae.a)(e._data),this._size=Object(ae.a)(e._size)):(this._data=e.toArray(),this._size=e.size()),this._datatype=t||e._datatype;else if(e&&Object(ie.b)(e.data)&&Object(ie.b)(e.size))this._data=e.data,this._size=e.size,this._datatype=t||e.datatype;else if(Object(ie.b)(e))this._data=function e(t){for(var r=0,n=t.length;r<n;r++){var i=t[r];Object(ie.b)(i)?t[r]=e(i):i&&!0===i.isMatrix&&(t[r]=e(i.valueOf()))}return t}(e),this._size=Object(I.a)(this._data),Object(I.r)(this._data,this._size),this._datatype=t;else{if(e)throw new TypeError("Unsupported type of data ("+Object(ie.M)(e)+")");this._data=[],this._size=[0],this._datatype=t}}function s(e,t,r){if(0!==t.length)return e._size=t.slice(0),e._data=Object(I.o)(e._data,e._size,r),e;for(var n=e._data;Object(ie.b)(n);)n=n[0];return n}function l(e,t,r){for(var n=e._size.slice(0),i=!1;n.length<t.length;)n.push(0),i=!0;for(var a=0,o=t.length;a<o;a++)t[a]>n[a]&&(n[a]=t[a],i=!0);i&&s(e,n,r)}return(m.prototype=new t).createDenseMatrix=function(e,t){return new m(e,t)},m.prototype.type="DenseMatrix",m.prototype.isDenseMatrix=!0,m.prototype.getDataType=function(){return Object(I.h)(this._data,ie.M)},m.prototype.storage=function(){return"dense"},m.prototype.datatype=function(){return this._datatype},m.prototype.create=function(e,t){return new m(e,t)},m.prototype.subset=function(e,t,r){switch(arguments.length){case 1:return function(e,t){if(!Object(ie.t)(t))throw new TypeError("Invalid index");{if(t.isScalar())return e.get(t.min());var r=t.size();if(r.length!==e._size.length)throw new D.a(r.length,e._size.length);for(var n=t.min(),i=t.max(),a=0,o=e._size.length;a<o;a++)Object(I.s)(n[a],e._size[a]),Object(I.s)(i[a],e._size[a]);return new m(function r(n,i,a,o){var e=o===a-1;var t=i.dimension(o);return e?t.map(function(e){return Object(I.s)(e,n.length),n[e]}).valueOf():t.map(function(e){Object(I.s)(e,n.length);var t=n[e];return r(t,i,a,o+1)}).valueOf()}(e._data,t,r.length,0),e._datatype)}}(this,e);case 2:case 3:return function(e,t,r,n){if(!t||!0!==t.isIndex)throw new TypeError("Invalid index");var i,a=t.size(),o=t.isScalar();Object(ie.v)(r)?(i=r.size(),r=r.valueOf()):i=Object(I.a)(r);if(o){if(0!==i.length)throw new TypeError("Scalar expected");e.set(t.min(),r,n)}else{if(a.length<e._size.length)throw new D.a(a.length,e._size.length,"<");if(i.length<a.length){for(var s=0,u=0;1===a[s]&&1===i[s];)s++;for(;1===a[s];)u++,s++;r=Object(I.q)(r,a.length,u,i)}if(!Object(ae.d)(a,i))throw new D.a(a,i,">");var c=t.max().map(function(e){return e+1});l(e,c,n);var f=a.length;!function r(n,i,a,o,s){var e=s===o-1;var t=i.dimension(s);e?t.forEach(function(e,t){Object(I.s)(e),n[e]=a[t[0]]}):t.forEach(function(e,t){Object(I.s)(e),r(n[e],i,a[t[0]],o,s+1)})}(e._data,t,r,f,0)}return e}(this,e,t,r);default:throw new SyntaxError("Wrong number of arguments")}},m.prototype.get=function(e){if(!Object(ie.b)(e))throw new TypeError("Array expected");if(e.length!==this._size.length)throw new D.a(e.length,this._size.length);for(var t=0;t<e.length;t++)Object(I.s)(e[t],this._size[t]);for(var r=this._data,n=0,i=e.length;n<i;n++){var a=e[n];Object(I.s)(a,r.length),r=r[a]}return r},m.prototype.set=function(e,t,r){if(!Object(ie.b)(e))throw new TypeError("Array expected");if(e.length<this._size.length)throw new D.a(e.length,this._size.length,"<");var n,i,a;l(this,e.map(function(e){return e+1}),r);var o=this._data;for(n=0,i=e.length-1;n<i;n++)a=e[n],Object(I.s)(a,o.length),o=o[a];return a=e[e.length-1],Object(I.s)(a,o.length),o[a]=t,this},m.prototype.resize=function(e,t,r){if(!Object(ie.b)(e))throw new TypeError("Array expected");return s(r?this.clone():this,e,t)},m.prototype.reshape=function(e,t){var r=t?this.clone():this;return r._data=Object(I.n)(r._data,e),r._size=e.slice(0),r},m.prototype.clone=function(){return new m({data:Object(ae.a)(this._data),size:Object(ae.a)(this._size),datatype:this._datatype})},m.prototype.size=function(){return this._size.slice(0)},m.prototype.map=function(t){var i=this;return new m({data:function r(e,n){return Object(ie.b)(e)?e.map(function(e,t){return r(e,n.concat(t))}):t(e,n,i)}(this._data,[]),size:Object(ae.a)(this._size),datatype:this._datatype})},m.prototype.forEach=function(t){var i=this;!function r(e,n){Object(ie.b)(e)?e.forEach(function(e,t){r(e,n.concat(t))}):t(e,n,i)}(this._data,[])},m.prototype.toArray=function(){return Object(ae.a)(this._data)},m.prototype.valueOf=function(){return this._data},m.prototype.format=function(e){return Object(J.d)(this._data,e)},m.prototype.toString=function(){return Object(J.d)(this._data)},m.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},m.prototype.diagonal=function(e){if(e){if(Object(ie.e)(e)&&(e=e.toNumber()),!Object(ie.y)(e)||!Object(j.i)(e))throw new TypeError("The parameter k must be an integer number")}else e=0;for(var t=0<e?e:0,r=e<0?-e:0,n=this._size[0],i=this._size[1],a=Math.min(n-r,i-t),o=[],s=0;s<a;s++)o[s]=this._data[s+r][s+t];return new m({data:o,size:[a],datatype:this._datatype})},m.diagonal=function(e,t,r,n){if(!Object(ie.b)(e))throw new TypeError("Array expected, size parameter");if(2!==e.length)throw new Error("Only two dimensions matrix are supported");if(e=e.map(function(e){if(Object(ie.e)(e)&&(e=e.toNumber()),!Object(ie.y)(e)||!Object(j.i)(e)||e<1)throw new Error("Size values must be positive integers");return e}),r){if(Object(ie.e)(r)&&(r=r.toNumber()),!Object(ie.y)(r)||!Object(j.i)(r))throw new TypeError("The parameter k must be an integer number")}else r=0;var i,a=0<r?r:0,o=r<0?-r:0,s=e[0],u=e[1],c=Math.min(s-o,u-a);if(Object(ie.b)(t)){if(t.length!==c)throw new Error("Invalid value array length");i=function(e){return t[e]}}else if(Object(ie.v)(t)){var f=t.size();if(1!==f.length||f[0]!==c)throw new Error("Invalid matrix length");i=function(e){return t.get([e])}}else i=function(){return t};n=n||(Object(ie.e)(i(0))?i(0).mul(0):0);var l=[];if(0<e.length){l=Object(I.o)(l,e,n);for(var p=0;p<c;p++)l[p+o][p+a]=i(p)}return new m({data:l,size:[s,u]})},m.fromJSON=function(e){return new m(e)},m.prototype.swapRows=function(e,t){if(!(Object(ie.y)(e)&&Object(j.i)(e)&&Object(ie.y)(t)&&Object(j.i)(t)))throw new Error("Row index must be positive integers");if(2!==this._size.length)throw new Error("Only two dimensional matrix is supported");return Object(I.s)(e,this._size[0]),Object(I.s)(t,this._size[0]),m._swapRows(e,t,this._data),this},m._swapRows=function(e,t,r){var n=r[e];r[e]=r[t],r[t]=n},m},{isClass:!0}),k=["typed"],z=Object(s.a)("clone",k,function(e){return(0,e.typed)("clone",{any:ae.a})}),R=r(10);function P(e){for(var t=0;t<e.length;t++)if(Object(ie.i)(e[t]))return!0;return!1}function F(e,t){Object(ie.v)(e)&&(e=e.valueOf());for(var r=0,n=e.length;r<n;r++){var i=e[r];Array.isArray(i)?F(i,t):t(i)}}function oe(e,t,r){return e&&"function"==typeof e.map?e.map(function(e){return oe(e,t,r)}):t(e)}function U(e,t,r){var n=Array.isArray(e)?Object(I.a)(e):e.size();if(t<0||t>=n.length)throw new R.a(t,n.length);return Object(ie.v)(e)?e.create(L(e.valueOf(),t,r)):L(e,t,r)}function L(e,t,r){var n,i,a,o;if(t<=0){if(Array.isArray(e[0])){for(o=function(e){var t,r,n=e.length,i=e[0].length,a=[];for(r=0;r<i;r++){var o=[];for(t=0;t<n;t++)o.push(e[t][r]);a.push(o)}return a}(e),i=[],n=0;n<o.length;n++)i[n]=L(o[n],t-1,r);return i}for(a=e[0],n=1;n<e.length;n++)a=r(a,e[n]);return a}for(i=[],n=0;n<e.length;n++)i[n]=L(e[n],t-1,r);return i}function H(e,t,r,n,i,a,o,s,u,c,f){var l,p,m,h,d=e._values,y=e._index,g=e._ptr,v=o._index;if(n)for(p=g[t],m=g[t+1],l=p;l<m;l++)r[h=y[l]]!==a?(r[h]=a,v.push(h),c?(n[h]=u?s(d[l],f):s(f,d[l]),i[h]=a):n[h]=d[l]):(n[h]=u?s(d[l],n[h]):s(n[h],d[l]),i[h]=a);else for(p=g[t],m=g[t+1],l=p;l<m;l++)r[h=y[l]]!==a?(r[h]=a,v.push(h)):i[h]=a}var $="isInteger",G=["typed"],Z=Object(s.a)($,G,function(e){var t=(0,e.typed)($,{number:j.i,BigNumber:function(e){return e.isInt()},Fraction:function(e){return 1===e.d&&isFinite(e.n)},"Array | Matrix":function(e){return oe(e,t)}});return t}),V="number";function W(e){return e<0}function Y(e){return 0<e}function X(e){return 0===e}function Q(e){return Number.isNaN(e)}Q.signature=X.signature=Y.signature=W.signature=V;var K="isNegative",ee=["typed"],te=Object(s.a)(K,ee,function(e){var t=(0,e.typed)(K,{number:W,BigNumber:function(e){return e.isNeg()&&!e.isZero()&&!e.isNaN()},Fraction:function(e){return e.s<0},Unit:function(e){return t(e.value)},"Array | Matrix":function(e){return oe(e,t)}});return t}),re="isNumeric",ne=["typed"],se=Object(s.a)(re,ne,function(e){var t=(0,e.typed)(re,{"number | BigNumber | Fraction | boolean":function(){return!0},"Complex | Unit | string | null | undefined | Node":function(){return!1},"Array | Matrix":function(e){return oe(e,t)}});return t}),ue="hasNumericValue",ce=["typed","isNumeric"],fe=Object(s.a)(ue,ce,function(e){var t=e.typed,r=e.isNumeric;return t(ue,{string:function(e){return 0<e.trim().length&&!isNaN(Number(e))},any:function(e){return r(e)}})}),le="isPositive",pe=["typed"],me=Object(s.a)(le,pe,function(e){var t=(0,e.typed)(le,{number:Y,BigNumber:function(e){return!e.isNeg()&&!e.isZero()&&!e.isNaN()},Fraction:function(e){return 0<e.s&&0<e.n},Unit:function(e){return t(e.value)},"Array | Matrix":function(e){return oe(e,t)}});return t}),he=["typed"],de=Object(s.a)("isZero",he,function(e){var t=(0,e.typed)("isZero",{number:X,BigNumber:function(e){return e.isZero()},Complex:function(e){return 0===e.re&&0===e.im},Fraction:function(e){return 1===e.d&&0===e.n},Unit:function(e){return t(e.value)},"Array | Matrix":function(e){return oe(e,t)}});return t}),ye=["typed"],ge=Object(s.a)("isNaN",ye,function(e){return(0,e.typed)("isNaN",{number:Q,BigNumber:function(e){return e.isNaN()},Fraction:function(e){return!1},Complex:function(e){return e.isNaN()},Unit:function(e){return Number.isNaN(e.value)},"Array | Matrix":function(e){return oe(e,Number.isNaN)}})}),ve=r(8),be=["typed"],xe=Object(s.a)("typeOf",be,function(e){return(0,e.typed)("typeOf",{any:ie.M})}),we=Object(s.a)("typeof",[],function(){return function(){Object(ve.a)('Function "typeof" has been renamed to "typeOf" in v6.0.0, please use the new function instead.');for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return ie.M.apply(ie.M,t)}});function Ne(e,t,r){if(null==r)return e.eq(t);if(e.eq(t))return!0;if(e.isNaN()||t.isNaN())return!1;if(e.isFinite()&&t.isFinite()){var n=e.minus(t).abs();if(n.isZero())return!0;var i=e.constructor.max(e.abs(),t.abs());return n.lte(i.times(r))}return!1}var Oe="equalScalar",Me=["typed","config"],Ee=Object(s.a)(Oe,Me,function(e){var t=e.typed,r=e.config,n=t(Oe,{"boolean, boolean":function(e,t){return e===t},"number, number":function(e,t){return Object(j.m)(e,t,r.epsilon)},"BigNumber, BigNumber":function(e,t){return e.eq(t)||Ne(e,t,r.epsilon)},"Fraction, Fraction":function(e,t){return e.equals(t)},"Complex, Complex":function(e,t){return function(e,t,r){return Object(j.m)(e.re,t.re,r)&&Object(j.m)(e.im,t.im,r)}(e,t,r.epsilon)},"Unit, Unit":function(e,t){if(!e.equalBase(t))throw new Error("Cannot compare units with different base");return n(e.value,t.value)}});return n}),je=(Object(s.a)(Oe,["typed","config"],function(e){var t=e.typed,r=e.config;return t(Oe,{"number, number":function(e,t){return Object(j.m)(e,t,r.epsilon)}})}),["typed","equalScalar","Matrix"]),Se=Object(s.a)("SparseMatrix",je,function(e){var O=e.typed,M=e.equalScalar,t=e.Matrix;function E(e,t){if(!(this instanceof E))throw new SyntaxError("Constructor must be called with the new operator");if(t&&!Object(ie.I)(t))throw new Error("Invalid datatype: "+t);if(Object(ie.v)(e))!function(e,t,r){"SparseMatrix"===t.type?(e._values=t._values?Object(ae.a)(t._values):void 0,e._index=Object(ae.a)(t._index),e._ptr=Object(ae.a)(t._ptr),e._size=Object(ae.a)(t._size),e._datatype=r||t._datatype):n(e,t.valueOf(),r||t._datatype)}(this,e,t);else if(e&&Object(ie.b)(e.index)&&Object(ie.b)(e.ptr)&&Object(ie.b)(e.size))this._values=e.values,this._index=e.index,this._ptr=e.ptr,this._size=e.size,this._datatype=t||e.datatype;else if(Object(ie.b)(e))n(this,e,t);else{if(e)throw new TypeError("Unsupported type of data ("+Object(ie.M)(e)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=t}}function n(e,t,r){e._values=[],e._index=[],e._ptr=[],e._datatype=r;var n=t.length,i=0,a=M,o=0;if(Object(ie.I)(r)&&(a=O.find(M,[r,r])||M,o=O.convert(0,r)),0<n){var s=0;do{e._ptr.push(e._index.length);for(var u=0;u<n;u++){var c=t[u];if(Object(ie.b)(c)){if(0===s&&i<c.length&&(i=c.length),s<c.length){var f=c[s];a(f,o)||(e._values.push(f),e._index.push(u))}}else 0===s&&i<1&&(i=1),a(c,o)||(e._values.push(c),e._index.push(u))}s++}while(s<i)}e._ptr.push(e._index.length),e._size=[n,i]}function g(e,t,r,n){if(r-t==0)return r;for(var i=t;i<r;i++)if(n[i]===e)return i;return t}function v(e,t,r,n,i,a,o){i.splice(e,0,n),a.splice(e,0,t);for(var s=r+1;s<o.length;s++)o[s]++}function f(e,t,r,n){var i=n||0,a=M,o=0;Object(ie.I)(e._datatype)&&(a=O.find(M,[e._datatype,e._datatype])||M,o=O.convert(0,e._datatype),i=O.convert(i,e._datatype));var s,u,c,f=!a(i,o),l=e._size[0],p=e._size[1];if(p<r){for(u=p;u<r;u++)if(e._ptr[u]=e._values.length,f)for(s=0;s<l;s++)e._values.push(i),e._index.push(s);e._ptr[r]=e._values.length}else r<p&&(e._ptr.splice(r+1,p-r),e._values.splice(e._ptr[r],e._values.length),e._index.splice(e._ptr[r],e._index.length));if(p=r,l<t){if(f){var m=0;for(u=0;u<p;u++){e._ptr[u]=e._ptr[u]+m,c=e._ptr[u+1]+m;var h=0;for(s=l;s<t;s++,h++)e._values.splice(c+h,0,i),e._index.splice(c+h,0,s),m++}e._ptr[p]=e._values.length}}else if(t<l){var d=0;for(u=0;u<p;u++){e._ptr[u]=e._ptr[u]-d;var y=e._ptr[u],g=e._ptr[u+1]-d;for(c=y;c<g;c++)t-1<(s=e._index[c])&&(e._values.splice(c,1),e._index.splice(c,1),d++)}e._ptr[u]=e._values.length}return e._size[0]=t,e._size[1]=r,e}function r(e,t,r,n,i){var a,o,s=n[0],u=n[1],c=[];for(a=0;a<s;a++)for(c[a]=[],o=0;o<u;o++)c[a][o]=0;for(o=0;o<u;o++)for(var f=r[o],l=r[o+1],p=f;p<l;p++)c[a=t[p]][o]=e?i?Object(ae.a)(e[p]):e[p]:1;return c}return(E.prototype=new t).createSparseMatrix=function(e,t){return new E(e,t)},E.prototype.type="SparseMatrix",E.prototype.isSparseMatrix=!0,E.prototype.getDataType=function(){return Object(I.h)(this._values,ie.M)},E.prototype.storage=function(){return"sparse"},E.prototype.datatype=function(){return this._datatype},E.prototype.create=function(e,t){return new E(e,t)},E.prototype.density=function(){var e=this._size[0],t=this._size[1];return 0!==e&&0!==t?this._index.length/(e*t):0},E.prototype.subset=function(e,t,r){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return function(e,t){if(!Object(ie.t)(t))throw new TypeError("Invalid index");if(t.isScalar())return e.get(t.min());var r,n,i,a,o=t.size();if(o.length!==e._size.length)throw new D.a(o.length,e._size.length);var s=t.min(),u=t.max();for(r=0,n=e._size.length;r<n;r++)Object(I.s)(s[r],e._size[r]),Object(I.s)(u[r],e._size[r]);var c=e._values,f=e._index,l=e._ptr,p=t.dimension(0),m=t.dimension(1),h=[],d=[];p.forEach(function(e,t){d[e]=t[0],h[e]=!0});var y=c?[]:void 0,g=[],v=[];return m.forEach(function(e){for(v.push(g.length),i=l[e],a=l[e+1];i<a;i++)r=f[i],!0===h[r]&&(g.push(d[r]),y&&y.push(c[i]))}),v.push(g.length),new E({values:y,index:g,ptr:v,size:o,datatype:e._datatype})}(this,e);case 2:case 3:return function(e,t,r,n){if(!t||!0!==t.isIndex)throw new TypeError("Invalid index");var i,a=t.size(),o=t.isScalar();Object(ie.v)(r)?(i=r.size(),r=r.toArray()):i=Object(I.a)(r);if(o){if(0!==i.length)throw new TypeError("Scalar expected");e.set(t.min(),r,n)}else{if(1!==a.length&&2!==a.length)throw new D.a(a.length,e._size.length,"<");if(i.length<a.length){for(var s=0,u=0;1===a[s]&&1===i[s];)s++;for(;1===a[s];)u++,s++;r=Object(I.q)(r,a.length,u,i)}if(!Object(ae.d)(a,i))throw new D.a(a,i,">");for(var c=t.min()[0],f=t.min()[1],l=i[0],p=i[1],m=0;m<l;m++)for(var h=0;h<p;h++){var d=r[m][h];e.set([m+c,h+f],d,n)}}return e}(this,e,t,r);default:throw new SyntaxError("Wrong number of arguments")}},E.prototype.get=function(e){if(!Object(ie.b)(e))throw new TypeError("Array expected");if(e.length!==this._size.length)throw new D.a(e.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var t=e[0],r=e[1];Object(I.s)(t,this._size[0]),Object(I.s)(r,this._size[1]);var n=g(t,this._ptr[r],this._ptr[r+1],this._index);return n<this._ptr[r+1]&&this._index[n]===t?this._values[n]:0},E.prototype.set=function(e,t,r){if(!Object(ie.b)(e))throw new TypeError("Array expected");if(e.length!==this._size.length)throw new D.a(e.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");var n=e[0],i=e[1],a=this._size[0],o=this._size[1],s=M,u=0;Object(ie.I)(this._datatype)&&(s=O.find(M,[this._datatype,this._datatype])||M,u=O.convert(0,this._datatype)),(a-1<n||o-1<i)&&(f(this,Math.max(n+1,a),Math.max(i+1,o),r),a=this._size[0],o=this._size[1]),Object(I.s)(n,a),Object(I.s)(i,o);var c=g(n,this._ptr[i],this._ptr[i+1],this._index);return c<this._ptr[i+1]&&this._index[c]===n?s(t,u)?function(e,t,r,n,i){r.splice(e,1),n.splice(e,1);for(var a=t+1;a<i.length;a++)i[a]--}(c,i,this._values,this._index,this._ptr):this._values[c]=t:v(c,n,i,t,this._values,this._index,this._ptr),this},E.prototype.resize=function(t,e,r){if(!Object(ie.b)(t))throw new TypeError("Array expected");if(2!==t.length)throw new Error("Only two dimensions matrix are supported");return t.forEach(function(e){if(!Object(ie.y)(e)||!Object(j.i)(e)||e<0)throw new TypeError("Invalid size, must contain positive integers (size: "+Object(J.d)(t)+")")}),f(r?this.clone():this,t[0],t[1],e)},E.prototype.reshape=function(t,e){if(!Object(ie.b)(t))throw new TypeError("Array expected");if(2!==t.length)throw new Error("Sparse matrices can only be reshaped in two dimensions");if(t.forEach(function(e){if(!Object(ie.y)(e)||!Object(j.i)(e)||e<0)throw new TypeError("Invalid size, must contain positive integers (size: "+Object(J.d)(t)+")")}),this._size[0]*this._size[1]!=t[0]*t[1])throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var r=e?this.clone():this;if(this._size[0]===t[0]&&this._size[1]===t[1])return r;for(var n=[],i=0;i<r._ptr.length;i++)for(var a=0;a<r._ptr[i+1]-r._ptr[i];a++)n.push(i);for(var o=r._values.slice(),s=r._index.slice(),u=0;u<r._index.length;u++){var c=s[u],f=n[u],l=c*r._size[1]+f;n[u]=l%t[1],s[u]=Math.floor(l/t[1])}r._values.length=0,r._index.length=0,r._ptr.length=t[1]+1,r._size=t.slice();for(var p=0;p<r._ptr.length;p++)r._ptr[p]=0;for(var m=0;m<o.length;m++){var h=s[m],d=n[m],y=o[m];v(g(h,r._ptr[d],r._ptr[d+1],r._index),h,d,y,r._values,r._index,r._ptr)}return r},E.prototype.clone=function(){return new E({values:this._values?Object(ae.a)(this._values):void 0,index:Object(ae.a)(this._index),ptr:Object(ae.a)(this._ptr),size:Object(ae.a)(this._size),datatype:this._datatype})},E.prototype.size=function(){return this._size.slice(0)},E.prototype.map=function(n,e){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");var i=this;return function(e,t,r,n,i,a,o){var s=[],u=[],c=[],f=M,l=0;Object(ie.I)(e._datatype)&&(f=O.find(M,[e._datatype,e._datatype])||M,l=O.convert(0,e._datatype));for(var p=function(e,t,r){e=a(e,t,r),f(e,l)||(s.push(e),u.push(t))},m=n;m<=i;m++){c.push(s.length);var h=e._ptr[m],d=e._ptr[m+1];if(o)for(var y=h;y<d;y++){var g=e._index[y];t<=g&&g<=r&&p(e._values[y],g-t,m-n)}else{for(var v={},b=h;b<d;b++){var x=e._index[b];v[x]=e._values[b]}for(var w=t;w<=r;w++){var N=w in v?v[w]:0;p(N,w-t,m-n)}}}return c.push(s.length),new E({values:s,index:u,ptr:c,size:[r-t+1,i-n+1]})}(this,0,this._size[0]-1,0,this._size[1]-1,function(e,t,r){return n(e,[t,r],i)},e)},E.prototype.forEach=function(e,t){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");for(var r=this._size[0],n=this._size[1],i=0;i<n;i++){var a=this._ptr[i],o=this._ptr[i+1];if(t)for(var s=a;s<o;s++){var u=this._index[s];e(this._values[s],[u,i],this)}else{for(var c={},f=a;f<o;f++){c[this._index[f]]=this._values[f]}for(var l=0;l<r;l++){e(l in c?c[l]:0,[l,i],this)}}}},E.prototype.toArray=function(){return r(this._values,this._index,this._ptr,this._size,!0)},E.prototype.valueOf=function(){return r(this._values,this._index,this._ptr,this._size,!1)},E.prototype.format=function(e){for(var t=this._size[0],r=this._size[1],n=this.density(),i="Sparse Matrix ["+Object(J.d)(t,e)+" x "+Object(J.d)(r,e)+"] density: "+Object(J.d)(n,e)+"\n",a=0;a<r;a++)for(var o=this._ptr[a],s=this._ptr[a+1],u=o;u<s;u++){var c=this._index[u];i+="\n ("+Object(J.d)(c,e)+", "+Object(J.d)(a,e)+") ==> "+(this._values?Object(J.d)(this._values[u],e):"X")}return i},E.prototype.toString=function(){return Object(J.d)(this.toArray())},E.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},E.prototype.diagonal=function(e){if(e){if(Object(ie.e)(e)&&(e=e.toNumber()),!Object(ie.y)(e)||!Object(j.i)(e))throw new TypeError("The parameter k must be an integer number")}else e=0;var t=0<e?e:0,r=e<0?-e:0,n=this._size[0],i=this._size[1],a=Math.min(n-r,i-t),o=[],s=[],u=[];u[0]=0;for(var c=t;c<i&&o.length<a;c++)for(var f=this._ptr[c],l=this._ptr[c+1],p=f;p<l;p++){var m=this._index[p];if(m===c-t+r){o.push(this._values[p]),s[o.length-1]=m-r;break}}return u.push(o.length),new E({values:o,index:s,ptr:u,size:[a,1]})},E.fromJSON=function(e){return new E(e)},E.diagonal=function(e,t,r,n,i){if(!Object(ie.b)(e))throw new TypeError("Array expected, size parameter");if(2!==e.length)throw new Error("Only two dimensions matrix are supported");if(e=e.map(function(e){if(Object(ie.e)(e)&&(e=e.toNumber()),!Object(ie.y)(e)||!Object(j.i)(e)||e<1)throw new Error("Size values must be positive integers");return e}),r){if(Object(ie.e)(r)&&(r=r.toNumber()),!Object(ie.y)(r)||!Object(j.i)(r))throw new TypeError("The parameter k must be an integer number")}else r=0;var a=M,o=0;Object(ie.I)(i)&&(a=O.find(M,[i,i])||M,o=O.convert(0,i));var s,u=0<r?r:0,c=r<0?-r:0,f=e[0],l=e[1],p=Math.min(f-c,l-u);if(Object(ie.b)(t)){if(t.length!==p)throw new Error("Invalid value array length");s=function(e){return t[e]}}else if(Object(ie.v)(t)){var m=t.size();if(1!==m.length||m[0]!==p)throw new Error("Invalid matrix length");s=function(e){return t.get([e])}}else s=function(){return t};for(var h=[],d=[],y=[],g=0;g<l;g++){y.push(h.length);var v=g-u;if(0<=v&&v<p){var b=s(v);a(b,o)||(d.push(v+c),h.push(b))}}return y.push(h.length),new E({values:h,index:d,ptr:y,size:[f,l]})},E.prototype.swapRows=function(e,t){if(!(Object(ie.y)(e)&&Object(j.i)(e)&&Object(ie.y)(t)&&Object(j.i)(t)))throw new Error("Row index must be positive integers");if(2!==this._size.length)throw new Error("Only two dimensional matrix is supported");return Object(I.s)(e,this._size[0]),Object(I.s)(t,this._size[0]),E._swapRows(e,t,this._size[1],this._values,this._index,this._ptr),this},E._forEachRow=function(e,t,r,n,i){for(var a=n[e],o=n[e+1],s=a;s<o;s++)i(r[s],t[s])},E._swapRows=function(e,t,r,n,i,a){for(var o=0;o<r;o++){var s=a[o],u=a[o+1],c=g(e,s,u,i),f=g(t,s,u,i);if(c<u&&f<u&&i[c]===e&&i[f]===t){if(n){var l=n[c];n[c]=n[f],n[f]=l}}else if(c<u&&i[c]===e&&(u<=f||i[f]!==t)){var p=n?n[c]:void 0;i.splice(f,0,t),n&&n.splice(f,0,p),i.splice(f<=c?c+1:c,1),n&&n.splice(f<=c?c+1:c,1)}else if(f<u&&i[f]===t&&(u<=c||i[c]!==e)){var m=n?n[f]:void 0;i.splice(c,0,e),n&&n.splice(c,0,m),i.splice(c<=f?f+1:f,1),n&&n.splice(c<=f?f+1:f,1)}}},E},{isClass:!0}),Ae=["typed"],Ce=Object(s.a)("number",Ae,function(e){var t=(0,e.typed)("number",{"":function(){return 0},number:function(e){return e},string:function(e){if("NaN"===e)return NaN;var t=Number(e);if(isNaN(t))throw new SyntaxError('String "'+e+'" is no valid number');return t},BigNumber:function(e){return e.toNumber()},Fraction:function(e){return e.valueOf()},Unit:function(e){throw new Error("Second argument with valueless unit expected")},null:function(e){return 0},"Unit, string | Unit":function(e,t){return e.toNumber(t)},"Array | Matrix":function(e){return oe(e,t)}});return t}),Te=["typed"],_e=Object(s.a)("string",Te,function(e){var t=(0,e.typed)("string",{"":function(){return""},number:j.h,null:function(e){return"null"},boolean:function(e){return e+""},string:function(e){return e},"Array | Matrix":function(e){return oe(e,t)},any:function(e){return String(e)}});return t}),Ie="boolean",Be=["typed"],qe=Object(s.a)(Ie,Be,function(e){var t=(0,e.typed)(Ie,{"":function(){return!1},boolean:function(e){return e},number:function(e){return!!e},null:function(e){return!1},BigNumber:function(e){return!e.isZero()},string:function(e){var t=e.toLowerCase();if("true"===t)return!0;if("false"===t)return!1;var r=Number(e);if(""!==e&&!isNaN(r))return!!r;throw new Error('Cannot convert "'+e+'" to a boolean')},"Array | Matrix":function(e){return oe(e,t)}});return t}),ke=["typed","BigNumber"],ze=Object(s.a)("bignumber",ke,function(e){var t=e.typed,r=e.BigNumber,n=t("bignumber",{"":function(){return new r(0)},number:function(e){return new r(e+"")},string:function(e){return new r(e)},BigNumber:function(e){return e},Fraction:function(e){return new r(e.n).div(e.d).times(e.s)},null:function(e){return new r(0)},"Array | Matrix":function(e){return oe(e,n)}});return n}),De=["typed","Complex"],Re=Object(s.a)("complex",De,function(e){var t=e.typed,r=e.Complex,n=t("complex",{"":function(){return r.ZERO},number:function(e){return new r(e,0)},"number, number":function(e,t){return new r(e,t)},"BigNumber, BigNumber":function(e,t){return new r(e.toNumber(),t.toNumber())},Fraction:function(e){return new r(e.valueOf(),0)},Complex:function(e){return e.clone()},string:function(e){return r(e)},null:function(e){return r(0)},Object:function(e){if("re"in e&&"im"in e)return new r(e.re,e.im);if("r"in e&&"phi"in e||"abs"in e&&"arg"in e)return new r(e);throw new Error("Expected object with properties (re and im) or (r and phi) or (abs and arg)")},"Array | Matrix":function(e){return oe(e,n)}});return n}),Pe=["typed","Fraction"],Fe=Object(s.a)("fraction",Pe,function(e){var t=e.typed,r=e.Fraction,n=t("fraction",{number:function(e){if(!isFinite(e)||isNaN(e))throw new Error(e+" cannot be represented as a fraction");return new r(e)},string:function(e){return new r(e)},"number, number":function(e,t){return new r(e,t)},null:function(e){return new r(0)},BigNumber:function(e){return new r(e.toString())},Fraction:function(e){return e},Object:function(e){return new r(e)},"Array | Matrix":function(e){return oe(e,n)}});return n}),Ue=["typed","Matrix","DenseMatrix","SparseMatrix"],Le=Object(s.a)("matrix",Ue,function(e){var t=e.typed,n=(e.Matrix,e.DenseMatrix),i=e.SparseMatrix;return t("matrix",{"":function(){return r([])},string:function(e){return r([],e)},"string, string":function(e,t){return r([],e,t)},Array:function(e){return r(e)},Matrix:function(e){return r(e,e.storage())},"Array | Matrix, string":r,"Array | Matrix, string, string":r});function r(e,t,r){if("dense"===t||"default"===t||void 0===t)return new n(e,r);if("sparse"===t)return new i(e,r);throw new TypeError("Unknown matrix type "+JSON.stringify(t)+".")}}),He="splitUnit",$e=["typed"],Ge=Object(s.a)(He,$e,function(e){return(0,e.typed)(He,{"Unit, Array":function(e,t){return e.splitUnit(t)}})}),Ze="number",Ve="number, number";function Je(e){return Math.abs(e)}function We(e,t){return e+t}function Ye(e,t){return e*t}function Xe(e){return-e}function Qe(e){return e}function Ke(e){return Object(j.d)(e)}function et(e){return Math.ceil(e)}function tt(e){return e*e*e}function rt(e){return Math.exp(e)}function nt(e){return Object(j.g)(e)}function it(e,t){if(!Object(j.i)(e)||!Object(j.i)(t))throw new Error("Parameters in function gcd must be integer numbers");for(var r;0!==t;)r=e%t,e=t,t=r;return e<0?-e:e}function at(e,t){if(!Object(j.i)(e)||!Object(j.i)(t))throw new Error("Parameters in function lcm must be integer numbers");if(0===e||0===t)return 0;for(var r,n=e*t;0!==t;)t=e%(r=t),e=r;return Math.abs(n/e)}function ot(e){return Math.log(e)}function st(e){return Object(j.j)(e)}function ut(e){return Object(j.l)(e)}function ct(e,t){if(0<t)return e-t*Math.floor(e/t);if(0===t)return e;throw new Error("Cannot calculate mod for a negative divisor")}function ft(e,t){var r=t<0;if(r&&(t=-t),0===t)throw new Error("Root must be non-zero");if(e<0&&Math.abs(t)%2!=1)throw new Error("Root must be odd when a is negative.");if(0===e)return r?1/0:0;if(!isFinite(e))return r?0:e;var n=Math.pow(Math.abs(e),1/t);return n=e<0?-n:n,r?1/n:n}function lt(e){return Object(j.n)(e)}function pt(e){return e*e}function mt(e,t){var r,n,i,a=0,o=1,s=1,u=0;if(!Object(j.i)(e)||!Object(j.i)(t))throw new Error("Parameters in function xgcd must be integer numbers");for(;t;)i=e-(n=Math.floor(e/t))*t,a=o-n*(r=a),o=r,s=u-n*(r=s),u=r,e=t,t=i;return e<0?[-e,-o,-u]:[e,e?o:0,u]}function ht(e,t){return e*e<1&&t===1/0||1<e*e&&t===-1/0?0:Math.pow(e,t)}function dt(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return parseFloat(Object(j.q)(e,t))}Je.signature=Ze,Ye.signature=We.signature=Ve,nt.signature=rt.signature=tt.signature=et.signature=Ke.signature=Qe.signature=Xe.signature=Ze,at.signature=it.signature=Ve,ut.signature=st.signature=ot.signature=Ze,ft.signature=ct.signature=Ve,pt.signature=lt.signature=Ze,dt.signature=ht.signature=mt.signature=Ve;var yt="unaryMinus",gt=["typed"],vt=Object(s.a)(yt,gt,function(e){var r=(0,e.typed)(yt,{number:Xe,Complex:function(e){return e.neg()},BigNumber:function(e){return e.neg()},Fraction:function(e){return e.neg()},Unit:function(e){var t=e.clone();return t.value=r(e.value),t},"Array | Matrix":function(e){return oe(e,r,!0)}});return r}),bt="unaryPlus",xt=["typed","config","BigNumber"],wt=Object(s.a)(bt,xt,function(e){var t=e.typed,r=e.config,n=e.BigNumber,i=t(bt,{number:Qe,Complex:function(e){return e},BigNumber:function(e){return e},Fraction:function(e){return e},Unit:function(e){return e.clone()},"Array | Matrix":function(e){return oe(e,i,!0)},"boolean | string":function(e){return"BigNumber"===r.number?new n(+e):+e}});return i}),Nt=["typed"],Ot=Object(s.a)("abs",Nt,function(e){var t=(0,e.typed)("abs",{number:Je,Complex:function(e){return e.abs()},BigNumber:function(e){return e.abs()},Fraction:function(e){return e.abs()},"Array | Matrix":function(e){return oe(e,t,!0)},Unit:function(e){return e.abs()}});return t}),Mt=["typed","isInteger"],Et=Object(s.a)("apply",Mt,function(e){var t=e.typed,i=e.isInteger;return t("apply",{"Array | Matrix, number | BigNumber, function":function(e,t,r){if(!i(t))throw new TypeError("Integer number expected for dimension");var n=Array.isArray(e)?Object(I.a)(e):e.size();if(t<0||t>=n.length)throw new R.a(t,n.length);return Object(ie.v)(e)?e.create(jt(e.valueOf(),t,r)):jt(e,t,r)}})});function jt(e,t,r){var n,i,a;if(t<=0){if(Array.isArray(e[0])){for(a=function(e){var t,r,n=e.length,i=e[0].length,a=[];for(r=0;r<i;r++){var o=[];for(t=0;t<n;t++)o.push(e[t][r]);a.push(o)}return a}(e),i=[],n=0;n<a.length;n++)i[n]=jt(a[n],t-1,r);return i}return r(e)}for(i=[],n=0;n<e.length;n++)i[n]=jt(e[n],t-1,r);return i}var St="addScalar",At=["typed"],Ct=Object(s.a)(St,At,function(e){var n=(0,e.typed)(St,{"number, number":We,"Complex, Complex":function(e,t){return e.add(t)},"BigNumber, BigNumber":function(e,t){return e.plus(t)},"Fraction, Fraction":function(e,t){return e.add(t)},"Unit, Unit":function(e,t){if(null===e.value||void 0===e.value)throw new Error("Parameter x contains a unit with undefined value");if(null===t.value||void 0===t.value)throw new Error("Parameter y contains a unit with undefined value");if(!e.equalBase(t))throw new Error("Units do not match");var r=e.clone();return r.value=n(r.value,t.value),r.fixPrefix=!1,r}});return n}),Tt=["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],_t=Object(s.a)("cbrt",Tt,function(e){var o=e.config,t=e.typed,a=e.isNegative,s=e.unaryMinus,u=e.matrix,c=e.Complex,f=e.BigNumber,l=e.Fraction,r=t("cbrt",{number:Ke,Complex:p,"Complex, boolean":p,BigNumber:function(e){return e.cbrt()},Unit:function(e){{if(e.value&&Object(ie.j)(e.value)){var t=e.clone();return t.value=1,(t=t.pow(1/3)).value=p(e.value),t}var r,n=a(e.value);n&&(e.value=s(e.value)),r=Object(ie.e)(e.value)?new f(1).div(3):Object(ie.o)(e.value)?new l(1,3):1/3;var i=e.pow(r);return n&&(i.value=s(i.value)),i}},"Array | Matrix":function(e){return oe(e,r,!0)}});function p(e,t){var r=e.arg()/3,n=e.abs(),i=new c(Ke(n),0).mul(new c(0,r).exp());if(t){var a=[i,new c(Ke(n),0).mul(new c(0,r+2*Math.PI/3).exp()),new c(Ke(n),0).mul(new c(0,r-2*Math.PI/3).exp())];return"Array"===o.matrix?a:u(a)}return i}return r}),It=["typed","config","round"],Bt=Object(s.a)("ceil",It,function(e){var t=e.typed,r=e.config,n=e.round,i=t("ceil",{number:function(e){return Object(j.m)(e,n(e),r.epsilon)?n(e):et(e)},Complex:function(e){return e.ceil()},BigNumber:function(e){return Ne(e,n(e),r.epsilon)?n(e):e.ceil()},Fraction:function(e){return e.ceil()},"Array | Matrix":function(e){return oe(e,i,!0)}});return i}),qt=["typed"],kt=Object(s.a)("cube",qt,function(e){var t=(0,e.typed)("cube",{number:tt,Complex:function(e){return e.mul(e).mul(e)},BigNumber:function(e){return e.times(e).times(e)},Fraction:function(e){return e.pow(3)},"Array | Matrix":function(e){return oe(e,t,!0)},Unit:function(e){return e.pow(3)}});return t}),zt=["typed"],Dt=Object(s.a)("exp",zt,function(e){var t=(0,e.typed)("exp",{number:rt,Complex:function(e){return e.exp()},BigNumber:function(e){return e.exp()},"Array | Matrix":function(e){return oe(e,t)}});return t}),Rt=["typed","Complex"],Pt=Object(s.a)("expm1",Rt,function(e){var t=e.typed,r=e.Complex,n=t("expm1",{number:nt,Complex:function(e){var t=Math.exp(e.re);return new r(t*Math.cos(e.im)-1,t*Math.sin(e.im))},BigNumber:function(e){return e.exp().minus(1)},"Array | Matrix":function(e){return oe(e,n)}});return n}),Ft=["typed","Complex","ceil","floor"],Ut=Object(s.a)("fix",Ft,function(e){var t=e.typed,r=e.Complex,n=e.ceil,i=e.floor,a=t("fix",{number:function(e){return 0<e?i(e):n(e)},Complex:function(e){return new r(0<e.re?Math.floor(e.re):Math.ceil(e.re),0<e.im?Math.floor(e.im):Math.ceil(e.im))},BigNumber:function(e){return e.isNegative()?n(e):i(e)},Fraction:function(e){return e.s<0?e.ceil():e.floor()},"Array | Matrix":function(e){return oe(e,a,!0)}});return a}),Lt=["typed","config","round"],Ht=Object(s.a)("floor",Lt,function(e){var t=e.typed,r=e.config,n=e.round,i=t("floor",{number:function(e){return Object(j.m)(e,n(e),r.epsilon)?n(e):Math.floor(e)},Complex:function(e){return e.floor()},BigNumber:function(e){return Ne(e,n(e),r.epsilon)?n(e):e.floor()},Fraction:function(e){return e.floor()},"Array | Matrix":function(e){return oe(e,i,!0)}});return i}),$t=["typed"],Gt=Object(s.a)("algorithm01",$t,function(e){var E=e.typed;return function(e,t,r,n){var i=e._data,a=e._size,o=e._datatype,s=t._values,u=t._index,c=t._ptr,f=t._size,l=t._datatype;if(a.length!==f.length)throw new D.a(a.length,f.length);if(a[0]!==f[0]||a[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+f+")");if(!s)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var p,m,h=a[0],d=a[1],y="string"==typeof o&&o===l?o:void 0,g=y?E.find(r,[y,y]):r,v=[];for(p=0;p<h;p++)v[p]=[];var b=[],x=[];for(m=0;m<d;m++){for(var w=m+1,N=c[m],O=c[m+1],M=N;M<O;M++)b[p=u[M]]=n?g(s[M],i[p][m]):g(i[p][m],s[M]),x[p]=w;for(p=0;p<h;p++)x[p]===w?v[p][m]=b[p]:v[p][m]=i[p][m]}return e.createDenseMatrix({data:v,size:[h,d],datatype:y})}}),Zt=["typed","equalScalar"],Vt=Object(s.a)("algorithm04",Zt,function(e){var q=e.typed,k=e.equalScalar;return function(e,t,r){var n=e._values,i=e._index,a=e._ptr,o=e._size,s=e._datatype,u=t._values,c=t._index,f=t._ptr,l=t._size,p=t._datatype;if(o.length!==l.length)throw new D.a(o.length,l.length);if(o[0]!==l[0]||o[1]!==l[1])throw new RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+l+")");var m,h=o[0],d=o[1],y=k,g=0,v=r;"string"==typeof s&&s===p&&(m=s,y=q.find(k,[m,m]),g=q.convert(0,m),v=q.find(r,[m,m]));var b,x,w,N,O,M=n&&u?[]:void 0,E=[],j=[],S=e.createSparseMatrix({values:M,index:E,ptr:j,size:[h,d],datatype:m}),A=n&&u?[]:void 0,C=n&&u?[]:void 0,T=[],_=[];for(x=0;x<d;x++){j[x]=E.length;var I=x+1;for(N=a[x],O=a[x+1],w=N;w<O;w++)b=i[w],E.push(b),T[b]=I,A&&(A[b]=n[w]);for(N=f[x],O=f[x+1],w=N;w<O;w++)if(T[b=c[w]]===I){if(A){var B=v(A[b],u[w]);y(B,g)?T[b]=null:A[b]=B}}else E.push(b),_[b]=I,C&&(C[b]=u[w]);if(A&&C)for(w=j[x];w<E.length;)T[b=E[w]]===I?(M[w]=A[b],w++):_[b]===I?(M[w]=C[b],w++):E.splice(w,1)}return j[d]=E.length,S}}),Jt=["typed","DenseMatrix"],Wt=Object(s.a)("algorithm10",Jt,function(e){var M=e.typed,E=e.DenseMatrix;return function(e,t,r,n){var i=e._values,a=e._index,o=e._ptr,s=e._size,u=e._datatype;if(!i)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var c,f=s[0],l=s[1],p=r;"string"==typeof u&&(c=u,t=M.convert(t,c),p=M.find(r,[c,c]));for(var m=[],h=new E({data:m,size:[f,l],datatype:c}),d=[],y=[],g=0;g<l;g++){for(var v=g+1,b=o[g],x=o[g+1],w=b;w<x;w++){var N=a[w];d[N]=i[w],y[N]=v}for(var O=0;O<f;O++)0===g&&(m[O]=[]),y[O]===v?m[O][g]=n?p(t,d[O]):p(d[O],t):m[O][g]=t}return h}}),Yt=["typed"],Xt=Object(s.a)("algorithm13",Yt,function(e){var h=e.typed;return function(e,t,r){var n,i=e._data,a=e._size,o=e._datatype,s=t._data,u=t._size,c=t._datatype,f=[];if(a.length!==u.length)throw new D.a(a.length,u.length);for(var l=0;l<a.length;l++){if(a[l]!==u[l])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+u+")");f[l]=a[l]}var p=r;"string"==typeof o&&o===c&&(n=o,p=h.find(r,[n,n]));var m=0<f.length?function e(t,r,n,i,a,o){var s=[];if(r===n.length-1)for(var u=0;u<i;u++)s[u]=t(a[u],o[u]);else for(var c=0;c<i;c++)s[c]=e(t,r+1,n,n[r+1],a[c],o[c]);return s}(p,0,f,f[0],i,s):[];return e.createDenseMatrix({data:m,size:f,datatype:n})}}),Qt=["typed"],Kt=Object(s.a)("algorithm14",Qt,function(e){var f=e.typed;return function(e,t,r,n){var i,a=e._data,o=e._size,s=e._datatype,u=r;"string"==typeof s&&(i=s,t=f.convert(t,i),u=f.find(r,[i,i]));var c=0<o.length?function e(t,r,n,i,a,o,s){var u=[];if(r===n.length-1)for(var c=0;c<i;c++)u[c]=s?t(o,a[c]):t(a[c],o);else for(var f=0;f<i;f++)u[f]=e(t,r+1,n,n[r+1],a[f],o,s);return u}(u,0,o,o[0],a,t,n):[];return e.createDenseMatrix({data:c,size:Object(ae.a)(o),datatype:i})}}),er=["typed","matrix","equalScalar","BigNumber","DenseMatrix"],tr=Object(s.a)("gcd",er,function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.BigNumber,a=e.DenseMatrix,o=Gt({typed:t}),s=Vt({typed:t,equalScalar:n}),u=Wt({typed:t,DenseMatrix:a}),c=Xt({typed:t}),f=Kt({typed:t}),l=t("gcd",{"number, number":it,"BigNumber, BigNumber":function(e,t){if(!e.isInt()||!t.isInt())throw new Error("Parameters in function gcd must be integer numbers");var r=new i(0);for(;!t.isZero();){var n=e.mod(t);e=t,t=n}return e.lt(r)?e.neg():e},"Fraction, Fraction":function(e,t){return e.gcd(t)},"SparseMatrix, SparseMatrix":function(e,t){return s(e,t,l)},"SparseMatrix, DenseMatrix":function(e,t){return o(t,e,l,!0)},"DenseMatrix, SparseMatrix":function(e,t){return o(e,t,l,!1)},"DenseMatrix, DenseMatrix":function(e,t){return c(e,t,l)},"Array, Array":function(e,t){return l(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return l(r(e),t)},"Matrix, Array":function(e,t){return l(e,r(t))},"SparseMatrix, number | BigNumber":function(e,t){return u(e,t,l,!1)},"DenseMatrix, number | BigNumber":function(e,t){return f(e,t,l,!1)},"number | BigNumber, SparseMatrix":function(e,t){return u(t,e,l,!0)},"number | BigNumber, DenseMatrix":function(e,t){return f(t,e,l,!0)},"Array, number | BigNumber":function(e,t){return f(r(e),t,l,!1).valueOf()},"number | BigNumber, Array":function(e,t){return f(r(t),e,l,!0).valueOf()},"Array | Matrix | number | BigNumber, Array | Matrix | number | BigNumber, ...Array | Matrix | number | BigNumber":function(e,t,r){for(var n=l(e,t),i=0;i<r.length;i++)n=l(n,r[i]);return n}});return l}),rr=["typed","equalScalar"],nr=Object(s.a)("algorithm02",rr,function(e){var S=e.typed,A=e.equalScalar;return function(e,t,r,n){var i=e._data,a=e._size,o=e._datatype,s=t._values,u=t._index,c=t._ptr,f=t._size,l=t._datatype;if(a.length!==f.length)throw new D.a(a.length,f.length);if(a[0]!==f[0]||a[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+f+")");if(!s)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var p,m=a[0],h=a[1],d=A,y=0,g=r;"string"==typeof o&&o===l&&(p=o,d=S.find(A,[p,p]),y=S.convert(0,p),g=S.find(r,[p,p]));for(var v=[],b=[],x=[],w=0;w<h;w++){x[w]=b.length;for(var N=c[w],O=c[w+1],M=N;M<O;M++){var E=u[M],j=n?g(s[M],i[E][w]):g(i[E][w],s[M]);d(j,y)||(b.push(E),v.push(j))}}return x[h]=b.length,t.createSparseMatrix({values:v,index:b,ptr:x,size:[m,h],datatype:p})}}),ir=["typed","equalScalar"],ar=Object(s.a)("algorithm06",ir,function(e){var A=e.typed,C=e.equalScalar;return function(e,t,r){var n=e._values,i=e._size,a=e._datatype,o=t._values,s=t._size,u=t._datatype;if(i.length!==s.length)throw new D.a(i.length,s.length);if(i[0]!==s[0]||i[1]!==s[1])throw new RangeError("Dimension mismatch. Matrix A ("+i+") must match Matrix B ("+s+")");var c,f=i[0],l=i[1],p=C,m=0,h=r;"string"==typeof a&&a===u&&(c=a,p=A.find(C,[c,c]),m=A.convert(0,c),h=A.find(r,[c,c]));for(var d=n&&o?[]:void 0,y=[],g=[],v=e.createSparseMatrix({values:d,index:y,ptr:g,size:[f,l],datatype:c}),b=d?[]:void 0,x=[],w=[],N=0;N<l;N++){g[N]=y.length;var O=N+1;if(H(e,N,x,b,w,O,v,h),H(t,N,x,b,w,O,v,h),b)for(var M=g[N];M<y.length;){var E=y[M];if(w[E]===O){var j=b[E];p(j,m)?y.splice(M,1):(d.push(j),M++)}else y.splice(M,1)}else for(var S=g[N];S<y.length;){w[y[S]]!==O?y.splice(S,1):S++}}return g[l]=y.length,v}}),or=["typed","equalScalar"],sr=Object(s.a)("algorithm11",or,function(e){var E=e.typed,j=e.equalScalar;return function(e,t,r,n){var i=e._values,a=e._index,o=e._ptr,s=e._size,u=e._datatype;if(!i)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var c,f=s[0],l=s[1],p=j,m=0,h=r;"string"==typeof u&&(c=u,p=E.find(j,[c,c]),m=E.convert(0,c),t=E.convert(t,c),h=E.find(r,[c,c]));for(var d=[],y=[],g=[],v=e.createSparseMatrix({values:d,index:y,ptr:g,size:[f,l],datatype:c}),b=0;b<l;b++){g[b]=y.length;for(var x=o[b],w=o[b+1],N=x;N<w;N++){var O=a[N],M=n?h(t,i[N]):h(i[N],t);p(M,m)||(y.push(O),d.push(M))}}return g[l]=y.length,v}}),ur=["typed","matrix","equalScalar"],cr=Object(s.a)("lcm",ur,function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=nr({typed:t,equalScalar:n}),a=ar({typed:t,equalScalar:n}),o=sr({typed:t,equalScalar:n}),s=Xt({typed:t}),u=Kt({typed:t}),c=t("lcm",{"number, number":at,"BigNumber, BigNumber":function(e,t){if(!e.isInt()||!t.isInt())throw new Error("Parameters in function lcm must be integer numbers");if(e.isZero())return e;if(t.isZero())return t;var r=e.times(t);for(;!t.isZero();){var n=t;t=e.mod(n),e=n}return r.div(e).abs()},"Fraction, Fraction":function(e,t){return e.lcm(t)},"SparseMatrix, SparseMatrix":function(e,t){return a(e,t,c)},"SparseMatrix, DenseMatrix":function(e,t){return i(t,e,c,!0)},"DenseMatrix, SparseMatrix":function(e,t){return i(e,t,c,!1)},"DenseMatrix, DenseMatrix":function(e,t){return s(e,t,c)},"Array, Array":function(e,t){return c(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return c(r(e),t)},"Matrix, Array":function(e,t){return c(e,r(t))},"SparseMatrix, number | BigNumber":function(e,t){return o(e,t,c,!1)},"DenseMatrix, number | BigNumber":function(e,t){return u(e,t,c,!1)},"number | BigNumber, SparseMatrix":function(e,t){return o(t,e,c,!0)},"number | BigNumber, DenseMatrix":function(e,t){return u(t,e,c,!0)},"Array, number | BigNumber":function(e,t){return u(r(e),t,c,!1).valueOf()},"number | BigNumber, Array":function(e,t){return u(r(t),e,c,!0).valueOf()},"Array | Matrix | number | BigNumber, Array | Matrix | number | BigNumber, ...Array | Matrix | number | BigNumber":function(e,t,r){for(var n=c(e,t),i=0;i<r.length;i++)n=c(n,r[i]);return n}});return c}),fr=["typed","config","Complex"],lr=Object(s.a)("log10",fr,function(e){var t=e.typed,r=e.config,n=e.Complex,i=t("log10",{number:function(e){return 0<=e||r.predictable?st(e):new n(e,0).log().div(Math.LN10)},Complex:function(e){return new n(e).log().div(Math.LN10)},BigNumber:function(e){return!e.isNegative()||r.predictable?e.log():new n(e.toNumber(),0).log().div(Math.LN10)},"Array | Matrix":function(e){return oe(e,i)}});return i}),pr=["typed","config","Complex"],mr=Object(s.a)("log2",pr,function(e){var t=e.typed,r=e.config,n=e.Complex,i=t("log2",{number:function(e){return 0<=e||r.predictable?ut(e):a(new n(e,0))},Complex:a,BigNumber:function(e){return!e.isNegative()||r.predictable?e.log(2):a(new n(e.toNumber(),0))},"Array | Matrix":function(e){return oe(e,i)}});function a(e){var t=Math.sqrt(e.re*e.re+e.im*e.im);return new n(Math.log2?Math.log2(t):Math.log(t)/Math.LN2,Math.atan2(e.im,e.re)/Math.LN2)}return i}),hr=["typed"],dr=Object(s.a)("algorithm03",hr,function(e){var A=e.typed;return function(e,t,r,n){var i=e._data,a=e._size,o=e._datatype,s=t._values,u=t._index,c=t._ptr,f=t._size,l=t._datatype;if(a.length!==f.length)throw new D.a(a.length,f.length);if(a[0]!==f[0]||a[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+f+")");if(!s)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var p,m=a[0],h=a[1],d=0,y=r;"string"==typeof o&&o===l&&(p=o,d=A.convert(0,p),y=A.find(r,[p,p]));for(var g=[],v=0;v<m;v++)g[v]=[];for(var b=[],x=[],w=0;w<h;w++){for(var N=w+1,O=c[w],M=c[w+1],E=O;E<M;E++){var j=u[E];b[j]=n?y(s[E],i[j][w]):y(i[j][w],s[E]),x[j]=N}for(var S=0;S<m;S++)x[S]===N?g[S][w]=b[S]:g[S][w]=n?y(d,i[S][w]):y(i[S][w],d)}return e.createDenseMatrix({data:g,size:[m,h],datatype:p})}}),yr=["typed","equalScalar"],gr=Object(s.a)("algorithm05",yr,function(e){var k=e.typed,z=e.equalScalar;return function(e,t,r){var n=e._values,i=e._index,a=e._ptr,o=e._size,s=e._datatype,u=t._values,c=t._index,f=t._ptr,l=t._size,p=t._datatype;if(o.length!==l.length)throw new D.a(o.length,l.length);if(o[0]!==l[0]||o[1]!==l[1])throw new RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+l+")");var m,h=o[0],d=o[1],y=z,g=0,v=r;"string"==typeof s&&s===p&&(m=s,y=k.find(z,[m,m]),g=k.convert(0,m),v=k.find(r,[m,m]));var b,x,w,N,O=n&&u?[]:void 0,M=[],E=[],j=e.createSparseMatrix({values:O,index:M,ptr:E,size:[h,d],datatype:m}),S=O?[]:void 0,A=O?[]:void 0,C=[],T=[];for(x=0;x<d;x++){E[x]=M.length;var _=x+1;for(w=a[x],N=a[x+1];w<N;w++)b=i[w],M.push(b),C[b]=_,S&&(S[b]=n[w]);for(w=f[x],N=f[x+1];w<N;w++)C[b=c[w]]!==_&&M.push(b),T[b]=_,A&&(A[b]=u[w]);if(O)for(w=E[x];w<M.length;){var I=C[b=M[w]],B=T[b];if(I===_||B===_){var q=v(I===_?S[b]:g,B===_?A[b]:g);y(q,g)?M.splice(w,1):(O.push(q),w++)}}}return E[d]=M.length,j}}),vr=["typed","DenseMatrix"],br=Object(s.a)("algorithm12",vr,function(e){var M=e.typed,E=e.DenseMatrix;return function(e,t,r,n){var i=e._values,a=e._index,o=e._ptr,s=e._size,u=e._datatype;if(!i)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var c,f=s[0],l=s[1],p=r;"string"==typeof u&&(c=u,t=M.convert(t,c),p=M.find(r,[c,c]));for(var m=[],h=new E({data:m,size:[f,l],datatype:c}),d=[],y=[],g=0;g<l;g++){for(var v=g+1,b=o[g],x=o[g+1],w=b;w<x;w++){var N=a[w];d[N]=i[w],y[N]=v}for(var O=0;O<f;O++)0===g&&(m[O]=[]),y[O]===v?m[O][g]=n?p(t,d[O]):p(d[O],t):m[O][g]=n?p(t,0):p(0,t)}return h}}),xr=["typed","matrix","equalScalar","DenseMatrix"],wr=Object(s.a)("mod",xr,function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.DenseMatrix,a=nr({typed:t,equalScalar:n}),o=dr({typed:t}),s=gr({typed:t,equalScalar:n}),u=sr({typed:t,equalScalar:n}),c=br({typed:t,DenseMatrix:i}),f=Xt({typed:t}),l=Kt({typed:t}),p=t("mod",{"number, number":ct,"BigNumber, BigNumber":function(e,t){return t.isZero()?e:e.mod(t)},"Fraction, Fraction":function(e,t){return e.mod(t)},"SparseMatrix, SparseMatrix":function(e,t){return s(e,t,p,!1)},"SparseMatrix, DenseMatrix":function(e,t){return a(t,e,p,!0)},"DenseMatrix, SparseMatrix":function(e,t){return o(e,t,p,!1)},"DenseMatrix, DenseMatrix":function(e,t){return f(e,t,p)},"Array, Array":function(e,t){return p(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return p(r(e),t)},"Matrix, Array":function(e,t){return p(e,r(t))},"SparseMatrix, any":function(e,t){return u(e,t,p,!1)},"DenseMatrix, any":function(e,t){return l(e,t,p,!1)},"any, SparseMatrix":function(e,t){return c(t,e,p,!0)},"any, DenseMatrix":function(e,t){return l(t,e,p,!0)},"Array, any":function(e,t){return l(r(e),t,p,!1).valueOf()},"any, Array":function(e,t){return l(r(t),e,p,!0).valueOf()}});return p}),Nr=["typed"],Or=Object(s.a)("multiplyScalar",Nr,function(e){var n=(0,e.typed)("multiplyScalar",{"number, number":Ye,"Complex, Complex":function(e,t){return e.mul(t)},"BigNumber, BigNumber":function(e,t){return e.times(t)},"Fraction, Fraction":function(e,t){return e.mul(t)},"number | Fraction | BigNumber | Complex, Unit":function(e,t){var r=t.clone();return r.value=null===r.value?r._normalize(e):n(r.value,e),r},"Unit, number | Fraction | BigNumber | Complex":function(e,t){var r=e.clone();return r.value=null===r.value?r._normalize(t):n(r.value,t),r},"Unit, Unit":function(e,t){return e.multiply(t)}});return n}),Mr="multiply",Er=["typed","matrix","addScalar","multiplyScalar","equalScalar"],jr=Object(s.a)(Mr,Er,function(e){var z=e.typed,n=e.matrix,D=e.addScalar,R=e.multiplyScalar,q=e.equalScalar,r=sr({typed:z,equalScalar:q}),i=Kt({typed:z}),a=z(Mr,Object(ae.e)({"Array, Array":function(e,t){o(Object(I.a)(e),Object(I.a)(t));var r=a(n(e),n(t));return Object(ie.v)(r)?r.valueOf():r},"Matrix, Matrix":function(e,t){var r=e.size(),n=t.size();return o(r,n),1===r.length?1===n.length?function(e,t,r){if(0===r)throw new Error("Cannot multiply two empty vectors");var n,i=e._data,a=e._datatype,o=t._data,s=t._datatype,u=D,c=R;a&&s&&a===s&&"string"==typeof a&&(n=a,u=z.find(D,[n,n]),c=z.find(R,[n,n]));for(var f=c(i[0],o[0]),l=1;l<r;l++)f=u(f,c(i[l],o[l]));return f}(e,t,r[0]):function(e,t){if("dense"===t.storage())return function(e,t){var r,n=e._data,i=e._size,a=e._datatype,o=t._data,s=t._size,u=t._datatype,c=i[0],f=s[1],l=D,p=R;a&&u&&a===u&&"string"==typeof a&&(r=a,l=z.find(D,[r,r]),p=z.find(R,[r,r]));for(var m=[],h=0;h<f;h++){for(var d=p(n[0],o[0][h]),y=1;y<c;y++)d=l(d,p(n[y],o[y][h]));m[h]=d}return e.createDenseMatrix({data:m,size:[f],datatype:r})}(e,t);throw new Error("Support for SparseMatrix not implemented")}(e,t):1===n.length?s(e,t):u(e,t)},"Matrix, Array":function(e,t){return a(e,n(t))},"Array, Matrix":function(e,t){return a(n(e,t.storage()),t)},"SparseMatrix, any":function(e,t){return r(e,t,R,!1)},"DenseMatrix, any":function(e,t){return i(e,t,R,!1)},"any, SparseMatrix":function(e,t){return r(t,e,R,!0)},"any, DenseMatrix":function(e,t){return i(t,e,R,!0)},"Array, any":function(e,t){return i(n(e),t,R,!1).valueOf()},"any, Array":function(e,t){return i(n(t),e,R,!0).valueOf()},"any, any":R,"any, any, ...any":function(e,t,r){for(var n=a(e,t),i=0;i<r.length;i++)n=a(n,r[i]);return n}},R.signatures));function o(e,t){switch(e.length){case 1:switch(t.length){case 1:if(e[0]!==t[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(e[0]!==t[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+e[0]+") must match Matrix rows ("+t[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+t.length+" dimensions)")}break;case 2:switch(t.length){case 1:if(e[1]!==t[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+e[1]+") must match Vector length ("+t[0]+")");break;case 2:if(e[1]!==t[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+e[1]+") must match Matrix B rows ("+t[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+t.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+e.length+" dimensions)")}}var s=z("_multiplyMatrixVector",{"DenseMatrix, any":function(e,t){var r,n=e._data,i=e._size,a=e._datatype,o=t._data,s=t._datatype,u=i[0],c=i[1],f=D,l=R;a&&s&&a===s&&"string"==typeof a&&(r=a,f=z.find(D,[r,r]),l=z.find(R,[r,r]));for(var p=[],m=0;m<u;m++){for(var h=n[m],d=l(h[0],o[0]),y=1;y<c;y++)d=f(d,l(h[y],o[y]));p[m]=d}return e.createDenseMatrix({data:p,size:[u],datatype:r})},"SparseMatrix, any":function(e,t){var r=e._values,n=e._index,i=e._ptr,a=e._datatype;if(!r)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var o,s=t._data,u=t._datatype,c=e._size[0],f=t._size[0],l=[],p=[],m=[],h=D,d=R,y=q,g=0;a&&u&&a===u&&"string"==typeof a&&(o=a,h=z.find(D,[o,o]),d=z.find(R,[o,o]),y=z.find(q,[o,o]),g=z.convert(0,o));for(var v=[],b=[],x=m[0]=0;x<f;x++){var w=s[x];if(!y(w,g))for(var N=i[x],O=i[x+1],M=N;M<O;M++){var E=n[M];b[E]?v[E]=h(v[E],d(w,r[M])):(b[E]=!0,p.push(E),v[E]=d(w,r[M]))}}for(var j=p.length,S=0;S<j;S++){var A=p[S];l[S]=v[A]}return m[1]=p.length,e.createSparseMatrix({values:l,index:p,ptr:m,size:[c,1],datatype:o})}}),u=z("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":function(e,t){var r,n=e._data,i=e._size,a=e._datatype,o=t._data,s=t._size,u=t._datatype,c=i[0],f=i[1],l=s[1],p=D,m=R;a&&u&&a===u&&"string"==typeof a&&(r=a,p=z.find(D,[r,r]),m=z.find(R,[r,r]));for(var h=[],d=0;d<c;d++){var y=n[d];h[d]=[];for(var g=0;g<l;g++){for(var v=m(y[0],o[0][g]),b=1;b<f;b++)v=p(v,m(y[b],o[b][g]));h[d][g]=v}}return e.createDenseMatrix({data:h,size:[c,l],datatype:r})},"DenseMatrix, SparseMatrix":function(e,t){var r=e._data,n=e._size,i=e._datatype,a=t._values,o=t._index,s=t._ptr,u=t._size,c=t._datatype;if(!a)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var f,l=n[0],p=u[1],m=D,h=R,d=q,y=0;i&&c&&i===c&&"string"==typeof i&&(f=i,m=z.find(D,[f,f]),h=z.find(R,[f,f]),d=z.find(q,[f,f]),y=z.convert(0,f));for(var g=[],v=[],b=[],x=t.createSparseMatrix({values:g,index:v,ptr:b,size:[l,p],datatype:f}),w=0;w<p;w++){b[w]=v.length;var N=s[w],O=s[w+1];if(N<O)for(var M=0,E=0;E<l;E++){for(var j=E+1,S=void 0,A=N;A<O;A++){var C=o[A];M!==j?(S=h(r[E][C],a[A]),M=j):S=m(S,h(r[E][C],a[A]))}M!==j||d(S,y)||(v.push(E),g.push(S))}}return b[p]=v.length,x},"SparseMatrix, DenseMatrix":function(e,t){var r=e._values,n=e._index,i=e._ptr,a=e._datatype;if(!r)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var o,s=t._data,u=t._datatype,c=e._size[0],f=t._size[0],l=t._size[1],p=D,m=R,h=q,d=0;a&&u&&a===u&&"string"==typeof a&&(o=a,p=z.find(D,[o,o]),m=z.find(R,[o,o]),h=z.find(q,[o,o]),d=z.convert(0,o));for(var y=[],g=[],v=[],b=e.createSparseMatrix({values:y,index:g,ptr:v,size:[c,l],datatype:o}),x=[],w=[],N=0;N<l;N++){v[N]=g.length;for(var O=N+1,M=0;M<f;M++){var E=s[M][N];if(!h(E,d))for(var j=i[M],S=i[M+1],A=j;A<S;A++){var C=n[A];w[C]!==O?(w[C]=O,g.push(C),x[C]=m(E,r[A])):x[C]=p(x[C],m(E,r[A]))}}for(var T=v[N],_=g.length,I=T;I<_;I++){var B=g[I];y[I]=x[B]}}return v[l]=g.length,b},"SparseMatrix, SparseMatrix":function(e,t){var r,n=e._values,i=e._index,a=e._ptr,o=e._datatype,s=t._values,u=t._index,c=t._ptr,f=t._datatype,l=e._size[0],p=t._size[1],m=n&&s,h=D,d=R;o&&f&&o===f&&"string"==typeof o&&(r=o,h=z.find(D,[r,r]),d=z.find(R,[r,r]));for(var y,g,v,b,x,w,N,O,M=m?[]:void 0,E=[],j=[],S=e.createSparseMatrix({values:M,index:E,ptr:j,size:[l,p],datatype:r}),A=m?[]:void 0,C=[],T=0;T<p;T++){j[T]=E.length;var _=T+1;for(x=c[T],w=c[T+1],b=x;b<w;b++)if(O=u[b],m)for(g=a[O],v=a[O+1],y=g;y<v;y++)N=i[y],C[N]!==_?(C[N]=_,E.push(N),A[N]=d(s[b],n[y])):A[N]=h(A[N],d(s[b],n[y]));else for(g=a[O],v=a[O+1],y=g;y<v;y++)N=i[y],C[N]!==_&&(C[N]=_,E.push(N));if(m)for(var I=j[T],B=E.length,q=I;q<B;q++){var k=E[q];M[q]=A[k]}}return j[p]=E.length,S}});return a}),Sr="nthRoot",Ar=["typed","matrix","equalScalar","BigNumber"],Cr=Object(s.a)(Sr,Ar,function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,u=e.BigNumber,i=Gt({typed:t}),a=nr({typed:t,equalScalar:n}),o=ar({typed:t,equalScalar:n}),s=sr({typed:t,equalScalar:n}),c=Xt({typed:t}),f=Kt({typed:t}),l="Complex number not supported in function nthRoot. Use nthRoots instead.",p=t(Sr,{number:function(e){return ft(e,2)},"number, number":ft,BigNumber:function(e){return m(e,new u(2))},Complex:function(e){throw new Error(l)},"Complex, number":function(e,t){throw new Error(l)},"BigNumber, BigNumber":m,"Array | Matrix":function(e){return p(e,2)},"SparseMatrix, SparseMatrix":function(e,t){if(1===t.density())return o(e,t,p);throw new Error("Root must be non-zero")},"SparseMatrix, DenseMatrix":function(e,t){return a(t,e,p,!0)},"DenseMatrix, SparseMatrix":function(e,t){if(1===t.density())return i(e,t,p,!1);throw new Error("Root must be non-zero")},"DenseMatrix, DenseMatrix":function(e,t){return c(e,t,p)},"Array, Array":function(e,t){return p(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return p(r(e),t)},"Matrix, Array":function(e,t){return p(e,r(t))},"SparseMatrix, number | BigNumber":function(e,t){return s(e,t,p,!1)},"DenseMatrix, number | BigNumber":function(e,t){return f(e,t,p,!1)},"number | BigNumber, SparseMatrix":function(e,t){if(1===t.density())return s(t,e,p,!0);throw new Error("Root must be non-zero")},"number | BigNumber, DenseMatrix":function(e,t){return f(t,e,p,!0)},"Array, number | BigNumber":function(e,t){return p(r(e),t).valueOf()},"number | BigNumber, Array":function(e,t){return p(e,r(t)).valueOf()}});return p;function m(e,t){var r=u.precision,n=u.clone({precision:r+2}),i=new u(0),a=new n(1),o=t.isNegative();if(o&&(t=t.neg()),t.isZero())throw new Error("Root must be non-zero");if(e.isNegative()&&!t.abs().mod(2).equals(1))throw new Error("Root must be odd when a is negative.");if(e.isZero())return o?new n(1/0):0;if(!e.isFinite())return o?i:e;var s=e.abs().pow(a.div(t));return s=e.isNeg()?s.neg():s,new u((o?a.div(s):s).toPrecision(r))}}),Tr=["typed","BigNumber","Fraction"],_r=Object(s.a)("sign",Tr,function(e){var t=e.typed,r=e.BigNumber,n=e.Fraction,i=t("sign",{number:lt,Complex:function(e){return e.sign()},BigNumber:function(e){return new r(e.cmp(0))},Fraction:function(e){return new n(e.s,1)},"Array | Matrix":function(e){return oe(e,i,!0)},Unit:function(e){return i(e.value)}});return i}),Ir=["config","typed","Complex"],Br=Object(s.a)("sqrt",Ir,function(e){var t=e.config,r=e.typed,n=e.Complex,i=r("sqrt",{number:a,Complex:function(e){return e.sqrt()},BigNumber:function(e){return!e.isNegative()||t.predictable?e.sqrt():a(e.toNumber())},"Array | Matrix":function(e){return oe(e,i,!0)},Unit:function(e){return e.pow(.5)}});function a(e){return isNaN(e)?NaN:0<=e||t.predictable?Math.sqrt(e):new n(e,0).sqrt()}return i}),qr=["typed"],kr=Object(s.a)("square",qr,function(e){var t=(0,e.typed)("square",{number:pt,Complex:function(e){return e.mul(e)},BigNumber:function(e){return e.times(e)},Fraction:function(e){return e.mul(e)},"Array | Matrix":function(e){return oe(e,t,!0)},Unit:function(e){return e.pow(2)}});return t}),zr="subtract",Dr=["typed","matrix","equalScalar","addScalar","unaryMinus","DenseMatrix"],Rr=Object(s.a)(zr,Dr,function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.addScalar,a=e.unaryMinus,o=e.DenseMatrix,s=Gt({typed:t}),u=dr({typed:t}),c=gr({typed:t,equalScalar:n}),f=Wt({typed:t,DenseMatrix:o}),l=Xt({typed:t}),p=Kt({typed:t}),m=t(zr,{"number, number":function(e,t){return e-t},"Complex, Complex":function(e,t){return e.sub(t)},"BigNumber, BigNumber":function(e,t){return e.minus(t)},"Fraction, Fraction":function(e,t){return e.sub(t)},"Unit, Unit":function(e,t){if(null===e.value)throw new Error("Parameter x contains a unit with undefined value");if(null===t.value)throw new Error("Parameter y contains a unit with undefined value");if(!e.equalBase(t))throw new Error("Units do not match");var r=e.clone();return r.value=m(r.value,t.value),r.fixPrefix=!1,r},"SparseMatrix, SparseMatrix":function(e,t){return Pr(e,t),c(e,t,m)},"SparseMatrix, DenseMatrix":function(e,t){return Pr(e,t),u(t,e,m,!0)},"DenseMatrix, SparseMatrix":function(e,t){return Pr(e,t),s(e,t,m,!1)},"DenseMatrix, DenseMatrix":function(e,t){return Pr(e,t),l(e,t,m)},"Array, Array":function(e,t){return m(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return m(r(e),t)},"Matrix, Array":function(e,t){return m(e,r(t))},"SparseMatrix, any":function(e,t){return f(e,a(t),i)},"DenseMatrix, any":function(e,t){return p(e,t,m)},"any, SparseMatrix":function(e,t){return f(t,e,m,!0)},"any, DenseMatrix":function(e,t){return p(t,e,m,!0)},"Array, any":function(e,t){return p(r(e),t,m,!1).valueOf()},"any, Array":function(e,t){return p(r(t),e,m,!0).valueOf()}});return m});function Pr(e,t){var r=e.size(),n=t.size();if(r.length!==n.length)throw new D.a(r.length,n.length)}var Fr=["typed","config","matrix","BigNumber"],Ur=Object(s.a)("xgcd",Fr,function(e){var t=e.typed,p=e.config,m=e.matrix,h=e.BigNumber;return t("xgcd",{"number, number":function(e,t){var r=mt(e,t);return"Array"===p.matrix?r:m(r)},"BigNumber, BigNumber":function(e,t){var r,n,i,a,o=new h(0),s=new h(1),u=o,c=s,f=s,l=o;if(!e.isInt()||!t.isInt())throw new Error("Parameters in function xgcd must be integer numbers");for(;!t.isZero();)n=e.div(t).floor(),i=e.mod(t),r=u,u=c.minus(n.times(u)),c=r,r=f,f=l.minus(n.times(f)),l=r,e=t,t=i;a=e.lt(o)?[e.neg(),c.neg(),l.neg()]:[e,e.isZero()?0:c,l];return"Array"===p.matrix?a:m(a)}})}),Lr=["typed","equalScalar"],Hr=Object(s.a)("algorithm09",Lr,function(e){var B=e.typed,q=e.equalScalar;return function(e,t,r){var n=e._values,i=e._index,a=e._ptr,o=e._size,s=e._datatype,u=t._values,c=t._index,f=t._ptr,l=t._size,p=t._datatype;if(o.length!==l.length)throw new D.a(o.length,l.length);if(o[0]!==l[0]||o[1]!==l[1])throw new RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+l+")");var m,h=o[0],d=o[1],y=q,g=0,v=r;"string"==typeof s&&s===p&&(m=s,y=B.find(q,[m,m]),g=B.convert(0,m),v=B.find(r,[m,m]));var b,x,w,N,O,M=n&&u?[]:void 0,E=[],j=[],S=e.createSparseMatrix({values:M,index:E,ptr:j,size:[h,d],datatype:m}),A=M?[]:void 0,C=[];for(x=0;x<d;x++){j[x]=E.length;var T=x+1;if(A)for(N=f[x],O=f[x+1],w=N;w<O;w++)C[b=c[w]]=T,A[b]=u[w];for(N=a[x],O=a[x+1],w=N;w<O;w++)if(b=i[w],A){var _=C[b]===T?A[b]:g,I=v(n[w],_);y(I,g)||(E.push(b),M.push(I))}else E.push(b)}return j[d]=E.length,S}}),$r="dotMultiply",Gr=["typed","matrix","equalScalar","multiplyScalar"],Zr=Object(s.a)($r,Gr,function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.multiplyScalar,a=nr({typed:t,equalScalar:n}),o=Hr({typed:t,equalScalar:n}),s=sr({typed:t,equalScalar:n}),u=Xt({typed:t}),c=Kt({typed:t}),f=t($r,{"any, any":i,"SparseMatrix, SparseMatrix":function(e,t){return o(e,t,i,!1)},"SparseMatrix, DenseMatrix":function(e,t){return a(t,e,i,!0)},"DenseMatrix, SparseMatrix":function(e,t){return a(e,t,i,!1)},"DenseMatrix, DenseMatrix":function(e,t){return u(e,t,i)},"Array, Array":function(e,t){return f(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return f(r(e),t)},"Matrix, Array":function(e,t){return f(e,r(t))},"SparseMatrix, any":function(e,t){return s(e,t,i,!1)},"DenseMatrix, any":function(e,t){return c(e,t,i,!1)},"any, SparseMatrix":function(e,t){return s(t,e,i,!0)},"any, DenseMatrix":function(e,t){return c(t,e,i,!0)},"Array, any":function(e,t){return c(r(e),t,i,!1).valueOf()},"any, Array":function(e,t){return c(r(t),e,i,!0).valueOf()}});return f});function Vr(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitAnd");var r=e.constructor;if(e.isNaN()||t.isNaN())return new r(NaN);if(e.isZero()||t.eq(-1)||e.eq(t))return e;if(t.isZero()||e.eq(-1))return t;if(!e.isFinite()||!t.isFinite()){if(!e.isFinite()&&!t.isFinite())return e.isNegative()===t.isNegative()?e:new r(0);if(!e.isFinite())return t.isNegative()?e:e.isNegative()?new r(0):t;if(!t.isFinite())return e.isNegative()?t:t.isNegative()?new r(0):e}return Yr(e,t,function(e,t){return e&t})}function Jr(e){if(e.isFinite()&&!e.isInteger())throw new Error("Integer expected in function bitNot");var t=e.constructor,r=t.precision;t.config({precision:1e9});var n=e.plus(new t(1));return n.s=-n.s||null,t.config({precision:r}),n}function Wr(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitOr");var r=e.constructor;if(e.isNaN()||t.isNaN())return new r(NaN);var n=new r(-1);return e.isZero()||t.eq(n)||e.eq(t)?t:t.isZero()||e.eq(n)?e:e.isFinite()&&t.isFinite()?Yr(e,t,function(e,t){return e|t}):!e.isFinite()&&!e.isNegative()&&t.isNegative()||e.isNegative()&&!t.isNegative()&&!t.isFinite()?n:e.isNegative()&&t.isNegative()?e.isFinite()?e:t:e.isFinite()?t:e}function Yr(e,t,r){var n,i,a,o,s,u=e.constructor,c=+(e.s<0),f=+(t.s<0);if(c){n=Xr(Jr(e));for(var l=0;l<n.length;++l)n[l]^=1}else n=Xr(e);if(f){i=Xr(Jr(t));for(var p=0;p<i.length;++p)i[p]^=1}else i=Xr(t);s=n.length<=i.length?(a=n,o=i,c):(a=i,o=n,f);var m=a.length,h=o.length,d=1^r(c,f),y=new u(1^d),g=new u(1),v=new u(2),b=u.precision;for(u.config({precision:1e9});0<m;)r(a[--m],o[--h])===d&&(y=y.plus(g)),g=g.times(v);for(;0<h;)r(s,o[--h])===d&&(y=y.plus(g)),g=g.times(v);return u.config({precision:b}),0==d&&(y.s=-y.s),y}function Xr(e){for(var t=e.d,r=t[0]+"",n=1;n<t.length;++n){for(var i=t[n]+"",a=7-i.length;a--;)i="0"+i;r+=i}for(var o=r.length;"0"===r.charAt(o);)o--;var s=e.e,u=r.slice(0,o+1||1),c=u.length;if(0<s)if(++s>c)for(s-=c;s--;)u+="0";else s<c&&(u=u.slice(0,s)+"."+u.slice(s));for(var f=[0],l=0;l<u.length;){for(var p=f.length;p--;)f[p]*=10;f[0]+=parseInt(u.charAt(l++));for(var m=0;m<f.length;++m)1<f[m]&&(null!==f[m+1]&&void 0!==f[m+1]||(f[m+1]=0),f[m+1]+=f[m]>>1,f[m]&=1)}return f.reverse()}function Qr(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitXor");var r=e.constructor;if(e.isNaN()||t.isNaN())return new r(NaN);if(e.isZero())return t;if(t.isZero())return e;if(e.eq(t))return new r(0);var n=new r(-1);return e.eq(n)?Jr(t):t.eq(n)?Jr(e):e.isFinite()&&t.isFinite()?Yr(e,t,function(e,t){return e^t}):e.isFinite()||t.isFinite()?new r(e.isNegative()===t.isNegative()?1/0:-1/0):n}function Kr(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function leftShift");var r=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new r(NaN):e.isZero()||t.isZero()?e:e.isFinite()||t.isFinite()?t.lt(55)?e.times(Math.pow(2,t.toNumber())+""):e.times(new r(2).pow(t)):new r(NaN)}function en(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function rightArithShift");var r=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new r(NaN):e.isZero()||t.isZero()?e:t.isFinite()?t.lt(55)?e.div(Math.pow(2,t.toNumber())+"").floor():e.div(new r(2).pow(t)).floor():e.isNegative()?new r(-1):e.isFinite()?new r(0):new r(NaN)}var tn="number, number";function rn(e,t){if(!Object(j.i)(e)||!Object(j.i)(t))throw new Error("Integers expected in function bitAnd");return e&t}function nn(e){if(!Object(j.i)(e))throw new Error("Integer expected in function bitNot");return~e}function an(e,t){if(!Object(j.i)(e)||!Object(j.i)(t))throw new Error("Integers expected in function bitOr");return e|t}function on(e,t){if(!Object(j.i)(e)||!Object(j.i)(t))throw new Error("Integers expected in function bitXor");return e^t}function sn(e,t){if(!Object(j.i)(e)||!Object(j.i)(t))throw new Error("Integers expected in function leftShift");return e<<t}function un(e,t){if(!Object(j.i)(e)||!Object(j.i)(t))throw new Error("Integers expected in function rightArithShift");return e>>t}function cn(e,t){if(!Object(j.i)(e)||!Object(j.i)(t))throw new Error("Integers expected in function rightLogShift");return e>>>t}rn.signature=tn,nn.signature="number",cn.signature=un.signature=sn.signature=on.signature=an.signature=tn;var fn=["typed","matrix","equalScalar"],ln=Object(s.a)("bitAnd",fn,function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=nr({typed:t,equalScalar:n}),a=ar({typed:t,equalScalar:n}),o=sr({typed:t,equalScalar:n}),s=Xt({typed:t}),u=Kt({typed:t}),c=t("bitAnd",{"number, number":rn,"BigNumber, BigNumber":Vr,"SparseMatrix, SparseMatrix":function(e,t){return a(e,t,c,!1)},"SparseMatrix, DenseMatrix":function(e,t){return i(t,e,c,!0)},"DenseMatrix, SparseMatrix":function(e,t){return i(e,t,c,!1)},"DenseMatrix, DenseMatrix":function(e,t){return s(e,t,c)},"Array, Array":function(e,t){return c(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return c(r(e),t)},"Matrix, Array":function(e,t){return c(e,r(t))},"SparseMatrix, any":function(e,t){return o(e,t,c,!1)},"DenseMatrix, any":function(e,t){return u(e,t,c,!1)},"any, SparseMatrix":function(e,t){return o(t,e,c,!0)},"any, DenseMatrix":function(e,t){return u(t,e,c,!0)},"Array, any":function(e,t){return u(r(e),t,c,!1).valueOf()},"any, Array":function(e,t){return u(r(t),e,c,!0).valueOf()}});return c}),pn=["typed"],mn=Object(s.a)("bitNot",pn,function(e){var t=(0,e.typed)("bitNot",{number:nn,BigNumber:Jr,"Array | Matrix":function(e){return oe(e,t)}});return t}),hn=["typed","matrix","equalScalar","DenseMatrix"],dn=Object(s.a)("bitOr",hn,function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.DenseMatrix,a=Gt({typed:t}),o=Vt({typed:t,equalScalar:n}),s=Wt({typed:t,DenseMatrix:i}),u=Xt({typed:t}),c=Kt({typed:t}),f=t("bitOr",{"number, number":an,"BigNumber, BigNumber":Wr,"SparseMatrix, SparseMatrix":function(e,t){return o(e,t,f)},"SparseMatrix, DenseMatrix":function(e,t){return a(t,e,f,!0)},"DenseMatrix, SparseMatrix":function(e,t){return a(e,t,f,!1)},"DenseMatrix, DenseMatrix":function(e,t){return u(e,t,f)},"Array, Array":function(e,t){return f(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return f(r(e),t)},"Matrix, Array":function(e,t){return f(e,r(t))},"SparseMatrix, any":function(e,t){return s(e,t,f,!1)},"DenseMatrix, any":function(e,t){return c(e,t,f,!1)},"any, SparseMatrix":function(e,t){return s(t,e,f,!0)},"any, DenseMatrix":function(e,t){return c(t,e,f,!0)},"Array, any":function(e,t){return c(r(e),t,f,!1).valueOf()},"any, Array":function(e,t){return c(r(t),e,f,!0).valueOf()}});return f}),yn=["typed","DenseMatrix"],gn=Object(s.a)("algorithm07",yn,function(e){var O=e.typed,M=e.DenseMatrix;return function(e,t,r){var n=e._size,i=e._datatype,a=t._size,o=t._datatype;if(n.length!==a.length)throw new D.a(n.length,a.length);if(n[0]!==a[0]||n[1]!==a[1])throw new RangeError("Dimension mismatch. Matrix A ("+n+") must match Matrix B ("+a+")");var s,u,c,f=n[0],l=n[1],p=0,m=r;"string"==typeof i&&i===o&&(s=i,p=O.convert(0,s),m=O.find(r,[s,s]));var h=[];for(u=0;u<f;u++)h[u]=[];var d=new M({data:h,size:[f,l],datatype:s}),y=[],g=[],v=[],b=[];for(c=0;c<l;c++){var x=c+1;for(E(e,c,v,y,x),E(t,c,b,g,x),u=0;u<f;u++){var w=v[u]===x?y[u]:p,N=b[u]===x?g[u]:p;h[u][c]=m(w,N)}}return d};function E(e,t,r,n,i){for(var a=e._values,o=e._index,s=e._ptr,u=s[t],c=s[t+1];u<c;u++){var f=o[u];r[f]=i,n[f]=a[u]}}}),vn=["typed","matrix","DenseMatrix"],bn=Object(s.a)("bitXor",vn,function(e){var t=e.typed,r=e.matrix,n=e.DenseMatrix,i=dr({typed:t}),a=gn({typed:t,DenseMatrix:n}),o=br({typed:t,DenseMatrix:n}),s=Xt({typed:t}),u=Kt({typed:t}),c=t("bitXor",{"number, number":on,"BigNumber, BigNumber":Qr,"SparseMatrix, SparseMatrix":function(e,t){return a(e,t,c)},"SparseMatrix, DenseMatrix":function(e,t){return i(t,e,c,!0)},"DenseMatrix, SparseMatrix":function(e,t){return i(e,t,c,!1)},"DenseMatrix, DenseMatrix":function(e,t){return s(e,t,c)},"Array, Array":function(e,t){return c(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return c(r(e),t)},"Matrix, Array":function(e,t){return c(e,r(t))},"SparseMatrix, any":function(e,t){return o(e,t,c,!1)},"DenseMatrix, any":function(e,t){return u(e,t,c,!1)},"any, SparseMatrix":function(e,t){return o(t,e,c,!0)},"any, DenseMatrix":function(e,t){return u(t,e,c,!0)},"Array, any":function(e,t){return u(r(e),t,c,!1).valueOf()},"any, Array":function(e,t){return u(r(t),e,c,!0).valueOf()}});return c}),xn=["typed"],wn=Object(s.a)("arg",xn,function(e){var t=(0,e.typed)("arg",{number:function(e){return Math.atan2(0,e)},BigNumber:function(e){return e.constructor.atan2(0,e)},Complex:function(e){return e.arg()},"Array | Matrix":function(e){return oe(e,t)}});return t}),Nn=["typed"],On=Object(s.a)("conj",Nn,function(e){var t=(0,e.typed)("conj",{number:function(e){return e},BigNumber:function(e){return e},Complex:function(e){return e.conjugate()},"Array | Matrix":function(e){return oe(e,t)}});return t}),Mn=["typed"],En=Object(s.a)("im",Mn,function(e){var t=(0,e.typed)("im",{number:function(e){return 0},BigNumber:function(e){return e.mul(0)},Complex:function(e){return e.im},"Array | Matrix":function(e){return oe(e,t)}});return t}),jn=["typed"],Sn=Object(s.a)("re",jn,function(e){var t=(0,e.typed)("re",{number:function(e){return e},BigNumber:function(e){return e},Complex:function(e){return e.re},"Array | Matrix":function(e){return oe(e,t)}});return t}),An="number, number";function Cn(e){return!e}function Tn(e,t){return!(!e&&!t)}function _n(e,t){return!!e!=!!t}function In(e,t){return!(!e||!t)}Cn.signature="number",In.signature=_n.signature=Tn.signature=An;var Bn=["typed"],qn=Object(s.a)("not",Bn,function(e){var t=(0,e.typed)("not",{number:Cn,Complex:function(e){return 0===e.re&&0===e.im},BigNumber:function(e){return e.isZero()||e.isNaN()},Unit:function(e){return null===e.value||t(e.value)},"Array | Matrix":function(e){return oe(e,t)}});return t}),kn=["typed","matrix","equalScalar","DenseMatrix"],zn=Object(s.a)("or",kn,function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.DenseMatrix,a=dr({typed:t}),o=gr({typed:t,equalScalar:n}),s=br({typed:t,DenseMatrix:i}),u=Xt({typed:t}),c=Kt({typed:t}),f=t("or",{"number, number":Tn,"Complex, Complex":function(e,t){return 0!==e.re||0!==e.im||0!==t.re||0!==t.im},"BigNumber, BigNumber":function(e,t){return!e.isZero()&&!e.isNaN()||!t.isZero()&&!t.isNaN()},"Unit, Unit":function(e,t){return f(e.value||0,t.value||0)},"SparseMatrix, SparseMatrix":function(e,t){return o(e,t,f)},"SparseMatrix, DenseMatrix":function(e,t){return a(t,e,f,!0)},"DenseMatrix, SparseMatrix":function(e,t){return a(e,t,f,!1)},"DenseMatrix, DenseMatrix":function(e,t){return u(e,t,f)},"Array, Array":function(e,t){return f(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return f(r(e),t)},"Matrix, Array":function(e,t){return f(e,r(t))},"SparseMatrix, any":function(e,t){return s(e,t,f,!1)},"DenseMatrix, any":function(e,t){return c(e,t,f,!1)},"any, SparseMatrix":function(e,t){return s(t,e,f,!0)},"any, DenseMatrix":function(e,t){return c(t,e,f,!0)},"Array, any":function(e,t){return c(r(e),t,f,!1).valueOf()},"any, Array":function(e,t){return c(r(t),e,f,!0).valueOf()}});return f}),Dn=["typed","matrix","DenseMatrix"],Rn=Object(s.a)("xor",Dn,function(e){var t=e.typed,r=e.matrix,n=e.DenseMatrix,i=dr({typed:t}),a=gn({typed:t,DenseMatrix:n}),o=br({typed:t,DenseMatrix:n}),s=Xt({typed:t}),u=Kt({typed:t}),c=t("xor",{"number, number":_n,"Complex, Complex":function(e,t){return(0!==e.re||0!==e.im)!=(0!==t.re||0!==t.im)},"BigNumber, BigNumber":function(e,t){return(!e.isZero()&&!e.isNaN())!=(!t.isZero()&&!t.isNaN())},"Unit, Unit":function(e,t){return c(e.value||0,t.value||0)},"SparseMatrix, SparseMatrix":function(e,t){return a(e,t,c)},"SparseMatrix, DenseMatrix":function(e,t){return i(t,e,c,!0)},"DenseMatrix, SparseMatrix":function(e,t){return i(e,t,c,!1)},"DenseMatrix, DenseMatrix":function(e,t){return s(e,t,c)},"Array, Array":function(e,t){return c(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return c(r(e),t)},"Matrix, Array":function(e,t){return c(e,r(t))},"SparseMatrix, any":function(e,t){return o(e,t,c,!1)},"DenseMatrix, any":function(e,t){return u(e,t,c,!1)},"any, SparseMatrix":function(e,t){return o(t,e,c,!0)},"any, DenseMatrix":function(e,t){return u(t,e,c,!0)},"Array, any":function(e,t){return u(r(e),t,c,!1).valueOf()},"any, Array":function(e,t){return u(r(t),e,c,!0).valueOf()}});return c}),Pn=["typed","matrix","isInteger"],Fn=Object(s.a)("concat",Pn,function(e){var t=e.typed,l=e.matrix,p=e.isInteger;return t("concat",{"...Array | Matrix | number | BigNumber":function(e){var t,r,n=e.length,i=-1,a=!1,o=[];for(t=0;t<n;t++){var s=e[t];if(Object(ie.v)(s)&&(a=!0),Object(ie.y)(s)||Object(ie.e)(s)){if(t!==n-1)throw new Error("Dimension must be specified as last argument");if(r=i,i=s.valueOf(),!p(i))throw new TypeError("Integer number expected for dimension");if(i<0||0<t&&r<i)throw new R.a(i,r+1)}else{var u=Object(ae.a)(s).valueOf(),c=Object(I.a)(u);if(o[t]=u,r=i,i=c.length-1,0<t&&i!==r)throw new D.a(r+1,i+1)}}if(0===o.length)throw new SyntaxError("At least one matrix expected");for(var f=o.shift();o.length;)f=Un(f,o.shift(),i,0);return a?l(f):f},"...string":function(e){return e.join("")}})});function Un(e,t,r,n){if(n<r){if(e.length!==t.length)throw new D.a(e.length,t.length);for(var i=[],a=0;a<e.length;a++)i[a]=Un(e[a],t[a],r,n+1);return i}return e.concat(t)}var Ln=["typed","Index","matrix","range"],Hn=Object(s.a)("column",Ln,function(e){var t=e.typed,i=e.Index,r=e.matrix,a=e.range;return t("column",{"Matrix, number":n,"Array, number":function(e,t){return n(r(Object(ae.a)(e)),t).valueOf()}});function n(e,t){if(2!==e.size().length)throw new Error("Only two dimensional matrix is supported");Object(I.s)(t,e.size()[1]);var r=a(0,e.size()[0]),n=new i(r,t);return e.subset(n)}}),$n=["typed","matrix","subtract","multiply"],Gn=Object(s.a)("cross",$n,function(e){var t=e.typed,r=e.matrix,o=e.subtract,s=e.multiply;return t("cross",{"Matrix, Matrix":function(e,t){return r(n(e.toArray(),t.toArray()))},"Matrix, Array":function(e,t){return r(n(e.toArray(),t))},"Array, Matrix":function(e,t){return r(n(e,t.toArray()))},"Array, Array":n});function n(e,t){var r=Math.max(Object(I.a)(e).length,Object(I.a)(t).length);e=Object(I.p)(e),t=Object(I.p)(t);var n=Object(I.a)(e),i=Object(I.a)(t);if(1!==n.length||1!==i.length||3!==n[0]||3!==i[0])throw new RangeError("Vectors with length 3 expected (Size A = ["+n.join(", ")+"], B = ["+i.join(", ")+"])");var a=[o(s(e[1],t[2]),s(e[2],t[1])),o(s(e[2],t[0]),s(e[0],t[2])),o(s(e[0],t[1]),s(e[1],t[0]))];return 1<r?[a]:a}}),Zn=["typed","matrix","DenseMatrix","SparseMatrix"],Vn=Object(s.a)("diag",Zn,function(e){var t=e.typed,f=e.matrix,u=e.DenseMatrix,c=e.SparseMatrix;return t("diag",{Array:function(e){return n(e,0,Object(I.a)(e),null)},"Array, number":function(e,t){return n(e,t,Object(I.a)(e),null)},"Array, BigNumber":function(e,t){return n(e,t.toNumber(),Object(I.a)(e),null)},"Array, string":function(e,t){return n(e,0,Object(I.a)(e),t)},"Array, number, string":function(e,t,r){return n(e,t,Object(I.a)(e),r)},"Array, BigNumber, string":function(e,t,r){return n(e,t.toNumber(),Object(I.a)(e),r)},Matrix:function(e){return n(e,0,e.size(),e.storage())},"Matrix, number":function(e,t){return n(e,t,e.size(),e.storage())},"Matrix, BigNumber":function(e,t){return n(e,t.toNumber(),e.size(),e.storage())},"Matrix, string":function(e,t){return n(e,0,e.size(),t)},"Matrix, number, string":function(e,t,r){return n(e,t,e.size(),r)},"Matrix, BigNumber, string":function(e,t,r){return n(e,t.toNumber(),e.size(),r)}});function n(e,t,r,n){if(!Object(j.i)(t))throw new TypeError("Second parameter in function diag must be an integer");var i=0<t?t:0,a=t<0?-t:0;switch(r.length){case 1:return function(e,t,r,n,i,a){var o=[n+i,n+a];if(r&&"sparse"!==r&&"dense"!==r)throw new TypeError("Unknown matrix type ".concat(r,'"'));var s="sparse"===r?c.diagonal(o,e,t):u.diagonal(o,e,t);return null!==r?s:s.valueOf()}(e,t,n,r[0],a,i);case 2:return function(e,t,r,n,i,a){if(Object(ie.v)(e)){var o=e.diagonal(t);return null!==r?r!==o.storage()?f(o,r):o:o.valueOf()}for(var s=Math.min(n[0]-i,n[1]-a),u=[],c=0;c<s;c++)u[c]=e[c+i][c+a];return null!==r?f(u):u}(e,t,n,r,a,i)}throw new RangeError("Matrix for function diag must be 2 dimensional")}}),Jn=Object(s.a)("eye",[],function(){return function(){throw new Error('Function "eye" is renamed to "identity" since mathjs version 5.0.0. To keep eye working, create an alias for it using "math.import({eye: math.identity}, {override: true})"')}});function Wn(e){return(Wn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Yn(i,a){return function e(){"object"!==Wn(e.cache)&&(e.cache={});for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=a?a(t):JSON.stringify(t);return n in e.cache||(e.cache[n]=i.apply(i,t)),e.cache[n]}}function Xn(e){return Object.keys(e.signatures||{}).reduce(function(e,t){var r=(t.match(/,/g)||[]).length+1;return Math.max(e,r)},-1)}var Qn=["typed"],Kn=Object(s.a)("filter",Qn,function(e){return(0,e.typed)("filter",{"Array, function":ei,"Matrix, function":function(e,t){return e.create(ei(e.toArray(),t))},"Array, RegExp":I.d,"Matrix, RegExp":function(e,t){return e.create(Object(I.d)(e.toArray(),t))}})});function ei(e,n){var i=Xn(n);return Object(I.c)(e,function(e,t,r){return 1===i?n(e):2===i?n(e,[t]):n(e,[t],r)})}var ti="flatten",ri=["typed","matrix"],ni=Object(s.a)(ti,ri,function(e){var t=e.typed,r=e.matrix;return t(ti,{Array:function(e){return Object(I.e)(Object(ae.a)(e))},Matrix:function(e){var t=Object(I.e)(Object(ae.a)(e.toArray()));return r(t)}})}),ii="forEach",ai=["typed"],oi=Object(s.a)(ii,ai,function(e){return(0,e.typed)(ii,{"Array, function":si,"Matrix, function":function(e,t){return e.forEach(t)}})});function si(t,i){var a=Xn(i);!function r(e,n){Array.isArray(e)?Object(I.f)(e,function(e,t){r(e,n.concat(t))}):1===a?i(e):2===a?i(e,n):i(e,n,t)}(t,[])}var ui="getMatrixDataType",ci=["typed"],fi=Object(s.a)(ui,ci,function(e){return(0,e.typed)(ui,{Array:function(e){return Object(I.h)(e,ie.M)},Matrix:function(e){return e.getDataType()}})}),li="identity",pi=["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],mi=Object(s.a)(li,pi,function(e){var t=e.typed,r=e.config,n=e.matrix,f=e.BigNumber,l=e.DenseMatrix,p=e.SparseMatrix;return t(li,{"":function(){return"Matrix"===r.matrix?n([]):[]},string:function(e){return n(e)},"number | BigNumber":function(e){return a(e,e,"Matrix"===r.matrix?"dense":void 0)},"number | BigNumber, string":function(e,t){return a(e,e,t)},"number | BigNumber, number | BigNumber":function(e,t){return a(e,t,"Matrix"===r.matrix?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(e,t,r){return a(e,t,r)},Array:function(e){return i(e)},"Array, string":function(e,t){return i(e,t)},Matrix:function(e){return i(e.valueOf(),e.storage())},"Matrix, string":function(e,t){return i(e.valueOf(),t)}});function i(e,t){switch(e.length){case 0:return t?n(t):[];case 1:return a(e[0],e[0],t);case 2:return a(e[0],e[1],t);default:throw new Error("Vector containing two values expected")}}function a(e,t,r){var n=Object(ie.e)(e)||Object(ie.e)(t)?f:null;if(Object(ie.e)(e)&&(e=e.toNumber()),Object(ie.e)(t)&&(t=t.toNumber()),!Object(j.i)(e)||e<1)throw new Error("Parameters in function identity must be positive integers");if(!Object(j.i)(t)||t<1)throw new Error("Parameters in function identity must be positive integers");var i=n?new f(1):1,a=n?new n(0):0,o=[e,t];if(r){if("sparse"===r)return p.diagonal(o,i,0,a);if("dense"===r)return l.diagonal(o,i,0,a);throw new TypeError('Unknown matrix type "'.concat(r,'"'))}for(var s=Object(I.o)([],o,a),u=e<t?e:t,c=0;c<u;c++)s[c][c]=i;return s}}),hi=["typed","matrix","multiplyScalar"],di=Object(s.a)("kron",hi,function(e){var t=e.typed,r=e.matrix,a=e.multiplyScalar;return t("kron",{"Matrix, Matrix":function(e,t){return r(n(e.toArray(),t.toArray()))},"Matrix, Array":function(e,t){return r(n(e.toArray(),t))},"Array, Matrix":function(e,t){return r(n(e,t.toArray()))},"Array, Array":n});function n(e,r){if(1===Object(I.a)(e).length&&(e=[e]),1===Object(I.a)(r).length&&(r=[r]),2<Object(I.a)(e).length||2<Object(I.a)(r).length)throw new RangeError("Vectors with dimensions greater then 2 are not supported expected (Size x = "+JSON.stringify(e.length)+", y = "+JSON.stringify(r.length)+")");var n=[],i=[];return e.map(function(t){return r.map(function(e){return i=[],n.push(i),t.map(function(t){return e.map(function(e){return i.push(a(t,e))})})})})&&n}}),yi=["typed"],gi=Object(s.a)("map",yi,function(e){return(0,e.typed)("map",{"Array, function":vi,"Matrix, function":function(e,t){return e.map(t)}})});function vi(t,i){var a=Xn(i);return function r(e,n){return Array.isArray(e)?e.map(function(e,t){return r(e,n.concat(t))}):1===a?i(e):2===a?i(e,n):i(e,n,t)}(t,[])}var bi=["typed","config","matrix","BigNumber"],xi=Object(s.a)("ones",bi,function(e){var t=e.typed,r=e.config,a=e.matrix,o=e.BigNumber;return t("ones",{"":function(){return"Array"===r.matrix?n([]):n([],"default")},"...number | BigNumber | string":function(e){if("string"!=typeof e[e.length-1])return"Array"===r.matrix?n(e):n(e,"default");var t=e.pop();return n(e,t)},Array:n,Matrix:function(e){var t=e.storage();return n(e.valueOf(),t)},"Array | Matrix, string":function(e,t){return n(e.valueOf(),t)}});function n(e,t){var r=function(e){var n=!1;return e.forEach(function(e,t,r){Object(ie.e)(e)&&(n=!0,r[t]=e.toNumber())}),n}(e)?new o(1):1;if(function(e){e.forEach(function(e){if("number"!=typeof e||!Object(j.i)(e)||e<0)throw new Error("Parameters in function ones must be positive integers")})}(e),t){var n=a(t);return 0<e.length?n.resize(e,r):n}var i=[];return 0<e.length?Object(I.o)(i,e,r):i}});function wi(){throw new Error('No "bignumber" implementation available')}function Ni(){throw new Error('No "fraction" implementation available')}function Oi(){throw new Error('No "matrix" implementation available')}var Mi=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq"],Ei=Object(s.a)("range",Mi,function(e){var t=e.typed,n=e.config,r=e.matrix,o=e.bignumber,s=e.smaller,u=e.smallerEq,c=e.larger,f=e.largerEq;return t("range",{string:a,"string, boolean":a,"number, number":function(e,t){return i(l(e,t,1))},"number, number, number":function(e,t,r){return i(l(e,t,r))},"number, number, boolean":function(e,t,r){return i(r?p(e,t,1):l(e,t,1))},"number, number, number, boolean":function(e,t,r,n){return i(n?p(e,t,r):l(e,t,r))},"BigNumber, BigNumber":function(e,t){return i(m(e,t,new e.constructor(1)))},"BigNumber, BigNumber, BigNumber":function(e,t,r){return i(m(e,t,r))},"BigNumber, BigNumber, boolean":function(e,t,r){var n=e.constructor;return i(r?h(e,t,new n(1)):m(e,t,new n(1)))},"BigNumber, BigNumber, BigNumber, boolean":function(e,t,r,n){return i(n?h(e,t,r):m(e,t,r))}});function i(e){return"Matrix"===n.matrix?r?r(e):Oi():e}function a(e,t){var r=function(e){var t=e.split(":").map(function(e){return Number(e)});if(t.some(function(e){return isNaN(e)}))return null;switch(t.length){case 2:return{start:t[0],end:t[1],step:1};case 3:return{start:t[0],end:t[2],step:t[1]};default:return null}}(e);if(!r)throw new SyntaxError('String "'+e+'" is no valid range');return"BigNumber"===n.number?(void 0===o&&wi(),i((t?h:m)(o(r.start),o(r.end),o(r.step)))):i((t?p:l)(r.start,r.end,r.step))}function l(e,t,r){var n=[],i=e;if(0<r)for(;s(i,t);)n.push(i),i+=r;else if(r<0)for(;c(i,t);)n.push(i),i+=r;return n}function p(e,t,r){var n=[],i=e;if(0<r)for(;u(i,t);)n.push(i),i+=r;else if(r<0)for(;f(i,t);)n.push(i),i+=r;return n}function m(e,t,r){var n=o(0),i=[],a=e;if(r.gt(n))for(;s(a,t);)i.push(a),a=a.plus(r);else if(r.lt(n))for(;c(a,t);)i.push(a),a=a.plus(r);return i}function h(e,t,r){var n=o(0),i=[],a=e;if(r.gt(n))for(;u(a,t);)i.push(a),a=a.plus(r);else if(r.lt(n))for(;f(a,t);)i.push(a),a=a.plus(r);return i}}),ji="reshape",Si=["typed","isInteger","matrix"],Ai=Object(s.a)(ji,Si,function(e){var t=e.typed,r=e.isInteger,n=e.matrix;return t(ji,{"Matrix, Array":function(e,t){return e.reshape?e.reshape(t):n(Object(I.n)(e.valueOf(),t))},"Array, Array":function(e,t){return t.forEach(function(e){if(!r(e))throw new TypeError("Invalid size for dimension: "+e)}),Object(I.n)(e,t)}})}),Ci=r(13),Ti=["config","matrix"],_i=Object(s.a)("resize",Ti,function(e){var a=e.config,o=e.matrix;return function(e,t,r){if(2!==arguments.length&&3!==arguments.length)throw new Ci.a("resize",arguments.length,2,3);if(Object(ie.v)(t)&&(t=t.valueOf()),Object(ie.e)(t[0])&&(t=t.map(function(e){return Object(ie.e)(e)?e.toNumber():e})),Object(ie.v)(e))return e.resize(t,r,!0);if("string"==typeof e)return function(e,t,r){if(void 0!==r){if("string"!=typeof r||1!==r.length)throw new TypeError("Single character expected as defaultValue")}else r=" ";if(1!==t.length)throw new D.a(t.length,1);var n=t[0];if("number"!=typeof n||!Object(j.i)(n))throw new TypeError("Invalid size, must contain positive integers (size: "+Object(J.d)(t)+")");{if(e.length>n)return e.substring(0,n);if(e.length<n){for(var i=e,a=0,o=n-e.length;a<o;a++)i+=r;return i}return e}}(e,t,r);var n=!Array.isArray(e)&&"Array"!==a.matrix;if(0===t.length){for(;Array.isArray(e);)e=e[0];return Object(ae.a)(e)}Array.isArray(e)||(e=[e]),e=Object(ae.a)(e);var i=Object(I.o)(e,t,r);return n?o(i):i}}),Ii=["typed","Index","matrix","range"],Bi=Object(s.a)("row",Ii,function(e){var t=e.typed,i=e.Index,r=e.matrix,a=e.range;return t("row",{"Matrix, number":n,"Array, number":function(e,t){return n(r(Object(ae.a)(e)),t).valueOf()}});function n(e,t){if(2!==e.size().length)throw new Error("Only two dimensional matrix is supported");Object(I.s)(t,e.size()[0]);var r=a(0,e.size()[1]),n=new i(t,r);return e.subset(n)}}),qi=["typed","config","?matrix"],ki=Object(s.a)("size",qi,function(e){var t=e.typed,r=e.config,n=e.matrix;return t("size",{Matrix:function(e){return e.create(e.size())},Array:I.a,string:function(e){return"Array"===r.matrix?[e.length]:n([e.length])},"number | Complex | BigNumber | Unit | boolean | null":function(e){return"Array"===r.matrix?[]:n?n([]):Oi()}})}),zi="squeeze",Di=["typed","matrix"],Ri=Object(s.a)(zi,Di,function(e){var t=e.typed,r=e.matrix;return t(zi,{Array:function(e){return Object(I.p)(Object(ae.a)(e))},Matrix:function(e){var t=Object(I.p)(e.toArray());return Array.isArray(t)?r(t):t},any:function(e){return Object(ae.a)(e)}})});function Pi(e){return(Pi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Fi(e,t){if($i(e)&&Li(e,t))return e[t];if("function"==typeof e[t]&&Hi(e,t))throw new Error('Cannot access method "'+t+'" as a property');throw new Error('No access to property "'+t+'"')}function Ui(e,t,r){if($i(e)&&Li(e,t))return e[t]=r;throw new Error('No access to property "'+t+'"')}function Li(e,t){return!(!e||"object"!==Pi(e))&&(!!Object(ae.f)(Gi,t)||!(t in Object.prototype)&&!(t in Function.prototype))}function Hi(e,t){return!(!e||"function"!=typeof e[t])&&(!(Object(ae.f)(e,t)&&Object.getPrototypeOf&&t in Object.getPrototypeOf(e))&&(!!Object(ae.f)(Zi,t)||!(t in Object.prototype)&&!(t in Function.prototype)))}function $i(e){return"object"===Pi(e)&&e&&e.constructor===Object}var Gi={length:!0,name:!0},Zi={toString:!0,valueOf:!0,toLocaleString:!0},Vi=["typed","matrix"],Ji=Object(s.a)("subset",Vi,function(e){var t=e.typed,i=e.matrix;return t("subset",{"Array, Index":function(e,t){var r=i(e).subset(t);return t.isScalar()?r:r.valueOf()},"Matrix, Index":function(e,t){return e.subset(t)},"Object, Index":Xi,"string, Index":Wi,"Array, Index, any":function(e,t,r){return i(Object(ae.a)(e)).subset(t,r,void 0).valueOf()},"Array, Index, any, any":function(e,t,r,n){return i(Object(ae.a)(e)).subset(t,r,n).valueOf()},"Matrix, Index, any":function(e,t,r){return e.clone().subset(t,r)},"Matrix, Index, any, any":function(e,t,r,n){return e.clone().subset(t,r,n)},"string, Index, string":Yi,"string, Index, string, string":Yi,"Object, Index, any":Qi})});function Wi(t,e){if(!Object(ie.t)(e))throw new TypeError("Index expected");if(1!==e.size().length)throw new D.a(e.size().length,1);var r=t.length;Object(I.s)(e.min()[0],r),Object(I.s)(e.max()[0],r);var n=e.dimension(0),i="";return n.forEach(function(e){i+=t.charAt(e)}),i}function Yi(e,t,r,n){if(!t||!0!==t.isIndex)throw new TypeError("Index expected");if(1!==t.size().length)throw new D.a(t.size().length,1);if(void 0!==n){if("string"!=typeof n||1!==n.length)throw new TypeError("Single character expected as defaultValue")}else n=" ";var i=t.dimension(0);if(i.size()[0]!==r.length)throw new D.a(i.size()[0],r.length);var a=e.length;Object(I.s)(t.min()[0]),Object(I.s)(t.max()[0]);for(var o=[],s=0;s<a;s++)o[s]=e.charAt(s);if(i.forEach(function(e,t){o[e]=r.charAt(t[0])}),o.length>a)for(var u=a-1,c=o.length;u<c;u++)o[u]||(o[u]=n);return o.join("")}function Xi(e,t){if(1!==t.size().length)throw new D.a(t.size(),1);var r=t.dimension(0);if("string"!=typeof r)throw new TypeError("String expected as index to retrieve an object property");return Fi(e,r)}function Qi(e,t,r){if(1!==t.size().length)throw new D.a(t.size(),1);var n=t.dimension(0);if("string"!=typeof n)throw new TypeError("String expected as index to retrieve an object property");var i=Object(ae.a)(e);return Ui(i,n,r),i}var Ki=["typed","matrix"],ea=Object(s.a)("transpose",Ki,function(e){var t=e.typed,r=e.matrix,n=t("transpose",{Array:function(e){return n(r(e)).valueOf()},Matrix:function(e){var t,r=e.size();switch(r.length){case 1:t=e.clone();break;case 2:var n=r[0],i=r[1];if(0===i)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+Object(J.d)(r)+")");switch(e.storage()){case"dense":t=function(e,t,r){for(var n,i=e._data,a=[],o=0;o<r;o++){n=a[o]=[];for(var s=0;s<t;s++)n[s]=Object(ae.a)(i[s][o])}return e.createDenseMatrix({data:a,size:[r,t],datatype:e._datatype})}(e,n,i);break;case"sparse":t=function(e,t,r){for(var n,i,a,o=e._values,s=e._index,u=e._ptr,c=o?[]:void 0,f=[],l=[],p=[],m=0;m<t;m++)p[m]=0;for(n=0,i=s.length;n<i;n++)p[s[n]]++;for(var h=0,d=0;d<t;d++)l.push(h),h+=p[d],p[d]=l[d];for(l.push(h),a=0;a<r;a++)for(var y=u[a],g=u[a+1],v=y;v<g;v++){var b=p[s[v]]++;f[b]=a,o&&(c[b]=Object(ae.a)(o[v]))}return e.createSparseMatrix({values:c,index:f,ptr:l,size:[r,t],datatype:e._datatype})}(e,n,i)}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+Object(J.d)(this._size)+")")}return t},any:function(e){return Object(ae.a)(e)}});return n}),ta="ctranspose",ra=["typed","transpose","conj"],na=Object(s.a)(ta,ra,function(e){var t=e.typed,r=e.transpose,n=e.conj;return t(ta,{any:function(e){return n(r(e))}})}),ia=["typed","config","matrix","BigNumber"],aa=Object(s.a)("zeros",ia,function(e){var t=e.typed,r=e.config,a=e.matrix,o=e.BigNumber;return t("zeros",{"":function(){return"Array"===r.matrix?n([]):n([],"default")},"...number | BigNumber | string":function(e){if("string"!=typeof e[e.length-1])return"Array"===r.matrix?n(e):n(e,"default");var t=e.pop();return n(e,t)},Array:n,Matrix:function(e){var t=e.storage();return n(e.valueOf(),t)},"Array | Matrix, string":function(e,t){return n(e.valueOf(),t)}});function n(e,t){var r=function(e){var n=!1;return e.forEach(function(e,t,r){Object(ie.e)(e)&&(n=!0,r[t]=e.toNumber())}),n}(e)?new o(0):0;if(function(e){e.forEach(function(e){if("number"!=typeof e||!Object(j.i)(e)||e<0)throw new Error("Parameters in function zeros must be positive integers")})}(e),t){var n=a(t);return 0<e.length?n.resize(e,r):n}var i=[];return 0<e.length?Object(I.o)(i,e,r):i}}),oa=["typed"],sa=Object(s.a)("erf",oa,function(e){var t=(0,e.typed)("name",{number:function(e){var t=Math.abs(e);return pa<=t?Object(j.n)(e):t<=ua?Object(j.n)(e)*function(e){var t,r=e*e,n=fa[0][4]*r,i=r;for(t=0;t<3;t+=1)n=(n+fa[0][t])*r,i=(i+la[0][t])*r;return e*(n+fa[0][3])/(i+la[0][3])}(t):t<=4?Object(j.n)(e)*(1-function(e){var t,r=fa[1][8]*e,n=e;for(t=0;t<7;t+=1)r=(r+fa[1][t])*e,n=(n+la[1][t])*e;var i=(r+fa[1][7])/(n+la[1][7]),a=parseInt(16*e)/16,o=(e-a)*(e+a);return Math.exp(-a*a)*Math.exp(-o)*i}(t)):Object(j.n)(e)*(1-function(e){var t,r=1/(e*e),n=fa[2][5]*r,i=r;for(t=0;t<4;t+=1)n=(n+fa[2][t])*r,i=(i+la[2][t])*r;var a=r*(n+fa[2][4])/(i+la[2][4]);a=(ca-a)/e,r=parseInt(16*e)/16;var o=(e-r)*(e+r);return Math.exp(-r*r)*Math.exp(-o)*a}(t))},"Array | Matrix":function(e){return oe(e,t)}});return t}),ua=.46875,ca=.5641895835477563,fa=[[3.1611237438705655,113.86415415105016,377.485237685302,3209.3775891384694,.18577770618460315],[.5641884969886701,8.883149794388377,66.11919063714163,298.6351381974001,881.952221241769,1712.0476126340707,2051.0783778260716,1230.3393547979972,2.1531153547440383e-8],[.30532663496123236,.36034489994980445,.12578172611122926,.016083785148742275,.0006587491615298378,.016315387137302097]],la=[[23.601290952344122,244.02463793444417,1282.6165260773723,2844.236833439171],[15.744926110709835,117.6939508913125,537.1811018620099,1621.3895745666903,3290.7992357334597,4362.619090143247,3439.3676741437216,1230.3393548037495],[2.568520192289822,1.8729528499234604,.5279051029514285,.06051834131244132,.0023352049762686918]],pa=Math.pow(2,53),ma=["typed","isNaN","isNumeric"],ha=Object(s.a)("mode",ma,function(e){var t=e.typed,o=e.isNaN,s=e.isNumeric;return t("mode",{"Array | Matrix":r,"...":function(e){return r(e)}});function r(e){if(0===(e=Object(I.e)(e.valueOf())).length)throw new Error("Cannot calculate mode of an empty array");for(var t={},r=[],n=0,i=0;i<e.length;i++){var a=e[i];if(s(a)&&o(a))throw new Error("Cannot calculate mode of an array containing NaN values");a in t||(t[a]=0),t[a]++,t[a]===n?r.push(a):t[a]>n&&(n=t[a],r=[a])}return r}});function da(e,t,r){var n;return-1!==String(e).indexOf("Unexpected type")?(n=2<arguments.length?" (type: "+Object(ie.M)(r)+", value: "+JSON.stringify(r)+")":" (type: "+e.data.actual+")",new TypeError("Cannot calculate "+t+", unexpected type of argument"+n)):-1!==String(e).indexOf("complex numbers")?(n=2<arguments.length?" (type: "+Object(ie.M)(r)+", value: "+JSON.stringify(r)+")":"",new TypeError("Cannot calculate "+t+", no ordering relation is defined for complex numbers"+n)):e}var ya=["typed","multiply"],ga=Object(s.a)("prod",ya,function(e){var t=e.typed,n=e.multiply;return t("prod",{"Array | Matrix":r,"Array | Matrix, number | BigNumber":function(e,t){throw new Error("prod(A, dim) is not yet supported")},"...":function(e){return r(e)}});function r(e){var r;if(F(e,function(t){try{r=void 0===r?t:n(r,t)}catch(e){throw da(e,"prod",t)}}),void 0===r)throw new Error("Cannot calculate prod of an empty array");return r}}),va=["typed"],ba=Object(s.a)("format",va,function(e){return(0,e.typed)("format",{any:J.d,"any, Object | function | number":J.d})}),xa=["typed"],wa=Object(s.a)("print",xa,function(e){return(0,e.typed)("print",{"string, Object | Array":Na,"string, Object | Array, number | Object":Na})});function Na(e,a,o){return e.replace(/\$([\w.]+)/g,function(e,t){for(var r=t.split("."),n=a[r.shift()];r.length&&void 0!==n;){var i=r.shift();n=i?n[i]:n+"."}return void 0!==n?Object(ie.I)(n)?n:Object(J.d)(n,o):e})}var Oa=["typed","matrix"],Ma=Object(s.a)("to",Oa,function(e){var t=e.typed,r=e.matrix,n=Xt({typed:t}),i=Kt({typed:t}),a=t("to",{"Unit, Unit | string":function(e,t){return e.to(t)},"Matrix, Matrix":function(e,t){return n(e,t,a)},"Array, Array":function(e,t){return a(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return a(r(e),t)},"Matrix, Array":function(e,t){return a(e,r(t))},"Matrix, any":function(e,t){return i(e,t,a,!1)},"any, Matrix":function(e,t){return i(t,e,a,!0)},"Array, any":function(e,t){return i(r(e),t,a,!1).valueOf()},"any, Array":function(e,t){return i(r(t),e,a,!0).valueOf()}});return a}),Ea="isPrime",ja=["typed"],Sa=Object(s.a)(Ea,ja,function(e){var t=(0,e.typed)(Ea,{number:function(e){if(e<2)return!1;if(2===e)return!0;if(e%2==0)return!1;for(var t=3;t*t<=e;t+=2)if(e%t==0)return!1;return!0},BigNumber:function(e){if(e.lt(2))return!1;if(e.equals(2))return!0;if(e.mod(2).isZero())return!1;for(var t=new e.constructor(3);t.times(t).lte(e);t=t.plus(1))if(e.mod(t).isZero())return!1;return!0},"Array | Matrix":function(e){return oe(e,t)}});return t}),Aa=["number","?bignumber","?fraction"],Ca=Object(s.a)("numeric",Aa,function(e){var t=e.number,r=e.bignumber,n=e.fraction,i={string:!0,number:!0,BigNumber:!0,Fraction:!0},a={number:function(e){return t(e)},BigNumber:r?function(e){return r(e)}:wi,Fraction:n?function(e){return n(e)}:Ni};return function(e,t){var r=Object(ie.M)(e);if(!(r in i))throw new TypeError("Cannot convert "+e+' of type "'+r+'"; valid input types are '+Object.keys(i).join(", "));if(!(t in a))throw new TypeError("Cannot convert "+e+' to type "'+t+'"; valid output types are '+Object.keys(a).join(", "));return t===r?e:a[t](e)}}),Ta="divideScalar",_a=["typed","numeric"],Ia=Object(s.a)(Ta,_a,function(e){var t=e.typed,i=e.numeric,a=t(Ta,{"number, number":function(e,t){return e/t},"Complex, Complex":function(e,t){return e.div(t)},"BigNumber, BigNumber":function(e,t){return e.div(t)},"Fraction, Fraction":function(e,t){return e.div(t)},"Unit, number | Fraction | BigNumber":function(e,t){var r=e.clone(),n=i(1,Object(ie.M)(t));return r.value=a(null===r.value?r._normalize(n):r.value,t),r},"number | Fraction | BigNumber, Unit":function(e,t){var r=t.clone();r=r.pow(-1);var n=i(1,Object(ie.M)(e));return r.value=a(e,null===t.value?t._normalize(n):t.value),r},"Unit, Unit":function(e,t){return e.divide(t)}});return a}),Ba=["typed","config","identity","multiply","matrix","fraction","number","Complex"],qa=Object(s.a)("pow",Ba,function(e){var t=e.typed,i=e.config,a=e.identity,o=e.multiply,r=e.matrix,s=e.number,u=e.fraction,c=e.Complex;return t("pow",{"number, number":n,"Complex, Complex":function(e,t){return e.pow(t)},"BigNumber, BigNumber":function(e,t){return t.isInteger()||0<=e||i.predictable?e.pow(t):new c(e.toNumber(),0).pow(t.toNumber(),0)},"Fraction, Fraction":function(e,t){if(1===t.d)return e.pow(t);if(i.predictable)throw new Error("Function pow does not support non-integer exponents for fractions.");return n(e.valueOf(),t.valueOf())},"Array, number":f,"Array, BigNumber":function(e,t){return f(e,t.toNumber())},"Matrix, number":l,"Matrix, BigNumber":function(e,t){return l(e,t.toNumber())},"Unit, number | BigNumber":function(e,t){return e.pow(t)}});function n(e,t){if(i.predictable&&!Object(j.i)(t)&&e<0)try{var r=u(t),n=s(r);if((t===n||Math.abs((t-n)/t)<1e-14)&&r.d%2==1)return(r.n%2==0?1:-1)*Math.pow(-e,t)}catch(e){}return i.predictable&&(e<-1&&t===1/0||-1<e&&e<0&&t===-1/0)?NaN:Object(j.i)(t)||0<=e||i.predictable?ht(e,t):e*e<1&&t===1/0||1<e*e&&t===-1/0?0:new c(e,0).pow(t,0)}function f(e,t){if(!Object(j.i)(t)||t<0)throw new TypeError("For A^b, b must be a positive integer (value is "+t+")");var r=Object(I.a)(e);if(2!==r.length)throw new Error("For A^b, A must be 2 dimensional (A has "+r.length+" dimensions)");if(r[0]!==r[1])throw new Error("For A^b, A must be square (size is "+r[0]+"x"+r[1]+")");for(var n=a(r[0]).valueOf(),i=e;1<=t;)1==(1&t)&&(n=o(i,n)),t>>=1,i=o(i,i);return n}function l(e,t){return r(f(e.valueOf(),t))}});function ka(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function za(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Da="Number of decimals in function round must be an integer",Ra="round",Pa=["typed","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],Fa=Object(s.a)(Ra,Pa,function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.zeros,a=e.BigNumber,o=e.DenseMatrix,s=sr({typed:t,equalScalar:n}),u=br({typed:t,DenseMatrix:o}),c=Kt({typed:t}),f=t(Ra,function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ka(r,!0).forEach(function(e){za(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ka(r).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}({},Ua,{Complex:function(e){return e.round()},"Complex, number":function(e,t){if(t%1)throw new TypeError(Da);return e.round(t)},"Complex, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(Da);var r=t.toNumber();return e.round(r)},"number, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(Da);return new a(e).toDecimalPlaces(t.toNumber())},BigNumber:function(e){return e.toDecimalPlaces(0)},"BigNumber, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(Da);return e.toDecimalPlaces(t.toNumber())},Fraction:function(e){return e.round()},"Fraction, number":function(e,t){if(t%1)throw new TypeError(Da);return e.round(t)},"Array | Matrix":function(e){return oe(e,f,!0)},"SparseMatrix, number | BigNumber":function(e,t){return s(e,t,f,!1)},"DenseMatrix, number | BigNumber":function(e,t){return c(e,t,f,!1)},"number | Complex | BigNumber, SparseMatrix":function(e,t){return n(e,0)?i(t.size(),t.storage()):u(t,e,f,!0)},"number | Complex | BigNumber, DenseMatrix":function(e,t){return n(e,0)?i(t.size(),t.storage()):c(t,e,f,!0)},"Array, number | BigNumber":function(e,t){return c(r(e),t,f,!1).valueOf()},"number | Complex | BigNumber, Array":function(e,t){return c(r(t),e,f,!0).valueOf()}}));return f}),Ua={number:dt,"number, number":function(e,t){if(!Object(j.i)(t))throw new TypeError(Da);if(t<0||15<t)throw new Error("Number of decimals in function round must be in te range of 0-15");return dt(e,t)}},La=["config","typed","divideScalar","Complex"],Ha=Object(s.a)("log",La,function(e){var t=e.typed,r=e.config,n=e.divideScalar,i=e.Complex,a=t("log",{number:function(e){return 0<=e||r.predictable?ot(e):new i(e,0).log()},Complex:function(e){return e.log()},BigNumber:function(e){return!e.isNegative()||r.predictable?e.ln():new i(e.toNumber(),0).log()},"Array | Matrix":function(e){return oe(e,a)},"any, any":function(e,t){return n(a(e),a(t))}});return a}),$a=["typed","config","divideScalar","log","Complex"],Ga=Object(s.a)("log1p",$a,function(e){var t=e.typed,r=e.config,n=e.divideScalar,i=e.log,a=e.Complex,o=t("log1p",{number:function(e){return-1<=e||r.predictable?Object(j.k)(e):s(new a(e,0))},Complex:s,BigNumber:function(e){var t=e.plus(1);return!t.isNegative()||r.predictable?t.ln():s(new a(e.toNumber(),0))},"Array | Matrix":function(e){return oe(e,o)},"any, any":function(e,t){return n(o(e),i(t))}});function s(e){var t=e.re+1;return new a(Math.log(Math.sqrt(t*t+e.im*e.im)),Math.atan2(e.im,t))}return o}),Za="nthRoots",Va=["config","typed","divideScalar","Complex"],Ja=Object(s.a)(Za,Va,function(e){var t=e.typed,f=(e.config,e.divideScalar,e.Complex),r=t(Za,{Complex:function(e){return n(e,2)},"Complex, number":n}),l=[function(e){return new f(e,0)},function(e){return new f(0,e)},function(e){return new f(-e,0)},function(e){return new f(0,-e)}];function n(e,t){if(t<0)throw new Error("Root must be greater than zero");if(0===t)throw new Error("Root must be non-zero");if(t%1!=0)throw new Error("Root must be an integer");if(0===e||0===e.abs())return[new f(0,0)];var r,n="number"==typeof e;!n&&0!==e.re&&0!==e.im||(r=n?2*+(e<0):0===e.im?2*+(e.re<0):2*+(e.im<0)+1);for(var i=e.arg(),a=e.abs(),o=[],s=Math.pow(a,1/t),u=0;u<t;u++){var c=(r+4*u)/t;c!==Math.round(c)?o.push(new f({r:s,phi:(i+2*Math.PI*u)/t})):o.push(l[c%4](s))}return o}return r}),Wa=["typed","equalScalar","matrix","pow","DenseMatrix"],Ya=Object(s.a)("dotPow",Wa,function(e){var t=e.typed,r=e.equalScalar,n=e.matrix,i=e.pow,a=e.DenseMatrix,o=dr({typed:t}),s=gn({typed:t,DenseMatrix:a}),u=sr({typed:t,equalScalar:r}),c=br({typed:t,DenseMatrix:a}),f=Xt({typed:t}),l=Kt({typed:t}),p=t("dotPow",{"any, any":i,"SparseMatrix, SparseMatrix":function(e,t){return s(e,t,i,!1)},"SparseMatrix, DenseMatrix":function(e,t){return o(t,e,i,!0)},"DenseMatrix, SparseMatrix":function(e,t){return o(e,t,i,!1)},"DenseMatrix, DenseMatrix":function(e,t){return f(e,t,i)},"Array, Array":function(e,t){return p(n(e),n(t)).valueOf()},"Array, Matrix":function(e,t){return p(n(e),t)},"Matrix, Array":function(e,t){return p(e,n(t))},"SparseMatrix, any":function(e,t){return u(e,t,p,!1)},"DenseMatrix, any":function(e,t){return l(e,t,p,!1)},"any, SparseMatrix":function(e,t){return c(t,e,p,!0)},"any, DenseMatrix":function(e,t){return l(t,e,p,!0)},"Array, any":function(e,t){return l(n(e),t,p,!1).valueOf()},"any, Array":function(e,t){return l(n(t),e,p,!0).valueOf()}});return p}),Xa="dotDivide",Qa=["typed","matrix","equalScalar","divideScalar","DenseMatrix"],Ka=Object(s.a)(Xa,Qa,function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.divideScalar,a=e.DenseMatrix,o=nr({typed:t,equalScalar:n}),s=dr({typed:t}),u=gn({typed:t,DenseMatrix:a}),c=sr({typed:t,equalScalar:n}),f=br({typed:t,DenseMatrix:a}),l=Xt({typed:t}),p=Kt({typed:t}),m=t(Xa,{"any, any":i,"SparseMatrix, SparseMatrix":function(e,t){return u(e,t,i,!1)},"SparseMatrix, DenseMatrix":function(e,t){return o(t,e,i,!0)},"DenseMatrix, SparseMatrix":function(e,t){return s(e,t,i,!1)},"DenseMatrix, DenseMatrix":function(e,t){return l(e,t,i)},"Array, Array":function(e,t){return m(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return m(r(e),t)},"Matrix, Array":function(e,t){return m(e,r(t))},"SparseMatrix, any":function(e,t){return c(e,t,i,!1)},"DenseMatrix, any":function(e,t){return p(e,t,i,!1)},"any, SparseMatrix":function(e,t){return f(t,e,i,!0)},"any, DenseMatrix":function(e,t){return p(t,e,i,!0)},"Array, any":function(e,t){return p(r(e),t,i,!1).valueOf()},"any, Array":function(e,t){return p(r(t),e,i,!0).valueOf()}});return m});function eo(e){var d=e.DenseMatrix;return function(e,t,r){var n=e.size();if(2!==n.length)throw new RangeError("Matrix must be two dimensional (size: "+Object(J.d)(n)+")");var i,a,o,s=n[0];if(s!==n[1])throw new RangeError("Matrix must be square (size: "+Object(J.d)(n)+")");if(Object(ie.v)(t)){var u=t.size();if(1===u.length){if(u[0]!==s)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(i=[],o=t._data,a=0;a<s;a++)i[a]=[o[a]];return new d({data:i,size:[s,1],datatype:t._datatype})}if(2!==u.length)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");if(u[0]!==s||1!==u[1])throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");if(Object(ie.n)(t)){if(r){for(i=[],o=t._data,a=0;a<s;a++)i[a]=[o[a][0]];return new d({data:i,size:[s,1],datatype:t._datatype})}return t}for(i=[],a=0;a<s;a++)i[a]=[0];for(var c=t._values,f=t._index,l=t._ptr,p=l[1],m=l[0];m<p;m++)i[a=f[m]][0]=c[m];return new d({data:i,size:[s,1],datatype:t._datatype})}if(Object(ie.b)(t)){var h=Object(I.a)(t);if(1===h.length){if(h[0]!==s)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(i=[],a=0;a<s;a++)i[a]=[t[a]];return new d({data:i,size:[s,1]})}if(2!==h.length)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");if(h[0]!==s||1!==h[1])throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(i=[],a=0;a<s;a++)i[a]=[t[a][0]];return new d({data:i,size:[s,1]})}}}var to=["typed","matrix","divideScalar","multiplyScalar","subtract","equalScalar","DenseMatrix"],ro=Object(s.a)("lsolve",to,function(e){var t=e.typed,r=e.matrix,v=e.divideScalar,b=e.multiplyScalar,x=e.subtract,w=e.equalScalar,N=e.DenseMatrix,O=eo({DenseMatrix:N});return t("lsolve",{"SparseMatrix, Array | Matrix":function(e,t){return function(e,t){for(var r,n,i=(t=O(e,t,!0))._data,a=e._size[0],o=e._size[1],s=e._values,u=e._index,c=e._ptr,f=[],l=0;l<o;l++){var p=i[l][0]||0;if(w(p,0))f[l]=[0];else{var m=0,h=[],d=[],y=c[l+1];for(n=c[l];n<y;n++)(r=u[n])===l?m=s[n]:l<r&&(h.push(s[n]),d.push(r));if(w(m,0))throw new Error("Linear system cannot be solved since matrix is singular");var g=v(p,m);for(n=0,y=d.length;n<y;n++)r=d[n],i[r]=[x(i[r][0]||0,b(g,h[n]))];f[l]=[g]}}return new N({data:f,size:[a,1]})}(e,t)},"DenseMatrix, Array | Matrix":function(e,t){return n(e,t)},"Array, Array | Matrix":function(e,t){return n(r(e),t).valueOf()}});function n(e,t){for(var r=(t=O(e,t,!0))._data,n=e._size[0],i=e._size[1],a=[],o=e._data,s=0;s<i;s++){var u=r[s][0]||0,c=void 0;if(w(u,0))c=0;else{var f=o[s][s];if(w(f,0))throw new Error("Linear system cannot be solved since matrix is singular");c=v(u,f);for(var l=s+1;l<n;l++)r[l]=[x(r[l][0]||0,b(c,o[l][s]))]}a[s]=[c]}return new N({data:a,size:[n,1]})}}),no=["typed","matrix","divideScalar","multiplyScalar","subtract","equalScalar","DenseMatrix"],io=Object(s.a)("usolve",no,function(e){var t=e.typed,r=e.matrix,b=e.divideScalar,x=e.multiplyScalar,w=e.subtract,N=e.equalScalar,O=e.DenseMatrix,M=eo({DenseMatrix:O});return t("usolve",{"SparseMatrix, Array | Matrix":function(e,t){return function(e,t){for(var r,n,i=(t=M(e,t,!0))._data,a=e._size[0],o=e._size[1],s=e._values,u=e._index,c=e._ptr,f=[],l=o-1;0<=l;l--){var p=i[l][0]||0;if(N(p,0))f[l]=[0];else{var m=0,h=[],d=[],y=c[l],g=c[l+1];for(n=g-1;y<=n;n--)(r=u[n])===l?m=s[n]:r<l&&(h.push(s[n]),d.push(r));if(N(m,0))throw new Error("Linear system cannot be solved since matrix is singular");var v=b(p,m);for(n=0,g=d.length;n<g;n++)r=d[n],i[r]=[w(i[r][0],x(v,h[n]))];f[l]=[v]}}return new O({data:f,size:[a,1]})}(e,t)},"DenseMatrix, Array | Matrix":function(e,t){return n(e,t)},"Array, Array | Matrix":function(e,t){return n(r(e),t).valueOf()}});function n(e,t){for(var r=(t=M(e,t,!0))._data,n=e._size[0],i=e._size[1],a=[],o=e._data,s=i-1;0<=s;s--){var u=r[s][0]||0,c=void 0;if(N(u,0))c=0;else{var f=o[s][s];if(N(f,0))throw new Error("Linear system cannot be solved since matrix is singular");c=b(u,f);for(var l=s-1;0<=l;l--)r[l]=[w(r[l][0]||0,x(c,o[l][s]))]}a[s]=[c]}return new O({data:a,size:[n,1]})}}),ao=["typed","equalScalar"],oo=Object(s.a)("algorithm08",ao,function(e){var I=e.typed,B=e.equalScalar;return function(e,t,r){var n=e._values,i=e._index,a=e._ptr,o=e._size,s=e._datatype,u=t._values,c=t._index,f=t._ptr,l=t._size,p=t._datatype;if(o.length!==l.length)throw new D.a(o.length,l.length);if(o[0]!==l[0]||o[1]!==l[1])throw new RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+l+")");if(!n||!u)throw new Error("Cannot perform operation on Pattern Sparse Matrices");var m,h=o[0],d=o[1],y=B,g=0,v=r;"string"==typeof s&&s===p&&(m=s,y=I.find(B,[m,m]),g=I.convert(0,m),v=I.find(r,[m,m]));for(var b,x,w,N,O=[],M=[],E=[],j=e.createSparseMatrix({values:O,index:M,ptr:E,size:[h,d],datatype:m}),S=[],A=[],C=0;C<d;C++){E[C]=M.length;var T=C+1;for(x=a[C],w=a[C+1],b=x;b<w;b++)A[N=i[b]]=T,S[N]=n[b],M.push(N);for(x=f[C],w=f[C+1],b=x;b<w;b++)A[N=c[b]]===T&&(S[N]=v(S[N],u[b]));for(b=E[C];b<M.length;){var _=S[N=M[b]];y(_,g)?M.splice(b,1):(O.push(_),b++)}}return E[d]=M.length,j}}),so="leftShift",uo=["typed","matrix","equalScalar","zeros","DenseMatrix"],co=Object(s.a)(so,uo,function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.zeros,a=e.DenseMatrix,o=Gt({typed:t}),s=nr({typed:t,equalScalar:n}),u=oo({typed:t,equalScalar:n}),c=Wt({typed:t,DenseMatrix:a}),f=sr({typed:t,equalScalar:n}),l=Xt({typed:t}),p=Kt({typed:t}),m=t(so,{"number, number":sn,"BigNumber, BigNumber":Kr,"SparseMatrix, SparseMatrix":function(e,t){return u(e,t,m,!1)},"SparseMatrix, DenseMatrix":function(e,t){return s(t,e,m,!0)},"DenseMatrix, SparseMatrix":function(e,t){return o(e,t,m,!1)},"DenseMatrix, DenseMatrix":function(e,t){return l(e,t,m)},"Array, Array":function(e,t){return m(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return m(r(e),t)},"Matrix, Array":function(e,t){return m(e,r(t))},"SparseMatrix, number | BigNumber":function(e,t){return n(t,0)?e.clone():f(e,t,m,!1)},"DenseMatrix, number | BigNumber":function(e,t){return n(t,0)?e.clone():p(e,t,m,!1)},"number | BigNumber, SparseMatrix":function(e,t){return n(e,0)?i(t.size(),t.storage()):c(t,e,m,!0)},"number | BigNumber, DenseMatrix":function(e,t){return n(e,0)?i(t.size(),t.storage()):p(t,e,m,!0)},"Array, number | BigNumber":function(e,t){return m(r(e),t).valueOf()},"number | BigNumber, Array":function(e,t){return m(e,r(t)).valueOf()}});return m}),fo="rightArithShift",lo=["typed","matrix","equalScalar","zeros","DenseMatrix"],po=Object(s.a)(fo,lo,function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.zeros,a=e.DenseMatrix,o=Gt({typed:t}),s=nr({typed:t,equalScalar:n}),u=oo({typed:t,equalScalar:n}),c=Wt({typed:t,DenseMatrix:a}),f=sr({typed:t,equalScalar:n}),l=Xt({typed:t}),p=Kt({typed:t}),m=t(fo,{"number, number":un,"BigNumber, BigNumber":en,"SparseMatrix, SparseMatrix":function(e,t){return u(e,t,m,!1)},"SparseMatrix, DenseMatrix":function(e,t){return s(t,e,m,!0)},"DenseMatrix, SparseMatrix":function(e,t){return o(e,t,m,!1)},"DenseMatrix, DenseMatrix":function(e,t){return l(e,t,m)},"Array, Array":function(e,t){return m(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return m(r(e),t)},"Matrix, Array":function(e,t){return m(e,r(t))},"SparseMatrix, number | BigNumber":function(e,t){return n(t,0)?e.clone():f(e,t,m,!1)},"DenseMatrix, number | BigNumber":function(e,t){return n(t,0)?e.clone():p(e,t,m,!1)},"number | BigNumber, SparseMatrix":function(e,t){return n(e,0)?i(t.size(),t.storage()):c(t,e,m,!0)},"number | BigNumber, DenseMatrix":function(e,t){return n(e,0)?i(t.size(),t.storage()):p(t,e,m,!0)},"Array, number | BigNumber":function(e,t){return m(r(e),t).valueOf()},"number | BigNumber, Array":function(e,t){return m(e,r(t)).valueOf()}});return m}),mo="rightLogShift",ho=["typed","matrix","equalScalar","zeros","DenseMatrix"],yo=Object(s.a)(mo,ho,function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.zeros,a=e.DenseMatrix,o=Gt({typed:t}),s=nr({typed:t,equalScalar:n}),u=oo({typed:t,equalScalar:n}),c=Wt({typed:t,DenseMatrix:a}),f=sr({typed:t,equalScalar:n}),l=Xt({typed:t}),p=Kt({typed:t}),m=t(mo,{"number, number":cn,"SparseMatrix, SparseMatrix":function(e,t){return u(e,t,m,!1)},"SparseMatrix, DenseMatrix":function(e,t){return s(t,e,m,!0)},"DenseMatrix, SparseMatrix":function(e,t){return o(e,t,m,!1)},"DenseMatrix, DenseMatrix":function(e,t){return l(e,t,m)},"Array, Array":function(e,t){return m(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return m(r(e),t)},"Matrix, Array":function(e,t){return m(e,r(t))},"SparseMatrix, number | BigNumber":function(e,t){return n(t,0)?e.clone():f(e,t,m,!1)},"DenseMatrix, number | BigNumber":function(e,t){return n(t,0)?e.clone():p(e,t,m,!1)},"number | BigNumber, SparseMatrix":function(e,t){return n(e,0)?i(t.size(),t.storage()):c(t,e,m,!0)},"number | BigNumber, DenseMatrix":function(e,t){return n(e,0)?i(t.size(),t.storage()):p(t,e,m,!0)},"Array, number | BigNumber":function(e,t){return m(r(e),t).valueOf()},"number | BigNumber, Array":function(e,t){return m(e,r(t)).valueOf()}});return m}),go=["typed","matrix","equalScalar","zeros","not"],vo=Object(s.a)("and",go,function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.zeros,a=e.not,o=nr({typed:t,equalScalar:n}),s=ar({typed:t,equalScalar:n}),u=sr({typed:t,equalScalar:n}),c=Xt({typed:t}),f=Kt({typed:t}),l=t("and",{"number, number":In,"Complex, Complex":function(e,t){return!(0===e.re&&0===e.im||0===t.re&&0===t.im)},"BigNumber, BigNumber":function(e,t){return!(e.isZero()||t.isZero()||e.isNaN()||t.isNaN())},"Unit, Unit":function(e,t){return l(e.value||0,t.value||0)},"SparseMatrix, SparseMatrix":function(e,t){return s(e,t,l,!1)},"SparseMatrix, DenseMatrix":function(e,t){return o(t,e,l,!0)},"DenseMatrix, SparseMatrix":function(e,t){return o(e,t,l,!1)},"DenseMatrix, DenseMatrix":function(e,t){return c(e,t,l)},"Array, Array":function(e,t){return l(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return l(r(e),t)},"Matrix, Array":function(e,t){return l(e,r(t))},"SparseMatrix, any":function(e,t){return a(t)?i(e.size(),e.storage()):u(e,t,l,!1)},"DenseMatrix, any":function(e,t){return a(t)?i(e.size(),e.storage()):f(e,t,l,!1)},"any, SparseMatrix":function(e,t){return a(e)?i(e.size(),e.storage()):u(t,e,l,!0)},"any, DenseMatrix":function(e,t){return a(e)?i(e.size(),e.storage()):f(t,e,l,!0)},"Array, any":function(e,t){return l(r(e),t).valueOf()},"any, Array":function(e,t){return l(e,r(t)).valueOf()}});return l}),bo="compare",xo=["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix"],wo=Object(s.a)(bo,xo,function(e){var t=e.typed,r=e.config,n=e.equalScalar,i=e.matrix,a=e.BigNumber,o=e.Fraction,s=e.DenseMatrix,u=dr({typed:t}),c=gr({typed:t,equalScalar:n}),f=br({typed:t,DenseMatrix:s}),l=Xt({typed:t}),p=Kt({typed:t}),m=t(bo,{"boolean, boolean":function(e,t){return e===t?0:t<e?1:-1},"number, number":function(e,t){return Object(j.m)(e,t,r.epsilon)?0:t<e?1:-1},"BigNumber, BigNumber":function(e,t){return Ne(e,t,r.epsilon)?new a(0):new a(e.cmp(t))},"Fraction, Fraction":function(e,t){return new o(e.compare(t))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")},"Unit, Unit":function(e,t){if(!e.equalBase(t))throw new Error("Cannot compare units with different base");return m(e.value,t.value)},"SparseMatrix, SparseMatrix":function(e,t){return c(e,t,m)},"SparseMatrix, DenseMatrix":function(e,t){return u(t,e,m,!0)},"DenseMatrix, SparseMatrix":function(e,t){return u(e,t,m,!1)},"DenseMatrix, DenseMatrix":function(e,t){return l(e,t,m)},"Array, Array":function(e,t){return m(i(e),i(t)).valueOf()},"Array, Matrix":function(e,t){return m(i(e),t)},"Matrix, Array":function(e,t){return m(e,i(t))},"SparseMatrix, any":function(e,t){return f(e,t,m,!1)},"DenseMatrix, any":function(e,t){return p(e,t,m,!1)},"any, SparseMatrix":function(e,t){return f(t,e,m,!0)},"any, DenseMatrix":function(e,t){return p(t,e,m,!0)},"Array, any":function(e,t){return p(i(e),t,m,!1).valueOf()},"any, Array":function(e,t){return p(i(t),e,m,!0).valueOf()}});return m}),No=r(12),Oo=r.n(No),Mo="compareNatural",Eo=["typed","compare"],jo=Object(s.a)(Mo,Eo,function(e){var t=e.typed,a=e.compare,o=a.signatures["boolean,boolean"],s=t(Mo,{"any, any":function(e,t){var r,n=Object(ie.M)(e),i=Object(ie.M)(t);if(!("number"!==n&&"BigNumber"!==n&&"Fraction"!==n||"number"!==i&&"BigNumber"!==i&&"Fraction"!==i))return"0"!==(r=a(e,t)).toString()?0<r?1:-1:Oo()(n,i);if("Array"===n||"Matrix"===n||"Array"===i||"Matrix"===i)return 0!==(r=function e(t,r){if(Object(ie.H)(t)&&Object(ie.H)(r))return u(t.toJSON().values,r.toJSON().values);if(Object(ie.H)(t))return e(t.toArray(),r);if(Object(ie.H)(r))return e(t,r.toArray());if(Object(ie.n)(t))return e(t.toJSON().data,r);if(Object(ie.n)(r))return e(t,r.toJSON().data);if(!Array.isArray(t))return e([t],r);if(!Array.isArray(r))return e(t,[r]);return u(t,r)}(e,t))?r:Oo()(n,i);if(n!==i)return Oo()(n,i);if("Complex"===n)return function(e,t){if(e.re>t.re)return 1;if(e.re<t.re)return-1;if(e.im>t.im)return 1;if(e.im<t.im)return-1;return 0}(e,t);if("Unit"===n)return e.equalBase(t)?s(e.value,t.value):u(e.formatUnits(),t.formatUnits());if("boolean"===n)return o(e,t);if("string"===n)return Oo()(e,t);if("Object"===n)return function(e,t){var r=Object.keys(e),n=Object.keys(t);r.sort(Oo.a),n.sort(Oo.a);var i=u(r,n);if(0!==i)return i;for(var a=0;a<r.length;a++){var o=s(e[r[a]],t[n[a]]);if(0!==o)return o}return 0}(e,t);if("null"===n)return 0;if("undefined"===n)return 0;throw new TypeError('Unsupported type of value "'+n+'"')}});function u(e,t){for(var r=0,n=Math.min(e.length,t.length);r<n;r++){var i=s(e[r],t[r]);if(0!==i)return i}return e.length>t.length?1:e.length<t.length?-1:0}return s});var So="compareText",Ao=["typed","matrix"],Co=Object(s.a)(So,Ao,function(e){var t=e.typed,r=e.matrix,n=Xt({typed:t}),i=Kt({typed:t}),a=t(So,{"any, any":J.a,"DenseMatrix, DenseMatrix":function(e,t){return n(e,t,J.a)},"Array, Array":function(e,t){return a(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return a(r(e),t)},"Matrix, Array":function(e,t){return a(e,r(t))},"DenseMatrix, any":function(e,t){return i(e,t,J.a,!1)},"any, DenseMatrix":function(e,t){return i(t,e,J.a,!0)},"Array, any":function(e,t){return i(r(e),t,J.a,!1).valueOf()},"any, Array":function(e,t){return i(r(t),e,J.a,!0).valueOf()}});return a}),To="equal",_o=["typed","matrix","equalScalar","DenseMatrix"],Io=Object(s.a)(To,_o,function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.DenseMatrix,a=dr({typed:t}),o=gn({typed:t,DenseMatrix:i}),s=br({typed:t,DenseMatrix:i}),u=Xt({typed:t}),c=Kt({typed:t}),f=t(To,{"any, any":function(e,t){return null===e?null===t:null===t?null===e:void 0===e?void 0===t:void 0===t?void 0===e:n(e,t)},"SparseMatrix, SparseMatrix":function(e,t){return o(e,t,n)},"SparseMatrix, DenseMatrix":function(e,t){return a(t,e,n,!0)},"DenseMatrix, SparseMatrix":function(e,t){return a(e,t,n,!1)},"DenseMatrix, DenseMatrix":function(e,t){return u(e,t,n)},"Array, Array":function(e,t){return f(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return f(r(e),t)},"Matrix, Array":function(e,t){return f(e,r(t))},"SparseMatrix, any":function(e,t){return s(e,t,n,!1)},"DenseMatrix, any":function(e,t){return c(e,t,n,!1)},"any, SparseMatrix":function(e,t){return s(t,e,n,!0)},"any, DenseMatrix":function(e,t){return c(t,e,n,!0)},"Array, any":function(e,t){return c(r(e),t,n,!1).valueOf()},"any, Array":function(e,t){return c(r(t),e,n,!0).valueOf()}});return f}),Bo=(Object(s.a)(To,["typed","equalScalar"],function(e){var t=e.typed,r=e.equalScalar;return t(To,{"any, any":function(e,t){return null===e?null===t:null===t?null===e:void 0===e?void 0===t:void 0===t?void 0===e:r(e,t)}})}),"equalText"),qo=["typed","compareText","isZero"],ko=Object(s.a)(Bo,qo,function(e){var t=e.typed,r=e.compareText,n=e.isZero;return t(Bo,{"any, any":function(e,t){return n(r(e,t))}})}),zo="smaller",Do=["typed","config","matrix","DenseMatrix"],Ro=Object(s.a)(zo,Do,function(e){var t=e.typed,r=e.config,n=e.matrix,i=e.DenseMatrix,a=dr({typed:t}),o=gn({typed:t,DenseMatrix:i}),s=br({typed:t,DenseMatrix:i}),u=Xt({typed:t}),c=Kt({typed:t}),f=t(zo,{"boolean, boolean":function(e,t){return e<t},"number, number":function(e,t){return e<t&&!Object(j.m)(e,t,r.epsilon)},"BigNumber, BigNumber":function(e,t){return e.lt(t)&&!Ne(e,t,r.epsilon)},"Fraction, Fraction":function(e,t){return-1===e.compare(t)},"Complex, Complex":function(e,t){throw new TypeError("No ordering relation is defined for complex numbers")},"Unit, Unit":function(e,t){if(!e.equalBase(t))throw new Error("Cannot compare units with different base");return f(e.value,t.value)},"SparseMatrix, SparseMatrix":function(e,t){return o(e,t,f)},"SparseMatrix, DenseMatrix":function(e,t){return a(t,e,f,!0)},"DenseMatrix, SparseMatrix":function(e,t){return a(e,t,f,!1)},"DenseMatrix, DenseMatrix":function(e,t){return u(e,t,f)},"Array, Array":function(e,t){return f(n(e),n(t)).valueOf()},"Array, Matrix":function(e,t){return f(n(e),t)},"Matrix, Array":function(e,t){return f(e,n(t))},"SparseMatrix, any":function(e,t){return s(e,t,f,!1)},"DenseMatrix, any":function(e,t){return c(e,t,f,!1)},"any, SparseMatrix":function(e,t){return s(t,e,f,!0)},"any, DenseMatrix":function(e,t){return c(t,e,f,!0)},"Array, any":function(e,t){return c(n(e),t,f,!1).valueOf()},"any, Array":function(e,t){return c(n(t),e,f,!0).valueOf()}});return f}),Po="smallerEq",Fo=["typed","config","matrix","DenseMatrix"],Uo=Object(s.a)(Po,Fo,function(e){var t=e.typed,r=e.config,n=e.matrix,i=e.DenseMatrix,a=dr({typed:t}),o=gn({typed:t,DenseMatrix:i}),s=br({typed:t,DenseMatrix:i}),u=Xt({typed:t}),c=Kt({typed:t}),f=t(Po,{"boolean, boolean":function(e,t){return e<=t},"number, number":function(e,t){return e<=t||Object(j.m)(e,t,r.epsilon)},"BigNumber, BigNumber":function(e,t){return e.lte(t)||Ne(e,t,r.epsilon)},"Fraction, Fraction":function(e,t){return 1!==e.compare(t)},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")},"Unit, Unit":function(e,t){if(!e.equalBase(t))throw new Error("Cannot compare units with different base");return f(e.value,t.value)},"SparseMatrix, SparseMatrix":function(e,t){return o(e,t,f)},"SparseMatrix, DenseMatrix":function(e,t){return a(t,e,f,!0)},"DenseMatrix, SparseMatrix":function(e,t){return a(e,t,f,!1)},"DenseMatrix, DenseMatrix":function(e,t){return u(e,t,f)},"Array, Array":function(e,t){return f(n(e),n(t)).valueOf()},"Array, Matrix":function(e,t){return f(n(e),t)},"Matrix, Array":function(e,t){return f(e,n(t))},"SparseMatrix, any":function(e,t){return s(e,t,f,!1)},"DenseMatrix, any":function(e,t){return c(e,t,f,!1)},"any, SparseMatrix":function(e,t){return s(t,e,f,!0)},"any, DenseMatrix":function(e,t){return c(t,e,f,!0)},"Array, any":function(e,t){return c(n(e),t,f,!1).valueOf()},"any, Array":function(e,t){return c(n(t),e,f,!0).valueOf()}});return f}),Lo="larger",Ho=["typed","config","matrix","DenseMatrix"],$o=Object(s.a)(Lo,Ho,function(e){var t=e.typed,r=e.config,n=e.matrix,i=e.DenseMatrix,a=dr({typed:t}),o=gn({typed:t,DenseMatrix:i}),s=br({typed:t,DenseMatrix:i}),u=Xt({typed:t}),c=Kt({typed:t}),f=t(Lo,{"boolean, boolean":function(e,t){return t<e},"number, number":function(e,t){return t<e&&!Object(j.m)(e,t,r.epsilon)},"BigNumber, BigNumber":function(e,t){return e.gt(t)&&!Ne(e,t,r.epsilon)},"Fraction, Fraction":function(e,t){return 1===e.compare(t)},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")},"Unit, Unit":function(e,t){if(!e.equalBase(t))throw new Error("Cannot compare units with different base");return f(e.value,t.value)},"SparseMatrix, SparseMatrix":function(e,t){return o(e,t,f)},"SparseMatrix, DenseMatrix":function(e,t){return a(t,e,f,!0)},"DenseMatrix, SparseMatrix":function(e,t){return a(e,t,f,!1)},"DenseMatrix, DenseMatrix":function(e,t){return u(e,t,f)},"Array, Array":function(e,t){return f(n(e),n(t)).valueOf()},"Array, Matrix":function(e,t){return f(n(e),t)},"Matrix, Array":function(e,t){return f(e,n(t))},"SparseMatrix, any":function(e,t){return s(e,t,f,!1)},"DenseMatrix, any":function(e,t){return c(e,t,f,!1)},"any, SparseMatrix":function(e,t){return s(t,e,f,!0)},"any, DenseMatrix":function(e,t){return c(t,e,f,!0)},"Array, any":function(e,t){return c(n(e),t,f,!1).valueOf()},"any, Array":function(e,t){return c(n(t),e,f,!0).valueOf()}});return f}),Go="largerEq",Zo=["typed","config","matrix","DenseMatrix"],Vo=Object(s.a)(Go,Zo,function(e){var t=e.typed,r=e.config,n=e.matrix,i=e.DenseMatrix,a=dr({typed:t}),o=gn({typed:t,DenseMatrix:i}),s=br({typed:t,DenseMatrix:i}),u=Xt({typed:t}),c=Kt({typed:t}),f=t(Go,{"boolean, boolean":function(e,t){return t<=e},"number, number":function(e,t){return t<=e||Object(j.m)(e,t,r.epsilon)},"BigNumber, BigNumber":function(e,t){return e.gte(t)||Ne(e,t,r.epsilon)},"Fraction, Fraction":function(e,t){return-1!==e.compare(t)},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")},"Unit, Unit":function(e,t){if(!e.equalBase(t))throw new Error("Cannot compare units with different base");return f(e.value,t.value)},"SparseMatrix, SparseMatrix":function(e,t){return o(e,t,f)},"SparseMatrix, DenseMatrix":function(e,t){return a(t,e,f,!0)},"DenseMatrix, SparseMatrix":function(e,t){return a(e,t,f,!1)},"DenseMatrix, DenseMatrix":function(e,t){return u(e,t,f)},"Array, Array":function(e,t){return f(n(e),n(t)).valueOf()},"Array, Matrix":function(e,t){return f(n(e),t)},"Matrix, Array":function(e,t){return f(e,n(t))},"SparseMatrix, any":function(e,t){return s(e,t,f,!1)},"DenseMatrix, any":function(e,t){return c(e,t,f,!1)},"any, SparseMatrix":function(e,t){return s(t,e,f,!0)},"any, DenseMatrix":function(e,t){return c(t,e,f,!0)},"Array, any":function(e,t){return c(n(e),t,f,!1).valueOf()},"any, Array":function(e,t){return c(n(t),e,f,!0).valueOf()}});return f}),Jo="deepEqual",Wo=["typed","equal"],Yo=Object(s.a)(Jo,Wo,function(e){var t=e.typed,a=e.equal;return t(Jo,{"any, any":function(e,t){return function e(t,r){{if(Array.isArray(t)){if(Array.isArray(r)){var n=t.length;if(n!==r.length)return!1;for(var i=0;i<n;i++)if(!e(t[i],r[i]))return!1;return!0}return!1}return!Array.isArray(r)&&a(t,r)}}(e.valueOf(),t.valueOf())}})}),Xo="unequal",Qo=["typed","config","equalScalar","matrix","DenseMatrix"],Ko=Object(s.a)(Xo,Qo,function(e){var t=e.typed,r=(e.config,e.equalScalar),n=e.matrix,i=e.DenseMatrix,a=dr({typed:t}),o=gn({typed:t,DenseMatrix:i}),s=br({typed:t,DenseMatrix:i}),u=Xt({typed:t}),c=Kt({typed:t}),f=t("unequal",{"any, any":function(e,t){return null===e?null!==t:null===t?null!==e:void 0===e?void 0!==t:void 0===t?void 0!==e:l(e,t)},"SparseMatrix, SparseMatrix":function(e,t){return o(e,t,l)},"SparseMatrix, DenseMatrix":function(e,t){return a(t,e,l,!0)},"DenseMatrix, SparseMatrix":function(e,t){return a(e,t,l,!1)},"DenseMatrix, DenseMatrix":function(e,t){return u(e,t,l)},"Array, Array":function(e,t){return f(n(e),n(t)).valueOf()},"Array, Matrix":function(e,t){return f(n(e),t)},"Matrix, Array":function(e,t){return f(e,n(t))},"SparseMatrix, any":function(e,t){return s(e,t,l,!1)},"DenseMatrix, any":function(e,t){return c(e,t,l,!1)},"any, SparseMatrix":function(e,t){return s(t,e,l,!0)},"any, DenseMatrix":function(e,t){return c(t,e,l,!0)},"Array, any":function(e,t){return c(n(e),t,l,!1).valueOf()},"any, Array":function(e,t){return c(n(t),e,l,!0).valueOf()}});function l(e,t){return!r(e,t)}return f}),es=(Object(s.a)(Xo,["typed","equalScalar"],function(e){var t=e.typed,r=e.equalScalar;return t(Xo,{"any, any":function(e,t){return null===e?null!==t:null===t?null!==e:void 0===e?void 0!==t:void 0===t?void 0!==e:!r(e,t)}})}),"partitionSelect"),ts=["typed","isNumeric","isNaN","compare"],rs=Object(s.a)(es,ts,function(e){function n(e,t){return-r(e,t)}var t=e.typed,f=e.isNumeric,l=e.isNaN,r=e.compare,i=r;return t(es,{"Array | Matrix, number":function(e,t){return a(e,t,i)},"Array | Matrix, number, string":function(e,t,r){if("asc"===r)return a(e,t,i);if("desc"===r)return a(e,t,n);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":a});function a(e,t,r){if(!Object(j.i)(t)||t<0)throw new Error("k must be a non-negative integer");if(Object(ie.v)(e)){if(1<e.size().length)throw new Error("Only one dimensional matrices supported");return o(e.valueOf(),t,r)}if(Array.isArray(e))return o(e,t,r)}function o(e,t,r){if(t>=e.length)throw new Error("k out of bounds");for(var n=0;n<e.length;n++)if(f(e[n])&&l(e[n]))return e[n];for(var i=0,a=e.length-1;i<a;){for(var o=i,s=a,u=e[Math.floor(Math.random()*(a-i+1))+i];o<s;)if(0<=r(e[o],u)){var c=e[s];e[s]=e[o],e[o]=c,--s}else++o;0<r(e[o],u)&&--o,t<=o?a=o:i=o+1}return e[t]}}),ns=["typed","matrix","compare","compareNatural"],is=Object(s.a)("sort",ns,function(e){function t(e,t){return-i(e,t)}var r=e.typed,n=e.matrix,i=e.compare,a=e.compareNatural,o=i;return r("sort",{Array:function(e){return u(e),e.sort(o)},Matrix:function(e){return c(e),n(e.toArray().sort(o),e.storage())},"Array, function":function(e,t){return u(e),e.sort(t)},"Matrix, function":function(e,t){return c(e),n(e.toArray().sort(t),e.storage())},"Array, string":function(e,t){return u(e),e.sort(s(t))},"Matrix, string":function(e,t){return c(e),n(e.toArray().sort(s(t)),e.storage())}});function s(e){if("asc"===e)return o;if("desc"===e)return t;if("natural"===e)return a;throw new Error('String "asc", "desc", or "natural" expected')}function u(e){if(1!==Object(I.a)(e).length)throw new Error("One dimensional array expected")}function c(e){if(1!==e.size().length)throw new Error("One dimensional matrix expected")}}),as=["typed","larger"],os=Object(s.a)("max",as,function(e){var t=e.typed,n=e.larger;return t("max",{"Array | Matrix":i,"Array | Matrix, number | BigNumber":function(e,t){return U(e,t.valueOf(),r)},"...":function(e){if(P(e))throw new TypeError("Scalar values expected in function max");return i(e)}});function r(e,t){try{return n(e,t)?e:t}catch(e){throw da(e,"max",t)}}function i(e){var r;if(F(e,function(t){try{isNaN(t)&&"number"==typeof t?r=NaN:void 0!==r&&!n(t,r)||(r=t)}catch(e){throw da(e,"max",t)}}),void 0===r)throw new Error("Cannot calculate max of an empty array");return r}}),ss=["typed","smaller"],us=Object(s.a)("min",ss,function(e){var t=e.typed,n=e.smaller;return t("min",{"Array | Matrix":i,"Array | Matrix, number | BigNumber":function(e,t){return U(e,t.valueOf(),r)},"...":function(e){if(P(e))throw new TypeError("Scalar values expected in function min");return i(e)}});function r(e,t){try{return n(e,t)?e:t}catch(e){throw da(e,"min",t)}}function i(e){var r;if(F(e,function(t){try{isNaN(t)&&"number"==typeof t?r=NaN:void 0!==r&&!n(t,r)||(r=t)}catch(e){throw da(e,"min",t)}}),void 0===r)throw new Error("Cannot calculate min of an empty array");return r}}),cs=["smaller","DenseMatrix"],fs=Object(s.a)("ImmutableDenseMatrix",cs,function(e){var r=e.smaller,n=e.DenseMatrix;function i(e,t){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(t&&!Object(ie.I)(t))throw new Error("Invalid datatype: "+t);if(Object(ie.v)(e)||Object(ie.b)(e)){var r=new n(e,t);this._data=r._data,this._size=r._size,this._datatype=r._datatype,this._min=null,this._max=null}else if(e&&Object(ie.b)(e.data)&&Object(ie.b)(e.size))this._data=e.data,this._size=e.size,this._datatype=e.datatype,this._min=void 0!==e.min?e.min:null,this._max=void 0!==e.max?e.max:null;else{if(e)throw new TypeError("Unsupported type of data ("+Object(ie.M)(e)+")");this._data=[],this._size=[0],this._datatype=t,this._min=null,this._max=null}}return(i.prototype=new n).type="ImmutableDenseMatrix",i.prototype.isImmutableDenseMatrix=!0,i.prototype.subset=function(e){switch(arguments.length){case 1:var t=n.prototype.subset.call(this,e);return Object(ie.v)(t)?new i({data:t._data,size:t._size,datatype:t._datatype}):t;case 2:case 3:throw new Error("Cannot invoke set subset on an Immutable Matrix instance");default:throw new SyntaxError("Wrong number of arguments")}},i.prototype.set=function(){throw new Error("Cannot invoke set on an Immutable Matrix instance")},i.prototype.resize=function(){throw new Error("Cannot invoke resize on an Immutable Matrix instance")},i.prototype.reshape=function(){throw new Error("Cannot invoke reshape on an Immutable Matrix instance")},i.prototype.clone=function(){return new i({data:Object(ae.a)(this._data),size:Object(ae.a)(this._size),datatype:this._datatype})},i.prototype.toJSON=function(){return{mathjs:"ImmutableDenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},i.fromJSON=function(e){return new i(e)},i.prototype.swapRows=function(){throw new Error("Cannot invoke swapRows on an Immutable Matrix instance")},i.prototype.min=function(){if(null===this._min){var t=null;this.forEach(function(e){null!==t&&!r(e,t)||(t=e)}),this._min=null!==t?t:void 0}return this._min},i.prototype.max=function(){if(null===this._max){var t=null;this.forEach(function(e){null!==t&&!r(t,e)||(t=e)}),this._max=null!==t?t:void 0}return this._max},i},{isClass:!0}),ls=["ImmutableDenseMatrix"],ps=Object(s.a)("Index",ls,function(e){var n=e.ImmutableDenseMatrix;function o(e){if(!(this instanceof o))throw new SyntaxError("Constructor must be called with the new operator");this._dimensions=[],this._isScalar=!0;for(var t=0,r=arguments.length;t<r;t++){var n=arguments[t];if(Object(ie.D)(n))this._dimensions.push(n),this._isScalar=!1;else if(Array.isArray(n)||Object(ie.v)(n)){var i=s(n.valueOf());this._dimensions.push(i);var a=i.size();1===a.length&&1===a[0]||(this._isScalar=!1)}else if("number"==typeof n)this._dimensions.push(s([n]));else{if("string"!=typeof n)throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");this._dimensions.push(n)}}}function s(e){for(var t=0,r=e.length;t<r;t++)if("number"!=typeof e[t]||!Object(j.i)(e[t]))throw new TypeError("Index parameters must be positive integer numbers");return new n(e)}return o.prototype.type="Index",o.prototype.isIndex=!0,o.prototype.clone=function(){var e=new o;return e._dimensions=Object(ae.a)(this._dimensions),e._isScalar=this._isScalar,e},o.create=function(e){var t=new o;return o.apply(t,e),t},o.prototype.size=function(){for(var e=[],t=0,r=this._dimensions.length;t<r;t++){var n=this._dimensions[t];e[t]="string"==typeof n?1:n.size()[0]}return e},o.prototype.max=function(){for(var e=[],t=0,r=this._dimensions.length;t<r;t++){var n=this._dimensions[t];e[t]="string"==typeof n?n:n.max()}return e},o.prototype.min=function(){for(var e=[],t=0,r=this._dimensions.length;t<r;t++){var n=this._dimensions[t];e[t]="string"==typeof n?n:n.min()}return e},o.prototype.forEach=function(e){for(var t=0,r=this._dimensions.length;t<r;t++)e(this._dimensions[t],t,this)},o.prototype.dimension=function(e){return this._dimensions[e]||null},o.prototype.isObjectProperty=function(){return 1===this._dimensions.length&&"string"==typeof this._dimensions[0]},o.prototype.getObjectProperty=function(){return this.isObjectProperty()?this._dimensions[0]:null},o.prototype.isScalar=function(){return this._isScalar},o.prototype.valueOf=o.prototype.toArray=function(){for(var e=[],t=0,r=this._dimensions.length;t<r;t++){var n=this._dimensions[t];e.push("string"==typeof n?n:n.toArray())}return e},o.prototype.toString=function(){for(var e=[],t=0,r=this._dimensions.length;t<r;t++){var n=this._dimensions[t];"string"==typeof n?e.push(JSON.stringify(n)):e.push(n.toString())}return"["+e.join(", ")+"]"},o.prototype.toJSON=function(){return{mathjs:"Index",dimensions:this._dimensions}},o.fromJSON=function(e){return o.create(e.dimensions)},o},{isClass:!0}),ms=["smaller","larger"],hs=Object(s.a)("FibonacciHeap",ms,function(e){var l=e.smaller,p=e.larger,m=1/Math.log((1+Math.sqrt(5))/2);function t(){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");this._minimum=null,this._size=0}function i(e,t,r){t.left.right=t.right,t.right.left=t.left,r.degree--,r.child===t&&(r.child=t.right),0===r.degree&&(r.child=null),t.left=e,t.right=e.right,((e.right=t).right.left=t).parent=null,t.mark=!1}t.prototype.type="FibonacciHeap",t.prototype.isFibonacciHeap=!0,t.prototype.insert=function(e,t){var r={key:e,value:t,degree:0};if(this._minimum){var n=this._minimum;r.left=n,r.right=n.right,(n.right=r).right.left=r,l(e,n.key)&&(this._minimum=r)}else(r.left=r).right=r,this._minimum=r;return this._size++,r},t.prototype.size=function(){return this._size},t.prototype.clear=function(){this._minimum=null,this._size=0},t.prototype.isEmpty=function(){return 0===this._size},t.prototype.extractMinimum=function(){var e=this._minimum;if(null===e)return e;for(var t=this._minimum,r=e.degree,n=e.child;0<r;){var i=n.right;n.left.right=n.right,n.right.left=n.left,n.left=t,n.right=t.right,((t.right=n).right.left=n).parent=null,n=i,r--}return e.left.right=e.right,e.right.left=e.left,t=e===e.right?null:function(e,t){var r,n=Math.floor(Math.log(t)*m)+1,i=new Array(n),a=0,o=e;if(o)for(a++,o=o.right;o!==e;)a++,o=o.right;for(;0<a;){for(var s=o.degree,u=o.right;r=i[s];){if(p(o.key,r.key)){var c=r;r=o,o=c}h(r,o),i[s]=null,s++}i[s]=o,o=u,a--}e=null;for(var f=0;f<n;f++)(r=i[f])&&(e?(r.left.right=r.right,r.right.left=r.left,r.left=e,r.right=e.right,(e.right=r).right.left=r,l(r.key,e.key)&&(e=r)):e=r);return e}(t=e.right,this._size),this._size--,this._minimum=t,e},t.prototype.remove=function(e){this._minimum=function(e,t,r){t.key=r;var n=t.parent;n&&l(t.key,n.key)&&(i(e,t,n),function e(t,r){var n=r.parent;if(!n)return;r.mark?(i(t,r,n),e(n)):r.mark=!0}(e,n));l(t.key,e.key)&&(e=t);return e}(this._minimum,e,-1),this.extractMinimum()};var h=function(e,t){e.left.right=e.right,e.right.left=e.left,(e.parent=t).child?(e.left=t.child,e.right=t.child.right,(t.child.right=e).right.left=e):((t.child=e).right=e).left=e,t.degree++,e.mark=!1};return t},{isClass:!0}),ds=["addScalar","equalScalar","FibonacciHeap"],ys=Object(s.a)("Spa",ds,function(e){var n=e.addScalar,c=e.equalScalar,t=e.FibonacciHeap;function r(){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this._values=[],this._heap=new t}return r.prototype.type="Spa",r.prototype.isSpa=!0,r.prototype.set=function(e,t){if(this._values[e])this._values[e].value=t;else{var r=this._heap.insert(e,t);this._values[e]=r}},r.prototype.get=function(e){var t=this._values[e];return t?t.value:0},r.prototype.accumulate=function(e,t){var r=this._values[e];r?r.value=n(r.value,t):(r=this._heap.insert(e,t),this._values[e]=r)},r.prototype.forEach=function(e,t,r){var n=this._heap,i=this._values,a=[],o=n.extractMinimum();for(o&&a.push(o);o&&o.key<=t;)o.key>=e&&(c(o.value,0)||r(o.key,o.value,this)),(o=n.extractMinimum())&&a.push(o);for(var s=0;s<a.length;s++){var u=a[s];i[(o=n.insert(u.key,u.value)).key]=o}},r.prototype.swap=function(e,t){var r=this._values[e],n=this._values[t];if(!r&&n)r=this._heap.insert(e,n.value),this._heap.remove(n),this._values[e]=r,this._values[t]=void 0;else if(r&&!n)n=this._heap.insert(t,r.value),this._heap.remove(r),this._values[t]=n,this._values[e]=void 0;else if(r&&n){var i=r.value;r.value=n.value,n.value=i}},r},{isClass:!0}),gs=Yn(function(e){return new e(1).exp()},ws),vs=Yn(function(e){return new e(1).plus(new e(5).sqrt()).div(2)},ws),bs=Yn(function(e){return e.acos(-1)},ws),xs=Yn(function(e){return bs(e).times(2)},ws);function ws(e){return e[0].precision}function Ns(e){return(Ns="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Os(){return(Os=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var Ms=["?on","config","addScalar","subtract","multiplyScalar","divideScalar","pow","abs","fix","round","equal","isNumeric","format","number","Complex","BigNumber","Fraction"],Es=Object(s.a)("Unit",Ms,function(e){var y,g,v,t=e.on,b=e.config,c=e.addScalar,f=e.subtract,l=e.multiplyScalar,p=e.divideScalar,m=e.pow,h=e.abs,d=e.fix,x=e.round,w=e.equal,i=e.isNumeric,s=e.format,r=e.number,n=e.Complex,N=e.BigNumber,O=e.Fraction,a=r;function M(e,t){if(!(this instanceof M))throw new Error("Constructor must be called with the new operator");if(null!=e&&!i(e)&&!Object(ie.j)(e))throw new TypeError("First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined");if(void 0!==t&&("string"!=typeof t||""===t))throw new TypeError("Second parameter in Unit constructor must be a string");if(void 0!==t){var r=M.parse(t);this.units=r.units,this.dimensions=r.dimensions}else{this.units=[{unit:z,prefix:I.NONE,power:0}],this.dimensions=[];for(var n=0;n<B.length;n++)this.dimensions[n]=0}this.value=null!=e?this._normalize(e):null,this.fixPrefix=!1,this.skipAutomaticSimplification=!0}function E(){for(;" "===v||"\t"===v;)j()}function o(e){return"0"<=e&&e<="9"}function j(){g++,v=y.charAt(g)}function u(e){g=e,v=y.charAt(g)}function S(){var e="",t=g;if("+"===v?j():"-"===v&&(e+=v,j()),!function(e){return"0"<=e&&e<="9"||"."===e}(v))return u(t),null;if("."===v){if(e+=v,j(),!o(v))return u(t),null}else{for(;o(v);)e+=v,j();"."===v&&(e+=v,j())}for(;o(v);)e+=v,j();if("E"===v||"e"===v){var r="",n=g;if(r+=v,j(),"+"!==v&&"-"!==v||(r+=v,j()),!o(v))return u(n),e;for(e+=r;o(v);)e+=v,j()}return e}function A(){for(var e="",t=y.charCodeAt(g);48<=t&&t<=57||65<=t&&t<=90||97<=t&&t<=122;)e+=v,j(),t=y.charCodeAt(g);return(65<=(t=e.charCodeAt(0))&&t<=90||97<=t&&t<=122)&&e||null}function C(e){return v===e?(j(),e):null}function T(e){if(Object(ae.f)(D,e)){var t=D[e];return{unit:t,prefix:t.prefixes[""]}}for(var r in D)if(Object(ae.f)(D,r)&&Object(J.b)(e,r)){var n=D[r],i=e.length-r.length,a=e.substring(0,i),o=Object(ae.f)(n.prefixes,a)?n.prefixes[a]:void 0;if(void 0!==o)return{unit:n,prefix:o}}return null}function _(e){return e.equalBase(q.NONE)&&null!==e.value&&!b.predictable?e.value:e}M.prototype.type="Unit",M.prototype.isUnit=!0,M.parse=function(e,t){if(t=t||{},g=-1,v="","string"!=typeof(y=e))throw new TypeError("Invalid argument in Unit.parse, string expected");var r=new M,n=1,i=!(r.units=[]);j(),E();var a=S(),o=null;if(a){if("BigNumber"===b.number)o=new N(a);else if("Fraction"===b.number)try{o=new O(a)}catch(e){o=parseFloat(a)}else o=parseFloat(a);E(),C("*")?(n=1,i=!0):C("/")&&(n=-1,i=!0)}for(var s=[],u=1;;){for(E();"("===v;)s.push(n),u*=n,n=1,j(),E();var c=void 0;if(!v)break;var f=v;if(null===(c=A()))throw new SyntaxError('Unexpected "'+f+'" in "'+y+'" at index '+g.toString());var l=T(c);if(null===l)throw new SyntaxError('Unit "'+c+'" not found.');var p=n*u;if(E(),C("^")){E();var m=S();if(null===m)throw new SyntaxError('In "'+e+'", "^" must be followed by a floating-point number');p*=m}r.units.push({unit:l.unit,prefix:l.prefix,power:p});for(var h=0;h<B.length;h++)r.dimensions[h]+=(l.unit.dimensions[h]||0)*p;for(E();")"===v;){if(0===s.length)throw new SyntaxError('Unmatched ")" in "'+y+'" at index '+g.toString());u/=s.pop(),j(),E()}if(i=!1,C("*")?(n=1,i=!0):C("/")?(n=-1,i=!0):n=1,l.unit.base){var d=l.unit.base.key;F.auto[d]={unit:l.unit,prefix:l.prefix}}}if(E(),v)throw new SyntaxError('Could not parse: "'+e+'"');if(i)throw new SyntaxError('Trailing characters: "'+e+'"');if(0!==s.length)throw new SyntaxError('Unmatched "(" in "'+y+'"');if(0===r.units.length&&!t.allowNoUnits)throw new SyntaxError('"'+e+'" contains no units');return r.value=void 0!==o?r._normalize(o):null,r},M.prototype.clone=function(){var e=new M;e.fixPrefix=this.fixPrefix,e.skipAutomaticSimplification=this.skipAutomaticSimplification,e.value=Object(ae.a)(this.value),e.dimensions=this.dimensions.slice(0),e.units=[];for(var t=0;t<this.units.length;t++)for(var r in e.units[t]={},this.units[t])Object(ae.f)(this.units[t],r)&&(e.units[t][r]=this.units[t][r]);return e},M.prototype._isDerived=function(){return 0!==this.units.length&&(1<this.units.length||1e-15<Math.abs(this.units[0].power-1))},M.prototype._normalize=function(e){var t,r,n,i,a;if(null==e||0===this.units.length)return e;if(this._isDerived()){var o=e;a=M._getNumberConverter(Object(ie.M)(e));for(var s=0;s<this.units.length;s++)t=a(this.units[s].unit.value),i=a(this.units[s].prefix.value),n=a(this.units[s].power),o=l(o,m(l(t,i),n));return o}return t=(a=M._getNumberConverter(Object(ie.M)(e)))(this.units[0].unit.value),r=a(this.units[0].unit.offset),i=a(this.units[0].prefix.value),l(c(e,r),l(t,i))},M.prototype._denormalize=function(e,t){var r,n,i,a,o;if(null==e||0===this.units.length)return e;if(this._isDerived()){var s=e;o=M._getNumberConverter(Object(ie.M)(e));for(var u=0;u<this.units.length;u++)r=o(this.units[u].unit.value),a=o(this.units[u].prefix.value),i=o(this.units[u].power),s=p(s,m(l(r,a),i));return s}return r=(o=M._getNumberConverter(Object(ie.M)(e)))(this.units[0].unit.value),a=o(this.units[0].prefix.value),n=o(this.units[0].unit.offset),f(p(p(e,r),null==t?a:t),n)},M.isValuelessUnit=function(e){return null!==T(e)},M.prototype.hasBase=function(e){if("string"==typeof e&&(e=q[e]),!e)return!1;for(var t=0;t<B.length;t++)if(1e-12<Math.abs((this.dimensions[t]||0)-(e.dimensions[t]||0)))return!1;return!0},M.prototype.equalBase=function(e){for(var t=0;t<B.length;t++)if(1e-12<Math.abs((this.dimensions[t]||0)-(e.dimensions[t]||0)))return!1;return!0},M.prototype.equals=function(e){return this.equalBase(e)&&w(this.value,e.value)},M.prototype.multiply=function(e){for(var t=this.clone(),r=0;r<B.length;r++)t.dimensions[r]=(this.dimensions[r]||0)+(e.dimensions[r]||0);for(var n=0;n<e.units.length;n++){var i={};for(var a in e.units[n])i[a]=e.units[n][a];t.units.push(i)}if(null!==this.value||null!==e.value){var o=null===this.value?this._normalize(1):this.value,s=null===e.value?e._normalize(1):e.value;t.value=l(o,s)}else t.value=null;return t.skipAutomaticSimplification=!1,_(t)},M.prototype.divide=function(e){for(var t=this.clone(),r=0;r<B.length;r++)t.dimensions[r]=(this.dimensions[r]||0)-(e.dimensions[r]||0);for(var n=0;n<e.units.length;n++){var i={};for(var a in e.units[n])i[a]=e.units[n][a];i.power=-i.power,t.units.push(i)}if(null!==this.value||null!==e.value){var o=null===this.value?this._normalize(1):this.value,s=null===e.value?e._normalize(1):e.value;t.value=p(o,s)}else t.value=null;return t.skipAutomaticSimplification=!1,_(t)},M.prototype.pow=function(e){for(var t=this.clone(),r=0;r<B.length;r++)t.dimensions[r]=(this.dimensions[r]||0)*e;for(var n=0;n<t.units.length;n++)t.units[n].power*=e;return null!==t.value?t.value=m(t.value,e):t.value=null,t.skipAutomaticSimplification=!1,_(t)},M.prototype.abs=function(){var e=this.clone();for(var t in e.value=null!==e.value?h(e.value):null,e.units)"VA"!==e.units[t].unit.name&&"VAR"!==e.units[t].unit.name||(e.units[t].unit=D.W);return e},M.prototype.to=function(e){var t,r=null===this.value?this._normalize(1):this.value;if("string"==typeof e){if(t=M.parse(e),!this.equalBase(t))throw new Error("Units do not match ('".concat(t.toString(),"' != '").concat(this.toString(),"')"));if(null!==t.value)throw new Error("Cannot convert to a unit with a value");return t.value=Object(ae.a)(r),t.fixPrefix=!0,t.skipAutomaticSimplification=!0,t}if(Object(ie.L)(e)){if(!this.equalBase(e))throw new Error("Units do not match ('".concat(e.toString(),"' != '").concat(this.toString(),"')"));if(null!==e.value)throw new Error("Cannot convert to a unit with a value");return(t=e.clone()).value=Object(ae.a)(r),t.fixPrefix=!0,t.skipAutomaticSimplification=!0,t}throw new Error("String or Unit expected as parameter")},M.prototype.toNumber=function(e){return a(this.toNumeric(e))},M.prototype.toNumeric=function(e){var t;return(t=e?this.to(e):this.clone())._isDerived()?t._denormalize(t.value):t._denormalize(t.value,t.units[0].prefix.value)},M.prototype.toString=function(){return this.format()},M.prototype.toJSON=function(){return{mathjs:"Unit",value:this._denormalize(this.value),unit:this.formatUnits(),fixPrefix:this.fixPrefix}},M.fromJSON=function(e){var t=new M(e.value,e.unit);return t.fixPrefix=e.fixPrefix||!1,t},M.prototype.valueOf=M.prototype.toString,M.prototype.simplify=function(){var e,t,r=this.clone(),n=[];for(var i in U)if(r.hasBase(q[i])){e=i;break}if("NONE"===e)r.units=[];else if(e&&Object(ae.f)(U,e)&&(t=U[e]),t)r.units=[{unit:t.unit,prefix:t.prefix,power:1}];else{for(var a=!1,o=0;o<B.length;o++){var s=B[o];1e-12<Math.abs(r.dimensions[o]||0)&&(Object(ae.f)(U,s)?n.push({unit:U[s].unit,prefix:U[s].prefix,power:r.dimensions[o]||0}):a=!0)}n.length<r.units.length&&!a&&(r.units=n)}return r},M.prototype.toSI=function(){for(var e=this.clone(),t=[],r=0;r<B.length;r++){var n=B[r];if(1e-12<Math.abs(e.dimensions[r]||0)){if(!Object(ae.f)(F.si,n))throw new Error("Cannot express custom unit "+n+" in SI units");t.push({unit:F.si[n].unit,prefix:F.si[n].prefix,power:e.dimensions[r]||0})}}return e.units=t,e.fixPrefix=!0,e.skipAutomaticSimplification=!0,e},M.prototype.formatUnits=function(){for(var e="",t="",r=0,n=0,i=0;i<this.units.length;i++)0<this.units[i].power?(r++,e+=" "+this.units[i].prefix.name+this.units[i].unit.name,1e-15<Math.abs(this.units[i].power-1)&&(e+="^"+this.units[i].power)):this.units[i].power<0&&n++;if(0<n)for(var a=0;a<this.units.length;a++)this.units[a].power<0&&(0<r?(t+=" "+this.units[a].prefix.name+this.units[a].unit.name,1e-15<Math.abs(this.units[a].power+1)&&(t+="^"+-this.units[a].power)):(t+=" "+this.units[a].prefix.name+this.units[a].unit.name,t+="^"+this.units[a].power));e=e.substr(1),t=t.substr(1),1<r&&0<n&&(e="("+e+")"),1<n&&0<r&&(t="("+t+")");var o=e;return 0<r&&0<n&&(o+=" / "),o+=t},M.prototype.format=function(e){var t=this.skipAutomaticSimplification||null===this.value?this.clone():this.simplify(),r=!1;for(var n in void 0!==t.value&&null!==t.value&&Object(ie.j)(t.value)&&(r=Math.abs(t.value.re)<1e-14),t.units)t.units[n].unit&&("VA"===t.units[n].unit.name&&r?t.units[n].unit=D.VAR:"VAR"!==t.units[n].unit.name||r||(t.units[n].unit=D.VA));1!==t.units.length||t.fixPrefix||Math.abs(t.units[0].power-Math.round(t.units[0].power))<1e-14&&(t.units[0].prefix=t._bestPrefix());var i=t._denormalize(t.value),a=null!==t.value?s(i,e||{}):"",o=t.formatUnits();return t.value&&Object(ie.j)(t.value)&&(a="("+a+")"),0<o.length&&0<a.length&&(a+=" "),a+=o},M.prototype._bestPrefix=function(){if(1!==this.units.length)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");if(1e-14<=Math.abs(this.units[0].power-Math.round(this.units[0].power)))throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");var e=null!==this.value?h(this.value):0,t=h(this.units[0].unit.value),r=this.units[0].prefix;if(0===e)return r;var n=this.units[0].power,i=Math.log(e/Math.pow(r.value*t,n))/Math.LN10-1.2;if(-2.200001<i&&i<1.800001)return r;i=Math.abs(i);var a=this.units[0].unit.prefixes;for(var o in a)if(Object(ae.f)(a,o)){var s=a[o];if(s.scientific){var u=Math.abs(Math.log(e/Math.pow(s.value*t,n))/Math.LN10-1.2);(u<i||u===i&&s.name.length<r.name.length)&&(r=s,i=u)}}return r};var I={NONE:{"":{name:"",value:1,scientific:!0}},SHORT:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:10,scientific:!(M.prototype.splitUnit=function(e){for(var t=this.clone(),r=[],n=0;n<e.length&&(t=t.to(e[n]),n!==e.length-1);n++){var i=t.toNumeric(),a=x(i),o=new M(w(a,i)?a:d(t.toNumeric()),e[n].toString());r.push(o),t=f(t,o)}for(var s=0,u=0;u<r.length;u++)s=c(s,r[u].value);return w(s,this.value)&&(t.value=0),r.push(t),r})},h:{name:"h",value:100,scientific:!1},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0},d:{name:"d",value:.1,scientific:!1},c:{name:"c",value:.01,scientific:!1},m:{name:"m",value:.001,scientific:!0},u:{name:"u",value:1e-6,scientific:!0},n:{name:"n",value:1e-9,scientific:!0},p:{name:"p",value:1e-12,scientific:!0},f:{name:"f",value:1e-15,scientific:!0},a:{name:"a",value:1e-18,scientific:!0},z:{name:"z",value:1e-21,scientific:!0},y:{name:"y",value:1e-24,scientific:!0}},LONG:{"":{name:"",value:1,scientific:!0},deca:{name:"deca",value:10,scientific:!1},hecto:{name:"hecto",value:100,scientific:!1},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0},deci:{name:"deci",value:.1,scientific:!1},centi:{name:"centi",value:.01,scientific:!1},milli:{name:"milli",value:.001,scientific:!0},micro:{name:"micro",value:1e-6,scientific:!0},nano:{name:"nano",value:1e-9,scientific:!0},pico:{name:"pico",value:1e-12,scientific:!0},femto:{name:"femto",value:1e-15,scientific:!0},atto:{name:"atto",value:1e-18,scientific:!0},zepto:{name:"zepto",value:1e-21,scientific:!0},yocto:{name:"yocto",value:1e-24,scientific:!0}},SQUARED:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:100,scientific:!1},h:{name:"h",value:1e4,scientific:!1},k:{name:"k",value:1e6,scientific:!0},M:{name:"M",value:1e12,scientific:!0},G:{name:"G",value:1e18,scientific:!0},T:{name:"T",value:1e24,scientific:!0},P:{name:"P",value:1e30,scientific:!0},E:{name:"E",value:1e36,scientific:!0},Z:{name:"Z",value:1e42,scientific:!0},Y:{name:"Y",value:1e48,scientific:!0},d:{name:"d",value:.01,scientific:!1},c:{name:"c",value:1e-4,scientific:!1},m:{name:"m",value:1e-6,scientific:!0},u:{name:"u",value:1e-12,scientific:!0},n:{name:"n",value:1e-18,scientific:!0},p:{name:"p",value:1e-24,scientific:!0},f:{name:"f",value:1e-30,scientific:!0},a:{name:"a",value:1e-36,scientific:!0},z:{name:"z",value:1e-42,scientific:!0},y:{name:"y",value:1e-48,scientific:!0}},CUBIC:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:1e3,scientific:!1},h:{name:"h",value:1e6,scientific:!1},k:{name:"k",value:1e9,scientific:!0},M:{name:"M",value:1e18,scientific:!0},G:{name:"G",value:1e27,scientific:!0},T:{name:"T",value:1e36,scientific:!0},P:{name:"P",value:1e45,scientific:!0},E:{name:"E",value:1e54,scientific:!0},Z:{name:"Z",value:1e63,scientific:!0},Y:{name:"Y",value:1e72,scientific:!0},d:{name:"d",value:.001,scientific:!1},c:{name:"c",value:1e-6,scientific:!1},m:{name:"m",value:1e-9,scientific:!0},u:{name:"u",value:1e-18,scientific:!0},n:{name:"n",value:1e-27,scientific:!0},p:{name:"p",value:1e-36,scientific:!0},f:{name:"f",value:1e-45,scientific:!0},a:{name:"a",value:1e-54,scientific:!0},z:{name:"z",value:1e-63,scientific:!0},y:{name:"y",value:1e-72,scientific:!0}},BINARY_SHORT_SI:{"":{name:"",value:1,scientific:!0},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0}},BINARY_SHORT_IEC:{"":{name:"",value:1,scientific:!0},Ki:{name:"Ki",value:1024,scientific:!0},Mi:{name:"Mi",value:Math.pow(1024,2),scientific:!0},Gi:{name:"Gi",value:Math.pow(1024,3),scientific:!0},Ti:{name:"Ti",value:Math.pow(1024,4),scientific:!0},Pi:{name:"Pi",value:Math.pow(1024,5),scientific:!0},Ei:{name:"Ei",value:Math.pow(1024,6),scientific:!0},Zi:{name:"Zi",value:Math.pow(1024,7),scientific:!0},Yi:{name:"Yi",value:Math.pow(1024,8),scientific:!0}},BINARY_LONG_SI:{"":{name:"",value:1,scientific:!0},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0}},BINARY_LONG_IEC:{"":{name:"",value:1,scientific:!0},kibi:{name:"kibi",value:1024,scientific:!0},mebi:{name:"mebi",value:Math.pow(1024,2),scientific:!0},gibi:{name:"gibi",value:Math.pow(1024,3),scientific:!0},tebi:{name:"tebi",value:Math.pow(1024,4),scientific:!0},pebi:{name:"pebi",value:Math.pow(1024,5),scientific:!0},exi:{name:"exi",value:Math.pow(1024,6),scientific:!0},zebi:{name:"zebi",value:Math.pow(1024,7),scientific:!0},yobi:{name:"yobi",value:Math.pow(1024,8),scientific:!0}},BTU:{"":{name:"",value:1,scientific:!0},MM:{name:"MM",value:1e6,scientific:!0}}};I.SHORTLONG=Os(I.SHORT,I.LONG),I.BINARY_SHORT=Os(I.BINARY_SHORT_SI,I.BINARY_SHORT_IEC),I.BINARY_LONG=Os(I.BINARY_LONG_SI,I.BINARY_LONG_IEC);var B=["MASS","LENGTH","TIME","CURRENT","TEMPERATURE","LUMINOUS_INTENSITY","AMOUNT_OF_SUBSTANCE","ANGLE","BIT"],q={NONE:{dimensions:[0,0,0,0,0,0,0,0,0]},MASS:{dimensions:[1,0,0,0,0,0,0,0,0]},LENGTH:{dimensions:[0,1,0,0,0,0,0,0,0]},TIME:{dimensions:[0,0,1,0,0,0,0,0,0]},CURRENT:{dimensions:[0,0,0,1,0,0,0,0,0]},TEMPERATURE:{dimensions:[0,0,0,0,1,0,0,0,0]},LUMINOUS_INTENSITY:{dimensions:[0,0,0,0,0,1,0,0,0]},AMOUNT_OF_SUBSTANCE:{dimensions:[0,0,0,0,0,0,1,0,0]},FORCE:{dimensions:[1,1,-2,0,0,0,0,0,0]},SURFACE:{dimensions:[0,2,0,0,0,0,0,0,0]},VOLUME:{dimensions:[0,3,0,0,0,0,0,0,0]},ENERGY:{dimensions:[1,2,-2,0,0,0,0,0,0]},POWER:{dimensions:[1,2,-3,0,0,0,0,0,0]},PRESSURE:{dimensions:[1,-1,-2,0,0,0,0,0,0]},ELECTRIC_CHARGE:{dimensions:[0,0,1,1,0,0,0,0,0]},ELECTRIC_CAPACITANCE:{dimensions:[-1,-2,4,2,0,0,0,0,0]},ELECTRIC_POTENTIAL:{dimensions:[1,2,-3,-1,0,0,0,0,0]},ELECTRIC_RESISTANCE:{dimensions:[1,2,-3,-2,0,0,0,0,0]},ELECTRIC_INDUCTANCE:{dimensions:[1,2,-2,-2,0,0,0,0,0]},ELECTRIC_CONDUCTANCE:{dimensions:[-1,-2,3,2,0,0,0,0,0]},MAGNETIC_FLUX:{dimensions:[1,2,-2,-1,0,0,0,0,0]},MAGNETIC_FLUX_DENSITY:{dimensions:[1,0,-2,-1,0,0,0,0,0]},FREQUENCY:{dimensions:[0,0,-1,0,0,0,0,0,0]},ANGLE:{dimensions:[0,0,0,0,0,0,0,1,0]},BIT:{dimensions:[0,0,0,0,0,0,0,0,1]}};for(var k in q)q[k].key=k;var z={name:"",base:{},value:1,offset:0,dimensions:B.map(function(e){return 0})},D={meter:{name:"meter",base:q.LENGTH,prefixes:I.LONG,value:1,offset:0},inch:{name:"inch",base:q.LENGTH,prefixes:I.NONE,value:.0254,offset:0},foot:{name:"foot",base:q.LENGTH,prefixes:I.NONE,value:.3048,offset:0},yard:{name:"yard",base:q.LENGTH,prefixes:I.NONE,value:.9144,offset:0},mile:{name:"mile",base:q.LENGTH,prefixes:I.NONE,value:1609.344,offset:0},link:{name:"link",base:q.LENGTH,prefixes:I.NONE,value:.201168,offset:0},rod:{name:"rod",base:q.LENGTH,prefixes:I.NONE,value:5.0292,offset:0},chain:{name:"chain",base:q.LENGTH,prefixes:I.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:q.LENGTH,prefixes:I.NONE,value:1e-10,offset:0},m:{name:"m",base:q.LENGTH,prefixes:I.SHORT,value:1,offset:0},in:{name:"in",base:q.LENGTH,prefixes:I.NONE,value:.0254,offset:0},ft:{name:"ft",base:q.LENGTH,prefixes:I.NONE,value:.3048,offset:0},yd:{name:"yd",base:q.LENGTH,prefixes:I.NONE,value:.9144,offset:0},mi:{name:"mi",base:q.LENGTH,prefixes:I.NONE,value:1609.344,offset:0},li:{name:"li",base:q.LENGTH,prefixes:I.NONE,value:.201168,offset:0},rd:{name:"rd",base:q.LENGTH,prefixes:I.NONE,value:5.02921,offset:0},ch:{name:"ch",base:q.LENGTH,prefixes:I.NONE,value:20.1168,offset:0},mil:{name:"mil",base:q.LENGTH,prefixes:I.NONE,value:254e-7,offset:0},m2:{name:"m2",base:q.SURFACE,prefixes:I.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:q.SURFACE,prefixes:I.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:q.SURFACE,prefixes:I.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:q.SURFACE,prefixes:I.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:q.SURFACE,prefixes:I.NONE,value:2589988.110336,offset:0},sqrd:{name:"sqrd",base:q.SURFACE,prefixes:I.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:q.SURFACE,prefixes:I.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:q.SURFACE,prefixes:I.NONE,value:6.4516e-10,offset:0},acre:{name:"acre",base:q.SURFACE,prefixes:I.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:q.SURFACE,prefixes:I.NONE,value:1e4,offset:0},m3:{name:"m3",base:q.VOLUME,prefixes:I.CUBIC,value:1,offset:0},L:{name:"L",base:q.VOLUME,prefixes:I.SHORT,value:.001,offset:0},l:{name:"l",base:q.VOLUME,prefixes:I.SHORT,value:.001,offset:0},litre:{name:"litre",base:q.VOLUME,prefixes:I.LONG,value:.001,offset:0},cuin:{name:"cuin",base:q.VOLUME,prefixes:I.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:q.VOLUME,prefixes:I.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:q.VOLUME,prefixes:I.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:q.VOLUME,prefixes:I.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:q.VOLUME,prefixes:I.NONE,value:15e-6,offset:0},drop:{name:"drop",base:q.VOLUME,prefixes:I.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:q.VOLUME,prefixes:I.NONE,value:5e-8,offset:0},minim:{name:"minim",base:q.VOLUME,prefixes:I.NONE,value:6.161152e-8,offset:0},fluiddram:{name:"fluiddram",base:q.VOLUME,prefixes:I.NONE,value:36966911e-13,offset:0},fluidounce:{name:"fluidounce",base:q.VOLUME,prefixes:I.NONE,value:2957353e-11,offset:0},gill:{name:"gill",base:q.VOLUME,prefixes:I.NONE,value:.0001182941,offset:0},cc:{name:"cc",base:q.VOLUME,prefixes:I.NONE,value:1e-6,offset:0},cup:{name:"cup",base:q.VOLUME,prefixes:I.NONE,value:.0002365882,offset:0},pint:{name:"pint",base:q.VOLUME,prefixes:I.NONE,value:.0004731765,offset:0},quart:{name:"quart",base:q.VOLUME,prefixes:I.NONE,value:.0009463529,offset:0},gallon:{name:"gallon",base:q.VOLUME,prefixes:I.NONE,value:.003785412,offset:0},beerbarrel:{name:"beerbarrel",base:q.VOLUME,prefixes:I.NONE,value:.1173478,offset:0},oilbarrel:{name:"oilbarrel",base:q.VOLUME,prefixes:I.NONE,value:.1589873,offset:0},hogshead:{name:"hogshead",base:q.VOLUME,prefixes:I.NONE,value:.238481,offset:0},fldr:{name:"fldr",base:q.VOLUME,prefixes:I.NONE,value:36966911e-13,offset:0},floz:{name:"floz",base:q.VOLUME,prefixes:I.NONE,value:2957353e-11,offset:0},gi:{name:"gi",base:q.VOLUME,prefixes:I.NONE,value:.0001182941,offset:0},cp:{name:"cp",base:q.VOLUME,prefixes:I.NONE,value:.0002365882,offset:0},pt:{name:"pt",base:q.VOLUME,prefixes:I.NONE,value:.0004731765,offset:0},qt:{name:"qt",base:q.VOLUME,prefixes:I.NONE,value:.0009463529,offset:0},gal:{name:"gal",base:q.VOLUME,prefixes:I.NONE,value:.003785412,offset:0},bbl:{name:"bbl",base:q.VOLUME,prefixes:I.NONE,value:.1173478,offset:0},obl:{name:"obl",base:q.VOLUME,prefixes:I.NONE,value:.1589873,offset:0},g:{name:"g",base:q.MASS,prefixes:I.SHORT,value:.001,offset:0},gram:{name:"gram",base:q.MASS,prefixes:I.LONG,value:.001,offset:0},ton:{name:"ton",base:q.MASS,prefixes:I.SHORT,value:907.18474,offset:0},t:{name:"t",base:q.MASS,prefixes:I.SHORT,value:1e3,offset:0},tonne:{name:"tonne",base:q.MASS,prefixes:I.LONG,value:1e3,offset:0},grain:{name:"grain",base:q.MASS,prefixes:I.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:q.MASS,prefixes:I.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:q.MASS,prefixes:I.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:q.MASS,prefixes:I.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:q.MASS,prefixes:I.NONE,value:45.359237,offset:0},stick:{name:"stick",base:q.MASS,prefixes:I.NONE,value:.115,offset:0},stone:{name:"stone",base:q.MASS,prefixes:I.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:q.MASS,prefixes:I.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:q.MASS,prefixes:I.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:q.MASS,prefixes:I.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:q.MASS,prefixes:I.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:q.MASS,prefixes:I.NONE,value:45.359237,offset:0},s:{name:"s",base:q.TIME,prefixes:I.SHORT,value:1,offset:0},min:{name:"min",base:q.TIME,prefixes:I.NONE,value:60,offset:0},h:{name:"h",base:q.TIME,prefixes:I.NONE,value:3600,offset:0},second:{name:"second",base:q.TIME,prefixes:I.LONG,value:1,offset:0},sec:{name:"sec",base:q.TIME,prefixes:I.LONG,value:1,offset:0},minute:{name:"minute",base:q.TIME,prefixes:I.NONE,value:60,offset:0},hour:{name:"hour",base:q.TIME,prefixes:I.NONE,value:3600,offset:0},day:{name:"day",base:q.TIME,prefixes:I.NONE,value:86400,offset:0},week:{name:"week",base:q.TIME,prefixes:I.NONE,value:604800,offset:0},month:{name:"month",base:q.TIME,prefixes:I.NONE,value:2629800,offset:0},year:{name:"year",base:q.TIME,prefixes:I.NONE,value:31557600,offset:0},decade:{name:"decade",base:q.TIME,prefixes:I.NONE,value:315576e3,offset:0},century:{name:"century",base:q.TIME,prefixes:I.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:q.TIME,prefixes:I.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:q.FREQUENCY,prefixes:I.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:q.FREQUENCY,prefixes:I.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:q.ANGLE,prefixes:I.SHORT,value:1,offset:0},radian:{name:"radian",base:q.ANGLE,prefixes:I.LONG,value:1,offset:0},deg:{name:"deg",base:q.ANGLE,prefixes:I.SHORT,value:null,offset:0},degree:{name:"degree",base:q.ANGLE,prefixes:I.LONG,value:null,offset:0},grad:{name:"grad",base:q.ANGLE,prefixes:I.SHORT,value:null,offset:0},gradian:{name:"gradian",base:q.ANGLE,prefixes:I.LONG,value:null,offset:0},cycle:{name:"cycle",base:q.ANGLE,prefixes:I.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:q.ANGLE,prefixes:I.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:q.ANGLE,prefixes:I.NONE,value:null,offset:0},A:{name:"A",base:q.CURRENT,prefixes:I.SHORT,value:1,offset:0},ampere:{name:"ampere",base:q.CURRENT,prefixes:I.LONG,value:1,offset:0},K:{name:"K",base:q.TEMPERATURE,prefixes:I.NONE,value:1,offset:0},degC:{name:"degC",base:q.TEMPERATURE,prefixes:I.NONE,value:1,offset:273.15},degF:{name:"degF",base:q.TEMPERATURE,prefixes:I.NONE,value:1/1.8,offset:459.67},degR:{name:"degR",base:q.TEMPERATURE,prefixes:I.NONE,value:1/1.8,offset:0},kelvin:{name:"kelvin",base:q.TEMPERATURE,prefixes:I.NONE,value:1,offset:0},celsius:{name:"celsius",base:q.TEMPERATURE,prefixes:I.NONE,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:q.TEMPERATURE,prefixes:I.NONE,value:1/1.8,offset:459.67},rankine:{name:"rankine",base:q.TEMPERATURE,prefixes:I.NONE,value:1/1.8,offset:0},mol:{name:"mol",base:q.AMOUNT_OF_SUBSTANCE,prefixes:I.SHORT,value:1,offset:0},mole:{name:"mole",base:q.AMOUNT_OF_SUBSTANCE,prefixes:I.LONG,value:1,offset:0},cd:{name:"cd",base:q.LUMINOUS_INTENSITY,prefixes:I.SHORT,value:1,offset:0},candela:{name:"candela",base:q.LUMINOUS_INTENSITY,prefixes:I.LONG,value:1,offset:0},N:{name:"N",base:q.FORCE,prefixes:I.SHORT,value:1,offset:0},newton:{name:"newton",base:q.FORCE,prefixes:I.LONG,value:1,offset:0},dyn:{name:"dyn",base:q.FORCE,prefixes:I.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:q.FORCE,prefixes:I.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:q.FORCE,prefixes:I.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:q.FORCE,prefixes:I.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:q.FORCE,prefixes:I.LONG,value:4448.2216,offset:0},J:{name:"J",base:q.ENERGY,prefixes:I.SHORT,value:1,offset:0},joule:{name:"joule",base:q.ENERGY,prefixes:I.SHORT,value:1,offset:0},erg:{name:"erg",base:q.ENERGY,prefixes:I.NONE,value:1e-7,offset:0},Wh:{name:"Wh",base:q.ENERGY,prefixes:I.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:q.ENERGY,prefixes:I.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:q.ENERGY,prefixes:I.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:"electronvolt",base:q.ENERGY,prefixes:I.LONG,value:1602176565e-28,offset:0},W:{name:"W",base:q.POWER,prefixes:I.SHORT,value:1,offset:0},watt:{name:"watt",base:q.POWER,prefixes:I.LONG,value:1,offset:0},hp:{name:"hp",base:q.POWER,prefixes:I.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:q.POWER,prefixes:I.SHORT,value:n.I,offset:0},VA:{name:"VA",base:q.POWER,prefixes:I.SHORT,value:1,offset:0},Pa:{name:"Pa",base:q.PRESSURE,prefixes:I.SHORT,value:1,offset:0},psi:{name:"psi",base:q.PRESSURE,prefixes:I.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:q.PRESSURE,prefixes:I.NONE,value:101325,offset:0},bar:{name:"bar",base:q.PRESSURE,prefixes:I.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:q.PRESSURE,prefixes:I.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:q.PRESSURE,prefixes:I.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:q.PRESSURE,prefixes:I.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:q.PRESSURE,prefixes:I.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:q.ELECTRIC_CHARGE,prefixes:I.LONG,value:1,offset:0},C:{name:"C",base:q.ELECTRIC_CHARGE,prefixes:I.SHORT,value:1,offset:0},farad:{name:"farad",base:q.ELECTRIC_CAPACITANCE,prefixes:I.LONG,value:1,offset:0},F:{name:"F",base:q.ELECTRIC_CAPACITANCE,prefixes:I.SHORT,value:1,offset:0},volt:{name:"volt",base:q.ELECTRIC_POTENTIAL,prefixes:I.LONG,value:1,offset:0},V:{name:"V",base:q.ELECTRIC_POTENTIAL,prefixes:I.SHORT,value:1,offset:0},ohm:{name:"ohm",base:q.ELECTRIC_RESISTANCE,prefixes:I.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:q.ELECTRIC_INDUCTANCE,prefixes:I.LONG,value:1,offset:0},H:{name:"H",base:q.ELECTRIC_INDUCTANCE,prefixes:I.SHORT,value:1,offset:0},siemens:{name:"siemens",base:q.ELECTRIC_CONDUCTANCE,prefixes:I.LONG,value:1,offset:0},S:{name:"S",base:q.ELECTRIC_CONDUCTANCE,prefixes:I.SHORT,value:1,offset:0},weber:{name:"weber",base:q.MAGNETIC_FLUX,prefixes:I.LONG,value:1,offset:0},Wb:{name:"Wb",base:q.MAGNETIC_FLUX,prefixes:I.SHORT,value:1,offset:0},tesla:{name:"tesla",base:q.MAGNETIC_FLUX_DENSITY,prefixes:I.LONG,value:1,offset:0},T:{name:"T",base:q.MAGNETIC_FLUX_DENSITY,prefixes:I.SHORT,value:1,offset:0},b:{name:"b",base:q.BIT,prefixes:I.BINARY_SHORT,value:1,offset:0},bits:{name:"bits",base:q.BIT,prefixes:I.BINARY_LONG,value:1,offset:0},B:{name:"B",base:q.BIT,prefixes:I.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:q.BIT,prefixes:I.BINARY_LONG,value:8,offset:0}},R={meters:"meter",inches:"inch",feet:"foot",yards:"yard",miles:"mile",links:"link",rods:"rod",chains:"chain",angstroms:"angstrom",lt:"l",litres:"litre",liter:"litre",liters:"litre",teaspoons:"teaspoon",tablespoons:"tablespoon",minims:"minim",fluiddrams:"fluiddram",fluidounces:"fluidounce",gills:"gill",cups:"cup",pints:"pint",quarts:"quart",gallons:"gallon",beerbarrels:"beerbarrel",oilbarrels:"oilbarrel",hogsheads:"hogshead",gtts:"gtt",grams:"gram",tons:"ton",tonnes:"tonne",grains:"grain",drams:"dram",ounces:"ounce",poundmasses:"poundmass",hundredweights:"hundredweight",sticks:"stick",lb:"lbm",lbs:"lbm",kips:"kip",acres:"acre",hectares:"hectare",sqfeet:"sqft",sqyard:"sqyd",sqmile:"sqmi",sqmiles:"sqmi",mmhg:"mmHg",mmh2o:"mmH2O",cmh2o:"cmH2O",seconds:"second",secs:"second",minutes:"minute",mins:"minute",hours:"hour",hr:"hour",hrs:"hour",days:"day",weeks:"week",months:"month",years:"year",decades:"decade",centuries:"century",millennia:"millennium",hertz:"hertz",radians:"radian",degrees:"degree",gradians:"gradian",cycles:"cycle",arcsecond:"arcsec",arcseconds:"arcsec",arcminute:"arcmin",arcminutes:"arcmin",BTUs:"BTU",watts:"watt",joules:"joule",amperes:"ampere",coulombs:"coulomb",volts:"volt",ohms:"ohm",farads:"farad",webers:"weber",teslas:"tesla",electronvolts:"electronvolt",moles:"mole"};function P(e){if("BigNumber"===e.number){var t=bs(N);D.rad.value=new N(1),D.deg.value=t.div(180),D.grad.value=t.div(200),D.cycle.value=t.times(2),D.arcsec.value=t.div(648e3),D.arcmin.value=t.div(10800)}else D.rad.value=1,D.deg.value=Math.PI/180,D.grad.value=Math.PI/200,D.cycle.value=2*Math.PI,D.arcsec.value=Math.PI/648e3,D.arcmin.value=Math.PI/10800;D.radian.value=D.rad.value,D.degree.value=D.deg.value,D.gradian.value=D.grad.value}P(b),t&&t("config",function(e,t){e.number!==t.number&&P(e)});var F={si:{NONE:{unit:z,prefix:I.NONE[""]},LENGTH:{unit:D.m,prefix:I.SHORT[""]},MASS:{unit:D.g,prefix:I.SHORT.k},TIME:{unit:D.s,prefix:I.SHORT[""]},CURRENT:{unit:D.A,prefix:I.SHORT[""]},TEMPERATURE:{unit:D.K,prefix:I.SHORT[""]},LUMINOUS_INTENSITY:{unit:D.cd,prefix:I.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:D.mol,prefix:I.SHORT[""]},ANGLE:{unit:D.rad,prefix:I.SHORT[""]},BIT:{unit:D.bit,prefix:I.SHORT[""]},FORCE:{unit:D.N,prefix:I.SHORT[""]},ENERGY:{unit:D.J,prefix:I.SHORT[""]},POWER:{unit:D.W,prefix:I.SHORT[""]},PRESSURE:{unit:D.Pa,prefix:I.SHORT[""]},ELECTRIC_CHARGE:{unit:D.C,prefix:I.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:D.F,prefix:I.SHORT[""]},ELECTRIC_POTENTIAL:{unit:D.V,prefix:I.SHORT[""]},ELECTRIC_RESISTANCE:{unit:D.ohm,prefix:I.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:D.H,prefix:I.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:D.S,prefix:I.SHORT[""]},MAGNETIC_FLUX:{unit:D.Wb,prefix:I.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:D.T,prefix:I.SHORT[""]},FREQUENCY:{unit:D.Hz,prefix:I.SHORT[""]}}};F.cgs=JSON.parse(JSON.stringify(F.si)),F.cgs.LENGTH={unit:D.m,prefix:I.SHORT.c},F.cgs.MASS={unit:D.g,prefix:I.SHORT[""]},F.cgs.FORCE={unit:D.dyn,prefix:I.SHORT[""]},F.cgs.ENERGY={unit:D.erg,prefix:I.NONE[""]},F.us=JSON.parse(JSON.stringify(F.si)),F.us.LENGTH={unit:D.ft,prefix:I.NONE[""]},F.us.MASS={unit:D.lbm,prefix:I.NONE[""]},F.us.TEMPERATURE={unit:D.degF,prefix:I.NONE[""]},F.us.FORCE={unit:D.lbf,prefix:I.NONE[""]},F.us.ENERGY={unit:D.BTU,prefix:I.BTU[""]},F.us.POWER={unit:D.hp,prefix:I.NONE[""]},F.us.PRESSURE={unit:D.psi,prefix:I.NONE[""]},F.auto=JSON.parse(JSON.stringify(F.si));var U=F.auto;for(var L in M.setUnitSystem=function(e){if(!Object(ae.f)(F,e))throw new Error("Unit system "+e+" does not exist. Choices are: "+Object.keys(F).join(", "));U=F[e]},M.getUnitSystem=function(){for(var e in F)if(F[e]===U)return e},M.typeConverters={BigNumber:function(e){return new N(e+"")},Fraction:function(e){return new O(e)},Complex:function(e){return e},number:function(e){return e}},M._getNumberConverter=function(e){if(!M.typeConverters[e])throw new TypeError('Unsupported type "'+e+'"');return M.typeConverters[e]},D){var H=D[L];H.dimensions=H.base.dimensions}for(var $ in R)if(Object(ae.f)(R,$)){var G=D[R[$]],Z={};for(var V in G)Object(ae.f)(G,V)&&(Z[V]=G[V]);Z.name=$,D[$]=Z}return M.createUnit=function(e,t){if("object"!==Ns(e))throw new TypeError("createUnit expects first parameter to be of type 'Object'");if(t&&t.override)for(var r in e)if(Object(ae.f)(e,r)&&M.deleteUnit(r),e[r].aliases)for(var n=0;n<e[r].aliases.length;n++)M.deleteUnit(e[r].aliases[n]);var i;for(var a in e)Object(ae.f)(e,a)&&(i=M.createUnitSingle(a,e[a]));return i},M.createUnitSingle=function(t,e,r){if(null==e&&(e={}),"string"!=typeof t)throw new TypeError("createUnitSingle expects first parameter to be of type 'string'");if(Object(ae.f)(D,t))throw new Error('Cannot create unit "'+t+'": a unit with that name already exists');!function(e){for(var t=0;t<e.length;t++){var r=e.charAt(t),n=function(e){return/^[a-zA-Z]$/.test(e)};if(0===t&&!n(r))throw new Error('Invalid unit name (must begin with alpha character): "'+e+'"');if(0<t&&!(n(r)||"0"<=(i=r)&&i<="9"))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+e+'"')}var i}(t);var n,i,a=null,o=[],s=0;if(e&&"Unit"===e.type)a=e.clone();else if("string"==typeof e)""!==e&&(n=e);else{if("object"!==Ns(e))throw new TypeError('Cannot create unit "'+t+'" from "'+e.toString()+'": expecting "string" or "Unit" or "Object"');n=e.definition,i=e.prefixes,s=e.offset,e.aliases&&(o=e.aliases.valueOf())}if(o)for(var u=0;u<o.length;u++)if(Object(ae.f)(D,o[u]))throw new Error('Cannot create alias "'+o[u]+'": a unit with that name already exists');if(n&&"string"==typeof n&&!a)try{a=M.parse(n,{allowNoUnits:!0})}catch(e){throw e.message='Could not create unit "'+t+'" from "'+n+'": '+e.message,e}else n&&"Unit"===n.type&&(a=n.clone());o=o||[],s=s||0,i=i&&i.toUpperCase&&I[i.toUpperCase()]||I.NONE;var c={};if(a){var f=!(c={name:t,value:a.value,dimensions:a.dimensions.slice(0),prefixes:i,offset:s});for(var l in q)if(Object(ae.f)(q,l)){for(var p=!0,m=0;m<B.length;m++)if(1e-12<Math.abs((c.dimensions[m]||0)-(q[l].dimensions[m]||0))){p=!1;break}if(p){f=!0,c.base=q[l];break}}if(!f){var h=t+"_STUFF",d={dimensions:a.dimensions.slice(0)};d.key=h,q[h]=d,U[h]={unit:c,prefix:I.NONE[""]},c.base=q[h]}}else{var y=t+"_STUFF";if(0<=B.indexOf(y))throw new Error('Cannot create new base unit "'+t+'": a base unit with that name already exists (and cannot be overridden)');for(var g in B.push(y),q)Object(ae.f)(q,g)&&(q[g].dimensions[B.length-1]=0);for(var v={dimensions:[]},b=0;b<B.length;b++)v.dimensions[b]=0;v.dimensions[B.length-1]=1,v.key=y,q[y]=v,c={name:t,value:1,dimensions:q[y].dimensions.slice(0),prefixes:i,offset:s,base:q[y]},U[y]={unit:c,prefix:I.NONE[""]}}M.UNITS[t]=c;for(var x=0;x<o.length;x++){var w=o[x],N={};for(var O in c)Object(ae.f)(c,O)&&(N[O]=c[O]);N.name=w,M.UNITS[w]=N}return new M(null,t)},M.deleteUnit=function(e){delete M.UNITS[e]},M.PREFIXES=I,M.BASE_DIMENSIONS=B,M.BASE_UNITS=q,M.UNIT_SYSTEMS=F,M.UNITS=D,M},{isClass:!0}),js=["typed","Unit"],Ss=Object(s.a)("unit",js,function(e){var t=e.typed,r=e.Unit,n=t("unit",{Unit:function(e){return e.clone()},string:function(e){return r.isValuelessUnit(e)?new r(null,e):r.parse(e,{allowNoUnits:!0})},"number | BigNumber | Fraction | Complex, string":function(e,t){return new r(e,t)},"Array | Matrix":function(e){return oe(e,n)}});return n}),As=["typed","SparseMatrix"],Cs=Object(s.a)("sparse",As,function(e){var t=e.typed,r=e.SparseMatrix;return t("sparse",{"":function(){return new r([])},string:function(e){return new r([],e)},"Array | Matrix":function(e){return new r(e)},"Array | Matrix, string":function(e,t){return new r(e,t)}})}),Ts="createUnit",_s=["typed","Unit"],Is=Object(s.a)(Ts,_s,function(e){var t=e.typed,i=e.Unit;return t(Ts,{"Object, Object":function(e,t){return i.createUnit(e,t)},Object:function(e){return i.createUnit(e,{})},"string, Unit | string | Object, Object":function(e,t,r){var n={};return n[e]=t,i.createUnit(n,r)},"string, Unit | string | Object":function(e,t){var r={};return r[e]=t,i.createUnit(r,{})},string:function(e){var t={};return t[e]={},i.createUnit(t,{})}})}),Bs=["typed","config","Complex"],qs=Object(s.a)("acos",Bs,function(e){var t=e.typed,r=e.config,n=e.Complex,i=t("acos",{number:function(e){return-1<=e&&e<=1||r.predictable?Math.acos(e):new n(e,0).acos()},Complex:function(e){return e.acos()},BigNumber:function(e){return e.acos()},"Array | Matrix":function(e){return oe(e,i)}});return i}),ks="number";function zs(e){return Object(j.a)(e)}function Ds(e){return Math.atan(1/e)}function Rs(e){return isFinite(e)?(Math.log((e+1)/e)+Math.log(e/(e-1)))/2:0}function Ps(e){return Math.asin(1/e)}function Fs(e){var t=1/e;return Math.log(t+Math.sqrt(t*t+1))}function Us(e){return Math.acos(1/e)}function Ls(e){var t=1/e,r=Math.sqrt(t*t-1);return Math.log(r+t)}function Hs(e){return Object(j.b)(e)}function $s(e){return Object(j.c)(e)}function Gs(e){return 1/Math.tan(e)}function Zs(e){var t=Math.exp(2*e);return(t+1)/(t-1)}function Vs(e){return 1/Math.sin(e)}function Js(e){return 0===e?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(e)-Math.exp(-e)))*Object(j.n)(e)}function Ws(e){return 1/Math.cos(e)}function Ys(e){return 2/(Math.exp(e)+Math.exp(-e))}function Xs(e){return Object(j.o)(e)}Xs.signature=Ys.signature=Ws.signature=Js.signature=Vs.signature=Zs.signature=Gs.signature=$s.signature=Hs.signature=Ls.signature=Us.signature=Fs.signature=Ps.signature=Rs.signature=Ds.signature=zs.signature=ks;var Qs=["typed","config","Complex"],Ks=Object(s.a)("acosh",Qs,function(e){var t=e.typed,r=e.config,n=e.Complex,i=t("acosh",{number:function(e){return 1<=e||r.predictable?zs(e):e<=-1?new n(Math.log(Math.sqrt(e*e-1)-e),Math.PI):new n(e,0).acosh()},Complex:function(e){return e.acosh()},BigNumber:function(e){return e.acosh()},"Array | Matrix":function(e){return oe(e,i)}});return i}),eu=["typed","BigNumber"],tu=Object(s.a)("acot",eu,function(e){var t=e.typed,r=e.BigNumber,n=t("acot",{number:Ds,Complex:function(e){return e.acot()},BigNumber:function(e){return new r(1).div(e).atan()},"Array | Matrix":function(e){return oe(e,n)}});return n}),ru=["typed","config","Complex","BigNumber"],nu=Object(s.a)("acoth",ru,function(e){var t=e.typed,r=e.config,n=e.Complex,i=e.BigNumber,a=t("acoth",{number:function(e){return 1<=e||e<=-1||r.predictable?Rs(e):new n(e,0).acoth()},Complex:function(e){return e.acoth()},BigNumber:function(e){return new i(1).div(e).atanh()},"Array | Matrix":function(e){return oe(e,a)}});return a}),iu=["typed","config","Complex","BigNumber"],au=Object(s.a)("acsc",iu,function(e){var t=e.typed,r=e.config,n=e.Complex,i=e.BigNumber,a=t("acsc",{number:function(e){return e<=-1||1<=e||r.predictable?Ps(e):new n(e,0).acsc()},Complex:function(e){return e.acsc()},BigNumber:function(e){return new i(1).div(e).asin()},"Array | Matrix":function(e){return oe(e,a)}});return a}),ou=["typed","BigNumber"],su=Object(s.a)("acsch",ou,function(e){var t=e.typed,r=e.BigNumber,n=t("acsch",{number:Fs,Complex:function(e){return e.acsch()},BigNumber:function(e){return new r(1).div(e).asinh()},"Array | Matrix":function(e){return oe(e,n)}});return n}),uu=["typed","config","Complex","BigNumber"],cu=Object(s.a)("asec",uu,function(e){var t=e.typed,r=e.config,n=e.Complex,i=e.BigNumber,a=t("asec",{number:function(e){return e<=-1||1<=e||r.predictable?Us(e):new n(e,0).asec()},Complex:function(e){return e.asec()},BigNumber:function(e){return new i(1).div(e).acos()},"Array | Matrix":function(e){return oe(e,a)}});return a}),fu=["typed","config","Complex","BigNumber"],lu=Object(s.a)("asech",fu,function(e){var t=e.typed,n=e.config,i=e.Complex,r=e.BigNumber,a=t("asech",{number:function(e){if(e<=1&&-1<=e||n.predictable){var t=1/e;if(0<t||n.predictable)return Ls(e);var r=Math.sqrt(t*t-1);return new i(Math.log(r-t),Math.PI)}return new i(e,0).asech()},Complex:function(e){return e.asech()},BigNumber:function(e){return new r(1).div(e).acosh()},"Array | Matrix":function(e){return oe(e,a)}});return a}),pu=["typed","config","Complex"],mu=Object(s.a)("asin",pu,function(e){var t=e.typed,r=e.config,n=e.Complex,i=t("asin",{number:function(e){return-1<=e&&e<=1||r.predictable?Math.asin(e):new n(e,0).asin()},Complex:function(e){return e.asin()},BigNumber:function(e){return e.asin()},"Array | Matrix":function(e){return oe(e,i,!0)}});return i}),hu=["typed"],du=Object(s.a)("asinh",hu,function(e){var t=(0,e.typed)("asinh",{number:Hs,Complex:function(e){return e.asinh()},BigNumber:function(e){return e.asinh()},"Array | Matrix":function(e){return oe(e,t,!0)}});return t}),yu=["typed"],gu=Object(s.a)("atan",yu,function(e){var t=(0,e.typed)("atan",{number:function(e){return Math.atan(e)},Complex:function(e){return e.atan()},BigNumber:function(e){return e.atan()},"Array | Matrix":function(e){return oe(e,t,!0)}});return t}),vu=["typed","matrix","equalScalar","BigNumber","DenseMatrix"],bu=Object(s.a)("atan2",vu,function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.BigNumber,a=e.DenseMatrix,o=nr({typed:t,equalScalar:n}),s=dr({typed:t}),u=Hr({typed:t,equalScalar:n}),c=sr({typed:t,equalScalar:n}),f=br({typed:t,DenseMatrix:a}),l=Xt({typed:t}),p=Kt({typed:t}),m=t("atan2",{"number, number":Math.atan2,"BigNumber, BigNumber":function(e,t){return i.atan2(e,t)},"SparseMatrix, SparseMatrix":function(e,t){return u(e,t,m,!1)},"SparseMatrix, DenseMatrix":function(e,t){return o(t,e,m,!0)},"DenseMatrix, SparseMatrix":function(e,t){return s(e,t,m,!1)},"DenseMatrix, DenseMatrix":function(e,t){return l(e,t,m)},"Array, Array":function(e,t){return m(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return m(r(e),t)},"Matrix, Array":function(e,t){return m(e,r(t))},"SparseMatrix, number | BigNumber":function(e,t){return c(e,t,m,!1)},"DenseMatrix, number | BigNumber":function(e,t){return p(e,t,m,!1)},"number | BigNumber, SparseMatrix":function(e,t){return f(t,e,m,!0)},"number | BigNumber, DenseMatrix":function(e,t){return p(t,e,m,!0)},"Array, number | BigNumber":function(e,t){return p(r(e),t,m,!1).valueOf()},"number | BigNumber, Array":function(e,t){return p(r(t),e,m,!0).valueOf()}});return m}),xu=["typed","config","Complex"],wu=Object(s.a)("atanh",xu,function(e){var t=e.typed,r=e.config,n=e.Complex,i=t("atanh",{number:function(e){return e<=1&&-1<=e||r.predictable?$s(e):new n(e,0).atanh()},Complex:function(e){return e.atanh()},BigNumber:function(e){return e.atanh()},"Array | Matrix":function(e){return oe(e,i,!0)}});return i}),Nu=["typed"],Ou=Object(s.a)("cos",Nu,function(e){var t=(0,e.typed)("cos",{number:Math.cos,Complex:function(e){return e.cos()},BigNumber:function(e){return e.cos()},Unit:function(e){if(!e.hasBase(e.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cos is no angle");return t(e.value)},"Array | Matrix":function(e){return oe(e,t)}});return t}),Mu=["typed"],Eu=Object(s.a)("cosh",Mu,function(e){var t=(0,e.typed)("cosh",{number:j.e,Complex:function(e){return e.cosh()},BigNumber:function(e){return e.cosh()},Unit:function(e){if(!e.hasBase(e.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cosh is no angle");return t(e.value)},"Array | Matrix":function(e){return oe(e,t)}});return t}),ju=["typed","BigNumber"],Su=Object(s.a)("cot",ju,function(e){var t=e.typed,r=e.BigNumber,n=t("cot",{number:Gs,Complex:function(e){return e.cot()},BigNumber:function(e){return new r(1).div(e.tan())},Unit:function(e){if(!e.hasBase(e.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return n(e.value)},"Array | Matrix":function(e){return oe(e,n)}});return n}),Au=["typed","BigNumber"],Cu=Object(s.a)("coth",Au,function(e){var t=e.typed,r=e.BigNumber,n=t("coth",{number:Zs,Complex:function(e){return e.coth()},BigNumber:function(e){return new r(1).div(e.tanh())},Unit:function(e){if(!e.hasBase(e.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function coth is no angle");return n(e.value)},"Array | Matrix":function(e){return oe(e,n)}});return n}),Tu=["typed","BigNumber"],_u=Object(s.a)("csc",Tu,function(e){var t=e.typed,r=e.BigNumber,n=t("csc",{number:Vs,Complex:function(e){return e.csc()},BigNumber:function(e){return new r(1).div(e.sin())},Unit:function(e){if(!e.hasBase(e.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function csc is no angle");return n(e.value)},"Array | Matrix":function(e){return oe(e,n)}});return n}),Iu=["typed","BigNumber"],Bu=Object(s.a)("csch",Iu,function(e){var t=e.typed,r=e.BigNumber,n=t("csch",{number:Js,Complex:function(e){return e.csch()},BigNumber:function(e){return new r(1).div(e.sinh())},Unit:function(e){if(!e.hasBase(e.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function csch is no angle");return n(e.value)},"Array | Matrix":function(e){return oe(e,n)}});return n}),qu=["typed","BigNumber"],ku=Object(s.a)("sec",qu,function(e){var t=e.typed,r=e.BigNumber,n=t("sec",{number:Ws,Complex:function(e){return e.sec()},BigNumber:function(e){return new r(1).div(e.cos())},Unit:function(e){if(!e.hasBase(e.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sec is no angle");return n(e.value)},"Array | Matrix":function(e){return oe(e,n)}});return n}),zu=["typed","BigNumber"],Du=Object(s.a)("sech",zu,function(e){var t=e.typed,r=e.BigNumber,n=t("sech",{number:Ys,Complex:function(e){return e.sech()},BigNumber:function(e){return new r(1).div(e.cosh())},Unit:function(e){if(!e.hasBase(e.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sech is no angle");return n(e.value)},"Array | Matrix":function(e){return oe(e,n)}});return n}),Ru=["typed"],Pu=Object(s.a)("sin",Ru,function(e){var t=(0,e.typed)("sin",{number:Math.sin,Complex:function(e){return e.sin()},BigNumber:function(e){return e.sin()},Unit:function(e){if(!e.hasBase(e.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sin is no angle");return t(e.value)},"Array | Matrix":function(e){return oe(e,t,!0)}});return t}),Fu=["typed"],Uu=Object(s.a)("sinh",Fu,function(e){var t=(0,e.typed)("sinh",{number:Xs,Complex:function(e){return e.sinh()},BigNumber:function(e){return e.sinh()},Unit:function(e){if(!e.hasBase(e.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sinh is no angle");return t(e.value)},"Array | Matrix":function(e){return oe(e,t,!0)}});return t}),Lu=["typed"],Hu=Object(s.a)("tan",Lu,function(e){var t=(0,e.typed)("tan",{number:Math.tan,Complex:function(e){return e.tan()},BigNumber:function(e){return e.tan()},Unit:function(e){if(!e.hasBase(e.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function tan is no angle");return t(e.value)},"Array | Matrix":function(e){return oe(e,t,!0)}});return t}),$u=["typed"],Gu=Object(s.a)("tanh",$u,function(e){var t=(0,e.typed)("tanh",{number:j.p,Complex:function(e){return e.tanh()},BigNumber:function(e){return e.tanh()},Unit:function(e){if(!e.hasBase(e.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function tanh is no angle");return t(e.value)},"Array | Matrix":function(e){return oe(e,t,!0)}});return t}),Zu="setCartesian",Vu=["typed","size","subset","compareNatural","Index","DenseMatrix"],Ju=Object(s.a)(Zu,Vu,function(e){var t=e.typed,s=e.size,u=e.subset,c=e.compareNatural,f=e.Index,l=e.DenseMatrix;return t(Zu,{"Array | Matrix, Array | Matrix":function(e,t){var r=[];if(0!==u(s(e),new f(0))&&0!==u(s(t),new f(0))){var n=Object(I.e)(Array.isArray(e)?e:e.toArray()).sort(c),i=Object(I.e)(Array.isArray(t)?t:t.toArray()).sort(c);r=[];for(var a=0;a<n.length;a++)for(var o=0;o<i.length;o++)r.push([n[a],i[o]])}return Array.isArray(e)&&Array.isArray(t)?r:new l(r)}})}),Wu="setDifference",Yu=["typed","size","subset","compareNatural","Index","DenseMatrix"],Xu=Object(s.a)(Wu,Yu,function(e){var t=e.typed,u=e.size,c=e.subset,f=e.compareNatural,l=e.Index,p=e.DenseMatrix;return t(Wu,{"Array | Matrix, Array | Matrix":function(e,t){var r;if(0===c(u(e),new l(0)))r=[];else{if(0===c(u(t),new l(0)))return Object(I.e)(e.toArray());var n,i=Object(I.i)(Object(I.e)(Array.isArray(e)?e:e.toArray()).sort(f)),a=Object(I.i)(Object(I.e)(Array.isArray(t)?t:t.toArray()).sort(f));r=[];for(var o=0;o<i.length;o++){n=!1;for(var s=0;s<a.length;s++)if(0===f(i[o].value,a[s].value)&&i[o].identifier===a[s].identifier){n=!0;break}n||r.push(i[o])}}return Array.isArray(e)&&Array.isArray(t)?Object(I.g)(r):new p(Object(I.g)(r))}})}),Qu="setDistinct",Ku=["typed","size","subset","compareNatural","Index","DenseMatrix"],ec=Object(s.a)(Qu,Ku,function(e){var t=e.typed,i=e.size,a=e.subset,o=e.compareNatural,s=e.Index,u=e.DenseMatrix;return t(Qu,{"Array | Matrix":function(e){var t;if(0===a(i(e),new s(0)))t=[];else{var r=Object(I.e)(Array.isArray(e)?e:e.toArray()).sort(o);(t=[]).push(r[0]);for(var n=1;n<r.length;n++)0!==o(r[n],r[n-1])&&t.push(r[n])}return Array.isArray(e)?t:new u(t)}})}),tc="setIntersect",rc=["typed","size","subset","compareNatural","Index","DenseMatrix"],nc=Object(s.a)(tc,rc,function(e){var t=e.typed,s=e.size,u=e.subset,c=e.compareNatural,f=e.Index,l=e.DenseMatrix;return t(tc,{"Array | Matrix, Array | Matrix":function(e,t){var r;if(0===u(s(e),new f(0))||0===u(s(t),new f(0)))r=[];else{var n=Object(I.i)(Object(I.e)(Array.isArray(e)?e:e.toArray()).sort(c)),i=Object(I.i)(Object(I.e)(Array.isArray(t)?t:t.toArray()).sort(c));r=[];for(var a=0;a<n.length;a++)for(var o=0;o<i.length;o++)if(0===c(n[a].value,i[o].value)&&n[a].identifier===i[o].identifier){r.push(n[a]);break}}return Array.isArray(e)&&Array.isArray(t)?Object(I.g)(r):new l(Object(I.g)(r))}})}),ic="setIsSubset",ac=["typed","size","subset","compareNatural","Index"],oc=Object(s.a)(ic,ac,function(e){var t=e.typed,s=e.size,u=e.subset,c=e.compareNatural,f=e.Index;return t(ic,{"Array | Matrix, Array | Matrix":function(e,t){if(0===u(s(e),new f(0)))return!0;if(0===u(s(t),new f(0)))return!1;for(var r,n=Object(I.i)(Object(I.e)(Array.isArray(e)?e:e.toArray()).sort(c)),i=Object(I.i)(Object(I.e)(Array.isArray(t)?t:t.toArray()).sort(c)),a=0;a<n.length;a++){r=!1;for(var o=0;o<i.length;o++)if(0===c(n[a].value,i[o].value)&&n[a].identifier===i[o].identifier){r=!0;break}if(!1===r)return!1}return!0}})}),sc="setMultiplicity",uc=["typed","size","subset","compareNatural","Index"],cc=Object(s.a)(sc,uc,function(e){var t=e.typed,a=e.size,o=e.subset,s=e.compareNatural,u=e.Index;return t(sc,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(e,t){if(0===o(a(t),new u(0)))return 0;for(var r=Object(I.e)(Array.isArray(t)?t:t.toArray()),n=0,i=0;i<r.length;i++)0===s(r[i],e)&&n++;return n}})}),fc="setPowerset",lc=["typed","size","subset","compareNatural","Index"],pc=Object(s.a)(fc,lc,function(e){var t=e.typed,i=e.size,a=e.subset,o=e.compareNatural,s=e.Index;return t(fc,{"Array | Matrix":function(e){if(0===a(i(e),new s(0)))return[];for(var t=Object(I.e)(Array.isArray(e)?e:e.toArray()).sort(o),r=[],n=0;n.toString(2).length<=t.length;)r.push(u(t,n.toString(2).split("").reverse())),n++;return function(e){for(var t=[],r=e.length-1;0<r;r--)for(var n=0;n<r;n++)e[n].length>e[n+1].length&&(t=e[n],e[n]=e[n+1],e[n+1]=t);return e}(r)}});function u(e,t){for(var r=[],n=0;n<t.length;n++)"1"===t[n]&&r.push(e[n]);return r}}),mc="setSize",hc=["typed","compareNatural"],dc=Object(s.a)(mc,hc,function(e){var t=e.typed,a=e.compareNatural;return t(mc,{"Array | Matrix":function(e){return Array.isArray(e)?Object(I.e)(e).length:Object(I.e)(e.toArray()).length},"Array | Matrix, boolean":function(e,t){if(!1===t||0===e.length)return Array.isArray(e)?Object(I.e)(e).length:Object(I.e)(e.toArray()).length;for(var r=Object(I.e)(Array.isArray(e)?e:e.toArray()).sort(a),n=1,i=1;i<r.length;i++)0!==a(r[i],r[i-1])&&n++;return n}})}),yc="setSymDifference",gc=["typed","size","concat","subset","setDifference","Index"],vc=Object(s.a)(yc,gc,function(e){var t=e.typed,i=e.size,a=e.concat,o=e.subset,s=e.setDifference,u=e.Index;return t(yc,{"Array | Matrix, Array | Matrix":function(e,t){if(0===o(i(e),new u(0)))return Object(I.e)(t);if(0===o(i(t),new u(0)))return Object(I.e)(e);var r=Object(I.e)(e),n=Object(I.e)(t);return a(s(r,n),s(n,r))}})}),bc="setUnion",xc=["typed","size","concat","subset","setIntersect","setSymDifference","Index"],wc=Object(s.a)(bc,xc,function(e){var t=e.typed,i=e.size,a=e.concat,o=e.subset,s=e.setIntersect,u=e.setSymDifference,c=e.Index;return t(bc,{"Array | Matrix, Array | Matrix":function(e,t){if(0===o(i(e),new c(0)))return Object(I.e)(t);if(0===o(i(t),new c(0)))return Object(I.e)(e);var r=Object(I.e)(e),n=Object(I.e)(t);return a(u(r,n),s(r,n))}})}),Nc=["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix"],Oc=Object(s.a)("add",Nc,function(e){var t=e.typed,r=e.matrix,n=e.addScalar,i=e.equalScalar,a=e.DenseMatrix,o=(e.SparseMatrix,Gt({typed:t})),s=Vt({typed:t,equalScalar:i}),u=Wt({typed:t,DenseMatrix:a}),c=Xt({typed:t}),f=Kt({typed:t}),l=t("add",Object(ae.e)({"DenseMatrix, DenseMatrix":function(e,t){return c(e,t,n)},"DenseMatrix, SparseMatrix":function(e,t){return o(e,t,n,!1)},"SparseMatrix, DenseMatrix":function(e,t){return o(t,e,n,!0)},"SparseMatrix, SparseMatrix":function(e,t){return s(e,t,n)},"Array, Array":function(e,t){return l(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return l(r(e),t)},"Matrix, Array":function(e,t){return l(e,r(t))},"DenseMatrix, any":function(e,t){return f(e,t,n,!1)},"SparseMatrix, any":function(e,t){return u(e,t,n,!1)},"any, DenseMatrix":function(e,t){return f(t,e,n,!0)},"any, SparseMatrix":function(e,t){return u(t,e,n,!0)},"Array, any":function(e,t){return f(r(e),t,n,!1).valueOf()},"any, Array":function(e,t){return f(r(t),e,n,!0).valueOf()},"any, any":n,"any, any, ...any":function(e,t,r){for(var n=l(e,t),i=0;i<r.length;i++)n=l(n,r[i]);return n}},n.signatures));return l}),Mc=["typed","abs","addScalar","divideScalar","multiplyScalar","sqrt","smaller","isPositive"],Ec=Object(s.a)("hypot",Mc,function(e){var t=e.typed,a=e.abs,o=e.addScalar,s=e.divideScalar,u=e.multiplyScalar,c=e.sqrt,f=e.smaller,l=e.isPositive,r=t("hypot",{"... number | BigNumber":function(e){for(var t=0,r=0,n=0;n<e.length;n++){var i=a(e[n]);f(r,i)?(t=u(t,u(s(r,i),s(r,i))),t=o(t,1),r=i):t=o(t,l(i)?u(s(i,r),s(i,r)):i)}return u(r,c(t))},Array:function(e){return r.apply(r,Object(I.e)(e))},Matrix:function(e){return r.apply(r,Object(I.e)(e.toArray()))}});return r}),jc=["typed","abs","add","pow","conj","sqrt","multiply","equalScalar","larger","smaller","matrix"],Sc=Object(s.a)("norm",jc,function(e){var t=e.typed,l=e.abs,p=e.add,m=e.pow,h=e.conj,d=e.sqrt,y=e.multiply,g=e.equalScalar,v=e.larger,b=e.smaller,r=e.matrix,n=t("norm",{number:Math.abs,Complex:function(e){return e.abs()},BigNumber:function(e){return e.abs()},boolean:function(e){return Math.abs(e)},Array:function(e){return x(r(e),2)},Matrix:function(e){return x(e,2)},"number | Complex | BigNumber | boolean, number | BigNumber | string":function(e){return n(e)},"Array, number | BigNumber | string":function(e,t){return x(r(e),t)},"Matrix, number | BigNumber | string":function(e,t){return x(e,t)}});function x(e,t){var r=e.size();if(1===r.length){if(t===Number.POSITIVE_INFINITY||"inf"===t){var n=0;return e.forEach(function(e){var t=l(e);v(t,n)&&(n=t)},!0),n}var i;if(t===Number.NEGATIVE_INFINITY||"-inf"===t)return e.forEach(function(e){var t=l(e);i&&!b(t,i)||(i=t)},!0),i||0;if("fro"===t)return x(e,2);if("number"!=typeof t||isNaN(t))throw new Error("Unsupported parameter value");if(g(t,0))return Number.POSITIVE_INFINITY;var a=0;return e.forEach(function(e){a=p(m(l(e),t),a)},!0),m(a,1/t)}if(2===r.length){if(1===t){var o=[],s=0;return e.forEach(function(e,t){var r=t[1],n=p(o[r]||0,l(e));v(n,s)&&(s=n),o[r]=n},!0),s}if(t===Number.POSITIVE_INFINITY||"inf"===t){var u=[],c=0;return e.forEach(function(e,t){var r=t[0],n=p(u[r]||0,l(e));v(n,c)&&(c=n),u[r]=n},!0),c}if("fro"===t){var f=0;return e.forEach(function(e,t){f=p(f,y(e,h(e)))}),l(d(f))}if(2===t)throw new Error("Unsupported parameter value, missing implementation of matrix singular value decomposition");throw new Error("Unsupported parameter value")}}return n}),Ac=["typed","add","multiply"],Cc=Object(s.a)("dot",Ac,function(e){var t=e.typed,s=e.add,u=e.multiply;return t("dot",{"Matrix, Matrix":function(e,t){return r(e.toArray(),t.toArray())},"Matrix, Array":function(e,t){return r(e.toArray(),t)},"Array, Matrix":function(e,t){return r(e,t.toArray())},"Array, Array":r});function r(e,t){var r=Object(I.a)(e),n=Object(I.a)(t),i=r[0];if(1!==r.length||1!==n.length)throw new RangeError("Vector expected");if(r[0]!==n[0])throw new RangeError("Vectors must have equal length ("+r[0]+" != "+n[0]+")");if(0===i)throw new RangeError("Cannot calculate the dot product of empty vectors");for(var a=0,o=0;o<i;o++)a=s(a,u(e[o],t[o]));return a}}),Tc=["typed","matrix","add"],_c=Object(s.a)("trace",Tc,function(e){var t=e.typed,r=e.matrix,m=e.add;return t("trace",{Array:function(e){return n(r(e))},SparseMatrix:function(e){var t=e._values,r=e._index,n=e._ptr,i=e._size,a=i[0],o=i[1];if(a!==o)throw new RangeError("Matrix must be square (size: "+Object(J.d)(i)+")");var s=0;if(0<t.length)for(var u=0;u<o;u++)for(var c=n[u],f=n[u+1],l=c;l<f;l++){var p=r[l];if(p===u){s=m(s,t[l]);break}if(u<p)break}return s},DenseMatrix:n,any:ae.a});function n(e){var t=e._size,r=e._data;switch(t.length){case 1:if(1===t[0])return Object(ae.a)(r[0]);throw new RangeError("Matrix must be square (size: "+Object(J.d)(t)+")");case 2:var n=t[0];if(n!==t[1])throw new RangeError("Matrix must be square (size: "+Object(J.d)(t)+")");for(var i=0,a=0;a<n;a++)i=m(i,r[a][a]);return i;default:throw new RangeError("Matrix must be two dimensional (size: "+Object(J.d)(t)+")")}}}),Ic=["typed","Index"],Bc=Object(s.a)("index",Ic,function(e){var t=e.typed,n=e.Index;return t("index",{"...number | string | BigNumber | Range | Array | Matrix":function(e){var t=e.map(function(e){return Object(ie.e)(e)?e.toNumber():Array.isArray(e)||Object(ie.v)(e)?e.map(function(e){return Object(ie.e)(e)?e.toNumber():e}):e}),r=new n;return n.apply(r,t),r}})}),qc={end:!0};function kc(e){return(kc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var zc=["mathWithTransform"],Dc=Object(s.a)("Node",zc,function(e){var a=e.mathWithTransform;function t(){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator")}return t.prototype.evaluate=function(e){return this.compile().evaluate(e)},t.prototype.eval=function(e){return Object(ve.a)("Method Node.eval is renamed to Node.evaluate. Please use the new method name."),this.evaluate(e)},t.prototype.type="Node",t.prototype.isNode=!0,t.prototype.comment="",t.prototype.compile=function(){var r=this._compile(a,{}),n={},i=null;function t(e){var t=e||{};return function(e){for(var t in e)if(Object(ae.f)(e,t)&&t in qc)throw new Error('Scope contains an illegal symbol, "'+t+'" is a reserved keyword')}(t),r(t,n,i)}return{evaluate:t,eval:function(e){return Object(ve.a)("Method eval is renamed to evaluate. Please use the new method."),t(e)}}},t.prototype._compile=function(e,t){throw new Error("Method _compile should be implemented by type "+this.type)},t.prototype.forEach=function(e){throw new Error("Cannot run forEach on a Node interface")},t.prototype.map=function(e){throw new Error("Cannot run map on a Node interface")},t.prototype._ifNode=function(e){if(!Object(ie.w)(e))throw new TypeError("Callback function must return a Node");return e},t.prototype.traverse=function(e){e(this,null,null),function n(e,i){e.forEach(function(e,t,r){i(e,t,r),n(e,i)})}(this,e)},t.prototype.transform=function(a){return function e(t,r,n){var i=a(t,r,n);return i!==t?i:t.map(e)}(this,null,null)},t.prototype.filter=function(n){var i=[];return this.traverse(function(e,t,r){n(e,t,r)&&i.push(e)}),i},t.prototype.find=function(){throw new Error("Function Node.find is deprecated. Use Node.filter instead.")},t.prototype.match=function(){throw new Error("Function Node.match is deprecated. See functions Node.filter, Node.transform, Node.traverse.")},t.prototype.clone=function(){throw new Error("Cannot clone a Node interface")},t.prototype.cloneDeep=function(){return this.map(function(e){return e.cloneDeep()})},t.prototype.equals=function(e){return!!e&&Object(ae.d)(this,e)},t.prototype.toString=function(e){var t;if(e&&"object"===kc(e))switch(kc(e.handler)){case"object":case"undefined":break;case"function":t=e.handler(this,e);break;default:throw new TypeError("Object or function expected as callback")}return void 0!==t?t:this._toString(e)},t.prototype.toJSON=function(){throw new Error("Cannot serialize object: toJSON not implemented by "+this.type)},t.prototype.toHTML=function(e){var t;if(e&&"object"===kc(e))switch(kc(e.handler)){case"object":case"undefined":break;case"function":t=e.handler(this,e);break;default:throw new TypeError("Object or function expected as callback")}return void 0!==t?t:this.toHTML(e)},t.prototype._toString=function(){throw new Error("_toString not implemented for "+this.type)},t.prototype.toTex=function(e){var t;if(e&&"object"===kc(e))switch(kc(e.handler)){case"object":case"undefined":break;case"function":t=e.handler(this,e);break;default:throw new TypeError("Object or function expected as callback")}return void 0!==t?t:this._toTex(e)},t.prototype._toTex=function(e){throw new Error("_toTex not implemented for "+this.type)},t.prototype.getIdentifier=function(){return this.type},t.prototype.getContent=function(){return this},t},{isClass:!0,isNode:!0});function Rc(e){return e&&e.isIndexError?new R.a(e.index+1,e.min+1,void 0!==e.max?e.max+1:void 0):e}function Pc(e){return(Pc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Fc(e){var r=e.subset;return function(e,t){try{if(Array.isArray(e))return r(e,t);if(e&&"function"==typeof e.subset)return e.subset(t);if("string"==typeof e)return r(e,t);if("object"!==Pc(e))throw new TypeError("Cannot apply index: unsupported type of object");if(!t.isObjectProperty())throw new TypeError("Cannot apply a numeric index as object property");return Fi(e,t.getObjectProperty())}catch(e){throw Rc(e)}}}var Uc=["subset","Node"],Lc=Object(s.a)("AccessorNode",Uc,function(e){var t=e.subset,r=e.Node,s=Fc({subset:t});function n(e,t){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(!Object(ie.w)(e))throw new TypeError('Node expected for parameter "object"');if(!Object(ie.u)(t))throw new TypeError('IndexNode expected for parameter "index"');this.object=e||null,this.index=t,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 i(e){return!(Object(ie.a)(e)||Object(ie.c)(e)||Object(ie.l)(e)||Object(ie.r)(e)||Object(ie.A)(e)||Object(ie.C)(e)||Object(ie.J)(e))}return(n.prototype=new r).type="AccessorNode",n.prototype.isAccessorNode=!0,n.prototype._compile=function(e,t){var a=this.object._compile(e,t),o=this.index._compile(e,t);if(this.index.isObjectProperty()){var n=this.index.getObjectProperty();return function(e,t,r){return Fi(a(e,t,r),n)}}return function(e,t,r){var n=a(e,t,r),i=o(e,t,n);return s(n,i)}},n.prototype.forEach=function(e){e(this.object,"object",this),e(this.index,"index",this)},n.prototype.map=function(e){return new n(this._ifNode(e(this.object,"object",this)),this._ifNode(e(this.index,"index",this)))},n.prototype.clone=function(){return new n(this.object,this.index)},n.prototype._toString=function(e){var t=this.object.toString(e);return i(this.object)&&(t="("+t+")"),t+this.index.toString(e)},n.prototype.toHTML=function(e){var t=this.object.toHTML(e);return i(this.object)&&(t='<span class="math-parenthesis math-round-parenthesis">(</span>'+t+'<span class="math-parenthesis math-round-parenthesis">)</span>'),t+this.index.toHTML(e)},n.prototype._toTex=function(e){var t=this.object.toTex(e);return i(this.object)&&(t="\\left(' + object + '\\right)"),t+this.index.toTex(e)},n.prototype.toJSON=function(){return{mathjs:"AccessorNode",object:this.object,index:this.index}},n.fromJSON=function(e){return new n(e.object,e.index)},n},{isClass:!0,isNode:!0}),Hc=["Node"],$c=Object(s.a)("ArrayNode",Hc,function(e){var t=e.Node;function n(e){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(this.items=e||[],!Array.isArray(this.items)||!this.items.every(ie.w))throw new TypeError("Array containing Nodes expected");function t(){throw new Error("Property `ArrayNode.nodes` is deprecated, use `ArrayNode.items` instead")}Object.defineProperty(this,"nodes",{get:t,set:t})}return(n.prototype=new t).type="ArrayNode",n.prototype.isArrayNode=!0,n.prototype._compile=function(t,r){var e=Object(I.m)(this.items,function(e){return e._compile(t,r)});if("Array"===t.config.matrix)return function(t,r,n){return Object(I.m)(e,function(e){return e(t,r,n)})};var i=t.matrix;return function(t,r,n){return i(Object(I.m)(e,function(e){return e(t,r,n)}))}},n.prototype.forEach=function(e){for(var t=0;t<this.items.length;t++){e(this.items[t],"items["+t+"]",this)}},n.prototype.map=function(e){for(var t=[],r=0;r<this.items.length;r++)t[r]=this._ifNode(e(this.items[r],"items["+r+"]",this));return new n(t)},n.prototype.clone=function(){return new n(this.items.slice(0))},n.prototype._toString=function(t){return"["+this.items.map(function(e){return e.toString(t)}).join(", ")+"]"},n.prototype.toJSON=function(){return{mathjs:"ArrayNode",items:this.items}},n.fromJSON=function(e){return new n(e.items)},n.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>'},n.prototype._toTex=function(t){var r="\\begin{bmatrix}";return this.items.forEach(function(e){e.items?r+=e.items.map(function(e){return e.toTex(t)}).join("&"):r+=e.toTex(t),r+="\\\\"}),r+="\\end{bmatrix}"},n},{isClass:!0,isNode:!0});function Gc(e){return(Gc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var Zc=[{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 Vc(e,t){var r=e;"keep"!==t&&(r=e.getContent());for(var n=r.getIdentifier(),i=0;i<Zc.length;i++)if(n in Zc[i])return i;return null}function Jc(e,t){var r=e;"keep"!==t&&(r=e.getContent());var n=r.getIdentifier(),i=Vc(r,t);if(null===i)return null;var a=Zc[i][n];if(Object(ae.f)(a,"associativity")){if("left"===a.associativity)return"left";if("right"===a.associativity)return"right";throw Error("'"+n+"' has the invalid associativity '"+a.associativity+"'.")}return null}function Wc(e,t,r){var n="keep"!==r?e.getContent():e,i="keep"!==r?e.getContent():t,a=n.getIdentifier(),o=i.getIdentifier(),s=Vc(n,r);if(null===s)return null;var u=Zc[s][a];if(Object(ae.f)(u,"associativeWith")&&u.associativeWith instanceof Array){for(var c=0;c<u.associativeWith.length;c++)if(u.associativeWith[c]===o)return!0;return!1}return null}var Yc=["subset","?matrix","Node"],Xc=Object(s.a)("AssignmentNode",Yc,function(e){var t=e.subset,r=e.matrix,n=e.Node,m=Fc({subset:t}),h=function(e){var n=e.subset,i=e.matrix;return function(e,t,r){try{if(Array.isArray(e))return i(e).subset(t,r).valueOf();if(e&&"function"==typeof e.subset)return e.subset(t,r);if("string"==typeof e)return n(e,t,r);if("object"!==Gc(e))throw new TypeError("Cannot apply index: unsupported type of object");if(!t.isObjectProperty())throw TypeError("Cannot apply a numeric index as object property");return Ui(e,t.getObjectProperty(),r),e}catch(e){throw Rc(e)}}}({subset:t,matrix:r});function i(e,t,r){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(this.object=e,this.index=r?t:null,this.value=r||t,!Object(ie.J)(e)&&!Object(ie.a)(e))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if(Object(ie.J)(e)&&"end"===e.name)throw new Error('Cannot assign to symbol "end"');if(this.index&&!Object(ie.u)(this.index))throw new TypeError('IndexNode expected as "index"');if(!Object(ie.w)(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 a(e,t){var r=Vc(e,t=t||"keep"),n=Vc(e.value,t);return"all"===t||null!==n&&n<=r}return(i.prototype=new n).type="AssignmentNode",i.prototype.isAssignmentNode=!0,i.prototype._compile=function(e,t){var o=this.object._compile(e,t),u=this.index?this.index._compile(e,t):null,c=this.value._compile(e,t),s=this.object.name;if(this.index){if(this.index.isObjectProperty()){var a=this.index.getObjectProperty();return function(e,t,r){var n=o(e,t,r),i=c(e,t,r);return Ui(n,a,i)}}if(Object(ie.J)(this.object))return function(e,t,r){var n=o(e,t,r),i=c(e,t,r),a=u(e,t,n);return Ui(e,s,h(n,a,i)),i};var f=this.object.object._compile(e,t);if(this.object.index.isObjectProperty()){var l=this.object.index.getObjectProperty();return function(e,t,r){var n=f(e,t,r),i=Fi(n,l),a=u(e,t,i),o=c(e,t,r);return Ui(n,l,h(i,a,o)),o}}var p=this.object.index._compile(e,t);return function(e,t,r){var n=f(e,t,r),i=p(e,t,n),a=m(n,i),o=u(e,t,a),s=c(e,t,r);return h(n,i,h(a,o,s)),s}}if(!Object(ie.J)(this.object))throw new TypeError("SymbolNode expected as object");return function(e,t,r){return Ui(e,s,c(e,t,r))}},i.prototype.forEach=function(e){e(this.object,"object",this),this.index&&e(this.index,"index",this),e(this.value,"value",this)},i.prototype.map=function(e){return new i(this._ifNode(e(this.object,"object",this)),this.index?this._ifNode(e(this.index,"index",this)):null,this._ifNode(e(this.value,"value",this)))},i.prototype.clone=function(){return new i(this.object,this.index,this.value)},i.prototype._toString=function(e){var t=this.object.toString(e),r=this.index?this.index.toString(e):"",n=this.value.toString(e);return a(this,e&&e.parenthesis)&&(n="("+n+")"),t+r+" = "+n},i.prototype.toJSON=function(){return{mathjs:"AssignmentNode",object:this.object,index:this.index,value:this.value}},i.fromJSON=function(e){return new i(e.object,e.index,e.value)},i.prototype.toHTML=function(e){var t=this.object.toHTML(e),r=this.index?this.index.toHTML(e):"",n=this.value.toHTML(e);return a(this,e&&e.parenthesis)&&(n='<span class="math-paranthesis math-round-parenthesis">(</span>'+n+'<span class="math-paranthesis math-round-parenthesis">)</span>'),t+r+'<span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+n},i.prototype._toTex=function(e){var t=this.object.toTex(e),r=this.index?this.index.toTex(e):"",n=this.value.toTex(e);return a(this,e&&e.parenthesis)&&(n="\\left(".concat(n,"\\right)")),t+r+":="+n},i},{isClass:!0,isNode:!0}),Qc=["ResultSet","Node"],Kc=Object(s.a)("BlockNode",Qc,function(e){var o=e.ResultSet,t=e.Node;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 t=e&&e.node,r=!e||void 0===e.visible||e.visible;if(!Object(ie.w)(t))throw new TypeError('Property "node" must be a Node');if("boolean"!=typeof r)throw new TypeError('Property "visible" must be a boolean');return{node:t,visible:r}})}return(a.prototype=new t).type="BlockNode",a.prototype.isBlockNode=!0,a.prototype._compile=function(t,r){var e=Object(I.m)(this.blocks,function(e){return{evaluate:e.node._compile(t,r),visible:e.visible}});return function(r,n,i){var a=[];return Object(I.f)(e,function(e){var t=e.evaluate(r,n,i);e.visible&&a.push(t)}),new o(a)}},a.prototype.forEach=function(e){for(var t=0;t<this.blocks.length;t++)e(this.blocks[t].node,"blocks["+t+"].node",this)},a.prototype.map=function(e){for(var t=[],r=0;r<this.blocks.length;r++){var n=this.blocks[r],i=this._ifNode(e(n.node,"blocks["+r+"].node",this));t[r]={node:i,visible:n.visible}}return new a(t)},a.prototype.clone=function(){return new a(this.blocks.map(function(e){return{node:e.node,visible:e.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(e){return new a(e.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},{isClass:!0,isNode:!0}),ef=["Node"],tf=Object(s.a)("ConditionalNode",ef,function(e){var t=e.Node;function n(e,t,r){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(!Object(ie.w)(e))throw new TypeError("Parameter condition must be a Node");if(!Object(ie.w)(t))throw new TypeError("Parameter trueExpr must be a Node");if(!Object(ie.w)(r))throw new TypeError("Parameter falseExpr must be a Node");this.condition=e,this.trueExpr=t,this.falseExpr=r}return(n.prototype=new t).type="ConditionalNode",n.prototype.isConditionalNode=!0,n.prototype._compile=function(e,t){var n=this.condition._compile(e,t),i=this.trueExpr._compile(e,t),a=this.falseExpr._compile(e,t);return function(e,t,r){return function(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e)return!!e;if(e){if(Object(ie.e)(e))return!e.isZero();if(Object(ie.j)(e))return!(!e.re&&!e.im);if(Object(ie.L)(e))return!!e.value}if(null!=e)throw new TypeError('Unsupported type of condition "'+Object(ie.M)(e)+'"');return!1}(n(e,t,r))?i(e,t,r):a(e,t,r)}},n.prototype.forEach=function(e){e(this.condition,"condition",this),e(this.trueExpr,"trueExpr",this),e(this.falseExpr,"falseExpr",this)},n.prototype.map=function(e){return new n(this._ifNode(e(this.condition,"condition",this)),this._ifNode(e(this.trueExpr,"trueExpr",this)),this._ifNode(e(this.falseExpr,"falseExpr",this)))},n.prototype.clone=function(){return new n(this.condition,this.trueExpr,this.falseExpr)},n.prototype._toString=function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",r=Vc(this,t),n=this.condition.toString(e),i=Vc(this.condition,t);("all"===t||"OperatorNode"===this.condition.type||null!==i&&i<=r)&&(n="("+n+")");var a=this.trueExpr.toString(e),o=Vc(this.trueExpr,t);("all"===t||"OperatorNode"===this.trueExpr.type||null!==o&&o<=r)&&(a="("+a+")");var s=this.falseExpr.toString(e),u=Vc(this.falseExpr,t);return("all"===t||"OperatorNode"===this.falseExpr.type||null!==u&&u<=r)&&(s="("+s+")"),n+" ? "+a+" : "+s},n.prototype.toJSON=function(){return{mathjs:"ConditionalNode",condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}},n.fromJSON=function(e){return new n(e.condition,e.trueExpr,e.falseExpr)},n.prototype.toHTML=function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",r=Vc(this,t),n=this.condition.toHTML(e),i=Vc(this.condition,t);("all"===t||"OperatorNode"===this.condition.type||null!==i&&i<=r)&&(n='<span class="math-parenthesis math-round-parenthesis">(</span>'+n+'<span class="math-parenthesis math-round-parenthesis">)</span>');var a=this.trueExpr.toHTML(e),o=Vc(this.trueExpr,t);("all"===t||"OperatorNode"===this.trueExpr.type||null!==o&&o<=r)&&(a='<span class="math-parenthesis math-round-parenthesis">(</span>'+a+'<span class="math-parenthesis math-round-parenthesis">)</span>');var s=this.falseExpr.toHTML(e),u=Vc(this.falseExpr,t);return("all"===t||"OperatorNode"===this.falseExpr.type||null!==u&&u<=r)&&(s='<span class="math-parenthesis math-round-parenthesis">(</span>'+s+'<span class="math-parenthesis math-round-parenthesis">)</span>'),n+'<span class="math-operator math-conditional-operator">?</span>'+a+'<span class="math-operator math-conditional-operator">:</span>'+s},n.prototype._toTex=function(e){return"\\begin{cases} {"+this.trueExpr.toTex(e)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(e)+"}\\\\{"+this.falseExpr.toTex(e)+"}, &\\quad{\\text{otherwise}}\\end{cases}"},n},{isClass:!0,isNode:!0}),rf=r(17),nf=r.n(rf),af={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{?}"},of={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"},sf={abs:{1:"\\left|${args[0]}\\right|"},add:{2:"\\left(${args[0]}".concat(of.add,"${args[1]}\\right)")},cbrt:{1:"\\sqrt[3]{${args[0]}}"},ceil:{1:"\\left\\lceil${args[0]}\\right\\rceil"},cube:{1:"\\left(${args[0]}\\right)^3"},divide:{2:"\\frac{${args[0]}}{${args[1]}}"},dotDivide:{2:"\\left(${args[0]}".concat(of.dotDivide,"${args[1]}\\right)")},dotMultiply:{2:"\\left(${args[0]}".concat(of.dotMultiply,"${args[1]}\\right)")},dotPow:{2:"\\left(${args[0]}".concat(of.dotPow,"${args[1]}\\right)")},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:"\\left(e".concat(of.pow,"{${args[0]}}-1\\right)"),fix:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},floor:{1:"\\left\\lfloor${args[0]}\\right\\rfloor"},gcd:"\\gcd\\left(${args}\\right)",hypot:"\\hypot\\left(${args}\\right)",log:{1:"\\ln\\left(${args[0]}\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}\\right)"},log10:{1:"\\log_{10}\\left(${args[0]}\\right)"},log1p:{1:"\\ln\\left(${args[0]}+1\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}+1\\right)"},log2:"\\log_{2}\\left(${args[0]}\\right)",mod:{2:"\\left(${args[0]}".concat(of.mod,"${args[1]}\\right)")},multiply:{2:"\\left(${args[0]}".concat(of.multiply,"${args[1]}\\right)")},norm:{1:"\\left\\|${args[0]}\\right\\|",2:void 0},nthRoot:{2:"\\sqrt[${args[1]}]{${args[0]}}"},nthRoots:{2:"\\{y : $y^{args[1]} = {${args[0]}}\\}"},pow:{2:"\\left(${args[0]}\\right)".concat(of.pow,"{${args[1]}}")},round:{1:"\\left\\lfloor${args[0]}\\right\\rceil",2:void 0},sign:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},sqrt:{1:"\\sqrt{${args[0]}}"},square:{1:"\\left(${args[0]}\\right)^2"},subtract:{2:"\\left(${args[0]}".concat(of.subtract,"${args[1]}\\right)")},unaryMinus:{1:"".concat(of.unaryMinus,"\\left(${args[0]}\\right)")},unaryPlus:{1:"".concat(of.unaryPlus,"\\left(${args[0]}\\right)")},bitAnd:{2:"\\left(${args[0]}".concat(of.bitAnd,"${args[1]}\\right)")},bitNot:{1:of.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:"\\left(${args[0]}".concat(of.bitOr,"${args[1]}\\right)")},bitXor:{2:"\\left(${args[0]}".concat(of.bitXor,"${args[1]}\\right)")},leftShift:{2:"\\left(${args[0]}".concat(of.leftShift,"${args[1]}\\right)")},rightArithShift:{2:"\\left(${args[0]}".concat(of.rightArithShift,"${args[1]}\\right)")},rightLogShift:{2:"\\left(${args[0]}".concat(of.rightLogShift,"${args[1]}\\right)")},bellNumbers:{1:"\\mathrm{B}_{${args[0]}}"},catalan:{1:"\\mathrm{C}_{${args[0]}}"},stirlingS2:{2:"\\mathrm{S}\\left(${args}\\right)"},arg:{1:"\\arg\\left(${args[0]}\\right)"},conj:{1:"\\left(${args[0]}\\right)^*"},im:{1:"\\Im\\left\\lbrace${args[0]}\\right\\rbrace"},re:{1:"\\Re\\left\\lbrace${args[0]}\\right\\rbrace"},and:{2:"\\left(${args[0]}".concat(of.and,"${args[1]}\\right)")},not:{1:of.not+"\\left(${args[0]}\\right)"},or:{2:"\\left(${args[0]}".concat(of.or,"${args[1]}\\right)")},xor:{2:"\\left(${args[0]}".concat(of.xor,"${args[1]}\\right)")},cross:{2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:"\\left(${args[0]}\\right)".concat(of.ctranspose)},det:{1:"\\det\\left(${args[0]}\\right)"},dot:{2:"\\left(${args[0]}\\cdot${args[1]}\\right)"},expm:{1:"\\exp\\left(${args[0]}\\right)"},inv:{1:"\\left(${args[0]}\\right)^{-1}"},sqrtm:{1:"{${args[0]}}".concat(of.pow,"{\\frac{1}{2}}")},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:"\\left(${args[0]}\\right)".concat(of.transpose)},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:"\\left(${args[0]}\\right)".concat(of.factorial)},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},equal:{2:"\\left(${args[0]}".concat(of.equal,"${args[1]}\\right)")},larger:{2:"\\left(${args[0]}".concat(of.larger,"${args[1]}\\right)")},largerEq:{2:"\\left(${args[0]}".concat(of.largerEq,"${args[1]}\\right)")},smaller:{2:"\\left(${args[0]}".concat(of.smaller,"${args[1]}\\right)")},smallerEq:{2:"\\left(${args[0]}".concat(of.smallerEq,"${args[1]}\\right)")},unequal:{2:"\\left(${args[0]}".concat(of.unequal,"${args[1]}\\right)")},erf:{1:"erf\\left(${args[0]}\\right)"},max:"\\max\\left(${args}\\right)",min:"\\min\\left(${args}\\right)",variance:"\\mathrm{Var}\\left(${args}\\right)",acos:{1:"\\cos^{-1}\\left(${args[0]}\\right)"},acosh:{1:"\\cosh^{-1}\\left(${args[0]}\\right)"},acot:{1:"\\cot^{-1}\\left(${args[0]}\\right)"},acoth:{1:"\\coth^{-1}\\left(${args[0]}\\right)"},acsc:{1:"\\csc^{-1}\\left(${args[0]}\\right)"},acsch:{1:"\\mathrm{csch}^{-1}\\left(${args[0]}\\right)"},asec:{1:"\\sec^{-1}\\left(${args[0]}\\right)"},asech:{1:"\\mathrm{sech}^{-1}\\left(${args[0]}\\right)"},asin:{1:"\\sin^{-1}\\left(${args[0]}\\right)"},asinh:{1:"\\sinh^{-1}\\left(${args[0]}\\right)"},atan:{1:"\\tan^{-1}\\left(${args[0]}\\right)"},atan2:{2:"\\mathrm{atan2}\\left(${args}\\right)"},atanh:{1:"\\tanh^{-1}\\left(${args[0]}\\right)"},cos:{1:"\\cos\\left(${args[0]}\\right)"},cosh:{1:"\\cosh\\left(${args[0]}\\right)"},cot:{1:"\\cot\\left(${args[0]}\\right)"},coth:{1:"\\coth\\left(${args[0]}\\right)"},csc:{1:"\\csc\\left(${args[0]}\\right)"},csch:{1:"\\mathrm{csch}\\left(${args[0]}\\right)"},sec:{1:"\\sec\\left(${args[0]}\\right)"},sech:{1:"\\mathrm{sech}\\left(${args[0]}\\right)"},sin:{1:"\\sin\\left(${args[0]}\\right)"},sinh:{1:"\\sinh\\left(${args[0]}\\right)"},tan:{1:"\\tan\\left(${args[0]}\\right)"},tanh:{1:"\\tanh\\left(${args[0]}\\right)"},to:{2:"\\left(${args[0]}".concat(of.to,"${args[1]}\\right)")},numeric:function(e,t){return e.args[0].toTex()},number:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"},string:{0:'\\mathtt{""}',1:"\\mathrm{string}\\left(${args[0]}\\right)"},bignumber:{0:"0",1:"\\left(${args[0]}\\right)"},complex:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)+".concat(af.i,"\\cdot\\left(${args[1]}\\right)\\right)")},matrix:{0:"\\begin{bmatrix}\\end{bmatrix}",1:"\\left(${args[0]}\\right)",2:"\\left(${args[0]}\\right)"},sparse:{0:"\\begin{bsparse}\\end{bsparse}",1:"\\left(${args[0]}\\right)"},unit:{1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"}},uf={deg:"^\\circ"};function cf(e){return nf()(e,{preserveFormatting:!0})}function ff(e,t){return(t=void 0!==t&&t)?Object(ae.f)(uf,e)?uf[e]:"\\mathrm{"+cf(e)+"}":Object(ae.f)(af,e)?af[e]:cf(e)}var lf=["Node"],pf=Object(s.a)("ConstantNode",lf,function(e){var t=e.Node;function r(e){if(!(this instanceof r))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=e}return(r.prototype=new t).type="ConstantNode",r.prototype.isConstantNode=!0,r.prototype._compile=function(e,t){var r=this.value;return function(){return r}},r.prototype.forEach=function(e){},r.prototype.map=function(e){return this.clone()},r.prototype.clone=function(){return new r(this.value)},r.prototype._toString=function(e){return Object(J.d)(this.value,e)},r.prototype.toHTML=function(e){var t=this._toString(e);switch(Object(ie.M)(this.value)){case"number":case"BigNumber":case"Fraction":return'<span class="math-number">'+t+"</span>";case"string":return'<span class="math-string">'+t+"</span>";case"boolean":return'<span class="math-boolean">'+t+"</span>";case"null":return'<span class="math-null-symbol">'+t+"</span>";case"undefined":return'<span class="math-undefined">'+t+"</span>";default:return'<span class="math-symbol">'+t+"</span>"}},r.prototype.toJSON=function(){return{mathjs:"ConstantNode",value:this.value}},r.fromJSON=function(e){return new r(e.value)},r.prototype._toTex=function(e){var t=this._toString(e);switch(Object(ie.M)(this.value)){case"string":return"\\mathtt{"+cf(t)+"}";case"number":case"BigNumber":var r=t.toLowerCase().indexOf("e");return-1!==r?t.substring(0,r)+"\\cdot10^{"+t.substring(r+1)+"}":t;case"Fraction":return this.value.toLatex();default:return t}},r},{isClass:!0,isNode:!0}),mf=["typed","Node"],hf=Object(s.a)("FunctionAssignmentNode",mf,function(e){var f=e.typed,t=e.Node;function n(e,t,r){if(!(this instanceof n))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(t))throw new TypeError('Array containing strings or objects expected for parameter "params"');if(!Object(ie.w)(r))throw new TypeError('Node expected for parameter "expr"');if(e in qc)throw new Error('Illegal function name, "'+e+'" is a reserved keyword');this.name=e,this.params=t.map(function(e){return e&&e.name||e}),this.types=t.map(function(e){return e&&e.type||"any"}),this.expr=r}function a(e,t){var r=Vc(e,t),n=Vc(e.expr,t);return"all"===t||null!==n&&n<=r}return(n.prototype=new t).type="FunctionAssignmentNode",n.prototype.isFunctionAssignmentNode=!0,n.prototype._compile=function(e,t){var r=Object.create(t);Object(I.f)(this.params,function(e){r[e]=!0});var a=this.expr._compile(e,r),o=this.name,s=this.params,u=Object(I.k)(this.types,","),c=o+"("+Object(I.k)(this.params,", ")+")";return function(r,n,i){var e={};e[u]=function(){for(var e=Object.create(n),t=0;t<s.length;t++)e[s[t]]=arguments[t];return a(r,e,i)};var t=f(o,e);return t.syntax=c,Ui(r,o,t),t}},n.prototype.forEach=function(e){e(this.expr,"expr",this)},n.prototype.map=function(e){var t=this._ifNode(e(this.expr,"expr",this));return new n(this.name,this.params.slice(0),t)},n.prototype.clone=function(){return new n(this.name,this.params.slice(0),this.expr)},n.prototype._toString=function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",r=this.expr.toString(e);return a(this,t)&&(r="("+r+")"),this.name+"("+this.params.join(", ")+") = "+r},n.prototype.toJSON=function(){var r=this.types;return{mathjs:"FunctionAssignmentNode",name:this.name,params:this.params.map(function(e,t){return{name:e,type:r[t]}}),expr:this.expr}},n.fromJSON=function(e){return new n(e.name,e.params,e.expr)},n.prototype.toHTML=function(e){for(var t=e&&e.parenthesis?e.parenthesis:"keep",r=[],n=0;n<this.params.length;n++)r.push('<span class="math-symbol math-parameter">'+Object(J.c)(this.params[n])+"</span>");var i=this.expr.toHTML(e);return a(this,t)&&(i='<span class="math-parenthesis math-round-parenthesis">(</span>'+i+'<span class="math-parenthesis math-round-parenthesis">)</span>'),'<span class="math-function">'+Object(J.c)(this.name)+'</span><span class="math-parenthesis math-round-parenthesis">(</span>'+r.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>'+i},n.prototype._toTex=function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",r=this.expr.toTex(e);return a(this,t)&&(r="\\left(".concat(r,"\\right)")),"\\mathrm{"+this.name+"}\\left("+this.params.map(ff).join(",")+"\\right):="+r},n},{isClass:!0,isNode:!0}),df=["Index"],yf=Object(s.a)("index",df,function(e){var a=e.Index;return function(){for(var e=[],t=0,r=arguments.length;t<r;t++){var n=arguments[t];if(Object(ie.D)(n))n.start--,n.end-=0<n.step?0:2;else if(n&&!0===n.isSet)n=n.map(function(e){return e-1});else if(Object(ie.b)(n)||Object(ie.v)(n))n=n.map(function(e){return e-1});else if(Object(ie.y)(n))n--;else if(Object(ie.e)(n))n=n.toNumber()-1;else if("string"!=typeof n)throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");e[t]=n}var i=new a;return a.apply(i,e),i}},{isTransformFunction:!0});function gf(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var vf=["Range","Node","Index","size"],bf=Object(s.a)("IndexNode",vf,function(e){var n=e.Range,t=e.Node,r=e.Index,h=e.size,a=yf({Index:r});function i(e,t){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(this.dimensions=e,this.dotNotation=t||!1,!Array.isArray(e)||!e.every(ie.w))throw new TypeError('Array containing Nodes expected for parameter "dimensions"');if(this.dotNotation&&!this.isObjectProperty())throw new Error("dotNotation only applicable for object properties");function r(){throw new Error("Property `IndexNode.object` is deprecated, use `IndexNode.fn` instead")}Object.defineProperty(this,"object",{get:r,set:r})}function d(e,t,r){return new n(Object(ie.e)(e)?e.toNumber():e,Object(ie.e)(t)?t.toNumber():t,Object(ie.e)(r)?r.toNumber():r)}return(i.prototype=new t).type="IndexNode",i.prototype.isIndexNode=!0,i.prototype._compile=function(p,m){var i=Object(I.m)(this.dimensions,function(e,a){if(Object(ie.E)(e)){if(e.needsEnd()){var t=Object.create(m);t.end=!0;var o=e.start._compile(p,t),s=e.end._compile(p,t),u=e.step?e.step._compile(p,t):function(){return 1};return function(e,t,r){var n=h(r).valueOf(),i=Object.create(t);return i.end=n[a],d(o(e,i,r),s(e,i,r),u(e,i,r))}}var n=e.start._compile(p,m),i=e.end._compile(p,m),c=e.step?e.step._compile(p,m):function(){return 1};return function(e,t,r){return d(n(e,t,r),i(e,t,r),c(e,t,r))}}if(Object(ie.J)(e)&&"end"===e.name){var r=Object.create(m);r.end=!0;var f=e._compile(p,r);return function(e,t,r){var n=h(r).valueOf(),i=Object.create(t);return i.end=n[a],f(e,i,r)}}var l=e._compile(p,m);return function(e,t,r){return l(e,t,r)}});return function(t,r,n){var e=Object(I.m)(i,function(e){return e(t,r,n)});return a.apply(void 0,gf(e))}},i.prototype.forEach=function(e){for(var t=0;t<this.dimensions.length;t++)e(this.dimensions[t],"dimensions["+t+"]",this)},i.prototype.map=function(e){for(var t=[],r=0;r<this.dimensions.length;r++)t[r]=this._ifNode(e(this.dimensions[r],"dimensions["+r+"]",this));return new i(t)},i.prototype.clone=function(){return new i(this.dimensions.slice(0))},i.prototype.isObjectProperty=function(){return 1===this.dimensions.length&&Object(ie.l)(this.dimensions[0])&&"string"==typeof this.dimensions[0].value},i.prototype.getObjectProperty=function(){return this.isObjectProperty()?this.dimensions[0].value:null},i.prototype._toString=function(e){return this.dotNotation?"."+this.getObjectProperty():"["+this.dimensions.join(", ")+"]"},i.prototype.toJSON=function(){return{mathjs:"IndexNode",dimensions:this.dimensions,dotNotation:this.dotNotation}},i.fromJSON=function(e){return new i(e.dimensions,e.dotNotation)},i.prototype.toHTML=function(e){for(var t=[],r=0;r<this.dimensions.length;r++)t[r]=this.dimensions[r].toHTML();return this.dotNotation?'<span class="math-operator math-accessor-operator">.</span><span class="math-symbol math-property">'+Object(J.c)(this.getObjectProperty())+"</span>":'<span class="math-parenthesis math-square-parenthesis">[</span>'+t.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'},i.prototype._toTex=function(t){var e=this.dimensions.map(function(e){return e.toTex(t)});return this.dotNotation?"."+this.getObjectProperty():"_{"+e.join(",")+"}"},i},{isClass:!0,isNode:!0});function xf(e){return(xf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var wf=["Node"],Nf=Object(s.a)("ObjectNode",wf,function(e){var t=e.Node;function n(t){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(this.properties=t||{},t&&("object"!==xf(t)||!Object.keys(t).every(function(e){return Object(ie.w)(t[e])})))throw new TypeError("Object containing Nodes expected")}return(n.prototype=new t).type="ObjectNode",n.prototype.isObjectNode=!0,n.prototype._compile=function(e,t){var a={};for(var r in this.properties)if(Object(ae.f)(this.properties,r)){var n=Object(J.e)(r),i=JSON.parse(n);if(!Li(this.properties,i))throw new Error('No access to property "'+i+'"');a[i]=this.properties[r]._compile(e,t)}return function(e,t,r){var n={};for(var i in a)Object(ae.f)(a,i)&&(n[i]=a[i](e,t,r));return n}},n.prototype.forEach=function(e){for(var t in this.properties)Object(ae.f)(this.properties,t)&&e(this.properties[t],"properties["+Object(J.e)(t)+"]",this)},n.prototype.map=function(e){var t={};for(var r in this.properties)Object(ae.f)(this.properties,r)&&(t[r]=this._ifNode(e(this.properties[r],"properties["+Object(J.e)(r)+"]",this)));return new n(t)},n.prototype.clone=function(){var e={};for(var t in this.properties)Object(ae.f)(this.properties,t)&&(e[t]=this.properties[t]);return new n(e)},n.prototype._toString=function(e){var t=[];for(var r in this.properties)Object(ae.f)(this.properties,r)&&t.push(Object(J.e)(r)+": "+this.properties[r].toString(e));return"{"+t.join(", ")+"}"},n.prototype.toJSON=function(){return{mathjs:"ObjectNode",properties:this.properties}},n.fromJSON=function(e){return new n(e.properties)},n.prototype.toHTML=function(e){var t=[];for(var r in this.properties)Object(ae.f)(this.properties,r)&&t.push('<span class="math-symbol math-property">'+Object(J.c)(r)+'</span><span class="math-operator math-assignment-operator math-property-assignment-operator math-binary-operator">:</span>'+this.properties[r].toHTML(e));return'<span class="math-parenthesis math-curly-parenthesis">{</span>'+t.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-curly-parenthesis">}</span>'},n.prototype._toTex=function(e){var t=[];for(var r in this.properties)Object(ae.f)(this.properties,r)&&t.push("\\mathbf{"+r+":} & "+this.properties[r].toTex(e)+"\\\\");return"\\left\\{\\begin{array}{ll}".concat(t.join("\n"),"\\end{array}\\right\\}")},n},{isClass:!0,isNode:!0}),Of=["Node"],Mf=Object(s.a)("OperatorNode",Of,function(e){var t=e.Node;function i(e,t,r,n){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 t)throw new TypeError('string expected for parameter "fn"');if(!Array.isArray(r)||!r.every(ie.w))throw new TypeError('Array containing Nodes expected for parameter "args"');this.implicit=!0===n,this.op=e,this.fn=t,this.args=r||[]}function m(i,a,e,t,r){var n,o=Vc(i,a),s=Jc(i,a);if("all"===a||2<t.length&&"OperatorNode:add"!==i.getIdentifier()&&"OperatorNode:multiply"!==i.getIdentifier())return t.map(function(e){switch(e.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}});switch(t.length){case 0:n=[];break;case 1:var u=Vc(t[0],a);if(r&&null!==u){var c,f;if(f="keep"===a?(c=t[0].getIdentifier(),i.getIdentifier()):(c=t[0].getContent().getIdentifier(),i.getContent().getIdentifier()),!1===Zc[o][f].latexLeftParens){n=[!1];break}if(!1===Zc[u][c].latexParens){n=[!1];break}}if(null===u){n=[!1];break}if(u<=o){n=[!0];break}n=[!1];break;case 2:var l,p,m=Vc(t[0],a),h=Wc(i,t[0],a);l=null!==m&&(m===o&&"right"===s&&!h||m<o);var d,y,g,v=Vc(t[1],a),b=Wc(i,t[1],a);if(p=null!==v&&(v===o&&"left"===s&&!b||v<o),r)g="keep"===a?(d=i.getIdentifier(),y=i.args[0].getIdentifier(),i.args[1].getIdentifier()):(d=i.getContent().getIdentifier(),y=i.args[0].getContent().getIdentifier(),i.args[1].getContent().getIdentifier()),null!==m&&(!1===Zc[o][d].latexLeftParens&&(l=!1),!1===Zc[m][y].latexParens&&(l=!1)),null!==v&&(!1===Zc[o][d].latexRightParens&&(p=!1),!1===Zc[v][g].latexParens&&(p=!1));n=[l,p];break;default:"OperatorNode:add"!==i.getIdentifier()&&"OperatorNode:multiply"!==i.getIdentifier()||(n=t.map(function(e){var t=Vc(e,a),r=Wc(i,e,a),n=Jc(e,a);return null!==t&&(o===t&&s===n&&!r||t<o)}))}return 2<=t.length&&"OperatorNode:multiply"===i.getIdentifier()&&i.implicit&&"auto"===a&&"hide"===e&&(n=t.map(function(e,t){var r="ParenthesisNode"===e.getIdentifier();return!(!n[t]&&!r)})),n}return(i.prototype=new t).type="OperatorNode",i.prototype.isOperatorNode=!0,i.prototype._compile=function(t,r){if("string"!=typeof this.fn||!Hi(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 i=Fi(t,this.fn),e=Object(I.m)(this.args,function(e){return e._compile(t,r)});if(1===e.length){var n=e[0];return function(e,t,r){return i(n(e,t,r))}}if(2!==e.length)return function(t,r,n){return i.apply(null,Object(I.m)(e,function(e){return e(t,r,n)}))};var a=e[0],o=e[1];return function(e,t,r){return i(a(e,t,r),o(e,t,r))}},i.prototype.forEach=function(e){for(var t=0;t<this.args.length;t++)e(this.args[t],"args["+t+"]",this)},i.prototype.map=function(e){for(var t=[],r=0;r<this.args.length;r++)t[r]=this._ifNode(e(this.args[r],"args["+r+"]",this));return new i(this.op,this.fn,t,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(r){var e=r&&r.parenthesis?r.parenthesis:"keep",t=r&&r.implicit?r.implicit:"hide",n=this.args,i=m(this,e,t,n,!1);if(1===n.length){var a=Jc(this,e),o=n[0].toString(r);i[0]&&(o="("+o+")");var s=/[a-zA-Z]+/.test(this.op);return"right"===a?this.op+(s?" ":"")+o:"left"===a?o+(s?" ":"")+this.op:o+this.op}if(2===n.length){var u=n[0].toString(r),c=n[1].toString(r);return i[0]&&(u="("+u+")"),i[1]&&(c="("+c+")"),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===t?u+" "+c:u+" "+this.op+" "+c}if(2<n.length&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())){var f=n.map(function(e,t){return e=e.toString(r),i[t]&&(e="("+e+")"),e});return this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===t?f.join(" "):f.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(e){return new i(e.op,e.fn,e.args,e.implicit)},i.prototype.toHTML=function(r){var e=r&&r.parenthesis?r.parenthesis:"keep",t=r&&r.implicit?r.implicit:"hide",n=this.args,i=m(this,e,t,n,!1);if(1===n.length){var a=Jc(this,e),o=n[0].toHTML(r);return i[0]&&(o='<span class="math-parenthesis math-round-parenthesis">(</span>'+o+'<span class="math-parenthesis math-round-parenthesis">)</span>'),"right"===a?'<span class="math-operator math-unary-operator math-lefthand-unary-operator">'+Object(J.c)(this.op)+"</span>"+o:o+'<span class="math-operator math-unary-operator math-righthand-unary-operator">'+Object(J.c)(this.op)+"</span>"}if(2===n.length){var s=n[0].toHTML(r),u=n[1].toHTML(r);return i[0]&&(s='<span class="math-parenthesis math-round-parenthesis">(</span>'+s+'<span class="math-parenthesis math-round-parenthesis">)</span>'),i[1]&&(u='<span class="math-parenthesis math-round-parenthesis">(</span>'+u+'<span class="math-parenthesis math-round-parenthesis">)</span>'),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===t?s+'<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'+u:s+'<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Object(J.c)(this.op)+"</span>"+u}var c=n.map(function(e,t){return e=e.toHTML(r),i[t]&&(e='<span class="math-parenthesis math-round-parenthesis">(</span>'+e+'<span class="math-parenthesis math-round-parenthesis">)</span>'),e});return 2<n.length&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())?this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===t?c.join('<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'):c.join('<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Object(J.c)(this.op)+"</span>"):'<span class="math-function">'+Object(J.c)(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+c.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'},i.prototype._toTex=function(r){var e=r&&r.parenthesis?r.parenthesis:"keep",t=r&&r.implicit?r.implicit:"hide",n=this.args,i=m(this,e,t,n,!0),a=of[this.fn];if(a=void 0===a?this.op:a,1===n.length){var o=Jc(this,e),s=n[0].toTex(r);return i[0]&&(s="\\left(".concat(s,"\\right)")),"right"===o?a+s:s+a}if(2===n.length){var u=n[0],c=u.toTex(r);i[0]&&(c="\\left(".concat(c,"\\right)"));var f,l=n[1].toTex(r);switch(i[1]&&(l="\\left(".concat(l,"\\right)")),f="keep"===e?u.getIdentifier():u.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return a+"{"+c+"}{"+l+"}";case"OperatorNode:pow":switch(c="{"+c+"}",l="{"+l+"}",f){case"ConditionalNode":case"OperatorNode:divide":c="\\left(".concat(c,"\\right)")}break;case"OperatorNode:multiply":if(this.implicit&&"hide"===t)return c+"~"+l}return c+a+l}if(2<n.length&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())){var p=n.map(function(e,t){return e=e.toTex(r),i[t]&&(e="\\left(".concat(e,"\\right)")),e});return"OperatorNode:multiply"===this.getIdentifier()&&this.implicit?p.join("~"):p.join(a)}return"\\mathrm{"+this.fn+"}\\left("+n.map(function(e){return e.toTex(r)}).join(",")+"\\right)"},i.prototype.getIdentifier=function(){return this.type+":"+this.fn},i},{isClass:!0,isNode:!0}),Ef=["Node"],jf=Object(s.a)("ParenthesisNode",Ef,function(e){var t=e.Node;function r(e){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(!Object(ie.w)(e))throw new TypeError('Node expected for parameter "content"');this.content=e}return(r.prototype=new t).type="ParenthesisNode",r.prototype.isParenthesisNode=!0,r.prototype._compile=function(e,t){return this.content._compile(e,t)},r.prototype.getContent=function(){return this.content.getContent()},r.prototype.forEach=function(e){e(this.content,"content",this)},r.prototype.map=function(e){return new r(e(this.content,"content",this))},r.prototype.clone=function(){return new r(this.content)},r.prototype._toString=function(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?"("+this.content.toString(e)+")":this.content.toString(e)},r.prototype.toJSON=function(){return{mathjs:"ParenthesisNode",content:this.content}},r.fromJSON=function(e){return new r(e.content)},r.prototype.toHTML=function(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?'<span class="math-parenthesis math-round-parenthesis">(</span>'+this.content.toHTML(e)+'<span class="math-parenthesis math-round-parenthesis">)</span>':this.content.toHTML(e)},r.prototype._toTex=function(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?"\\left(".concat(this.content.toTex(e),"\\right)"):this.content.toTex(e)},r},{isClass:!0,isNode:!0}),Sf=["Node"],Af=Object(s.a)("RangeNode",Sf,function(e){var t=e.Node;function n(e,t,r){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(!Object(ie.w)(e))throw new TypeError("Node expected");if(!Object(ie.w)(t))throw new TypeError("Node expected");if(r&&!Object(ie.w)(r))throw new TypeError("Node expected");if(3<arguments.length)throw new Error("Too many arguments");this.start=e,this.end=t,this.step=r||null}function o(e,t){var r=Vc(e,t),n={},i=Vc(e.start,t);if(n.start=null!==i&&i<=r||"all"===t,e.step){var a=Vc(e.step,t);n.step=null!==a&&a<=r||"all"===t}var o=Vc(e.end,t);return n.end=null!==o&&o<=r||"all"===t,n}return(n.prototype=new t).type="RangeNode",n.prototype.isRangeNode=!0,n.prototype.needsEnd=function(){return 0<this.filter(function(e){return Object(ie.J)(e)&&"end"===e.name}).length},n.prototype._compile=function(e,t){var n=e.range,i=this.start._compile(e,t),a=this.end._compile(e,t);if(this.step){var o=this.step._compile(e,t);return function(e,t,r){return n(i(e,t,r),a(e,t,r),o(e,t,r))}}return function(e,t,r){return n(i(e,t,r),a(e,t,r))}},n.prototype.forEach=function(e){e(this.start,"start",this),e(this.end,"end",this),this.step&&e(this.step,"step",this)},n.prototype.map=function(e){return new n(this._ifNode(e(this.start,"start",this)),this._ifNode(e(this.end,"end",this)),this.step&&this._ifNode(e(this.step,"step",this)))},n.prototype.clone=function(){return new n(this.start,this.end,this.step&&this.step)},n.prototype._toString=function(e){var t,r=o(this,e&&e.parenthesis?e.parenthesis:"keep"),n=this.start.toString(e);if(r.start&&(n="("+n+")"),t=n,this.step){var i=this.step.toString(e);r.step&&(i="("+i+")"),t+=":"+i}var a=this.end.toString(e);return r.end&&(a="("+a+")"),t+=":"+a},n.prototype.toJSON=function(){return{mathjs:"RangeNode",start:this.start,end:this.end,step:this.step}},n.fromJSON=function(e){return new n(e.start,e.end,e.step)},n.prototype.toHTML=function(e){var t,r=o(this,e&&e.parenthesis?e.parenthesis:"keep"),n=this.start.toHTML(e);if(r.start&&(n='<span class="math-parenthesis math-round-parenthesis">(</span>'+n+'<span class="math-parenthesis math-round-parenthesis">)</span>'),t=n,this.step){var i=this.step.toHTML(e);r.step&&(i='<span class="math-parenthesis math-round-parenthesis">(</span>'+i+'<span class="math-parenthesis math-round-parenthesis">)</span>'),t+='<span class="math-operator math-range-operator">:</span>'+i}var a=this.end.toHTML(e);return r.end&&(a='<span class="math-parenthesis math-round-parenthesis">(</span>'+a+'<span class="math-parenthesis math-round-parenthesis">)</span>'),t+='<span class="math-operator math-range-operator">:</span>'+a},n.prototype._toTex=function(e){var t=o(this,e&&e.parenthesis?e.parenthesis:"keep"),r=this.start.toTex(e);if(t.start&&(r="\\left(".concat(r,"\\right)")),this.step){var n=this.step.toTex(e);t.step&&(n="\\left(".concat(n,"\\right)")),r+=":"+n}var i=this.end.toTex(e);return t.end&&(i="\\left(".concat(i,"\\right)")),r+=":"+i},n},{isClass:!0,isNode:!0}),Cf=["Node"],Tf=Object(s.a)("RelationalNode",Cf,function(e){var t=e.Node;function i(e,t){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(!Array.isArray(e))throw new TypeError("Parameter conditionals must be an array");if(!Array.isArray(t))throw new TypeError("Parameter params must be an array");if(e.length!==t.length-1)throw new TypeError("Parameter params must contain exactly one more element than parameter conditionals");this.conditionals=e,this.params=t}return(i.prototype=new t).type="RelationalNode",i.prototype.isRelationalNode=!0,i.prototype._compile=function(o,t){var s=this,u=this.params.map(function(e){return e._compile(o,t)});return function(e,t,r){for(var n,i=u[0](e,t,r),a=0;a<s.conditionals.length;a++){if(n=i,i=u[a+1](e,t,r),!Fi(o,s.conditionals[a])(n,i))return!1}return!0}},i.prototype.forEach=function(r){var n=this;this.params.forEach(function(e,t){return r(e,"params["+t+"]",n)},this)},i.prototype.map=function(r){var n=this;return new i(this.conditionals.slice(),this.params.map(function(e,t){return n._ifNode(r(e,"params["+t+"]",n))},this))},i.prototype.clone=function(){return new i(this.conditionals,this.params)},i.prototype._toString=function(n){for(var i=n&&n.parenthesis?n.parenthesis:"keep",a=Vc(this,i),e=this.params.map(function(e,t){var r=Vc(e,i);return"all"===i||null!==r&&r<=a?"("+e.toString(n)+")":e.toString(n)}),t={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="},r=e[0],o=0;o<this.conditionals.length;o++)r+=" "+t[this.conditionals[o]]+" "+e[o+1];return r},i.prototype.toJSON=function(){return{mathjs:"RelationalNode",conditionals:this.conditionals,params:this.params}},i.fromJSON=function(e){return new i(e.conditionals,e.params)},i.prototype.toHTML=function(n){for(var i=n&&n.parenthesis?n.parenthesis:"keep",a=Vc(this,i),e=this.params.map(function(e,t){var r=Vc(e,i);return"all"===i||null!==r&&r<=a?'<span class="math-parenthesis math-round-parenthesis">(</span>'+e.toHTML(n)+'<span class="math-parenthesis math-round-parenthesis">)</span>':e.toHTML(n)}),t={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="},r=e[0],o=0;o<this.conditionals.length;o++)r+='<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Object(J.c)(t[this.conditionals[o]])+"</span>"+e[o+1];return r},i.prototype._toTex=function(n){for(var i=n&&n.parenthesis?n.parenthesis:"keep",a=Vc(this,i),e=this.params.map(function(e,t){var r=Vc(e,i);return"all"===i||null!==r&&r<=a?"\\left("+e.toTex(n)+"\right)":e.toTex(n)}),t=e[0],r=0;r<this.conditionals.length;r++)t+=of[this.conditionals[r]]+e[r+1];return t},i},{isClass:!0,isNode:!0}),_f=["math","?Unit","Node"],If=Object(s.a)("SymbolNode",_f,function(e){var n=e.math,o=e.Unit,t=e.Node;function s(e){return!!o&&o.isValuelessUnit(e)}function r(e){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if("string"!=typeof e)throw new TypeError('String expected for parameter "name"');this.name=e}return(r.prototype=new t).type="SymbolNode",r.prototype.isSymbolNode=!0,r.prototype._compile=function(n,e){var i=this.name;if(!0===e[i])return function(e,t,r){return t[i]};if(i in n)return function(e,t,r){return Fi(i in e?e:n,i)};var a=s(i);return function(e,t,r){return i in e?Fi(e,i):a?new o(null,i):function(e){throw new Error("Undefined symbol "+e)}(i)}},r.prototype.forEach=function(e){},r.prototype.map=function(e){return this.clone()},r.prototype.clone=function(){return new r(this.name)},r.prototype._toString=function(e){return this.name},r.prototype.toHTML=function(e){var t=Object(J.c)(this.name);return"true"===t||"false"===t?'<span class="math-symbol math-boolean">'+t+"</span>":"i"===t?'<span class="math-symbol math-imaginary-symbol">'+t+"</span>":"Infinity"===t?'<span class="math-symbol math-infinity-symbol">'+t+"</span>":"NaN"===t?'<span class="math-symbol math-nan-symbol">'+t+"</span>":"null"===t?'<span class="math-symbol math-null-symbol">'+t+"</span>":"undefined"===t?'<span class="math-symbol math-undefined-symbol">'+t+"</span>":'<span class="math-symbol">'+t+"</span>"},r.prototype.toJSON=function(){return{mathjs:"SymbolNode",name:this.name}},r.fromJSON=function(e){return new r(e.name)},r.prototype._toTex=function(e){var t=!1;void 0===n[this.name]&&s(this.name)&&(t=!0);var r=ff(this.name,t);return"\\"===r[0]?r:" "+r},r},{isClass:!0,isNode:!0});function Bf(e){return(Bf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function qf(){return(qf=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var kf=["math","Node","SymbolNode"],zf=Object(s.a)("FunctionNode",kf,function(e){var i=e.math,t=e.Node,n=e.SymbolNode;function y(e,t){if(!(this instanceof y))throw new SyntaxError("Constructor must be called with the new operator");if("string"==typeof e&&(e=new n(e)),!Object(ie.w)(e))throw new TypeError('Node expected as parameter "fn"');if(!Array.isArray(t)||!t.every(ie.w))throw new TypeError('Array containing Nodes expected for parameter "args"');this.fn=e,this.args=t||[],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")}});function r(){throw new Error("Property `FunctionNode.object` is deprecated, use `FunctionNode.fn` instead")}Object.defineProperty(this,"object",{get:r,set:r})}(y.prototype=new t).type="FunctionNode",y.prototype.isFunctionNode=!0,y.prototype._compile=function(i,t){if(!(this instanceof y))throw new TypeError("No valid FunctionNode");var a=Object(I.m)(this.args,function(e){return e._compile(i,t)});if(Object(ie.J)(this.fn)){var o=this.fn.name,s=o in i?Fi(i,o):void 0;if("function"==typeof s&&!0===s.rawArgs){var n=this.args;return function(e,t,r){return(o in e?Fi(e,o):s)(n,i,qf({},e,t))}}if(1===a.length){var u=a[0];return function(e,t,r){return(o in e?Fi(e,o):s)(u(e,t,r))}}if(2!==a.length)return function(t,r,n){return(o in t?Fi(t,o):s).apply(null,Object(I.m)(a,function(e){return e(t,r,n)}))};var c=a[0],f=a[1];return function(e,t,r){return(o in e?Fi(e,o):s)(c(e,t,r),f(e,t,r))}}if(Object(ie.a)(this.fn)&&Object(ie.u)(this.fn.index)&&this.fn.index.isObjectProperty()){var l=this.fn.object._compile(i,t),p=this.fn.index.getObjectProperty(),m=this.args;return function(t,r,n){var e=l(t,r,n);return function(e,t){if(!Hi(e,t))throw new Error('No access to method "'+t+'"')}(e,p),e[p]&&e[p].rawArgs?e[p](m,i,qf({},t,r)):e[p].apply(e,Object(I.m)(a,function(e){return e(t,r,n)}))}}var h=this.fn._compile(i,t),d=this.args;return function(t,r,n){var e=h(t,r,n);return e&&e.rawArgs?e(d,i,qf({},t,r)):e.apply(e,Object(I.m)(a,function(e){return e(t,r,n)}))}},y.prototype.forEach=function(e){e(this.fn,"fn",this);for(var t=0;t<this.args.length;t++)e(this.args[t],"args["+t+"]",this)},y.prototype.map=function(e){for(var t=this._ifNode(e(this.fn,"fn",this)),r=[],n=0;n<this.args.length;n++)r[n]=this._ifNode(e(this.args[n],"args["+n+"]",this));return new y(t,r)},y.prototype.clone=function(){return new y(this.fn,this.args.slice(0))};var a=y.prototype.toString;function o(e,t,r){for(var n,i="",a=new RegExp("\\$(?:\\{([a-z_][a-z_0-9]*)(?:\\[([0-9]+)\\])?\\}|\\$)","ig"),o=0;null!==(n=a.exec(e));)if(i+=e.substring(o,n.index),o=n.index,"$$"===n[0])i+="$",o++;else{o+=n[0].length;var s=t[n[1]];if(!s)throw new ReferenceError("Template: Property "+n[1]+" does not exist.");if(void 0===n[2])switch(Bf(s)){case"string":i+=s;break;case"object":if(Object(ie.w)(s))i+=s.toTex(r);else{if(!Array.isArray(s))throw new TypeError("Template: "+n[1]+" has to be a Node, String or array of Nodes");i+=s.map(function(e,t){if(Object(ie.w)(e))return e.toTex(r);throw new TypeError("Template: "+n[1]+"["+t+"] is not a Node.")}).join(",")}break;default:throw new TypeError("Template: "+n[1]+" has to be a Node, String or array of Nodes")}else{if(!Object(ie.w)(s[n[2]]&&s[n[2]]))throw new TypeError("Template: "+n[1]+"["+n[2]+"] is not a Node.");i+=s[n[2]].toTex(r)}}return i+=e.slice(o)}y.prototype.toString=function(e){var t,r=this.fn.toString(e);return e&&"object"===Bf(e.handler)&&Object(ae.f)(e.handler,r)&&(t=e.handler[r](this,e)),void 0!==t?t:a.call(this,e)},y.prototype._toString=function(t){var e=this.args.map(function(e){return e.toString(t)});return(Object(ie.q)(this.fn)?"("+this.fn.toString(t)+")":this.fn.toString(t))+"("+e.join(", ")+")"},y.prototype.toJSON=function(){return{mathjs:"FunctionNode",fn:this.fn,args:this.args}},y.fromJSON=function(e){return new y(e.fn,e.args)},y.prototype.toHTML=function(t){var e=this.args.map(function(e){return e.toHTML(t)});return'<span class="math-function">'+Object(J.c)(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 r=y.prototype.toTex;return y.prototype.toTex=function(e){var t;return e&&"object"===Bf(e.handler)&&Object(ae.f)(e.handler,this.name)&&(t=e.handler[this.name](this,e)),void 0!==t?t:r.call(this,e)},y.prototype._toTex=function(t){var e,r,n=this.args.map(function(e){return e.toTex(t)});switch(sf[this.name]&&(e=sf[this.name]),!i[this.name]||"function"!=typeof i[this.name].toTex&&"object"!==Bf(i[this.name].toTex)&&"string"!=typeof i[this.name].toTex||(e=i[this.name].toTex),Bf(e)){case"function":r=e(this,t);break;case"string":r=o(e,this,t);break;case"object":switch(Bf(e[n.length])){case"function":r=e[n.length](this,t);break;case"string":r=o(e[n.length],this,t)}}return void 0!==r?r:o("\\mathrm{${name}}\\left(${args}\\right)",this,t)},y.prototype.getIdentifier=function(){return this.type+":"+this.name},y},{isClass:!0,isNode:!0});function Df(){return(Df=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var Rf=["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],Pf=Object(s.a)("parse",Rf,function(e){var t=e.typed,s=e.numeric,u=e.config,i=e.AccessorNode,c=e.ArrayNode,o=e.AssignmentNode,a=e.BlockNode,f=e.ConditionalNode,l=e.ConstantNode,p=e.FunctionAssignmentNode,m=e.FunctionNode,h=e.IndexNode,d=e.ObjectNode,y=e.OperatorNode,g=e.ParenthesisNode,n=e.RangeNode,v=e.RelationalNode,b=e.SymbolNode,x=t("parse",{string:function(e){return k(e,{})},"Array | Matrix":function(e){return r(e,{})},"string, Object":function(e,t){return k(e,void 0!==t.nodes?t.nodes:{})},"Array | Matrix, Object":r});function r(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=void 0!==t.nodes?t.nodes:{};return oe(e,function(e){if("string"!=typeof e)throw new TypeError("String expected");return k(e,r)})}var w={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},N={",":!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},O={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},M={true:!0,false:!1,null:null,undefined:void 0},E=["NaN","Infinity"];function j(e,t){return e.expression.substr(e.index,t)}function S(e){return j(e,1)}function A(e){e.index++}function C(e){return e.expression.charAt(e.index-1)}function T(e){return e.expression.charAt(e.index+1)}function _(e){for(e.tokenType=w.NULL,e.token="",e.comment="";x.isWhitespace(S(e),e.nestingLevel);)A(e);if("#"===S(e))for(;"\n"!==S(e)&&""!==S(e);)e.comment+=S(e),A(e);if(""!==S(e)){if("\n"===S(e)&&!e.nestingLevel)return e.tokenType=w.DELIMITER,e.token=S(e),void A(e);var t=S(e),r=j(e,2),n=j(e,3);if(3===n.length&&N[n])return e.tokenType=w.DELIMITER,e.token=n,A(e),A(e),void A(e);if(2===r.length&&N[r])return e.tokenType=w.DELIMITER,e.token=r,A(e),void A(e);if(N[t])return e.tokenType=w.DELIMITER,e.token=t,void A(e);if(x.isDigitDot(t)){if(e.tokenType=w.NUMBER,"."===S(e))e.token+=S(e),A(e),x.isDigit(S(e))||(e.tokenType=w.DELIMITER);else{for(;x.isDigit(S(e));)e.token+=S(e),A(e);x.isDecimalMark(S(e),T(e))&&(e.token+=S(e),A(e))}for(;x.isDigit(S(e));)e.token+=S(e),A(e);if("E"===S(e)||"e"===S(e))if(x.isDigit(T(e))||"-"===T(e)||"+"===T(e)){if(e.token+=S(e),A(e),"+"!==S(e)&&"-"!==S(e)||(e.token+=S(e),A(e)),!x.isDigit(S(e)))throw re(e,'Digit expected, got "'+S(e)+'"');for(;x.isDigit(S(e));)e.token+=S(e),A(e);if(x.isDecimalMark(S(e),T(e)))throw re(e,'Digit expected, got "'+S(e)+'"')}else if("."===T(e))throw A(e),re(e,'Digit expected, got "'+S(e)+'"')}else{if(!x.isAlpha(S(e),C(e),T(e))){for(e.tokenType=w.UNKNOWN;""!==S(e);)e.token+=S(e),A(e);throw re(e,'Syntax error in part "'+e.token+'"')}for(;x.isAlpha(S(e),C(e),T(e))||x.isDigit(S(e));)e.token+=S(e),A(e);Object(ae.f)(O,e.token)?e.tokenType=w.DELIMITER:e.tokenType=w.SYMBOL}}else e.tokenType=w.DELIMITER}function I(e){for(;_(e),"\n"===e.token;);}function B(e){e.nestingLevel++}function q(e){e.nestingLevel--}function k(e,t){var r={extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:w.NULL,nestingLevel:0,conditionalLevel:null};Df(r,{expression:e,extraNodes:t}),_(r);var n=function(e){var t,r,n=[];""!==e.token&&"\n"!==e.token&&";"!==e.token&&((t=z(e)).comment=e.comment);for(;"\n"===e.token||";"===e.token;)0===n.length&&t&&(r=";"!==e.token,n.push({node:t,visible:r})),_(e),"\n"!==e.token&&";"!==e.token&&""!==e.token&&((t=z(e)).comment=e.comment,r=";"!==e.token,n.push({node:t,visible:r}));return 0<n.length?new a(n):(t||((t=new l(void 0)).comment=e.comment),t)}(r);if(""!==r.token)throw r.tokenType===w.DELIMITER?ne(r,"Unexpected operator "+r.token):re(r,'Unexpected part "'+r.token+'"');return n}function z(e){var t,r,n,i,a=function(e){var t=function(e){var t=D(e);for(;"or"===e.token;)I(e),t=new y("or","or",[t,D(e)]);return t}(e);for(;"?"===e.token;){var r=e.conditionalLevel;e.conditionalLevel=e.nestingLevel,I(e);var n=t,i=z(e);if(":"!==e.token)throw re(e,"False part of conditional expression expected");e.conditionalLevel=null,I(e);var a=z(e);t=new f(n,i,a),e.conditionalLevel=r}return t}(e);if("="!==e.token)return a;if(Object(ie.J)(a))return t=a.name,I(e),n=z(e),new o(new b(t),n);if(Object(ie.a)(a))return I(e),n=z(e),new o(a.object,a.index,n);if(Object(ie.r)(a)&&Object(ie.J)(a.fn)&&(i=!0,r=[],t=a.name,a.args.forEach(function(e,t){Object(ie.J)(e)?r[t]=e.name:i=!1}),i))return I(e),n=z(e),new p(t,r,n);throw re(e,"Invalid left hand side of assignment operator =")}function D(e){for(var t=R(e);"xor"===e.token;)I(e),t=new y("xor","xor",[t,R(e)]);return t}function R(e){for(var t=P(e);"and"===e.token;)I(e),t=new y("and","and",[t,P(e)]);return t}function P(e){for(var t=F(e);"|"===e.token;)I(e),t=new y("|","bitOr",[t,F(e)]);return t}function F(e){for(var t=U(e);"^|"===e.token;)I(e),t=new y("^|","bitXor",[t,U(e)]);return t}function U(e){for(var t=L(e);"&"===e.token;)I(e),t=new y("&","bitAnd",[t,L(e)]);return t}function L(e){for(var t=[H(e)],r=[],n={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};Object(ae.f)(n,e.token);){var i={name:e.token,fn:n[e.token]};r.push(i),I(e),t.push(H(e))}return 1===t.length?t[0]:2===t.length?new y(r[0].name,r[0].fn,t):new v(r.map(function(e){return e.fn}),t)}function H(e){var t,r,n,i;t=$(e);for(var a={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};Object(ae.f)(a,e.token);)n=a[r=e.token],I(e),i=[t,$(e)],t=new y(r,n,i);return t}function $(e){var t,r,n,i;t=G(e);for(var a={to:"to",in:"to"};Object(ae.f)(a,e.token);)n=a[r=e.token],I(e),t="in"===r&&""===e.token?new y("*","multiply",[t,new b("in")],!0):(i=[t,G(e)],new y(r,n,i));return t}function G(e){var t,r=[];if(t=":"===e.token?new l(1):Z(e),":"===e.token&&e.conditionalLevel!==e.nestingLevel){for(r.push(t);":"===e.token&&r.length<3;)I(e),")"===e.token||"]"===e.token||","===e.token||""===e.token?r.push(new b("end")):r.push(Z(e));t=3===r.length?new n(r[0],r[2],r[1]):new n(r[0],r[1])}return t}function Z(e){var t,r,n,i;t=V(e);for(var a={"+":"add","-":"subtract"};Object(ae.f)(a,e.token);)n=a[r=e.token],I(e),i=[t,V(e)],t=new y(r,n,i);return t}function V(e){var t,r,n,i;r=t=J(e);for(var a={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide","%":"mod",mod:"mod"};Object(ae.f)(a,e.token);)i=a[n=e.token],I(e),r=J(e),t=new y(n,i,[t,r]);return t}function J(e){var t,r;for(r=t=W(e);e.tokenType===w.SYMBOL||"in"===e.token&&Object(ie.l)(t)||!(e.tokenType!==w.NUMBER||Object(ie.l)(r)||Object(ie.B)(r)&&"!"!==r.op)||"("===e.token;)r=W(e),t=new y("*","multiply",[t,r],!0);return t}function W(e){for(var t=Y(e),r=t,n=[];"/"===e.token&&Object(ie.l)(r);){if(n.push(Df({},e)),I(e),e.tokenType!==w.NUMBER){Df(e,n.pop());break}if(n.push(Df({},e)),I(e),e.tokenType!==w.SYMBOL&&"("!==e.token){n.pop(),Df(e,n.pop());break}Df(e,n.pop()),n.pop(),r=Y(e),t=new y("/","divide",[t,r])}return t}function Y(e){var t,r,n,i={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return Object(ae.f)(i,e.token)?(n=i[e.token],t=e.token,I(e),r=[Y(e)],new y(t,n,r)):function(e){var t,r,n,i;t=function(e){var t,r,n;t=function(e){var t=[];if(e.tokenType===w.SYMBOL&&Object(ae.f)(e.extraNodes,e.token)){var r=e.extraNodes[e.token];if(_(e),"("===e.token){if(t=[],B(e),_(e),")"!==e.token)for(t.push(z(e));","===e.token;)_(e),t.push(z(e));if(")"!==e.token)throw re(e,"Parenthesis ) expected");q(e),_(e)}return new r(t)}return function(e){var t,r;if(e.tokenType===w.SYMBOL||e.tokenType===w.DELIMITER&&e.token in O)return r=e.token,_(e),t=Object(ae.f)(M,r)?new l(M[r]):-1!==E.indexOf(r)?new l(s(r,"number")):new b(r),t=X(e,t);return function(e){var t,r;return'"'!==e.token?function(e){var t,r;return"'"!==e.token?function(e){var t,r,n,i;if("["!==e.token)return function(e){if("{"!==e.token)return function(e){var t;return e.tokenType!==w.NUMBER?function(e){var t;if("("!==e.token)return function(e){throw""===e.token?re(e,"Unexpected end of expression"):re(e,"Value expected")}(e);if(B(e),_(e),t=z(e),")"===e.token)return q(e),_(e),t=new g(t),t=X(e,t);throw re(e,"Parenthesis ) expected")}(e):(t=e.token,_(e),new l(s(t,u.number)))}(e);var t;B(e);var r={};do{if(_(e),"}"!==e.token){if('"'===e.token)t=Q(e);else if("'"===e.token)t=K(e);else{if(e.tokenType!==w.SYMBOL)throw re(e,"Symbol or string expected as object key");t=e.token,_(e)}if(":"!==e.token)throw re(e,"Colon : expected after object key");_(e),r[t]=z(e)}}while(","===e.token);if("}"!==e.token)throw re(e,"Comma , or bracket } expected after object value");q(e),_(e);var n=new d(r);return n=X(e,n)}(e);if(B(e),_(e),"]"!==e.token){var a=ee(e);if(";"===e.token){for(n=1,r=[a];";"===e.token;)_(e),r[n]=ee(e),n++;if("]"!==e.token)throw re(e,"End of matrix ] expected");q(e),_(e),i=r[0].items.length;for(var o=1;o<n;o++)if(r[o].items.length!==i)throw ne(e,"Column dimensions mismatch ("+r[o].items.length+" !== "+i+")");t=new c(r)}else{if("]"!==e.token)throw re(e,"End of matrix ] expected");q(e),_(e),t=a}}else q(e),_(e),t=new c([]);return X(e,t)}(e):(r=K(e),t=new l(r),t=X(e,t))}(e):(r=Q(e),t=new l(r),t=X(e,t))}(e)}(e)}(e);var i={"!":"factorial","'":"ctranspose"};for(;Object(ae.f)(i,e.token);)r=e.token,n=i[r],_(e),t=new y(r,n,[t]),t=X(e,t);return t}(e),"^"!==e.token&&".^"!==e.token||(r=e.token,n="^"===r?"pow":"dotPow",I(e),i=[t,Y(e)],t=new y(r,n,i));return t}(e)}function X(e,t,r){for(var n;!("("!==e.token&&"["!==e.token&&"."!==e.token||r&&-1===r.indexOf(e.token));)if(n=[],"("===e.token){if(!Object(ie.J)(t)&&!Object(ie.a)(t))return t;if(B(e),_(e),")"!==e.token)for(n.push(z(e));","===e.token;)_(e),n.push(z(e));if(")"!==e.token)throw re(e,"Parenthesis ) expected");q(e),_(e),t=new m(t,n)}else if("["===e.token){if(B(e),_(e),"]"!==e.token)for(n.push(z(e));","===e.token;)_(e),n.push(z(e));if("]"!==e.token)throw re(e,"Parenthesis ] expected");q(e),_(e),t=new i(t,new h(n))}else{if(_(e),e.tokenType!==w.SYMBOL)throw re(e,"Property name expected after dot");n.push(new l(e.token)),_(e);t=new i(t,new h(n,!0))}return t}function Q(e){for(var t="";""!==S(e)&&'"'!==S(e);)"\\"===S(e)&&(t+=S(e),A(e)),t+=S(e),A(e);if(_(e),'"'!==e.token)throw re(e,'End of string " expected');return _(e),JSON.parse('"'+t+'"')}function K(e){for(var t="";""!==S(e)&&"'"!==S(e);)"\\"===S(e)&&(t+=S(e),A(e)),t+=S(e),A(e);if(_(e),"'"!==e.token)throw re(e,"End of string ' expected");return _(e),JSON.parse('"'+t+'"')}function ee(e){for(var t=[z(e)],r=1;","===e.token;)_(e),t[r]=z(e),r++;return new c(t)}function te(e){return e.index-e.token.length+1}function re(e,t){var r=te(e),n=new SyntaxError(t+" (char "+r+")");return n.char=r,n}function ne(e,t){var r=te(e),n=new SyntaxError(t+" (char "+r+")");return n.char=r,n}return x.isAlpha=function(e,t,r){return x.isValidLatinOrGreek(e)||x.isValidMathSymbol(e,r)||x.isValidMathSymbol(t,e)},x.isValidLatinOrGreek=function(e){return/^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(e)},x.isValidMathSymbol=function(e,t){return/^[\uD835]$/.test(e)&&/^[\uDC00-\uDFFF]$/.test(t)&&/^[^\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(t)},x.isWhitespace=function(e,t){return" "===e||"\t"===e||"\n"===e&&0<t},x.isDecimalMark=function(e,t){return"."===e&&"/"!==t&&"*"!==t&&"^"!==t},x.isDigitDot=function(e){return"0"<=e&&e<="9"||"."===e},x.isDigit=function(e){return"0"<=e&&e<="9"},x}),Ff="compile",Uf=["typed","parse"],Lf=Object(s.a)(Ff,Uf,function(e){var t=e.typed,r=e.parse;return t(Ff,{string:function(e){return r(e).compile()},"Array | Matrix":function(e){return oe(e,function(e){return r(e).compile()})}})}),Hf="evaluate",$f=["typed","parse"],Gf=Object(s.a)(Hf,$f,function(e){var t=e.typed,r=e.parse;return t(Hf,{string:function(e){return r(e).compile().evaluate({})},"string, Object":function(e,t){return r(e).compile().evaluate(t)},"Array | Matrix":function(e){var t={};return oe(e,function(e){return r(e).compile().evaluate(t)})},"Array | Matrix, Object":function(e,t){return oe(e,function(e){return r(e).compile().evaluate(t)})}})}),Zf=Object(s.a)("eval",["evaluate"],function(e){var n=e.evaluate;return function(){Object(ve.a)('Function "eval" has been renamed to "evaluate" in v6.0.0, please use the new function instead.');for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.apply(n,t)}}),Vf=["parse"],Jf=Object(s.a)("Parser",Vf,function(e){var t=e.parse;function r(){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this.scope={}}return r.prototype.type="Parser",r.prototype.isParser=!0,r.prototype.parse=function(e){throw new Error("Parser.parse is deprecated. Use math.parse instead.")},r.prototype.compile=function(e){throw new Error("Parser.compile is deprecated. Use math.compile instead.")},r.prototype.evaluate=function(e){return t(e).compile().evaluate(this.scope)},r.prototype.eval=function(e){return Object(ve.a)("Method Parser.eval is renamed to Parser.evaluate. Please use the new method name."),this.evaluate(e)},r.prototype.get=function(e){return e in this.scope?Fi(this.scope,e):void 0},r.prototype.getAll=function(){return Object(ae.e)({},this.scope)},r.prototype.set=function(e,t){return Ui(this.scope,e,t)},r.prototype.remove=function(e){delete this.scope[e]},r.prototype.clear=function(){for(var e in this.scope)Object(ae.f)(this.scope,e)&&delete this.scope[e]},r},{isClass:!0}),Wf=["typed","Parser"],Yf=Object(s.a)("parser",Wf,function(e){var t=e.typed,r=e.Parser;return t("parser",{"":function(){return new r}})}),Xf=["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtract","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],Qf=Object(s.a)("lup",Xf,function(e){var t=e.typed,r=e.matrix,M=e.abs,E=e.addScalar,j=e.divideScalar,S=e.multiplyScalar,A=e.subtract,C=e.larger,T=e.equalScalar,O=e.unaryMinus,_=e.DenseMatrix,I=e.SparseMatrix,B=e.Spa;return t("lup",{DenseMatrix:function(e){return n(e)},SparseMatrix:function(e){return function(e){var r,s,u,c=e._size[0],t=e._size[1],n=Math.min(c,t),f=e._values,l=e._index,p=e._ptr,m=[],h=[],d=[],y=[c,n],g=[],v=[],b=[],x=[n,t],w=[],N=[];for(r=0;r<c;r++)w[r]=r,N[r]=r;function i(){var i=new B;s<c&&(d.push(m.length),m.push(1),h.push(s)),b.push(g.length);var e=p[s],t=p[s+1];for(u=e;u<t;u++)r=l[u],i.set(w[r],f[u]);0<s&&i.forEach(0,s-1,function(r,n){I._forEachRow(r,m,h,d,function(e,t){r<e&&i.accumulate(e,O(S(t,n)))})});var n=s,a=i.get(s),o=M(a);i.forEach(s+1,c-1,function(e,t){var r=M(t);C(r,o)&&(n=e,o=r,a=t)}),s!==n&&(I._swapRows(s,n,y[1],m,h,d),I._swapRows(s,n,x[1],g,v,b),i.swap(s,n),function(e,t){var r=N[e],n=N[t];w[r]=t,w[n]=e,N[e]=n,N[t]=r}(s,n)),i.forEach(0,c-1,function(e,t){e<=s?(g.push(t),v.push(e)):(t=j(t,a),T(t,0)||(m.push(t),h.push(e)))})}for(s=0;s<t;s++)i();return b.push(g.length),d.push(m.length),{L:new I({values:m,index:h,ptr:d,size:y}),U:new I({values:g,index:v,ptr:b,size:x}),p:w,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}}(e)},Array:function(e){var t=n(r(e));return{L:t.L.valueOf(),U:t.U.valueOf(),p:t.p}}});function n(e){var t,r,n,i=e._size[0],a=e._size[1],o=Math.min(i,a),s=Object(ae.a)(e._data),u=[],c=[i,o],f=[],l=[o,a],p=[];for(t=0;t<i;t++)p[t]=t;for(r=0;r<a;r++){if(0<r)for(t=0;t<i;t++){var m=Math.min(t,r),h=0;for(n=0;n<m;n++)h=E(h,S(s[t][n],s[n][r]));s[t][r]=A(s[t][r],h)}var d=r,y=0,g=0;for(t=r;t<i;t++){var v=s[t][r],b=M(v);C(b,y)&&(d=t,y=b,g=v)}if(r!==d&&(p[r]=[p[d],p[d]=p[r]][0],_._swapRows(r,d,s)),r<i)for(t=r+1;t<i;t++){var x=s[t][r];T(x,0)||(s[t][r]=j(s[t][r],g))}}for(r=0;r<a;r++)for(t=0;t<i;t++)0===r&&(t<a&&(f[t]=[]),u[t]=[]),t<r?(t<a&&(f[t][r]=s[t][r]),r<i&&(u[t][r]=0)):t!==r?(t<a&&(f[t][r]=0),r<i&&(u[t][r]=s[t][r])):(t<a&&(f[t][r]=s[t][r]),r<i&&(u[t][r]=1));var w=new _({data:u,size:c}),N=new _({data:f,size:l}),O=[];for(t=0,o=p.length;t<o;t++)O[p[t]]=t;return{L:w,U:N,p:O,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}}}),Kf=["typed","matrix","zeros","identity","isZero","unequal","sign","sqrt","conj","unaryMinus","addScalar","divideScalar","multiplyScalar","subtract"],el=Object(s.a)("qr",Kf,function(e){var t=e.typed,r=e.matrix,b=e.zeros,x=e.identity,w=e.isZero,N=e.unequal,O=e.sign,M=e.sqrt,E=e.conj,j=e.unaryMinus,S=e.addScalar,A=e.divideScalar,C=e.multiplyScalar,T=e.subtract;return t("qr",{DenseMatrix:function(e){return n(e)},SparseMatrix:function(e){return function(){throw new Error("qr not implemented for sparse matrices yet")}()},Array:function(e){var t=n(r(e));return{Q:t.Q.valueOf(),R:t.R.valueOf()}}});function n(e){var t,r,n,i=e._size[0],a=e._size[1],o=x([i],"dense"),s=o._data,u=e.clone(),c=u._data,f=b([i],"");for(n=0;n<Math.min(a,i);++n){var l=c[n][n],p=j(O(l)),m=E(p),h=0;for(t=n;t<i;t++)h=S(h,C(c[t][n],E(c[t][n])));var d=C(p,M(h));if(!w(d)){var y=T(l,d);for(t=n+(f[n]=1);t<i;t++)f[t]=A(c[t][n],y);var g=j(E(A(y,d))),v=void 0;for(r=n;r<a;r++){for(v=0,t=n;t<i;t++)v=S(v,C(E(f[t]),c[t][r]));for(v=C(v,g),t=n;t<i;t++)c[t][r]=C(T(c[t][r],C(f[t],v)),m)}for(t=0;t<i;t++){for(v=0,r=n;r<i;r++)v=S(v,C(s[t][r],f[r]));for(v=C(v,g),r=n;r<i;++r)s[t][r]=A(T(s[t][r],C(v,E(f[r]))),m)}}}for(t=0;t<i;++t)for(r=0;r<t&&r<a;++r){if(N(0,A(c[t][r],1e5)))throw new Error("math.qr(): unknown error - R is not lower triangular (element ("+t+", "+r+") = "+c[t][r]+")");c[t][r]=C(c[t][r],0)}return{Q:o,R:u,toString:function(){return"Q: "+this.Q.toString()+"\nR: "+this.R.toString()}}}});function tl(e,t,r,n,i,a,o){var s=0;for(r[o]=e;0<=s;){var u=r[o+s],c=r[n+u];-1===c?(s--,a[t++]=u):(r[n+u]=r[i+c],r[o+ ++s]=c)}return t}function rl(e){return-e-2}var nl=["add","multiply","transpose"],il=Object(s.a)("csAmd",nl,function(e){var K=e.add,ee=e.multiply,te=e.transpose;return function(e,t){if(!t||e<=0||3<e)return null;var r=t._size,n=r[0],i=r[1],a=0,o=Math.max(16,10*Math.sqrt(i)),s=function(e,t,r,n,i){var a=te(t);if(1===e&&n===r)return K(t,a);if(2!==e)return ee(a,t);for(var o=a._index,s=a._ptr,u=0,c=0;c<r;c++){var f=s[c];if(s[c]=u,!(s[c+1]-f>i))for(var l=s[c+1];f<l;f++)o[u++]=o[f]}return s[r]=u,t=te(a),ee(a,t)}(e,t,n,i,o=Math.min(i-2,o));!function(e,t,r){for(var n=e._values,i=e._index,a=e._ptr,o=e._size[1],s=0,u=0;u<o;u++){var c=a[u];for(a[u]=s;c<a[u+1];c++)t(i[c],u,n?n[c]:1,r)&&(i[s]=i[c],n&&(n[s]=n[c]),s++)}a[o]=s,i.splice(s,i.length-s),n&&n.splice(s,n.length-s)}(s,ne,null);for(var u,c,f,l,p,m,h,d,y,g,v,b,x,w,N,O,M=s._index,E=s._ptr,j=E[i],S=[],A=[],C=i+1,T=2*(i+1),_=3*(i+1),I=4*(i+1),B=5*(i+1),q=6*(i+1),k=7*(i+1),z=S,D=function(e,t,r,n,i,a,o,s,u,c,f,l){for(var p=0;p<e;p++)r[n+p]=t[p+1]-t[p];for(var m=r[n+e]=0;m<=e;m++)r[i+m]=-1,a[m]=-1,r[o+m]=-1,r[s+m]=-1,r[u+m]=1,r[c+m]=1,r[f+m]=0,r[l+m]=r[n+m];var h=re(0,0,r,c,e);return r[f+e]=-2,t[e]=-1,r[c+e]=0,h}(i,E,A,0,_,z,T,k,C,q,I,B),R=function(e,t,r,n,i,a,o,s,u,c,f){for(var l=0,p=0;p<e;p++){var m=r[n+p];if(0===m)r[i+p]=-2,l++,t[p]=-1,r[a+p]=0;else if(o<m)r[s+p]=0,r[i+p]=-1,l++,t[p]=rl(e),r[s+e]++;else{var h=r[u+m];-1!==h&&(c[h]=p),r[f+p]=r[u+m],r[u+m]=p}}return l}(i,E,A,B,I,q,o,C,_,z,T),P=0;R<i;){for(f=-1;P<i&&-1===(f=A[_+P]);P++);-1!==A[T+f]&&(z[A[T+f]]=-1),A[_+P]=A[T+f];var F=A[I+f],U=A[C+f];R+=U;var L=0;A[C+f]=-U;var H=E[f],$=0===F?H:j,G=$;for(l=1;l<=F+1;l++){for(d=F<l?(h=H,A[0+(m=f)]-F):(h=E[m=M[H++]],A[0+m]),p=1;p<=d;p++)(y=A[C+(u=M[h++])])<=0||(L+=y,A[C+u]=-y,-1!==A[T+(M[G++]=u)]&&(z[A[T+u]]=z[u]),-1!==z[u]?A[T+z[u]]=A[T+u]:A[_+A[B+u]]=A[T+u]);m!==f&&(E[m]=rl(f),A[q+m]=0)}for(0!==F&&(j=G),A[B+f]=L,E[f]=$,A[0+f]=G-$,A[I+f]=-2,D=re(D,a,A,q,i),g=$;g<G;g++)if(!((v=A[I+(u=M[g])])<=0)){var Z=D-(y=-A[C+u]);for(H=E[u],b=E[u]+v-1;H<=b;H++)A[q+(m=M[H])]>=D?A[q+m]-=y:0!==A[q+m]&&(A[q+m]=A[B+m]+Z)}for(g=$;g<G;g++){for(x=(b=E[u=M[g]])+A[I+u]-1,O=N=0,H=w=b;H<=x;H++)if(0!==A[q+(m=M[H])]){var V=A[q+m]-D;0<V?(O+=V,N+=M[w++]=m):(E[m]=rl(f),A[q+m]=0)}A[I+u]=w-b+1;var J=w,W=b+A[0+u];for(H=1+x;H<W;H++){var Y=A[C+(c=M[H])];Y<=0||(O+=Y,N+=M[w++]=c)}0===O?(E[u]=rl(f),L-=y=-A[C+u],U+=y,R+=y,A[C+u]=0,A[I+u]=-1):(A[B+u]=Math.min(A[B+u],O),M[w]=M[J],M[J]=M[b],M[b]=f,A[0+u]=w-b+1,N=(N<0?-N:N)%i,A[T+u]=A[k+N],z[A[k+N]=u]=N)}for(A[B+f]=L,D=re(D+(a=Math.max(a,L)),a,A,q,i),g=$;g<G;g++)if(!(0<=A[C+(u=M[g])]))for(u=A[k+(N=z[u])],A[k+N]=-1;-1!==u&&-1!==A[T+u];u=A[T+u],D++){for(d=A[0+u],v=A[I+u],H=E[u]+1;H<=E[u]+d-1;H++)A[q+M[H]]=D;var X=u;for(c=A[T+u];-1!==c;){var Q=A[0+c]===d&&A[I+c]===v;for(H=E[c]+1;Q&&H<=E[c]+d-1;H++)A[q+M[H]]!==D&&(Q=0);Q?(E[c]=rl(u),A[C+u]+=A[C+c],A[C+c]=0,A[I+c]=-1,c=A[T+c],A[T+X]=c):c=A[T+(X=c)]}}for(g=H=$;g<G;g++)(y=-A[C+(u=M[g])])<=0||(A[C+u]=y,O=A[B+u]+L-y,-1!==A[_+(O=Math.min(O,i-R-y))]&&(z[A[_+O]]=u),A[T+u]=A[_+O],z[u]=-1,A[_+O]=u,P=Math.min(P,O),A[B+u]=O,M[H++]=u);A[C+f]=U,0==(A[0+f]=H-$)&&(E[f]=-1,A[q+f]=0),0!==F&&(j=H)}for(u=0;u<i;u++)E[u]=rl(E[u]);for(c=0;c<=i;c++)A[_+c]=-1;for(c=i;0<=c;c--)0<A[C+c]||(A[T+c]=A[_+E[c]],A[_+E[c]]=c);for(m=i;0<=m;m--)A[C+m]<=0||-1!==E[m]&&(A[T+m]=A[_+E[m]],A[_+E[m]]=m);for(u=f=0;u<=i;u++)-1===E[u]&&(f=tl(u,f,A,_,T,S,q));return S.splice(S.length-1,1),S};function re(e,t,r,n,i){if(e<2||e+t<0){for(var a=0;a<i;a++)0!==r[n+a]&&(r[n+a]=1);e=2}return e}function ne(e,t){return e!==t}});function al(e,t,r,n,i,a,o){var s,u,c,f=0;if(e<=t||r[n+t]<=r[i+e])return-1;r[i+e]=r[n+t];var l=r[a+e];if(r[a+e]=t,-1===l)f=1,c=e;else{for(f=2,c=l;c!==r[o+c];c=r[o+c]);for(s=l;s!==c;s=u)u=r[o+s],r[o+s]=c}return{jleaf:f,q:c}}var ol=["transpose"],sl=Object(s.a)("csCounts",ol,function(e){var j=e.transpose;return function(e,t,r,n){if(!e||!t||!r)return null;var i,a,o,s,u,c,f,l=e._size,p=l[0],m=l[1],h=4*m+(n?m+p+1:0),d=[],y=m,g=2*m,v=3*m,b=4*m,x=5*m+1;for(o=0;o<h;o++)d[o]=-1;var w=[],N=j(e),O=N._index,M=N._ptr;for(o=0;o<m;o++)for(w[a=r[o]]=-1===d[v+a]?1:0;-1!==a&&-1===d[v+a];a=t[a])d[v+a]=o;if(n){for(o=0;o<m;o++)d[r[o]]=o;for(i=0;i<p;i++){for(o=m,c=M[i],f=M[i+1],u=c;u<f;u++)o=Math.min(o,d[O[u]]);d[x+i]=d[b+o],d[b+o]=i}}for(i=0;i<m;i++)d[0+i]=i;for(o=0;o<m;o++){for(-1!==t[a=r[o]]&&w[t[a]]--,s=n?d[b+o]:a;-1!==s;s=n?d[x+s]:-1)for(u=M[s];u<M[s+1];u++){var E=al(i=O[u],a,d,v,y,g,0);1<=E.jleaf&&w[a]++,2===E.jleaf&&w[E.q]--}-1!==t[a]&&(d[0+a]=t[a])}for(a=0;a<m;a++)-1!==t[a]&&(w[t[a]]+=w[a]);return w}}),ul=["add","multiply","transpose"],cl=Object(s.a)("csSqr",ul,function(e){var t=e.add,r=e.multiply,n=e.transpose,c=il({add:t,multiply:r,transpose:n}),f=sl({transpose:n});return function(e,t,r){var n,i=t._ptr,a=t._size[1],o={};if(o.q=c(e,t),e&&!o.q)return null;if(r){var s=e?function(e,t,r,n){for(var i=e._values,a=e._index,o=e._ptr,s=e._size,u=e._datatype,c=s[0],f=s[1],l=n&&e._values?[]:null,p=[],m=[],h=0,d=0;d<f;d++){m[d]=h;for(var y=r?r[d]:d,g=o[y],v=o[y+1],b=g;b<v;b++){var x=t?t[a[b]]:a[b];p[h]=x,l&&(l[h]=i[b]),h++}}return m[f]=h,e.createSparseMatrix({values:l,index:p,ptr:m,size:[c,f],datatype:u})}(t,null,o.q,0):t;o.parent=function(e,t){if(!e)return null;var r,n,i=e._index,a=e._ptr,o=e._size,s=o[0],u=o[1],c=[],f=[],l=u;if(t)for(r=0;r<s;r++)f[l+r]=-1;for(var p=0;p<u;p++){c[p]=-1,f[0+p]=-1;for(var m=a[p],h=a[p+1],d=m;d<h;d++){var y=i[d];for(r=t?f[l+y]:y;-1!==r&&r<p;r=n)n=f[0+r],f[0+r]=p,-1===n&&(c[r]=p);t&&(f[l+y]=p)}}return c}(s,1);var u=function(e,t){if(!e)return null;var r,n=0,i=[],a=[],o=t,s=2*t;for(r=0;r<t;r++)a[0+r]=-1;for(r=t-1;0<=r;r--)-1!==e[r]&&(a[o+r]=a[0+e[r]],a[0+e[r]]=r);for(r=0;r<t;r++)-1===e[r]&&(n=tl(r,n,a,0,o,i,s));return i}(o.parent,a);if(o.cp=f(s,o.parent,u,1),s&&o.parent&&o.cp&&function(e,t){var r=e._ptr,n=e._index,i=e._size,a=i[0],o=i[1];t.pinv=[],t.leftmost=[];var s,u,c,f,l,p=t.parent,m=t.pinv,h=t.leftmost,d=[],y=a,g=a+o,v=a+2*o;for(u=0;u<o;u++)d[y+u]=-1,d[g+u]=-1,d[v+u]=0;for(s=0;s<a;s++)h[s]=-1;for(u=o-1;0<=u;u--)for(f=r[u],l=r[u+1],c=f;c<l;c++)h[n[c]]=u;for(s=a-1;0<=s;s--)(m[s]=-1)!==(u=h[s])&&(0==d[v+u]++&&(d[g+u]=s),d[0+s]=d[y+u],d[y+u]=s);for(t.lnz=0,t.m2=a,u=0;u<o;u++)if(s=d[y+u],t.lnz++,s<0&&(s=t.m2++),m[s]=u,!(--v[u]<=0)){t.lnz+=d[v+u];var b=p[u];-1!==b&&(0===d[v+b]&&(d[g+b]=d[g+u]),d[0+d[g+u]]=d[y+b],d[y+b]=d[0+s],d[v+b]+=d[v+u])}for(s=0;s<a;s++)m[s]<0&&(m[s]=u++);return!0}(s,o))for(n=o.unz=0;n<a;n++)o.unz+=o.cp[n]}else o.unz=4*i[a]+a,o.lnz=o.unz;return o}});function fl(e,t){return e[t]<0}function ll(e,t){e[t]=rl(e[t])}function pl(e){return e<0?rl(e):e}function ml(e,t,r,n,i){var a,o,s,u=t._index,c=t._ptr,f=t._size[1],l=0;for(n[0]=e;0<=l;){e=n[l];var p=i?i[e]:e;fl(c,e)||(ll(c,e),n[f+l]=p<0?0:pl(c[p]));var m=1;for(o=n[f+l],s=p<0?0:pl(c[p+1]);o<s;o++)if(!fl(c,a=u[o])){n[f+l]=o,n[++l]=a,m=0;break}m&&(l--,n[--r]=e)}return r}var hl=["divideScalar","multiply","subtract"],dl=Object(s.a)("csSpsolve",hl,function(e){var O=e.divideScalar,M=e.multiply,E=e.subtract;return function(e,t,r,n,i,a,o){var s,u,c,f,l=e._values,p=e._index,m=e._ptr,h=e._size[1],d=t._values,y=t._index,g=t._ptr,v=function(e,t,r,n,i){var a,o,s,u=e._ptr,c=e._size,f=t._index,l=t._ptr,p=c[1],m=p;for(o=l[r],s=l[r+1],a=o;a<s;a++){var h=f[a];fl(u,h)||(m=ml(h,e,m,n,i))}for(a=m;a<p;a++)ll(u,n[a]);return m}(e,t,r,n,a);for(s=v;s<h;s++)i[n[s]]=0;for(u=g[r],c=g[r+1],s=u;s<c;s++)i[y[s]]=d[s];for(var b=v;b<h;b++){var x=n[b],w=a?a[x]:x;if(!(w<0))for(u=m[w],c=m[w+1],i[x]=O(i[x],l[o?u:c-1]),s=o?u+1:u,f=o?c:c-1;s<f;s++){var N=p[s];i[N]=E(i[N],M(l[s],i[x]))}}return v}}),yl=["abs","divideScalar","multiply","subtract","larger","largerEq","SparseMatrix"],gl=Object(s.a)("csLu",yl,function(e){var S=e.abs,A=e.divideScalar,C=e.multiply,t=e.subtract,T=e.larger,_=e.largerEq,I=e.SparseMatrix,B=dl({divideScalar:A,multiply:C,subtract:t});return function(e,t,r){if(!e)return null;var n,i=e._size[1],a=100,o=100;t&&(n=t.q,a=t.lnz||a,o=t.unz||o);var s,u,c=[],f=[],l=[],p=new I({values:c,index:f,ptr:l,size:[i,i]}),m=[],h=[],d=[],y=new I({values:m,index:h,ptr:d,size:[i,i]}),g=[],v=[],b=[];for(s=0;s<i;s++)v[s]=0,g[s]=-1,l[s+1]=0;for(var x=o=a=0;x<i;x++){l[x]=a,d[x]=o;var w=n?n[x]:x,N=B(p,e,w,b,v,g,1),O=-1,M=-1;for(u=N;u<i;u++)if(g[s=b[u]]<0){var E=S(v[s]);T(E,M)&&(M=E,O=s)}else h[o]=g[s],m[o++]=v[s];if(-1===O||M<=0)return null;g[w]<0&&_(S(v[w]),C(M,r))&&(O=w);var j=v[O];for(h[o]=x,m[o++]=j,g[O]=x,f[a]=O,c[a++]=1,u=N;u<i;u++)g[s=b[u]]<0&&(f[a]=s,c[a++]=A(v[s],j)),v[s]=0}for(l[i]=a,d[i]=o,u=0;u<a;u++)f[u]=g[f[u]];return c.splice(a,c.length-a),f.splice(a,f.length-a),m.splice(o,m.length-o),h.splice(o,h.length-o),{L:p,U:y,pinv:g}}}),vl=["typed","abs","add","multiply","transpose","divideScalar","subtract","larger","largerEq","SparseMatrix"],bl=Object(s.a)("slu",vl,function(e){var t=e.typed,r=e.abs,n=e.add,i=e.multiply,a=e.transpose,o=e.divideScalar,s=e.subtract,u=e.larger,c=e.largerEq,f=e.SparseMatrix,l=cl({add:n,multiply:i,transpose:a}),p=gl({abs:r,divideScalar:o,multiply:i,subtract:s,larger:u,largerEq:c,SparseMatrix:f});return t("slu",{"SparseMatrix, number, number":function(e,t,r){if(!Object(j.i)(t)||t<0||3<t)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(r<0||1<r)throw new Error("Partial pivoting threshold must be a number from 0 to 1");var n=l(t,e,!1),i=p(e,n,r);return{L:i.L,U:i.U,p:i.pinv,q:n.q,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\np: "+this.p.toString()+(this.q?"\nq: "+this.q.toString():"")+"\n"}}}})});function xl(e,t){var r,n=t.length,i=[];if(e)for(r=0;r<n;r++)i[e[r]]=t[r];else for(r=0;r<n;r++)i[r]=t[r];return i}var wl="lusolve",Nl=["typed","matrix","lup","slu","usolve","lsolve","DenseMatrix"],Ol=Object(s.a)(wl,Nl,function(e){var t=e.typed,n=e.matrix,i=e.lup,a=e.slu,s=e.usolve,u=e.lsolve,c=eo({DenseMatrix:e.DenseMatrix});return t(wl,{"Array, Array | Matrix":function(e,t){e=n(e);var r=i(e);return o(r.L,r.U,r.p,null,t).valueOf()},"DenseMatrix, Array | Matrix":function(e,t){var r=i(e);return o(r.L,r.U,r.p,null,t)},"SparseMatrix, Array | Matrix":function(e,t){var r=i(e);return o(r.L,r.U,r.p,null,t)},"SparseMatrix, Array | Matrix, number, number":function(e,t,r,n){var i=a(e,r,n);return o(i.L,i.U,i.p,i.q,t)},"Object, Array | Matrix":function(e,t){return o(e.L,e.U,e.p,e.q,t)}});function f(e){if(Object(ie.v)(e))return e;if(Object(ie.b)(e))return n(e);throw new TypeError("Invalid Matrix LU decomposition")}function o(e,t,r,n,i){e=f(e),t=f(t),i=c(e,i,!1),r&&(i._data=xl(r,i._data));var a=u(e,i),o=s(t,a);return n&&(o._data=xl(n,o._data)),o}}),Ml=["parse"],El=Object(s.a)("Help",Ml,function(e){var o=e.parse;function n(e){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(!e)throw new Error('Argument "doc" missing');this.doc=e}return n.prototype.type="Help",n.prototype.isHelp=!0,n.prototype.toString=function(){var e=this.doc||{},t="\n";if(e.name&&(t+="Name: "+e.name+"\n\n"),e.category&&(t+="Category: "+e.category+"\n\n"),e.description&&(t+="Description:\n "+e.description+"\n\n"),e.syntax&&(t+="Syntax:\n "+e.syntax.join("\n ")+"\n\n"),e.examples){t+="Examples:\n";for(var r={},n=0;n<e.examples.length;n++){var i=e.examples[n];t+=" "+i+"\n";var a=void 0;try{a=o(i).compile().evaluate(r)}catch(e){a=e}void 0===a||Object(ie.s)(a)||(t+=" "+Object(J.d)(a,{precision:14})+"\n")}t+="\n"}return e.seealso&&e.seealso.length&&(t+="See also: "+e.seealso.join(", ")+"\n"),t},n.prototype.toJSON=function(){var e=Object(ae.a)(this.doc);return e.mathjs="Help",e},n.fromJSON=function(e){var t={};for(var r in e)"mathjs"!==r&&(t[r]=e[r]);return new n(t)},n.prototype.valueOf=n.prototype.toString,n},{isClass:!0}),jl=["?on","math"],Sl=Object(s.a)("Chain",jl,function(e){var t=e.on,r=e.math;function i(e){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");Object(ie.h)(e)?this.value=e.value:this.value=e}function a(e,t){Object(ae.h)(i.prototype,e,function(){var e=t();if("function"==typeof e)return o(e)})}function o(r){return function(){for(var e=[this.value],t=0;t<arguments.length;t++)e[t+1]=arguments[t];return new i(r.apply(r,e))}}i.prototype.type="Chain",i.prototype.isChain=!0,i.prototype.done=function(){return this.value},i.prototype.valueOf=function(){return this.value},i.prototype.toString=function(){return Object(J.d)(this.value)},i.prototype.toJSON=function(){return{mathjs:"Chain",value:this.value}},i.fromJSON=function(e){return new i(e.value)},i.createProxy=function(t,e){if("string"==typeof t)!function(e,t){"function"==typeof t&&(i.prototype[e]=o(t))}(t,e);else{var r=function(e){Object(ae.f)(t,e)&&void 0===s[e]&&a(e,function(){return t[e]})};for(var n in t)r(n)}};var s={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return i.createProxy(r),t&&t("import",function(e,t,r){r||a(e,t)}),i},{isClass:!0}),Al={name:"typeOf",category:"Utils",syntax:["typeOf(x)"],description:"Get the type of a variable.",examples:["typeOf(3.5)","typeOf(2 - 4i)","typeOf(45 deg)",'typeOf("hello world")'],seealso:["getMatrixDataType"]},Cl={name:"evaluate",category:"Expression",syntax:["evaluate(expression)","evaluate([expr1, expr2, expr3, ...])"],description:"Evaluate an expression or an array with expressions.",examples:['evaluate("2 + 3")','evaluate("sqrt(" + 4 + ")")'],seealso:[]},Tl={name:"pi",category:"Constants",syntax:["pi"],description:"The number pi is a mathematical constant that is the ratio of a circle's circumference to its diameter, and is approximately equal to 3.14159",examples:["pi","sin(pi/2)"],seealso:["tau"]},_l={name:"e",category:"Constants",syntax:["e"],description:"Euler's number, the base of the natural logarithm. Approximately equal to 2.71828",examples:["e","e ^ 2","exp(2)","log(e)"],seealso:["exp"]},Il={name:"variance",category:"Statistics",syntax:["variance(a, b, c, ...)","variance(A)","variance(A, normalization)"],description:'Compute the variance of all values. Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["variance(2, 4, 6)","variance([2, 4, 6, 8])",'variance([2, 4, 6, 8], "uncorrected")','variance([2, 4, 6, 8], "biased")',"variance([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","min","prod","std","sum"]},Bl={bignumber:{name:"bignumber",category:"Construction",syntax:["bignumber(x)"],description:"Create a big number from a number or string.",examples:["0.1 + 0.2","bignumber(0.1) + bignumber(0.2)",'bignumber("7.2")','bignumber("7.2e500")',"bignumber([0.1, 0.2, 0.3])"],seealso:["boolean","complex","fraction","index","matrix","string","unit"]},boolean:{name:"boolean",category:"Construction",syntax:["x","boolean(x)"],description:"Convert a string or number into a boolean.",examples:["boolean(0)","boolean(1)","boolean(3)",'boolean("true")','boolean("false")',"boolean([1, 0, 1, 1])"],seealso:["bignumber","complex","index","matrix","number","string","unit"]},complex:{name:"complex",category:"Construction",syntax:["complex()","complex(re, im)","complex(string)"],description:"Create a complex number.",examples:["complex()","complex(2, 3)",'complex("7 - 2i")'],seealso:["bignumber","boolean","index","matrix","number","string","unit"]},createUnit:{name:"createUnit",category:"Construction",syntax:["createUnit(definitions)","createUnit(name, definition)"],description:"Create a user-defined unit and register it with the Unit type.",examples:['createUnit("foo")','createUnit("knot", {definition: "0.514444444 m/s", aliases: ["knots", "kt", "kts"]})','createUnit("mph", "1 mile/hour")'],seealso:["unit","splitUnit"]},fraction:{name:"fraction",category:"Construction",syntax:["fraction(num)","fraction(num,den)"],description:"Create a fraction from a number or from a numerator and denominator.",examples:["fraction(0.125)","fraction(1, 3) + fraction(2, 5)"],seealso:["bignumber","boolean","complex","index","matrix","string","unit"]},index:{name:"index",category:"Construction",syntax:["[start]","[start:end]","[start:step:end]","[start1, start 2, ...]","[start1:end1, start2:end2, ...]","[start1:step1:end1, start2:step2:end2, ...]"],description:"Create an index to get or replace a subset of a matrix",examples:["[]","[1, 2, 3]","A = [1, 2, 3; 4, 5, 6]","A[1, :]","A[1, 2] = 50","A[0:2, 0:2] = ones(2, 2)"],seealso:["bignumber","boolean","complex","matrix,","number","range","string","unit"]},matrix:{name:"matrix",category:"Construction",syntax:["[]","[a1, b1, ...; a2, b2, ...]","matrix()",'matrix("dense")',"matrix([...])"],description:"Create a matrix.",examples:["[]","[1, 2, 3]","[1, 2, 3; 4, 5, 6]","matrix()","matrix([3, 4])",'matrix([3, 4; 5, 6], "sparse")','matrix([3, 4; 5, 6], "sparse", "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","sparse"]},number:{name:"number",category:"Construction",syntax:["x","number(x)","number(unit, valuelessUnit)"],description:"Create a number or convert a string or boolean into a number.",examples:["2","2e3","4.05","number(2)",'number("7.2")',"number(true)","number([true, false, true, true])",'number(unit("52cm"), "m")'],seealso:["bignumber","boolean","complex","fraction","index","matrix","string","unit"]},sparse:{name:"sparse",category:"Construction",syntax:["sparse()","sparse([a1, b1, ...; a1, b2, ...])",'sparse([a1, b1, ...; a1, b2, ...], "number")'],description:"Create a sparse matrix.",examples:["sparse()","sparse([3, 4; 5, 6])",'sparse([3, 0; 5, 0], "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","matrix"]},splitUnit:{name:"splitUnit",category:"Construction",syntax:["splitUnit(unit: Unit, parts: Unit[])"],description:"Split a unit in an array of units whose sum is equal to the original unit.",examples:['splitUnit(1 m, ["feet", "inch"])'],seealso:["unit","createUnit"]},string:{name:"string",category:"Construction",syntax:['"text"',"string(x)"],description:"Create a string or convert a value to a string",examples:['"Hello World!"',"string(4.2)","string(3 + 2i)"],seealso:["bignumber","boolean","complex","index","matrix","number","unit"]},unit:{name:"unit",category:"Construction",syntax:["value unit","unit(value, unit)","unit(string)"],description:"Create a unit.",examples:["5.5 mm","3 inch",'unit(7.1, "kilogram")','unit("23 deg")'],seealso:["bignumber","boolean","complex","index","matrix","number","string"]},e:_l,E:_l,false:{name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]},i:{name:"i",category:"Constants",syntax:["i"],description:"Imaginary unit, defined as i*i=-1. A complex number is described as a + b*i, where a is the real part, and b is the imaginary part.",examples:["i","i * i","sqrt(-1)"],seealso:[]},Infinity:{name:"Infinity",category:"Constants",syntax:["Infinity"],description:"Infinity, a number which is larger than the maximum number that can be handled by a floating point number.",examples:["Infinity","1 / 0"],seealso:[]},LN2:{name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]},LN10:{name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]},LOG2E:{name:"LOG2E",category:"Constants",syntax:["LOG2E"],description:"Returns the base-2 logarithm of E, approximately equal to 1.442",examples:["LOG2E","log(e, 2)"],seealso:[]},LOG10E:{name:"LOG10E",category:"Constants",syntax:["LOG10E"],description:"Returns the base-10 logarithm of E, approximately equal to 0.434",examples:["LOG10E","log(e, 10)"],seealso:[]},NaN:{name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]},null:{name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]},pi:Tl,PI:Tl,phi:{name:"phi",category:"Constants",syntax:["phi"],description:"Phi is the golden ratio. Two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the two quantities. Phi is defined as `(1 + sqrt(5)) / 2` and is approximately 1.618034...",examples:["phi"],seealso:[]},SQRT1_2:{name:"SQRT1_2",category:"Constants",syntax:["SQRT1_2"],description:"Returns the square root of 1/2, approximately equal to 0.707",examples:["SQRT1_2","sqrt(1/2)"],seealso:[]},SQRT2:{name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]},tau:{name:"tau",category:"Constants",syntax:["tau"],description:"Tau is the ratio constant of a circle's circumference to radius, equal to 2 * pi, approximately 6.2832.",examples:["tau","2 * pi"],seealso:["pi"]},true:{name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]},version:{name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]},speedOfLight:{description:"Speed of light in vacuum",examples:["speedOfLight"]},gravitationConstant:{description:"Newtonian constant of gravitation",examples:["gravitationConstant"]},planckConstant:{description:"Planck constant",examples:["planckConstant"]},reducedPlanckConstant:{description:"Reduced Planck constant",examples:["reducedPlanckConstant"]},magneticConstant:{description:"Magnetic constant (vacuum permeability)",examples:["magneticConstant"]},electricConstant:{description:"Electric constant (vacuum permeability)",examples:["electricConstant"]},vacuumImpedance:{description:"Characteristic impedance of vacuum",examples:["vacuumImpedance"]},coulomb:{description:"Coulomb's constant",examples:["coulomb"]},elementaryCharge:{description:"Elementary charge",examples:["elementaryCharge"]},bohrMagneton:{description:"Borh magneton",examples:["bohrMagneton"]},conductanceQuantum:{description:"Conductance quantum",examples:["conductanceQuantum"]},inverseConductanceQuantum:{description:"Inverse conductance quantum",examples:["inverseConductanceQuantum"]},magneticFluxQuantum:{description:"Magnetic flux quantum",examples:["magneticFluxQuantum"]},nuclearMagneton:{description:"Nuclear magneton",examples:["nuclearMagneton"]},klitzing:{description:"Von Klitzing constant",examples:["klitzing"]},bohrRadius:{description:"Borh radius",examples:["bohrRadius"]},classicalElectronRadius:{description:"Classical electron radius",examples:["classicalElectronRadius"]},electronMass:{description:"Electron mass",examples:["electronMass"]},fermiCoupling:{description:"Fermi coupling constant",examples:["fermiCoupling"]},fineStructure:{description:"Fine-structure constant",examples:["fineStructure"]},hartreeEnergy:{description:"Hartree energy",examples:["hartreeEnergy"]},protonMass:{description:"Proton mass",examples:["protonMass"]},deuteronMass:{description:"Deuteron Mass",examples:["deuteronMass"]},neutronMass:{description:"Neutron mass",examples:["neutronMass"]},quantumOfCirculation:{description:"Quantum of circulation",examples:["quantumOfCirculation"]},rydberg:{description:"Rydberg constant",examples:["rydberg"]},thomsonCrossSection:{description:"Thomson cross section",examples:["thomsonCrossSection"]},weakMixingAngle:{description:"Weak mixing angle",examples:["weakMixingAngle"]},efimovFactor:{description:"Efimov factor",examples:["efimovFactor"]},atomicMass:{description:"Atomic mass constant",examples:["atomicMass"]},avogadro:{description:"Avogadro's number",examples:["avogadro"]},boltzmann:{description:"Boltzmann constant",examples:["boltzmann"]},faraday:{description:"Faraday constant",examples:["faraday"]},firstRadiation:{description:"First radiation constant",examples:["firstRadiation"]},loschmidt:{description:"Loschmidt constant at T=273.15 K and p=101.325 kPa",examples:["loschmidt"]},gasConstant:{description:"Gas constant",examples:["gasConstant"]},molarPlanckConstant:{description:"Molar Planck constant",examples:["molarPlanckConstant"]},molarVolume:{description:"Molar volume of an ideal gas at T=273.15 K and p=101.325 kPa",examples:["molarVolume"]},sackurTetrode:{description:"Sackur-Tetrode constant at T=1 K and p=101.325 kPa",examples:["sackurTetrode"]},secondRadiation:{description:"Second radiation constant",examples:["secondRadiation"]},stefanBoltzmann:{description:"Stefan-Boltzmann constant",examples:["stefanBoltzmann"]},wienDisplacement:{description:"Wien displacement law constant",examples:["wienDisplacement"]},molarMass:{description:"Molar mass constant",examples:["molarMass"]},molarMassC12:{description:"Molar mass constant of carbon-12",examples:["molarMassC12"]},gravity:{description:"Standard acceleration of gravity (standard acceleration of free-fall on Earth)",examples:["gravity"]},planckLength:{description:"Planck length",examples:["planckLength"]},planckMass:{description:"Planck mass",examples:["planckMass"]},planckTime:{description:"Planck time",examples:["planckTime"]},planckCharge:{description:"Planck charge",examples:["planckCharge"]},planckTemperature:{description:"Planck temperature",examples:["planckTemperature"]},derivative:{name:"derivative",category:"Algebra",syntax:["derivative(expr, variable)","derivative(expr, variable, {simplify: boolean})"],description:"Takes the derivative of an expression expressed in parser Nodes. The derivative will be taken over the supplied variable in the second parameter. If there are multiple variables in the expression, it will return a partial derivative.",examples:['derivative("2x^3", "x")','derivative("2x^3", "x", {simplify: false})','derivative("2x^2 + 3x + 4", "x")','derivative("sin(2x)", "x")','f = parse("x^2 + x")','x = parse("x")',"df = derivative(f, x)","df.evaluate({x: 3})"],seealso:["simplify","parse","evaluate"]},lsolve:{name:"lsolve",category:"Algebra",syntax:["x=lsolve(L, b)"],description:"Solves the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lup","lusolve","usolve","matrix","sparse"]},lup:{name:"lup",category:"Algebra",syntax:["lup(m)"],description:"Calculate the Matrix LU decomposition with partial pivoting. Matrix A is decomposed in three matrices (L, U, P) where P * A = L * U",examples:["lup([[2, 1], [1, 4]])","lup(matrix([[2, 1], [1, 4]]))","lup(sparse([[2, 1], [1, 4]]))"],seealso:["lusolve","lsolve","usolve","matrix","sparse","slu","qr"]},lusolve:{name:"lusolve",category:"Algebra",syntax:["x=lusolve(A, b)","x=lusolve(lu, b)"],description:"Solves the linear system A * x = b where A is an [n x n] matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lusolve(a, b)"],seealso:["lup","slu","lsolve","usolve","matrix","sparse"]},simplify:{name:"simplify",category:"Algebra",syntax:["simplify(expr)","simplify(expr, rules)"],description:"Simplify an expression tree.",examples:['simplify("3 + 2 / 4")','simplify("2x + x")','f = parse("x * (x + 2 + x)")',"simplified = simplify(f)","simplified.evaluate({x: 2})"],seealso:["derivative","parse","evaluate"]},rationalize:{name:"rationalize",category:"Algebra",syntax:["rationalize(expr)","rationalize(expr, scope)","rationalize(expr, scope, detailed)"],description:"Transform a rationalizable expression in a rational fraction. If rational fraction is one variable polynomial then converts the numerator and denominator in canonical form, with decreasing exponents, returning the coefficients of numerator.",examples:['rationalize("2x/y - y/(x+1)")','rationalize("2x/y - y/(x+1)", true)'],seealso:["simplify"]},slu:{name:"slu",category:"Algebra",syntax:["slu(A, order, threshold)"],description:"Calculate the Matrix LU decomposition with full pivoting. Matrix A is decomposed in two matrices (L, U) and two permutation vectors (pinv, q) where P * A * Q = L * U",examples:["slu(sparse([4.5, 0, 3.2, 0; 3.1, 2.9, 0, 0.9; 0, 1.7, 3, 0; 3.5, 0.4, 0, 1]), 1, 0.001)"],seealso:["lusolve","lsolve","usolve","matrix","sparse","lup","qr"]},usolve:{name:"usolve",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Solves the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["lup","lusolve","lsolve","matrix","sparse"]},qr:{name:"qr",category:"Algebra",syntax:["qr(A)"],description:"Calculates the Matrix QR decomposition. Matrix `A` is decomposed in two matrices (`Q`, `R`) where `Q` is an orthogonal matrix and `R` is an upper triangular matrix.",examples:["qr([[1, -1, 4], [1, 4, -2], [1, 4, 2], [1, -1, 0]])"],seealso:["lup","slu","matrix"]},abs:{name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]},add:{name:"add",category:"Operators",syntax:["x + y","add(x, y)"],description:"Add two values.",examples:["a = 2.1 + 3.6","a - 3.6","3 + 2i","3 cm + 2 inch",'"2.3" + "4"'],seealso:["subtract"]},cbrt:{name:"cbrt",category:"Arithmetic",syntax:["cbrt(x)","cbrt(x, allRoots)"],description:"Compute the cubic root value. If x = y * y * y, then y is the cubic root of x. When `x` is a number or complex number, an optional second argument `allRoots` can be provided to return all three cubic roots. If not provided, the principal root is returned",examples:["cbrt(64)","cube(4)","cbrt(-8)","cbrt(2 + 3i)","cbrt(8i)","cbrt(8i, true)","cbrt(27 m^3)"],seealso:["square","sqrt","cube","multiply"]},ceil:{name:"ceil",category:"Arithmetic",syntax:["ceil(x)"],description:"Round a value towards plus infinity. If x is complex, both real and imaginary part are rounded towards plus infinity.",examples:["ceil(3.2)","ceil(3.8)","ceil(-4.2)"],seealso:["floor","fix","round"]},cube:{name:"cube",category:"Arithmetic",syntax:["cube(x)"],description:"Compute the cube of a value. The cube of x is x * x * x.",examples:["cube(2)","2^3","2 * 2 * 2"],seealso:["multiply","square","pow"]},divide:{name:"divide",category:"Operators",syntax:["x / y","divide(x, y)"],description:"Divide two values.",examples:["a = 2 / 3","a * 3","4.5 / 2","3 + 4 / 2","(3 + 4) / 2","18 km / 4.5"],seealso:["multiply"]},dotDivide:{name:"dotDivide",category:"Operators",syntax:["x ./ y","dotDivide(x, y)"],description:"Divide two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a ./ b"],seealso:["multiply","dotMultiply","divide"]},dotMultiply:{name:"dotMultiply",category:"Operators",syntax:["x .* y","dotMultiply(x, y)"],description:"Multiply two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a .* b"],seealso:["multiply","divide","dotDivide"]},dotPow:{name:"dotPow",category:"Operators",syntax:["x .^ y","dotPow(x, y)"],description:"Calculates the power of x to y element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","a .^ 2"],seealso:["pow"]},exp:{name:"exp",category:"Arithmetic",syntax:["exp(x)"],description:"Calculate the exponent of a value.",examples:["exp(1.3)","e ^ 1.3","log(exp(1.3))","x = 2.4","(exp(i*x) == cos(x) + i*sin(x)) # Euler's formula"],seealso:["expm","expm1","pow","log"]},expm:{name:"expm",category:"Arithmetic",syntax:["exp(x)"],description:"Compute the matrix exponential, expm(A) = e^A. The matrix must be square. Not to be confused with exp(a), which performs element-wise exponentiation.",examples:["expm([[0,2],[0,0]])"],seealso:["exp"]},expm1:{name:"expm1",category:"Arithmetic",syntax:["expm1(x)"],description:"Calculate the value of subtracting 1 from the exponential value.",examples:["expm1(2)","pow(e, 2) - 1","log(expm1(2) + 1)"],seealso:["exp","pow","log"]},fix:{name:"fix",category:"Arithmetic",syntax:["fix(x)"],description:"Round a value towards zero. If x is complex, both real and imaginary part are rounded towards zero.",examples:["fix(3.2)","fix(3.8)","fix(-4.2)","fix(-4.8)"],seealso:["ceil","floor","round"]},floor:{name:"floor",category:"Arithmetic",syntax:["floor(x)"],description:"Round a value towards minus infinity.If x is complex, both real and imaginary part are rounded towards minus infinity.",examples:["floor(3.2)","floor(3.8)","floor(-4.2)"],seealso:["ceil","fix","round"]},gcd:{name:"gcd",category:"Arithmetic",syntax:["gcd(a, b)","gcd(a, b, c, ...)"],description:"Compute the greatest common divisor.",examples:["gcd(8, 12)","gcd(-4, 6)","gcd(25, 15, -10)"],seealso:["lcm","xgcd"]},hypot:{name:"hypot",category:"Arithmetic",syntax:["hypot(a, b, c, ...)","hypot([a, b, c, ...])"],description:"Calculate the hypotenusa of a list with values. ",examples:["hypot(3, 4)","sqrt(3^2 + 4^2)","hypot(-2)","hypot([3, 4, 5])"],seealso:["abs","norm"]},lcm:{name:"lcm",category:"Arithmetic",syntax:["lcm(x, y)"],description:"Compute the least common multiple.",examples:["lcm(4, 6)","lcm(6, 21)","lcm(6, 21, 5)"],seealso:["gcd"]},log:{name:"log",category:"Arithmetic",syntax:["log(x)","log(x, base)"],description:"Compute the logarithm of a value. If no base is provided, the natural logarithm of x is calculated. If base if provided, the logarithm is calculated for the specified base. log(x, base) is defined as log(x) / log(base).",examples:["log(3.5)","a = log(2.4)","exp(a)","10 ^ 4","log(10000, 10)","log(10000) / log(10)","b = log(1024, 2)","2 ^ b"],seealso:["exp","log1p","log2","log10"]},log2:{name:"log2",category:"Arithmetic",syntax:["log2(x)"],description:"Calculate the 2-base of a value. This is the same as calculating `log(x, 2)`.",examples:["log2(0.03125)","log2(16)","log2(16) / log2(2)","pow(2, 4)"],seealso:["exp","log1p","log","log10"]},log1p:{name:"log1p",category:"Arithmetic",syntax:["log1p(x)","log1p(x, base)"],description:"Calculate the logarithm of a `value+1`",examples:["log1p(2.5)","exp(log1p(1.4))","pow(10, 4)","log1p(9999, 10)","log1p(9999) / log(10)"],seealso:["exp","log","log2","log10"]},log10:{name:"log10",category:"Arithmetic",syntax:["log10(x)"],description:"Compute the 10-base logarithm of a value.",examples:["log10(0.00001)","log10(10000)","10 ^ 4","log(10000) / log(10)","log(10000, 10)"],seealso:["exp","log"]},mod:{name:"mod",category:"Operators",syntax:["x % y","x mod y","mod(x, y)"],description:"Calculates the modulus, the remainder of an integer division.",examples:["7 % 3","11 % 2","10 mod 4","isOdd(x) = x % 2","isOdd(2)","isOdd(3)"],seealso:["divide"]},multiply:{name:"multiply",category:"Operators",syntax:["x * y","multiply(x, y)"],description:"multiply two values.",examples:["a = 2.1 * 3.4","a / 3.4","2 * 3 + 4","2 * (3 + 4)","3 * 2.1 km"],seealso:["divide"]},norm:{name:"norm",category:"Arithmetic",syntax:["norm(x)","norm(x, p)"],description:"Calculate the norm of a number, vector or matrix.",examples:["abs(-3.5)","norm(-3.5)","norm(3 - 4i)","norm([1, 2, -3], Infinity)","norm([1, 2, -3], -Infinity)","norm([3, 4], 2)","norm([[1, 2], [3, 4]], 1)",'norm([[1, 2], [3, 4]], "inf")','norm([[1, 2], [3, 4]], "fro")']},nthRoot:{name:"nthRoot",category:"Arithmetic",syntax:["nthRoot(a)","nthRoot(a, root)"],description:'Calculate the nth root of a value. The principal nth root of a positive real number A, is the positive real solution of the equation "x^root = A".',examples:["4 ^ 3","nthRoot(64, 3)","nthRoot(9, 2)","sqrt(9)"],seealso:["nthRoots","pow","sqrt"]},nthRoots:{name:"nthRoots",category:"Arithmetic",syntax:["nthRoots(A)","nthRoots(A, root)"],description:'Calculate the nth roots of a value. An nth root of a positive real number A, is a positive real solution of the equation "x^root = A". This function returns an array of complex values.',examples:["nthRoots(1)","nthRoots(1, 3)"],seealso:["sqrt","pow","nthRoot"]},pow:{name:"pow",category:"Operators",syntax:["x ^ y","pow(x, y)"],description:"Calculates the power of x to y, x^y.",examples:["2^3","2*2*2","1 + e ^ (pi * i)"],seealso:["multiply","nthRoot","nthRoots","sqrt"]},round:{name:"round",category:"Arithmetic",syntax:["round(x)","round(x, n)"],description:"round a value towards the nearest integer.If x is complex, both real and imaginary part are rounded towards the nearest integer. When n is specified, the value is rounded to n decimals.",examples:["round(3.2)","round(3.8)","round(-4.2)","round(-4.8)","round(pi, 3)","round(123.45678, 2)"],seealso:["ceil","floor","fix"]},sign:{name:"sign",category:"Arithmetic",syntax:["sign(x)"],description:"Compute the sign of a value. The sign of a value x is 1 when x>1, -1 when x<0, and 0 when x=0.",examples:["sign(3.5)","sign(-4.2)","sign(0)"],seealso:["abs"]},sqrt:{name:"sqrt",category:"Arithmetic",syntax:["sqrt(x)"],description:"Compute the square root value. If x = y * y, then y is the square root of x.",examples:["sqrt(25)","5 * 5","sqrt(-1)"],seealso:["square","sqrtm","multiply","nthRoot","nthRoots","pow"]},sqrtm:{name:"sqrtm",category:"Arithmetic",syntax:["sqrtm(x)"],description:"Calculate the principal square root of a square matrix. The principal square root matrix `X` of another matrix `A` is such that `X * X = A`.",examples:["sqrtm([[1, 2], [3, 4]])"],seealso:["sqrt","abs","square","multiply"]},square:{name:"square",category:"Arithmetic",syntax:["square(x)"],description:"Compute the square of a value. The square of x is x * x.",examples:["square(3)","sqrt(9)","3^2","3 * 3"],seealso:["multiply","pow","sqrt","cube"]},subtract:{name:"subtract",category:"Operators",syntax:["x - y","subtract(x, y)"],description:"subtract two values.",examples:["a = 5.3 - 2","a + 2","2/3 - 1/6","2 * 3 - 3","2.1 km - 500m"],seealso:["add"]},unaryMinus:{name:"unaryMinus",category:"Operators",syntax:["-x","unaryMinus(x)"],description:"Inverse the sign of a value. Converts booleans and strings to numbers.",examples:["-4.5","-(-5.6)",'-"22"'],seealso:["add","subtract","unaryPlus"]},unaryPlus:{name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]},xgcd:{name:"xgcd",category:"Arithmetic",syntax:["xgcd(a, b)"],description:"Calculate the extended greatest common divisor for two values. The result is an array [d, x, y] with 3 entries, where d is the greatest common divisor, and d = x * a + y * b.",examples:["xgcd(8, 12)","gcd(8, 12)","xgcd(36163, 21199)"],seealso:["gcd","lcm"]},bitAnd:{name:"bitAnd",category:"Bitwise",syntax:["x & y","bitAnd(x, y)"],description:"Bitwise AND operation. Performs the logical AND operation on each pair of the corresponding bits of the two given values by multiplying them. If both bits in the compared position are 1, the bit in the resulting binary representation is 1, otherwise, the result is 0",examples:["5 & 3","bitAnd(53, 131)","[1, 12, 31] & 42"],seealso:["bitNot","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]},bitNot:{name:"bitNot",category:"Bitwise",syntax:["~x","bitNot(x)"],description:"Bitwise NOT operation. Performs a logical negation on each bit of the given value. Bits that are 0 become 1, and those that are 1 become 0.",examples:["~1","~2","bitNot([2, -3, 4])"],seealso:["bitAnd","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]},bitOr:{name:"bitOr",category:"Bitwise",syntax:["x | y","bitOr(x, y)"],description:"Bitwise OR operation. Performs the logical inclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if the first bit is 1 or the second bit is 1 or both bits are 1, otherwise, the result is 0.",examples:["5 | 3","bitOr([1, 2, 3], 4)"],seealso:["bitAnd","bitNot","bitXor","leftShift","rightArithShift","rightLogShift"]},bitXor:{name:"bitXor",category:"Bitwise",syntax:["bitXor(x, y)"],description:"Bitwise XOR operation, exclusive OR. Performs the logical exclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if only the first bit is 1 or only the second bit is 1, but will be 0 if both are 0 or both are 1.",examples:["bitOr(1, 2)","bitXor([2, 3, 4], 4)"],seealso:["bitAnd","bitNot","bitOr","leftShift","rightArithShift","rightLogShift"]},leftShift:{name:"leftShift",category:"Bitwise",syntax:["x << y","leftShift(x, y)"],description:"Bitwise left logical shift of a value x by y number of bits.",examples:["4 << 1","8 >> 1"],seealso:["bitAnd","bitNot","bitOr","bitXor","rightArithShift","rightLogShift"]},rightArithShift:{name:"rightArithShift",category:"Bitwise",syntax:["x >> y","rightArithShift(x, y)"],description:"Bitwise right arithmetic shift of a value x by y number of bits.",examples:["8 >> 1","4 << 1","-12 >> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightLogShift"]},rightLogShift:{name:"rightLogShift",category:"Bitwise",syntax:["x >>> y","rightLogShift(x, y)"],description:"Bitwise right logical shift of a value x by y number of bits.",examples:["8 >>> 1","4 << 1","-12 >>> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightArithShift"]},bellNumbers:{name:"bellNumbers",category:"Combinatorics",syntax:["bellNumbers(n)"],description:"The Bell Numbers count the number of partitions of a set. A partition is a pairwise disjoint subset of S whose union is S. `bellNumbers` only takes integer arguments. The following condition must be enforced: n >= 0.",examples:["bellNumbers(3)","bellNumbers(8)"],seealso:["stirlingS2"]},catalan:{name:"catalan",category:"Combinatorics",syntax:["catalan(n)"],description:"The Catalan Numbers enumerate combinatorial structures of many different types. catalan only takes integer arguments. The following condition must be enforced: n >= 0.",examples:["catalan(3)","catalan(8)"],seealso:["bellNumbers"]},composition:{name:"composition",category:"Combinatorics",syntax:["composition(n, k)"],description:"The composition counts of n into k parts. composition only takes integer arguments. The following condition must be enforced: k <= n.",examples:["composition(5, 3)"],seealso:["combinations"]},stirlingS2:{name:"stirlingS2",category:"Combinatorics",syntax:["stirlingS2(n, k)"],description:"he Stirling numbers of the second kind, counts the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets. `stirlingS2` only takes integer arguments. The following condition must be enforced: k <= n. If n = k or k = 1, then s(n,k) = 1.",examples:["stirlingS2(5, 3)"],seealso:["bellNumbers"]},config:{name:"config",category:"Core",syntax:["config()","config(options)"],description:"Get configuration or change configuration.",examples:["config()","1/3 + 1/4",'config({number: "Fraction"})',"1/3 + 1/4"],seealso:[]},import:{name:"import",category:"Core",syntax:["import(functions)","import(functions, options)"],description:"Import functions or constants from an object.",examples:["import({myFn: f(x)=x^2, myConstant: 32 })","myFn(2)","myConstant"],seealso:[]},typed:{name:"typed",category:"Core",syntax:["typed(signatures)","typed(name, signatures)"],description:"Create a typed function.",examples:['double = typed({ "number, number": f(x)=x+x })',"double(2)",'double("hello")'],seealso:[]},arg:{name:"arg",category:"Complex",syntax:["arg(x)"],description:"Compute the argument of a complex value. If x = a+bi, the argument is computed as atan2(b, a).",examples:["arg(2 + 2i)","atan2(3, 2)","arg(2 + 3i)"],seealso:["re","im","conj","abs"]},conj:{name:"conj",category:"Complex",syntax:["conj(x)"],description:"Compute the complex conjugate of a complex value. If x = a+bi, the complex conjugate is a-bi.",examples:["conj(2 + 3i)","conj(2 - 3i)","conj(-5.2i)"],seealso:["re","im","abs","arg"]},re:{name:"re",category:"Complex",syntax:["re(x)"],description:"Get the real part of a complex number.",examples:["re(2 + 3i)","im(2 + 3i)","re(-5.2i)","re(2.4)"],seealso:["im","conj","abs","arg"]},im:{name:"im",category:"Complex",syntax:["im(x)"],description:"Get the imaginary part of a complex number.",examples:["im(2 + 3i)","re(2 + 3i)","im(-5.2i)","im(2.4)"],seealso:["re","conj","abs","arg"]},evaluate:Cl,eval:Cl,help:{name:"help",category:"Expression",syntax:["help(object)","help(string)"],description:"Display documentation on a function or data type.",examples:["help(sqrt)",'help("complex")'],seealso:[]},distance:{name:"distance",category:"Geometry",syntax:["distance([x1, y1], [x2, y2])","distance([[x1, y1], [x2, y2])"],description:"Calculates the Euclidean distance between two points.",examples:["distance([0,0], [4,4])","distance([[0,0], [4,4]])"],seealso:[]},intersect:{name:"intersect",category:"Geometry",syntax:["intersect(expr1, expr2, expr3, expr4)","intersect(expr1, expr2, expr3)"],description:"Computes the intersection point of lines and/or planes.",examples:["intersect([0, 0], [10, 10], [10, 0], [0, 10])","intersect([1, 0, 1], [4, -2, 2], [1, 1, 1, 6])"],seealso:[]},and:{name:"and",category:"Logical",syntax:["x and y","and(x, y)"],description:"Logical and. Test whether two values are both defined with a nonzero/nonempty value.",examples:["true and false","true and true","2 and 4"],seealso:["not","or","xor"]},not:{name:"not",category:"Logical",syntax:["not x","not(x)"],description:"Logical not. Flips the boolean value of given argument.",examples:["not true","not false","not 2","not 0"],seealso:["and","or","xor"]},or:{name:"or",category:"Logical",syntax:["x or y","or(x, y)"],description:"Logical or. Test if at least one value is defined with a nonzero/nonempty value.",examples:["true or false","false or false","0 or 4"],seealso:["not","and","xor"]},xor:{name:"xor",category:"Logical",syntax:["x xor y","xor(x, y)"],description:"Logical exclusive or, xor. Test whether one and only one value is defined with a nonzero/nonempty value.",examples:["true xor false","false xor false","true xor true","0 xor 4"],seealso:["not","and","or"]},concat:{name:"concat",category:"Matrix",syntax:["concat(A, B, C, ...)","concat(A, B, C, ..., dim)"],description:"Concatenate matrices. By default, the matrices are concatenated by the last dimension. The dimension on which to concatenate can be provided as last argument.",examples:["A = [1, 2; 5, 6]","B = [3, 4; 7, 8]","concat(A, B)","concat(A, B, 1)","concat(A, B, 2)"],seealso:["det","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]},cross:{name:"cross",category:"Matrix",syntax:["cross(A, B)"],description:"Calculate the cross product for two vectors in three dimensional space.",examples:["cross([1, 1, 0], [0, 1, 1])","cross([3, -3, 1], [4, 9, 2])","cross([2, 3, 4], [5, 6, 7])"],seealso:["multiply","dot"]},column:{name:"column",category:"Matrix",syntax:["column(x, index)"],description:"Return a column from a matrix or array.",examples:["A = [[1, 2], [3, 4]]","column(A, 1)","column(A, 2)"],seealso:["row"]},ctranspose:{name:"ctranspose",category:"Matrix",syntax:["x'","ctranspose(x)"],description:"Complex Conjugate and Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","ctranspose(a)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","zeros"]},det:{name:"det",category:"Matrix",syntax:["det(x)"],description:"Calculate the determinant of a matrix",examples:["det([1, 2; 3, 4])","det([-2, 2, 3; -1, 1, 3; 2, 0, -1])"],seealso:["concat","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]},diag:{name:"diag",category:"Matrix",syntax:["diag(x)","diag(x, k)"],description:"Create a diagonal matrix or retrieve the diagonal of a matrix. When x is a vector, a matrix with the vector values on the diagonal will be returned. When x is a matrix, a vector with the diagonal values of the matrix is returned. When k is provided, the k-th diagonal will be filled in or retrieved, if k is positive, the values are placed on the super diagonal. When k is negative, the values are placed on the sub diagonal.",examples:["diag(1:3)","diag(1:3, 1)","a = [1, 2, 3; 4, 5, 6; 7, 8, 9]","diag(a)"],seealso:["concat","det","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]},dot:{name:"dot",category:"Matrix",syntax:["dot(A, B)","A * B"],description:"Calculate the dot product of two vectors. The dot product of A = [a1, a2, a3, ..., an] and B = [b1, b2, b3, ..., bn] is defined as dot(A, B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn",examples:["dot([2, 4, 1], [2, 2, 3])","[2, 4, 1] * [2, 2, 3]"],seealso:["multiply","cross"]},getMatrixDataType:{name:"getMatrixDataType",category:"Matrix",syntax:["getMatrixDataType(x)"],description:'Find the data type of all elements in a matrix or array, for example "number" if all items are a number and "Complex" if all values are complex numbers. If a matrix contains more than one data type, it will return "mixed".',examples:["getMatrixDataType([1, 2, 3])","getMatrixDataType([[5 cm], [2 inch]])",'getMatrixDataType([1, "text"])',"getMatrixDataType([1, bignumber(4)])"],seealso:["matrix","sparse","typeOf"]},identity:{name:"identity",category:"Matrix",syntax:["identity(n)","identity(m, n)","identity([m, n])"],description:"Returns the identity matrix with size m-by-n. The matrix has ones on the diagonal and zeros elsewhere.",examples:["identity(3)","identity(3, 5)","a = [1, 2, 3; 4, 5, 6]","identity(size(a))"],seealso:["concat","det","diag","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]},filter:{name:"filter",category:"Matrix",syntax:["filter(x, test)"],description:"Filter items in a matrix.",examples:["isPositive(x) = x > 0","filter([6, -2, -1, 4, 3], isPositive)","filter([6, -2, 0, 1, 0], x != 0)"],seealso:["sort","map","forEach"]},flatten:{name:"flatten",category:"Matrix",syntax:["flatten(x)"],description:"Flatten a multi dimensional matrix into a single dimensional matrix.",examples:["a = [1, 2, 3; 4, 5, 6]","size(a)","b = flatten(a)","size(b)"],seealso:["concat","resize","size","squeeze"]},forEach:{name:"forEach",category:"Matrix",syntax:["forEach(x, callback)"],description:"Iterates over all elements of a matrix/array, and executes the given callback function.",examples:["forEach([1, 2, 3], function(val) { console.log(val) })"],seealso:["map","sort","filter"]},inv:{name:"inv",category:"Matrix",syntax:["inv(x)"],description:"Calculate the inverse of a matrix",examples:["inv([1, 2; 3, 4])","inv(4)","1 / 4"],seealso:["concat","det","diag","identity","ones","range","size","squeeze","subset","trace","transpose","zeros"]},kron:{name:"kron",category:"Matrix",syntax:["kron(x, y)"],description:"Calculates the kronecker product of 2 matrices or vectors.",examples:["kron([[1, 0], [0, 1]], [[1, 2], [3, 4]])","kron([1,1], [2,3,4])"],seealso:["multiply","dot","cross"]},map:{name:"map",category:"Matrix",syntax:["map(x, callback)"],description:"Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array.",examples:["map([1, 2, 3], square)"],seealso:["filter","forEach"]},ones:{name:"ones",category:"Matrix",syntax:["ones(m)","ones(m, n)","ones(m, n, p, ...)","ones([m])","ones([m, n])","ones([m, n, p, ...])"],description:"Create a matrix containing ones.",examples:["ones(3)","ones(3, 5)","ones([2,3]) * 4.5","a = [1, 2, 3; 4, 5, 6]","ones(size(a))"],seealso:["concat","det","diag","identity","inv","range","size","squeeze","subset","trace","transpose","zeros"]},partitionSelect:{name:"partitionSelect",category:"Matrix",syntax:["partitionSelect(x, k)","partitionSelect(x, k, compare)"],description:"Partition-based selection of an array or 1D matrix. Will find the kth smallest value, and mutates the input array. Uses Quickselect.",examples:["partitionSelect([5, 10, 1], 2)",'partitionSelect(["C", "B", "A", "D"], 1)'],seealso:["sort"]},range:{name:"range",category:"Type",syntax:["start:end","start:step:end","range(start, end)","range(start, end, step)","range(string)"],description:"Create a range. Lower bound of the range is included, upper bound is excluded.",examples:["1:5","3:-1:-3","range(3, 7)","range(0, 12, 2)",'range("4:10")',"a = [1, 2, 3, 4; 5, 6, 7, 8]","a[1:2, 1:2]"],seealso:["concat","det","diag","identity","inv","ones","size","squeeze","subset","trace","transpose","zeros"]},resize:{name:"resize",category:"Matrix",syntax:["resize(x, size)","resize(x, size, defaultValue)"],description:"Resize a matrix.",examples:["resize([1,2,3,4,5], [3])","resize([1,2,3], [5])","resize([1,2,3], [5], -1)","resize(2, [2, 3])",'resize("hello", [8], "!")'],seealso:["size","subset","squeeze","reshape"]},reshape:{name:"reshape",category:"Matrix",syntax:["reshape(x, sizes)"],description:"Reshape a multi dimensional array to fit the specified dimensions.",examples:["reshape([1, 2, 3, 4, 5, 6], [2, 3])","reshape([[1, 2], [3, 4]], [1, 4])","reshape([[1, 2], [3, 4]], [4])"],seealso:["size","squeeze","resize"]},row:{name:"row",category:"Matrix",syntax:["row(x, index)"],description:"Return a row from a matrix or array.",examples:["A = [[1, 2], [3, 4]]","row(A, 1)","row(A, 2)"],seealso:["column"]},size:{name:"size",category:"Matrix",syntax:["size(x)"],description:"Calculate the size of a matrix.",examples:["size(2.3)",'size("hello world")',"a = [1, 2; 3, 4; 5, 6]","size(a)","size(1:6)"],seealso:["concat","det","diag","identity","inv","ones","range","squeeze","subset","trace","transpose","zeros"]},sort:{name:"sort",category:"Matrix",syntax:["sort(x)","sort(x, compare)"],description:'Sort the items in a matrix. Compare can be a string "asc", "desc", "natural", or a custom sort function.',examples:["sort([5, 10, 1])",'sort(["C", "B", "A", "D"])',"sortByLength(a, b) = size(a)[1] - size(b)[1]",'sort(["Langdon", "Tom", "Sara"], sortByLength)','sort(["10", "1", "2"], "natural")'],seealso:["map","filter","forEach"]},squeeze:{name:"squeeze",category:"Matrix",syntax:["squeeze(x)"],description:"Remove inner and outer singleton dimensions from a matrix.",examples:["a = zeros(3,2,1)","size(squeeze(a))","b = zeros(1,1,3)","size(squeeze(b))"],seealso:["concat","det","diag","identity","inv","ones","range","size","subset","trace","transpose","zeros"]},subset:{name:"subset",category:"Matrix",syntax:["value(index)","value(index) = replacement","subset(value, [index])","subset(value, [index], replacement)"],description:"Get or set a subset of a matrix or string. Indexes are one-based. Both the ranges lower-bound and upper-bound are included.",examples:["d = [1, 2; 3, 4]","e = []","e[1, 1:2] = [5, 6]","e[2, :] = [7, 8]","f = d * e","f[2, 1]","f[:, 1]"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","trace","transpose","zeros"]},trace:{name:"trace",category:"Matrix",syntax:["trace(A)"],description:"Calculate the trace of a matrix: the sum of the elements on the main diagonal of a square matrix.",examples:["A = [1, 2, 3; -1, 2, 3; 2, 0, 3]","trace(A)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","transpose","zeros"]},transpose:{name:"transpose",category:"Matrix",syntax:["x'","transpose(x)"],description:"Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","transpose(a)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","zeros"]},zeros:{name:"zeros",category:"Matrix",syntax:["zeros(m)","zeros(m, n)","zeros(m, n, p, ...)","zeros([m])","zeros([m, n])","zeros([m, n, p, ...])"],description:"Create a matrix containing zeros.",examples:["zeros(3)","zeros(3, 5)","a = [1, 2, 3; 4, 5, 6]","zeros(size(a))"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose"]},combinations:{name:"combinations",category:"Probability",syntax:["combinations(n, k)"],description:"Compute the number of combinations of n items taken k at a time",examples:["combinations(7, 5)"],seealso:["combinationsWithRep","permutations","factorial"]},combinationsWithRep:{name:"combinationsWithRep",category:"Probability",syntax:["combinationsWithRep(n, k)"],description:"Compute the number of combinations of n items taken k at a time with replacements.",examples:["combinationsWithRep(7, 5)"],seealso:["combinations","permutations","factorial"]},factorial:{name:"factorial",category:"Probability",syntax:["n!","factorial(n)"],description:"Compute the factorial of a value",examples:["5!","5 * 4 * 3 * 2 * 1","3!"],seealso:["combinations","combinationsWithRep","permutations","gamma"]},gamma:{name:"gamma",category:"Probability",syntax:["gamma(n)"],description:"Compute the gamma function. For small values, the Lanczos approximation is used, and for large values the extended Stirling approximation.",examples:["gamma(4)","3!","gamma(1/2)","sqrt(pi)"],seealso:["factorial"]},kldivergence:{name:"kldivergence",category:"Probability",syntax:["kldivergence(x, y)"],description:"Calculate the Kullback-Leibler (KL) divergence between two distributions.",examples:["kldivergence([0.7,0.5,0.4], [0.2,0.9,0.5])"],seealso:[]},multinomial:{name:"multinomial",category:"Probability",syntax:["multinomial(A)"],description:"Multinomial Coefficients compute the number of ways of picking a1, a2, ..., ai unordered outcomes from `n` possibilities. multinomial takes one array of integers as an argument. The following condition must be enforced: every ai > 0.",examples:["multinomial([1, 2, 1])"],seealso:["combinations","factorial"]},permutations:{name:"permutations",category:"Probability",syntax:["permutations(n)","permutations(n, k)"],description:"Compute the number of permutations of n items taken k at a time",examples:["permutations(5)","permutations(5, 3)"],seealso:["combinations","combinationsWithRep","factorial"]},pickRandom:{name:"pickRandom",category:"Probability",syntax:["pickRandom(array)","pickRandom(array, number)","pickRandom(array, weights)","pickRandom(array, number, weights)","pickRandom(array, weights, number)"],description:"Pick a random entry from a given array.",examples:["pickRandom(0:10)","pickRandom([1, 3, 1, 6])","pickRandom([1, 3, 1, 6], 2)","pickRandom([1, 3, 1, 6], [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], 2, [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], [2, 3, 2, 1], 2)"],seealso:["random","randomInt"]},random:{name:"random",category:"Probability",syntax:["random()","random(max)","random(min, max)","random(size)","random(size, max)","random(size, min, max)"],description:"Return a random number.",examples:["random()","random(10, 20)","random([2, 3])"],seealso:["pickRandom","randomInt"]},randomInt:{name:"randomInt",category:"Probability",syntax:["randomInt(max)","randomInt(min, max)","randomInt(size)","randomInt(size, max)","randomInt(size, min, max)"],description:"Return a random integer number",examples:["randomInt(10, 20)","randomInt([2, 3], 10)"],seealso:["pickRandom","random"]},compare:{name:"compare",category:"Relational",syntax:["compare(x, y)"],description:"Compare two values. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compare(2, 3)","compare(3, 2)","compare(2, 2)","compare(5cm, 40mm)","compare(2, [1, 2, 3])"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compareNatural","compareText"]},compareNatural:{name:"compareNatural",category:"Relational",syntax:["compareNatural(x, y)"],description:"Compare two values of any type in a deterministic, natural way. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compareNatural(2, 3)","compareNatural(3, 2)","compareNatural(2, 2)","compareNatural(5cm, 40mm)",'compareNatural("2", "10")',"compareNatural(2 + 3i, 2 + 4i)","compareNatural([1, 2, 4], [1, 2, 3])","compareNatural([1, 5], [1, 2, 3])","compareNatural([1, 2], [1, 2])","compareNatural({a: 2}, {a: 4})"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare","compareText"]},compareText:{name:"compareText",category:"Relational",syntax:["compareText(x, y)"],description:"Compare two strings lexically. Comparison is case sensitive. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:['compareText("B", "A")','compareText("A", "B")','compareText("A", "A")','compareText("2", "10")','compare("2", "10")',"compare(2, 10)",'compareNatural("2", "10")','compareText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural"]},deepEqual:{name:"deepEqual",category:"Relational",syntax:["deepEqual(x, y)"],description:"Check equality of two matrices element wise. Returns true if the size of both matrices is equal and when and each of the elements are equal.",examples:["deepEqual([1,3,4], [1,3,4])","deepEqual([1,3,4], [1,3])"],seealso:["equal","unequal","smaller","larger","smallerEq","largerEq","compare"]},equal:{name:"equal",category:"Relational",syntax:["x == y","equal(x, y)"],description:"Check equality of two values. Returns true if the values are equal, and false if not.",examples:["2+2 == 3","2+2 == 4","a = 3.2","b = 6-2.8","a == b","50cm == 0.5m"],seealso:["unequal","smaller","larger","smallerEq","largerEq","compare","deepEqual","equalText"]},equalText:{name:"equalText",category:"Relational",syntax:["equalText(x, y)"],description:"Check equality of two strings. Comparison is case sensitive. Returns true if the values are equal, and false if not.",examples:['equalText("Hello", "Hello")','equalText("a", "A")','equal("2e3", "2000")','equalText("2e3", "2000")','equalText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural","compareText","equal"]},larger:{name:"larger",category:"Relational",syntax:["x > y","larger(x, y)"],description:"Check if value x is larger than y. Returns true if x is larger than y, and false if not.",examples:["2 > 3","5 > 2*2","a = 3.3","b = 6-2.8","(a > b)","(b < a)","5 cm > 2 inch"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare"]},largerEq:{name:"largerEq",category:"Relational",syntax:["x >= y","largerEq(x, y)"],description:"Check if value x is larger or equal to y. Returns true if x is larger or equal to y, and false if not.",examples:["2 >= 1+1","2 > 1+1","a = 3.2","b = 6-2.8","(a >= b)"],seealso:["equal","unequal","smallerEq","smaller","compare"]},smaller:{name:"smaller",category:"Relational",syntax:["x < y","smaller(x, y)"],description:"Check if value x is smaller than value y. Returns true if x is smaller than y, and false if not.",examples:["2 < 3","5 < 2*2","a = 3.3","b = 6-2.8","(a < b)","5 cm < 2 inch"],seealso:["equal","unequal","larger","smallerEq","largerEq","compare"]},smallerEq:{name:"smallerEq",category:"Relational",syntax:["x <= y","smallerEq(x, y)"],description:"Check if value x is smaller or equal to value y. Returns true if x is smaller than y, and false if not.",examples:["2 <= 1+1","2 < 1+1","a = 3.2","b = 6-2.8","(a <= b)"],seealso:["equal","unequal","larger","smaller","largerEq","compare"]},unequal:{name:"unequal",category:"Relational",syntax:["x != y","unequal(x, y)"],description:"Check unequality of two values. Returns true if the values are unequal, and false if they are equal.",examples:["2+2 != 3","2+2 != 4","a = 3.2","b = 6-2.8","a != b","50cm != 0.5m","5 cm != 2 inch"],seealso:["equal","smaller","larger","smallerEq","largerEq","compare","deepEqual"]},setCartesian:{name:"setCartesian",category:"Set",syntax:["setCartesian(set1, set2)"],description:"Create the cartesian product of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setCartesian([1, 2], [3, 4])"],seealso:["setUnion","setIntersect","setDifference","setPowerset"]},setDifference:{name:"setDifference",category:"Set",syntax:["setDifference(set1, set2)"],description:"Create the difference of two (multi)sets: every element of set1, that is not the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setDifference([1, 2, 3, 4], [3, 4, 5, 6])","setDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setSymDifference"]},setDistinct:{name:"setDistinct",category:"Set",syntax:["setDistinct(set)"],description:"Collect the distinct elements of a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setDistinct([1, 1, 1, 2, 2, 3])"],seealso:["setMultiplicity"]},setIntersect:{name:"setIntersect",category:"Set",syntax:["setIntersect(set1, set2)"],description:"Create the intersection of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIntersect([1, 2, 3, 4], [3, 4, 5, 6])","setIntersect([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setDifference"]},setIsSubset:{name:"setIsSubset",category:"Set",syntax:["setIsSubset(set1, set2)"],description:"Check whether a (multi)set is a subset of another (multi)set: every element of set1 is the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIsSubset([1, 2], [3, 4, 5, 6])","setIsSubset([3, 4], [3, 4, 5, 6])"],seealso:["setUnion","setIntersect","setDifference"]},setMultiplicity:{name:"setMultiplicity",category:"Set",syntax:["setMultiplicity(element, set)"],description:"Count the multiplicity of an element in a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setMultiplicity(1, [1, 2, 2, 4])","setMultiplicity(2, [1, 2, 2, 4])"],seealso:["setDistinct","setSize"]},setPowerset:{name:"setPowerset",category:"Set",syntax:["setPowerset(set)"],description:"Create the powerset of a (multi)set: the powerset contains very possible subsets of a (multi)set. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setPowerset([1, 2, 3])"],seealso:["setCartesian"]},setSize:{name:"setSize",category:"Set",syntax:["setSize(set)","setSize(set, unique)"],description:'Count the number of elements of a (multi)set. When the second parameter "unique" is true, count only the unique values. A multi-dimension array will be converted to a single-dimension array before the operation.',examples:["setSize([1, 2, 2, 4])","setSize([1, 2, 2, 4], true)"],seealso:["setUnion","setIntersect","setDifference"]},setSymDifference:{name:"setSymDifference",category:"Set",syntax:["setSymDifference(set1, set2)"],description:"Create the symmetric difference of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setSymDifference([1, 2, 3, 4], [3, 4, 5, 6])","setSymDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setDifference"]},setUnion:{name:"setUnion",category:"Set",syntax:["setUnion(set1, set2)"],description:"Create the union of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setUnion([1, 2, 3, 4], [3, 4, 5, 6])","setUnion([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setIntersect","setDifference"]},erf:{name:"erf",category:"Special",syntax:["erf(x)"],description:"Compute the erf function of a value using a rational Chebyshev approximations for different intervals of x",examples:["erf(0.2)","erf(-0.5)","erf(4)"],seealso:[]},mad:{name:"mad",category:"Statistics",syntax:["mad(a, b, c, ...)","mad(A)"],description:"Compute the median absolute deviation of a matrix or a list with values. The median absolute deviation is defined as the median of the absolute deviations from the median.",examples:["mad(10, 20, 30)","mad([1, 2, 3])"],seealso:["mean","median","std","abs"]},max:{name:"max",category:"Statistics",syntax:["max(a, b, c, ...)","max(A)","max(A, dim)"],description:"Compute the maximum value of a list of values.",examples:["max(2, 3, 4, 1)","max([2, 3, 4, 1])","max([2, 5; 4, 3])","max([2, 5; 4, 3], 1)","max([2, 5; 4, 3], 2)","max(2.7, 7.1, -4.5, 2.0, 4.1)","min(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["mean","median","min","prod","std","sum","variance"]},mean:{name:"mean",category:"Statistics",syntax:["mean(a, b, c, ...)","mean(A)","mean(A, dim)"],description:"Compute the arithmetic mean of a list of values.",examples:["mean(2, 3, 4, 1)","mean([2, 3, 4, 1])","mean([2, 5; 4, 3])","mean([2, 5; 4, 3], 1)","mean([2, 5; 4, 3], 2)","mean([1.0, 2.7, 3.2, 4.0])"],seealso:["max","median","min","prod","std","sum","variance"]},median:{name:"median",category:"Statistics",syntax:["median(a, b, c, ...)","median(A)"],description:"Compute the median of all values. The values are sorted and the middle value is returned. In case of an even number of values, the average of the two middle values is returned.",examples:["median(5, 2, 7)","median([3, -1, 5, 7])"],seealso:["max","mean","min","prod","std","sum","variance","quantileSeq"]},min:{name:"min",category:"Statistics",syntax:["min(a, b, c, ...)","min(A)","min(A, dim)"],description:"Compute the minimum value of a list of values.",examples:["min(2, 3, 4, 1)","min([2, 3, 4, 1])","min([2, 5; 4, 3])","min([2, 5; 4, 3], 1)","min([2, 5; 4, 3], 2)","min(2.7, 7.1, -4.5, 2.0, 4.1)","max(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["max","mean","median","prod","std","sum","variance"]},mode:{name:"mode",category:"Statistics",syntax:["mode(a, b, c, ...)","mode(A)","mode(A, a, b, B, c, ...)"],description:"Computes the mode of all values as an array. In case mode being more than one, multiple values are returned in an array.",examples:["mode(2, 1, 4, 3, 1)","mode([1, 2.7, 3.2, 4, 2.7])","mode(1, 4, 6, 1, 6)"],seealso:["max","mean","min","median","prod","std","sum","variance"]},prod:{name:"prod",category:"Statistics",syntax:["prod(a, b, c, ...)","prod(A)"],description:"Compute the product of all values.",examples:["prod(2, 3, 4)","prod([2, 3, 4])","prod([2, 5; 4, 3])"],seealso:["max","mean","min","median","min","std","sum","variance"]},quantileSeq:{name:"quantileSeq",category:"Statistics",syntax:["quantileSeq(A, prob[, sorted])","quantileSeq(A, [prob1, prob2, ...][, sorted])","quantileSeq(A, N[, sorted])"],description:"Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. Supported types of sequence values are: Number, BigNumber, Unit Supported types of probablity are: Number, BigNumber. \n\nIn case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated.",examples:["quantileSeq([3, -1, 5, 7], 0.5)","quantileSeq([3, -1, 5, 7], [1/3, 2/3])","quantileSeq([3, -1, 5, 7], 2)","quantileSeq([-1, 3, 5, 7], 0.5, true)"],seealso:["mean","median","min","max","prod","std","sum","variance"]},std:{name:"std",category:"Statistics",syntax:["std(a, b, c, ...)","std(A)","std(A, normalization)"],description:'Compute the standard deviation of all values, defined as std(A) = sqrt(variance(A)). Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["std(2, 4, 6)","std([2, 4, 6, 8])",'std([2, 4, 6, 8], "uncorrected")','std([2, 4, 6, 8], "biased")',"std([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","min","prod","sum","variance"]},sum:{name:"sum",category:"Statistics",syntax:["sum(a, b, c, ...)","sum(A)"],description:"Compute the sum of all values.",examples:["sum(2, 3, 4, 1)","sum([2, 3, 4, 1])","sum([2, 5; 4, 3])"],seealso:["max","mean","median","min","prod","std","sum","variance"]},variance:Il,var:Il,acos:{name:"acos",category:"Trigonometry",syntax:["acos(x)"],description:"Compute the inverse cosine of a value in radians.",examples:["acos(0.5)","acos(cos(2.3))"],seealso:["cos","atan","asin"]},acosh:{name:"acosh",category:"Trigonometry",syntax:["acosh(x)"],description:"Calculate the hyperbolic arccos of a value, defined as `acosh(x) = ln(sqrt(x^2 - 1) + x)`.",examples:["acosh(1.5)"],seealso:["cosh","asinh","atanh"]},acot:{name:"acot",category:"Trigonometry",syntax:["acot(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acot(0.5)","acot(cot(0.5))","acot(2)"],seealso:["cot","atan"]},acoth:{name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the hyperbolic arccotangent of a value, defined as `acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`.",examples:["acoth(2)","acoth(0.5)"],seealso:["acsch","asech"]},acsc:{name:"acsc",category:"Trigonometry",syntax:["acsc(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acsc(2)","acsc(csc(0.5))","acsc(0.5)"],seealso:["csc","asin","asec"]},acsch:{name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the hyperbolic arccosecant of a value, defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]},asec:{name:"asec",category:"Trigonometry",syntax:["asec(x)"],description:"Calculate the inverse secant of a value.",examples:["asec(0.5)","asec(sec(0.5))","asec(2)"],seealso:["acos","acot","acsc"]},asech:{name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]},asin:{name:"asin",category:"Trigonometry",syntax:["asin(x)"],description:"Compute the inverse sine of a value in radians.",examples:["asin(0.5)","asin(sin(0.5))"],seealso:["sin","acos","atan"]},asinh:{name:"asinh",category:"Trigonometry",syntax:["asinh(x)"],description:"Calculate the hyperbolic arcsine of a value, defined as `asinh(x) = ln(x + sqrt(x^2 + 1))`.",examples:["asinh(0.5)"],seealso:["acosh","atanh"]},atan:{name:"atan",category:"Trigonometry",syntax:["atan(x)"],description:"Compute the inverse tangent of a value in radians.",examples:["atan(0.5)","atan(tan(0.5))"],seealso:["tan","acos","asin"]},atanh:{name:"atanh",category:"Trigonometry",syntax:["atanh(x)"],description:"Calculate the hyperbolic arctangent of a value, defined as `atanh(x) = ln((1 + x)/(1 - x)) / 2`.",examples:["atanh(0.5)"],seealso:["acosh","asinh"]},atan2:{name:"atan2",category:"Trigonometry",syntax:["atan2(y, x)"],description:"Computes the principal value of the arc tangent of y/x in radians.",examples:["atan2(2, 2) / pi","angle = 60 deg in rad","x = cos(angle)","y = sin(angle)","atan2(y, x)"],seealso:["sin","cos","tan"]},cos:{name:"cos",category:"Trigonometry",syntax:["cos(x)"],description:"Compute the cosine of x in radians.",examples:["cos(2)","cos(pi / 4) ^ 2","cos(180 deg)","cos(60 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["acos","sin","tan"]},cosh:{name:"cosh",category:"Trigonometry",syntax:["cosh(x)"],description:"Compute the hyperbolic cosine of x in radians.",examples:["cosh(0.5)"],seealso:["sinh","tanh","coth"]},cot:{name:"cot",category:"Trigonometry",syntax:["cot(x)"],description:"Compute the cotangent of x in radians. Defined as 1/tan(x)",examples:["cot(2)","1 / tan(2)"],seealso:["sec","csc","tan"]},coth:{name:"coth",category:"Trigonometry",syntax:["coth(x)"],description:"Compute the hyperbolic cotangent of x in radians.",examples:["coth(2)","1 / tanh(2)"],seealso:["sech","csch","tanh"]},csc:{name:"csc",category:"Trigonometry",syntax:["csc(x)"],description:"Compute the cosecant of x in radians. Defined as 1/sin(x)",examples:["csc(2)","1 / sin(2)"],seealso:["sec","cot","sin"]},csch:{name:"csch",category:"Trigonometry",syntax:["csch(x)"],description:"Compute the hyperbolic cosecant of x in radians. Defined as 1/sinh(x)",examples:["csch(2)","1 / sinh(2)"],seealso:["sech","coth","sinh"]},sec:{name:"sec",category:"Trigonometry",syntax:["sec(x)"],description:"Compute the secant of x in radians. Defined as 1/cos(x)",examples:["sec(2)","1 / cos(2)"],seealso:["cot","csc","cos"]},sech:{name:"sech",category:"Trigonometry",syntax:["sech(x)"],description:"Compute the hyperbolic secant of x in radians. Defined as 1/cosh(x)",examples:["sech(2)","1 / cosh(2)"],seealso:["coth","csch","cosh"]},sin:{name:"sin",category:"Trigonometry",syntax:["sin(x)"],description:"Compute the sine of x in radians.",examples:["sin(2)","sin(pi / 4) ^ 2","sin(90 deg)","sin(30 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["asin","cos","tan"]},sinh:{name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]},tan:{name:"tan",category:"Trigonometry",syntax:["tan(x)"],description:"Compute the tangent of x in radians.",examples:["tan(0.5)","sin(0.5) / cos(0.5)","tan(pi / 4)","tan(45 deg)"],seealso:["atan","sin","cos"]},tanh:{name:"tanh",category:"Trigonometry",syntax:["tanh(x)"],description:"Compute the hyperbolic tangent of x in radians.",examples:["tanh(0.5)","sinh(0.5) / cosh(0.5)"],seealso:["sinh","cosh"]},to:{name:"to",category:"Units",syntax:["x to unit","to(x, unit)"],description:"Change the unit of a value.",examples:["5 inch to cm","3.2kg to g","16 bytes in bits"],seealso:[]},clone:{name:"clone",category:"Utils",syntax:["clone(x)"],description:"Clone a variable. Creates a copy of primitive variables,and a deep copy of matrices",examples:["clone(3.5)","clone(2 - 4i)","clone(45 deg)","clone([1, 2; 3, 4])",'clone("hello world")'],seealso:[]},format:{name:"format",category:"Utils",syntax:["format(value)","format(value, precision)"],description:"Format a value of any type as string.",examples:["format(2.3)","format(3 - 4i)","format([])","format(pi, 3)"],seealso:["print"]},isNaN:{name:"isNaN",category:"Utils",syntax:["isNaN(x)"],description:"Test whether a value is NaN (not a number)",examples:["isNaN(2)","isNaN(0 / 0)","isNaN(NaN)","isNaN(Infinity)"],seealso:["isNegative","isNumeric","isPositive","isZero"]},isInteger:{name:"isInteger",category:"Utils",syntax:["isInteger(x)"],description:"Test whether a value is an integer number.",examples:["isInteger(2)","isInteger(3.5)","isInteger([3, 0.5, -2])"],seealso:["isNegative","isNumeric","isPositive","isZero"]},isNegative:{name:"isNegative",category:"Utils",syntax:["isNegative(x)"],description:"Test whether a value is negative: smaller than zero.",examples:["isNegative(2)","isNegative(0)","isNegative(-4)","isNegative([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isPositive","isZero"]},isNumeric:{name:"isNumeric",category:"Utils",syntax:["isNumeric(x)"],description:"Test whether a value is a numeric value. Returns true when the input is a number, BigNumber, Fraction, or boolean.",examples:["isNumeric(2)",'isNumeric("2")','hasNumericValue("2")',"isNumeric(0)","isNumeric(bignumber(500))","isNumeric(fraction(0.125))","isNumeric(2 + 3i)",'isNumeric([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","hasNumericValue"]},hasNumericValue:{name:"hasNumericValue",category:"Utils",syntax:["hasNumericValue(x)"],description:"Test whether a value is an numeric value. In case of a string, true is returned if the string contains a numeric value.",examples:["hasNumericValue(2)",'hasNumericValue("2")','isNumeric("2")',"hasNumericValue(0)","hasNumericValue(bignumber(500))","hasNumericValue(fraction(0.125))","hasNumericValue(2 + 3i)",'hasNumericValue([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","isNumeric"]},isPositive:{name:"isPositive",category:"Utils",syntax:["isPositive(x)"],description:"Test whether a value is positive: larger than zero.",examples:["isPositive(2)","isPositive(0)","isPositive(-4)","isPositive([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isNegative","isZero"]},isPrime:{name:"isPrime",category:"Utils",syntax:["isPrime(x)"],description:"Test whether a value is prime: has no divisors other than itself and one.",examples:["isPrime(3)","isPrime(-2)","isPrime([2, 17, 100])"],seealso:["isInteger","isNumeric","isNegative","isZero"]},isZero:{name:"isZero",category:"Utils",syntax:["isZero(x)"],description:"Test whether a value is zero.",examples:["isZero(2)","isZero(0)","isZero(-4)","isZero([3, 0, -2, 0])"],seealso:["isInteger","isNumeric","isNegative","isPositive"]},typeOf:Al,typeof:Al,numeric:{name:"numeric",category:"Utils",syntax:["numeric(x)"],description:"Convert a numeric input to a specific numeric type: number, BigNumber, or Fraction.",examples:['numeric("4")','numeric("4", "number")','numeric("4", "BigNumber")','numeric("4", "Fraction)','numeric(4, "Fraction")','numeric(fraction(2, 5), "number)'],seealso:["number","fraction","bignumber","string","format"]}},ql=["typed","mathWithTransform","Help"],kl=Object(s.a)("help",ql,function(e){var t=e.typed,a=e.mathWithTransform,o=e.Help;return t("help",{any:function(e){var t,r=e;if("string"!=typeof e)for(t in a)if(Object(ae.f)(a,t)&&e===a[t]){r=t;break}var n=Fi(Bl,r);if(n)return new o(n);var i="function"==typeof r?r.name:r;throw new Error('No documentation found on "'+i+'"')}})}),zl=["typed","Chain"],Dl=Object(s.a)("chain",zl,function(e){var t=e.typed,r=e.Chain;return t("chain",{"":function(){return new r},any:function(e){return new r(e)}})}),Rl=["typed","matrix","subtract","multiply","unaryMinus","lup"],Pl=Object(s.a)("det",Rl,function(e){var t=e.typed,n=e.matrix,f=e.subtract,l=e.multiply,p=e.unaryMinus,m=e.lup;return t("det",{any:function(e){return Object(ae.a)(e)},"Array | Matrix":function(e){var t;switch((t=Object(ie.v)(e)?e.size():Array.isArray(e)?(e=n(e)).size():[]).length){case 0:return Object(ae.a)(e);case 1:if(1===t[0])return Object(ae.a)(e.valueOf()[0]);throw new RangeError("Matrix must be square (size: "+Object(J.d)(t)+")");case 2:var r=t[0];if(r===t[1])return function(e,t){{if(1===t)return Object(ae.a)(e[0][0]);if(2===t)return f(l(e[0][0],e[1][1]),l(e[1][0],e[0][1]));for(var r=m(e),n=r.U[0][0],i=1;i<t;i++)n=l(n,r.U[i][i]);for(var a=0,o=0,s=[];;){for(;s[o];)o++;if(t<=o)break;for(var u=o,c=0;!s[r.p[u]];)s[r.p[u]]=!0,u=r.p[u],c++;c%2==0&&a++}return a%2==0?n:p(n)}}(e.clone().valueOf(),r);throw new RangeError("Matrix must be square (size: "+Object(J.d)(t)+")");default:throw new RangeError("Matrix must be two dimensional (size: "+Object(J.d)(t)+")")}}})}),Fl=["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],Ul=Object(s.a)("inv",Fl,function(e){var t=e.typed,i=e.matrix,v=e.divideScalar,b=e.addScalar,x=e.multiply,w=e.unaryMinus,N=e.det,O=e.identity,M=e.abs;return t("inv",{"Array | Matrix":function(e){var t=Object(ie.v)(e)?e.size():Object(I.a)(e);switch(t.length){case 1:if(1===t[0])return Object(ie.v)(e)?i([v(1,e.valueOf()[0])]):[v(1,e[0])];throw new RangeError("Matrix must be square (size: "+Object(J.d)(t)+")");case 2:var r=t[0],n=t[1];if(r===n)return Object(ie.v)(e)?i(a(e.valueOf(),r,n),e.storage()):a(e,r,n);throw new RangeError("Matrix must be square (size: "+Object(J.d)(t)+")");default:throw new RangeError("Matrix must be two dimensional (size: "+Object(J.d)(t)+")")}},any:function(e){return v(1,e)}});function a(e,t,r){var n,i,a,o,s;if(1===t){if(0===(o=e[0][0]))throw Error("Cannot calculate inverse, determinant is zero");return[[v(1,o)]]}if(2===t){var u=N(e);if(0===u)throw Error("Cannot calculate inverse, determinant is zero");return[[v(e[1][1],u),v(w(e[0][1]),u)],[v(w(e[1][0]),u),v(e[0][0],u)]]}var c=e.concat();for(n=0;n<t;n++)c[n]=c[n].concat();for(var f=O(t).valueOf(),l=0;l<r;l++){var p=M(c[l][l]),m=l;for(n=l+1;n<t;)M(c[n][l])>p&&(p=M(c[n][l]),m=n),n++;if(0===p)throw Error("Cannot calculate inverse, determinant is zero");(n=m)!==l&&(s=c[l],c[l]=c[n],c[n]=s,s=f[l],f[l]=f[n],f[n]=s);var h=c[l],d=f[l];for(n=0;n<t;n++){var y=c[n],g=f[n];if(n!==l){if(0!==y[l]){for(a=v(w(y[l]),h[l]),i=l;i<r;i++)y[i]=b(y[i],x(a,h[i]));for(i=0;i<r;i++)g[i]=b(g[i],x(a,d[i]))}}else{for(a=h[l],i=l;i<r;i++)y[i]=v(y[i],a);for(i=0;i<r;i++)g[i]=v(g[i],a)}}}return f}}),Ll=["typed","abs","add","identity","inv","multiply"],Hl=Object(s.a)("expm",Ll,function(e){var t=e.typed,d=e.abs,y=e.add,g=e.identity,v=e.inv,b=e.multiply;return t("expm",{Matrix:function(e){var t=e.size();if(2!==t.length||t[0]!==t[1])throw new RangeError("Matrix must be square (size: "+Object(J.d)(t)+")");for(var r=t[0],n=function(e,t){for(var r=0;r<30;r++)for(var n=0;n<=r;n++){var i=r-n;if(x(e,n,i)<t)return{q:n,j:i}}throw new Error("Could not find acceptable parameters to compute the matrix exponential (try increasing maxSearchSize in expm.js)")}(function(e){for(var t=e.size()[0],r=0,n=0;n<t;n++){for(var i=0,a=0;a<t;a++)i+=d(e.get([n,a]));r=Math.max(i,r)}return r}(e),1e-15),i=n.q,a=n.j,o=b(e,Math.pow(2,-a)),s=g(r),u=g(r),c=1,f=o,l=-1,p=1;p<=i;p++)1<p&&(f=b(f,o),l=-l),s=y(s,b(c=c*(i-p+1)/((2*i-p+1)*p),f)),u=y(u,b(c*l,f));for(var m=b(v(u),s),h=0;h<a;h++)m=b(m,m);return Object(ie.H)(e)?e.createSparseMatrix(m):m}});function x(e,t,r){for(var n=1,i=2;i<=t;i++)n*=i;for(var a=n,o=t+1;o<=2*t;o++)a*=o;var s=a*(2*t+1);return 8*Math.pow(e/Math.pow(2,r),2*t)*n*n/(a*s)}}),$l=["typed","abs","add","multiply","sqrt","subtract","inv","size","max","identity"],Gl=Object(s.a)("sqrtm",$l,function(e){var t=e.typed,o=e.abs,s=e.add,u=e.multiply,r=e.sqrt,c=e.subtract,f=e.inv,l=e.size,p=e.max,m=e.identity,n=t("sqrtm",{"Array | Matrix":function(e){var t=Object(ie.v)(e)?e.size():Object(I.a)(e);switch(t.length){case 1:if(1===t[0])return r(e);throw new RangeError("Matrix must be square (size: "+Object(J.d)(t)+")");case 2:if(t[0]===t[1])return function(e){var t,r=0,n=e,i=m(l(e));do{var a=n;if(n=u(.5,s(a,f(i))),i=u(.5,s(i,f(a))),t=p(o(c(n,a))),d<t&&++r>h)throw new Error("computing square root of matrix: iterative method could not converge")}while(d<t);return n}(e);throw new RangeError("Matrix must be square (size: "+Object(J.d)(t)+")")}}}),h=1e3,d=1e-6;return n}),Zl=["typed","matrix","multiply","equalScalar","divideScalar","inv"],Vl=Object(s.a)("divide",Zl,function(e){var t=e.typed,r=e.matrix,n=e.multiply,i=e.equalScalar,a=e.divideScalar,o=e.inv,s=sr({typed:t,equalScalar:i}),u=Kt({typed:t});return t("divide",Object(ae.e)({"Array | Matrix, Array | Matrix":function(e,t){return n(e,o(t))},"DenseMatrix, any":function(e,t){return u(e,t,a,!1)},"SparseMatrix, any":function(e,t){return s(e,t,a,!1)},"Array, any":function(e,t){return u(r(e),t,a,!1).valueOf()},"any, Array | Matrix":function(e,t){return n(e,o(t))}},a.signatures))}),Jl="distance",Wl=["typed","addScalar","subtract","divideScalar","multiplyScalar","unaryMinus","sqrt","abs"],Yl=Object(s.a)(Jl,Wl,function(e){var t=e.typed,l=e.addScalar,p=e.subtract,m=e.multiplyScalar,h=e.divideScalar,s=e.unaryMinus,d=e.sqrt,u=e.abs;return t(Jl,{"Array, Array, Array":function(e,t,r){if(2!==e.length||2!==t.length||2!==r.length)throw new TypeError("Invalid Arguments: Try again");if(!c(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!c(t))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!c(r))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");var n=h(p(r[1],r[0]),p(t[1],t[0])),i=m(m(n,n),t[0]),a=s(m(n,t[0])),o=e[1];return f(e[0],e[1],i,a,o)},"Object, Object, Object":function(e,t,r){if(2!==Object.keys(e).length||2!==Object.keys(t).length||2!==Object.keys(r).length)throw new TypeError("Invalid Arguments: Try again");if(!c(e))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!c(t))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!c(r))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if("pointX"in e&&"pointY"in e&&"lineOnePtX"in t&&"lineOnePtY"in t&&"lineTwoPtX"in r&&"lineTwoPtY"in r){var n=h(p(r.lineTwoPtY,r.lineTwoPtX),p(t.lineOnePtY,t.lineOnePtX)),i=m(m(n,n),t.lineOnePtX),a=s(m(n,t.lineOnePtX)),o=e.pointX;return f(e.pointX,e.pointY,i,a,o)}throw new TypeError("Key names do not match")},"Array, Array":function(e,t){if(2===e.length&&3===t.length){if(!c(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!n(t))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return f(e[0],e[1],t[0],t[1],t[2])}if(3===e.length&&6===t.length){if(!n(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!i(t))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return o(e[0],e[1],e[2],t[0],t[1],t[2],t[3],t[4],t[5])}if(2===e.length&&2===t.length){if(!c(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!c(t))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");return y(e[0],e[1],t[0],t[1])}if(3!==e.length||3!==t.length)throw new TypeError("Invalid Arguments: Try again");if(!n(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!n(t))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return g(e[0],e[1],e[2],t[0],t[1],t[2])},"Object, Object":function(e,t){if(2===Object.keys(e).length&&3===Object.keys(t).length){if(!c(e))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!n(t))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in e&&"pointY"in e&&"xCoeffLine"in t&&"yCoeffLine"in t&&"constant"in t)return f(e.pointX,e.pointY,t.xCoeffLine,t.yCoeffLine,t.constant);throw new TypeError("Key names do not match")}if(3===Object.keys(e).length&&6===Object.keys(t).length){if(!n(e))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!i(t))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in e&&"pointY"in e&&"x0"in t&&"y0"in t&&"z0"in t&&"a"in t&&"b"in t&&"c"in t)return o(e.pointX,e.pointY,e.pointZ,t.x0,t.y0,t.z0,t.a,t.b,t.c);throw new TypeError("Key names do not match")}if(2===Object.keys(e).length&&2===Object.keys(t).length){if(!c(e))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!c(t))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in e&&"pointOneY"in e&&"pointTwoX"in t&&"pointTwoY"in t)return y(e.pointOneX,e.pointOneY,t.pointTwoX,t.pointTwoY);throw new TypeError("Key names do not match")}if(3!==Object.keys(e).length||3!==Object.keys(t).length)throw new TypeError("Invalid Arguments: Try again");if(!n(e))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!n(t))throw new TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers");if("pointOneX"in e&&"pointOneY"in e&&"pointOneZ"in e&&"pointTwoX"in t&&"pointTwoY"in t&&"pointTwoZ"in t)return g(e.pointOneX,e.pointOneY,e.pointOneZ,t.pointTwoX,t.pointTwoY,t.pointTwoZ);throw new TypeError("Key names do not match")},Array:function(e){if(!function(e){if(2===e[0].length&&r(e[0][0])&&r(e[0][1])){if(e.some(function(e){return 2!==e.length||!r(e[0])||!r(e[1])}))return!1}else{if(!(3===e[0].length&&r(e[0][0])&&r(e[0][1])&&r(e[0][2])))return!1;if(e.some(function(e){return 3!==e.length||!r(e[0])||!r(e[1])||!r(e[2])}))return!1}return!0}(e))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return function(e){for(var t=[],r=0;r<e.length-1;r++)for(var n=r+1;n<e.length;n++)2===e[0].length?t.push(y(e[r][0],e[r][1],e[n][0],e[n][1])):3===e[0].length&&t.push(g(e[r][0],e[r][1],e[r][2],e[n][0],e[n][1],e[n][2]));return t}(e)}});function r(e){return"number"==typeof e||Object(ie.e)(e)}function c(e){return e.constructor!==Array&&(e=a(e)),r(e[0])&&r(e[1])}function n(e){return e.constructor!==Array&&(e=a(e)),r(e[0])&&r(e[1])&&r(e[2])}function i(e){return e.constructor!==Array&&(e=a(e)),r(e[0])&&r(e[1])&&r(e[2])&&r(e[3])&&r(e[4])&&r(e[5])}function a(e){for(var t=Object.keys(e),r=[],n=0;n<t.length;n++)r.push(e[t[n]]);return r}function f(e,t,r,n,i){var a=u(l(l(m(r,e),m(n,t)),i)),o=d(l(m(r,r),m(n,n)));return h(a,o)}function o(e,t,r,n,i,a,o,s,u){var c=[p(m(p(i,t),u),m(p(a,r),s)),p(m(p(a,r),o),m(p(n,e),u)),p(m(p(n,e),s),m(p(i,t),o))];c=d(l(l(m(c[0],c[0]),m(c[1],c[1])),m(c[2],c[2])));var f=d(l(l(m(o,o),m(s,s)),m(u,u)));return h(c,f)}function y(e,t,r,n){var i=p(n,t),a=p(r,e),o=l(m(i,i),m(a,a));return d(o)}function g(e,t,r,n,i,a){var o=p(a,r),s=p(i,t),u=p(n,e),c=l(l(m(o,o),m(s,s)),m(u,u));return d(c)}}),Xl=["typed","config","abs","add","addScalar","matrix","multiply","multiplyScalar","divideScalar","subtract","smaller","equalScalar"],Ql=Object(s.a)("intersect",Xl,function(e){var t=e.typed,h=e.config,d=e.abs,y=e.add,E=e.addScalar,i=e.matrix,g=e.multiply,j=e.multiplyScalar,S=e.divideScalar,A=e.subtract,v=e.smaller,C=e.equalScalar,a=t("intersect",{"Array, Array, Array":function(e,t,r){if(!s(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!s(t))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!function(e){return 4===e.length&&n(e[0])&&n(e[1])&&n(e[2])&&n(e[3])}(r))throw new TypeError("Array with 4 numbers expected as third argument");return function(e,t,r,n,i,a,o,s,u,c){var f=j(e,o),l=j(n,o),p=j(t,s),m=j(i,s),h=j(r,u),d=j(a,u),y=S(A(A(A(c,f),p),h),A(A(A(E(E(l,m),d),f),p),h)),g=E(e,j(y,A(n,e))),v=E(t,j(y,A(i,t))),b=E(r,j(y,A(a,r)));return[g,v,b]}(e[0],e[1],e[2],t[0],t[1],t[2],r[0],r[1],r[2],r[3])},"Array, Array, Array, Array":function(e,t,r,n){if(2===e.length){if(!o(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!o(t))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!o(r))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!o(n))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return function(e,t,r,n){var i=e,a=r,o=A(i,t),s=A(a,n),u=A(j(o[0],s[1]),j(s[0],o[1]));if(v(d(u),h.epsilon))return null;var c=j(s[0],i[1]),f=j(s[1],i[0]),l=j(s[0],a[1]),p=j(s[1],a[0]),m=S(E(A(A(c,f),l),p),u);return y(g(o,m),i)}(e,t,r,n)}if(3!==e.length)throw new TypeError("Arrays with two or thee dimensional points expected");if(!s(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!s(t))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!s(r))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!s(n))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return function(e,t,r,n,i,a,o,s,u,c,f,l){var p=T(e,o,c,o,t,s,f,s,r,u,l,u),m=T(c,o,n,e,f,s,i,t,l,u,a,r),h=T(e,o,n,e,t,s,i,t,r,u,a,r),d=T(c,o,c,o,f,s,f,s,l,u,l,u),y=T(n,e,n,e,i,t,i,t,a,r,a,r),g=S(A(j(p,m),j(h,d)),A(j(y,d),j(m,m))),v=S(E(p,j(g,m)),d),b=E(e,j(g,A(n,e))),x=E(t,j(g,A(i,t))),w=E(r,j(g,A(a,r))),N=E(o,j(v,A(c,o))),O=E(s,j(v,A(f,s))),M=E(u,j(v,A(l,u)));return C(b,N)&&C(x,O)&&C(w,M)?[b,x,w]:null}(e[0],e[1],e[2],t[0],t[1],t[2],r[0],r[1],r[2],n[0],n[1],n[2])},"Matrix, Matrix, Matrix":function(e,t,r){return i(a(e.valueOf(),t.valueOf(),r.valueOf()))},"Matrix, Matrix, Matrix, Matrix":function(e,t,r,n){return i(a(e.valueOf(),t.valueOf(),r.valueOf(),n.valueOf()))}});function n(e){return"number"==typeof e||Object(ie.e)(e)}function o(e){return 2===e.length&&n(e[0])&&n(e[1])}function s(e){return 3===e.length&&n(e[0])&&n(e[1])&&n(e[2])}function T(e,t,r,n,i,a,o,s,u,c,f,l){var p=j(A(e,t),A(r,n)),m=j(A(i,a),A(o,s)),h=j(A(u,c),A(f,l));return E(E(p,m),h)}return a}),Kl=["typed","config","add","?bignumber","?fraction"],ep=Object(s.a)("sum",Kl,function(e){var t=e.typed,n=e.config,i=e.add,a=e.bignumber,o=e.fraction;return t("sum",{"Array | Matrix":r,"Array | Matrix, number | BigNumber":function(e,t){try{return U(e,t,i)}catch(e){throw da(e,"sum")}},"...":function(e){if(P(e))throw new TypeError("Scalar values expected in function sum");return r(e)}});function r(e){var r;if(F(e,function(t){try{r=void 0===r?t:i(r,t)}catch(e){throw da(e,"sum",t)}}),void 0===r)switch(n.number){case"number":return 0;case"BigNumber":return a?a(0):wi();case"Fraction":return o?o(0):Ni();default:return 0}return r}}),tp=["typed","add","divide"],rp=Object(s.a)("mean",tp,function(e){var t=e.typed,i=e.add,a=e.divide;return t("mean",{"Array | Matrix":r,"Array | Matrix, number | BigNumber":function(e,t){try{var r=U(e,t,i),n=Array.isArray(e)?Object(I.a)(e):e.size();return a(r,n[t])}catch(e){throw da(e,"mean")}},"...":function(e){if(P(e))throw new TypeError("Scalar values expected in function mean");return r(e)}});function r(e){var r=0,n=0;if(F(e,function(t){try{r=i(r,t),n++}catch(e){throw da(e,"mean",t)}}),0===n)throw new Error("Cannot calculate mean of an empty array");return a(r,n)}}),np=["typed","add","divide","compare","partitionSelect"],ip=Object(s.a)("median",np,function(e){var t=e.typed,r=e.add,n=e.divide,s=e.compare,u=e.partitionSelect,i=t("median",{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(e,t){throw new Error("median(A, dim) is not yet supported")},"...":function(e){if(P(e))throw new TypeError("Scalar values expected in function median");return a(e)}});function a(e){try{var t=(e=Object(I.e)(e.valueOf())).length;if(0===t)throw new Error("Cannot calculate median of an empty array");if(t%2==0){for(var r=t/2-1,n=u(e,1+r),i=e[r],a=0;a<r;++a)0<s(e[a],i)&&(i=e[a]);return f(i,n)}var o=u(e,(t-1)/2);return c(o)}catch(e){throw da(e,"median")}}var c=t({"number | BigNumber | Complex | Unit":function(e){return e}}),f=t({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(e,t){return n(r(e,t),2)}});return i}),ap=["typed","abs","map","median","subtract"],op=Object(s.a)("mad",ap,function(e){var t=e.typed,r=e.abs,n=e.map,i=e.median,a=e.subtract;return t("mad",{"Array | Matrix":o,"...":function(e){return o(e)}});function o(e){if(0===(e=Object(I.e)(e.valueOf())).length)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var t=i(e);return i(n(e,function(e){return r(a(e,t))}))}catch(e){throw e instanceof TypeError&&-1!==e.message.indexOf("median")?new TypeError(e.message.replace("median","mad")):da(e,"mad")}}}),sp="unbiased",up="variance",cp=["typed","add","subtract","multiply","divide","apply","isNaN"],fp=Object(s.a)(up,cp,function(e){var t=e.typed,o=e.add,s=e.subtract,u=e.multiply,c=e.divide,n=e.apply,f=e.isNaN;return t(up,{"Array | Matrix":function(e){return i(e,sp)},"Array | Matrix, string":i,"Array | Matrix, number | BigNumber":function(e,t){return r(e,t,sp)},"Array | Matrix, number | BigNumber, string":r,"...":function(e){return i(e,sp)}});function i(e,t){var r=0,n=0;if(0===e.length)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(F(e,function(t){try{r=o(r,t),n++}catch(e){throw da(e,"variance",t)}}),0===n)throw new Error("Cannot calculate variance of an empty array");var i=c(r,n);if(r=0,F(e,function(e){var t=s(e,i);r=o(r,u(t,t))}),f(r))return r;switch(t){case"uncorrected":return c(r,n);case"biased":return c(r,n+1);case"unbiased":var a=Object(ie.e)(r)?r.mul(0):0;return 1===n?a:c(r,n-1);default:throw new Error('Unknown normalization "'+t+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function r(e,t,r){try{if(0===e.length)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return n(e,t,function(e){return i(e,r)})}catch(e){throw da(e,"variance")}}}),lp=Object(s.a)("var",["variance"],function(e){var n=e.variance;return function(){Object(ve.a)('Function "var" has been renamed to "variance" in v6.0.0, please use the new function instead.');for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.apply(n,t)}}),pp=["typed","add","multiply","partitionSelect","compare"],mp=Object(s.a)("quantileSeq",pp,function(e){var t=e.typed,w=e.add,N=e.multiply,O=e.partitionSelect,M=e.compare;function h(e,t,r){var n=Object(I.e)(e),i=n.length;if(0===i)throw new Error("Cannot calculate quantile of an empty sequence");if(Object(ie.y)(t)){var a=t*(i-1),o=a%1;if(0==o){var s=r?n[a]:O(n,a);return E(s),s}var u,c,f=Math.floor(a);if(r)u=n[f],c=n[f+1];else{c=O(n,f+1),u=n[f];for(var l=0;l<f;++l)0<M(n[l],u)&&(u=n[l])}return E(u),E(c),w(N(u,1-o),N(c,o))}var p=t.times(i-1);if(p.isInteger()){p=p.toNumber();var m=r?n[p]:O(n,p);return E(m),m}var h,d,y=p.floor(),g=p.minus(y),v=y.toNumber();if(r)h=n[v],d=n[v+1];else{d=O(n,v+1),h=n[v];for(var b=0;b<v;++b)0<M(n[b],h)&&(h=n[b])}E(h),E(d);var x=new g.constructor(1);return w(N(h,x.minus(g)),N(d,g))}var E=t({"number | BigNumber | Unit":function(e){return e}});return function(e,t,r){var n,i,a;if(arguments.length<2||3<arguments.length)throw new SyntaxError("Function quantileSeq requires two or three parameters");if(Object(ie.i)(e)){if("boolean"!=typeof(r=r||!1))throw new TypeError("Unexpected type of argument in function quantileSeq");if(i=e.valueOf(),Object(ie.y)(t)){if(t<0)throw new Error("N/prob must be non-negative");if(t<=1)return h(i,t,r);if(1<t){if(!Object(j.i)(t))throw new Error("N must be a positive integer");var o=t+1;n=new Array(t);for(var s=0;s<t;)n[s]=h(i,++s/o,r);return n}}if(Object(ie.e)(t)){var u=t.constructor;if(t.isNegative())throw new Error("N/prob must be non-negative");if(a=new u(1),t.lte(a))return new u(h(i,t,r));if(t.gt(a)){if(!t.isInteger())throw new Error("N must be a positive integer");var c=t.toNumber();if(4294967295<c)throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");var f=new u(c+1);n=new Array(c);for(var l=0;l<c;)n[l]=new u(h(i,new u(++l).div(f),r));return n}}if(Array.isArray(t)){n=new Array(t.length);for(var p=0;p<n.length;++p){var m=t[p];if(Object(ie.y)(m)){if(m<0||1<m)throw new Error("Probability must be between 0 and 1, inclusive")}else{if(!Object(ie.e)(m))throw new TypeError("Unexpected type of argument in function quantileSeq");if(a=new m.constructor(1),m.isNegative()||m.gt(a))throw new Error("Probability must be between 0 and 1, inclusive")}n[p]=h(i,m,r)}return n}throw new TypeError("Unexpected type of argument in function quantileSeq")}throw new TypeError("Unexpected type of argument in function quantileSeq")}}),hp=["typed","sqrt","variance"],dp=Object(s.a)("std",hp,function(e){var t=e.typed,r=e.sqrt,n=e.variance;return t("std",{"Array | Matrix":i,"Array | Matrix, string":i,"Array | Matrix, number | BigNumber":i,"Array | Matrix, number | BigNumber, string":i,"...":function(e){return i(e)}});function i(e,t){if(0===e.length)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{return r(n.apply(null,arguments))}catch(e){throw e instanceof TypeError&&-1!==e.message.indexOf(" variance")?new TypeError(e.message.replace(" variance"," std")):e}}});function yp(e,t){if(t<e)return 1;if(t===e)return t;var r=t+e>>1;return yp(e,r)*yp(1+r,t)}function gp(e,t){if(!Object(j.i)(e)||e<0)throw new TypeError("Positive integer value expected in function combinations");if(!Object(j.i)(t)||t<0)throw new TypeError("Positive integer value expected in function combinations");if(e<t)throw new TypeError("k must be less than or equal to n");var r=e-t;return t<r?yp(1+r,e)/yp(1,t):yp(t+1,e)/yp(1,r)}gp.signature="number, number";var vp="combinations",bp=["typed"],xp=Object(s.a)(vp,bp,function(e){return(0,e.typed)(vp,{"number, number":gp,"BigNumber, BigNumber":function(e,t){var r,n,i,a,o=new e.constructor(1);if(!wp(e)||!wp(t))throw new TypeError("Positive integer value expected in function combinations");if(t.gt(e))throw new TypeError("k must be less than n in function combinations");for(r=e.minus(t),t.lt(r)&&(r=t),i=n=o,a=e.minus(r);i.lte(a);i=i.plus(1))n=n.times(r.plus(i)).dividedBy(i);return n}})});function wp(e){return e.isInteger()&&e.gte(0)}var Np="combinationsWithRep",Op=["typed"],Mp=Object(s.a)(Np,Op,function(e){return(0,e.typed)(Np,{"number, number":function(e,t){if(!Object(j.i)(e)||e<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!Object(j.i)(t)||t<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(e<1)throw new TypeError("k must be less than or equal to n + k - 1");return yp(e,e+t-1)/yp(1,t)},"BigNumber, BigNumber":function(e,t){var r,n,i=new e.constructor(1);if(!Ep(e)||!Ep(t))throw new TypeError("Positive integer value expected in function combinationsWithRep");if(e.lt(i))throw new TypeError("k must be less than or equal to n + k - 1 in function combinationsWithRep");var a=e.minus(i);for(n=r=i;n.lte(t);n=n.plus(1))r=r.times(a.plus(n)).dividedBy(n);return r}})});function Ep(e){return e.isInteger()&&e.gte(0)}function jp(e){var t;if(Object(j.i)(e))return e<=0?isFinite(e)?1/0:NaN:171<e?1/0:yp(1,e-1);if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*jp(1-e));if(171.35<=e)return 1/0;if(85<e){var r=e*e,n=r*e,i=n*e,a=i*e;return Math.sqrt(2*Math.PI/e)*Math.pow(e/Math.E,e)*(1+1/(12*e)+1/(288*r)-139/(51840*n)-571/(2488320*i)+163879/(209018880*a)+5246819/(75246796800*a*e))}--e,t=Ap[0];for(var o=1;o<Ap.length;++o)t+=Ap[o]/(e+o);var s=e+Sp+.5;return Math.sqrt(2*Math.PI)*Math.pow(s,e+.5)*Math.exp(-s)*t}jp.signature="number";var Sp=4.7421875,Ap=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],Cp=["typed","config","multiplyScalar","pow","BigNumber","Complex"],Tp=Object(s.a)("gamma",Cp,function(e){var t=e.typed,i=e.config,c=e.multiplyScalar,f=e.pow,a=e.BigNumber,l=e.Complex,p=t("gamma",{number:jp,Complex:function(e){if(0===e.im)return p(e.re);e=new l(e.re-1,e.im);for(var t=new l(Ap[0],0),r=1;r<Ap.length;++r){var n=e.re+r,i=n*n+e.im*e.im;0!=i?(t.re+=Ap[r]*n/i,t.im+=-Ap[r]*e.im/i):t.re=Ap[r]<0?-1/0:1/0}var a=new l(e.re+Sp+.5,e.im),o=Math.sqrt(2*Math.PI);e.re+=.5;var s=f(a,e);0===s.im?s.re*=o:(0===s.re||(s.re*=o),s.im*=o);var u=Math.exp(-a.re);return a.re=u*Math.cos(-a.im),a.im=u*Math.sin(-a.im),c(c(s,a),t)},BigNumber:function(e){if(e.isInteger())return e.isNegative()||e.isZero()?new a(1/0):function(e){if(e.isZero())return new a(1);var t=i.precision+(0|Math.log(e.toNumber())),r=new(a.clone({precision:t}))(e),n=e.toNumber()-1;for(;1<n;)r=r.times(n),n--;return new a(r.toPrecision(a.precision))}(e.minus(1));if(!e.isFinite())return new a(e.isNegative()?NaN:1/0);throw new Error("Integer BigNumber expected")},"Array | Matrix":function(e){return oe(e,p)}});return p}),_p="factorial",Ip=["typed","gamma"],Bp=Object(s.a)(_p,Ip,function(e){var t=e.typed,r=e.gamma,n=t(_p,{number:function(e){if(e<0)throw new Error("Value must be non-negative");return r(e+1)},BigNumber:function(e){if(e.isNegative())throw new Error("Value must be non-negative");return r(e.plus(1))},"Array | Matrix":function(e){return oe(e,n)}});return n}),qp="kldivergence",kp=["typed","matrix","divide","sum","multiply","dotDivide","log","isNumeric"],zp=Object(s.a)(qp,kp,function(e){var t=e.typed,r=e.matrix,s=e.divide,u=e.sum,c=e.multiply,f=e.dotDivide,l=e.log,p=e.isNumeric;return t(qp,{"Array, Array":function(e,t){return n(r(e),r(t))},"Matrix, Array":function(e,t){return n(e,r(t))},"Array, Matrix":function(e,t){return n(r(e),t)},"Matrix, Matrix":function(e,t){return n(e,t)}});function n(e,t){var r=t.size().length,n=e.size().length;if(1<r)throw new Error("first object must be one dimensional");if(1<n)throw new Error("second object must be one dimensional");if(r!==n)throw new Error("Length of two vectors must be equal");if(0===u(e))throw new Error("Sum of elements in first object must be non zero");if(0===u(t))throw new Error("Sum of elements in second object must be non zero");var i=s(e,u(e)),a=s(t,u(t)),o=u(c(i,l(f(i,a))));return p(o)?o:Number.NaN}}),Dp="multinomial",Rp=["typed","add","divide","multiply","factorial","isInteger","isPositive"],Pp=Object(s.a)(Dp,Rp,function(e){var t=e.typed,n=e.add,i=e.divide,a=e.multiply,o=e.factorial,s=e.isInteger,u=e.isPositive;return t(Dp,{"Array | Matrix":function(e){var t=0,r=1;return F(e,function(e){if(!s(e)||!u(e))throw new TypeError("Positive integer value expected in function multinomial");t=n(t,e),r=a(r,o(e))}),i(o(t),r)}})}),Fp="permutations",Up=["typed","factorial"],Lp=Object(s.a)(Fp,Up,function(e){var t=e.typed,r=e.factorial;return t(Fp,{"number | BigNumber":r,"number, number":function(e,t){if(!Object(j.i)(e)||e<0)throw new TypeError("Positive integer value expected in function permutations");if(!Object(j.i)(t)||t<0)throw new TypeError("Positive integer value expected in function permutations");if(e<t)throw new TypeError("second argument k must be less than or equal to first argument n");return yp(e-t+1,e)},"BigNumber, BigNumber":function(e,t){var r,n;if(!Hp(e)||!Hp(t))throw new TypeError("Positive integer value expected in function permutations");if(t.gt(e))throw new TypeError("second argument k must be less than or equal to first argument n");for(r=e.mul(0).add(1),n=e.minus(t).plus(1);n.lte(e);n=n.plus(1))r=r.times(n);return r}})});function Hp(e){return e.isInteger()&&e.gte(0)}var $p=r(15),Gp=r.n($p),Zp=Gp()();function Vp(e){var t,r;return t=null===(r=e)?Zp:Gp()(String(r)),function(){return t()}}var Jp=["typed","config","?on"],Wp=Object(s.a)("pickRandom",Jp,function(e){var t=e.typed,r=e.config,n=e.on,m=Vp(r.randomSeed);return n&&n("config",function(e,t){e.randomSeed!==t.randomSeed&&(m=Vp(e.randomSeed))}),t({"Array | Matrix":function(e){return i(e)},"Array | Matrix, number":function(e,t){return i(e,t,void 0)},"Array | Matrix, Array":function(e,t){return i(e,void 0,t)},"Array | Matrix, Array | Matrix, number":function(e,t,r){return i(e,r,t)},"Array | Matrix, number, Array | Matrix":function(e,t,r){return i(e,t,r)}});function i(e,t,r){var n=void 0===t;if(n&&(t=1),e=e.valueOf(),r=r&&r.valueOf(),1<Object(I.a)(e).length)throw new Error("Only one dimensional vectors supported");var i=0;if(void 0!==r){if(r.length!==e.length)throw new Error("Weights must have the same length as possibles");for(var a=0,o=r.length;a<o;a++){if(!Object(ie.y)(r[a])||r[a]<0)throw new Error("Weights must be an array of positive numbers");i+=r[a]}}var s=e.length;if(0===s)return[];if(s<=t)return 1<t?e:e[0];for(var u,c=[];c.length<t;){if(void 0===r)u=e[Math.floor(m()*s)];else for(var f=m()*i,l=0,p=e.length;l<p;l++)if((f-=r[l])<0){u=e[l];break}-1===c.indexOf(u)&&c.push(u)}return n?c[0]:c}});function Yp(e,t){var r=[];if(1<(e=e.slice(0)).length)for(var n=0,i=e.shift();n<i;n++)r.push(Yp(e,t));else for(var a=0,o=e.shift();a<o;a++)r.push(t());return r}var Xp="random",Qp=["typed","config","?on"],Kp=Object(s.a)(Xp,Qp,function(e){var t=e.typed,r=e.config,n=e.on,i=Vp(r.randomSeed);return n&&n("config",function(e,t){e.randomSeed!==t.randomSeed&&(i=Vp(e.randomSeed))}),t(Xp,{"":function(){return o(0,1)},number:function(e){return o(0,e)},"number, number":function(e,t){return o(e,t)},"Array | Matrix":function(e){return a(e,0,1)},"Array | Matrix, number":function(e,t){return a(e,0,t)},"Array | Matrix, number, number":function(e,t,r){return a(e,t,r)}});function a(e,t,r){var n=Yp(e.valueOf(),function(){return o(t,r)});return Object(ie.v)(e)?e.create(n):n}function o(e,t){return e+i()*(t-e)}}),em="randomInt",tm=["typed","config","?on"],rm=Object(s.a)(em,tm,function(e){var t=e.typed,r=e.config,n=e.on,i=Vp(r.randomSeed);return n&&n("config",function(e,t){e.randomSeed!==t.randomSeed&&(i=Vp(e.randomSeed))}),t(em,{"":function(){return o(0,1)},number:function(e){return o(0,e)},"number, number":function(e,t){return o(e,t)},"Array | Matrix":function(e){return a(e,0,1)},"Array | Matrix, number":function(e,t){return a(e,0,t)},"Array | Matrix, number, number":function(e,t,r){return a(e,t,r)}});function a(e,t,r){var n=Yp(e.valueOf(),function(){return o(t,r)});return Object(ie.v)(e)?e.create(n):n}function o(e,t){return Math.floor(e+i()*(t-e))}}),nm="stirlingS2",im=["typed","addScalar","subtract","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","larger"],am=Object(s.a)(nm,im,function(e){var t=e.typed,u=e.addScalar,c=e.subtract,f=e.multiplyScalar,l=e.divideScalar,p=e.pow,m=e.factorial,h=e.combinations,d=e.isNegative,y=e.isInteger,g=e.larger;return t(nm,{"number | BigNumber, number | BigNumber":function(e,t){if(!y(e)||d(e)||!y(t)||d(t))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(g(t,e))throw new TypeError("k must be less than or equal to n in function stirlingS2");for(var r=m(t),n=0,i=0;i<=t;i++){var a=p(-1,c(t,i)),o=h(t,i),s=p(i,e);n=u(n,f(f(o,s),a))}return l(n,r)}})}),om="bellNumbers",sm=["typed","addScalar","isNegative","isInteger","stirlingS2"],um=Object(s.a)(om,sm,function(e){var t=e.typed,n=e.addScalar,i=e.isNegative,a=e.isInteger,o=e.stirlingS2;return t(om,{"number | BigNumber":function(e){if(!a(e)||i(e))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var t=0,r=0;r<=e;r++)t=n(t,o(e,r));return t}})}),cm="catalan",fm=["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],lm=Object(s.a)(cm,fm,function(e){var t=e.typed,r=e.addScalar,n=e.divideScalar,i=e.multiplyScalar,a=e.combinations,o=e.isNegative,s=e.isInteger;return t(cm,{"number | BigNumber":function(e){if(!s(e)||o(e))throw new TypeError("Non-negative integer value expected in function catalan");return n(a(i(e,2),e),r(e,1))}})}),pm="composition",mm=["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],hm=Object(s.a)(pm,mm,function(e){var t=e.typed,r=e.addScalar,n=e.combinations,i=e.isPositive,a=(e.isNegative,e.isInteger),o=e.larger;return t(pm,{"number | BigNumber, number | BigNumber":function(e,t){if(!(a(e)&&i(e)&&a(t)&&i(t)))throw new TypeError("Positive integer value expected in function composition");if(o(t,e))throw new TypeError("k must be less than or equal to n in function composition");return n(r(e,-1),r(t,-1))}})}),dm=["FunctionNode","OperatorNode","SymbolNode"],ym=Object(s.a)("simplifyUtil",dm,function(e){var r=e.FunctionNode,n=e.OperatorNode,i=e.SymbolNode,a={add:!0,multiply:!0},o={add:!0,multiply:!0};function s(e,t){if(!Object(ie.B)(e))return!1;var r=e.fn.toString();return t&&Object(ae.f)(t,r)&&Object(ae.f)(t[r],"associative")?t[r].associative:o[r]||!1}function u(e){var i,a=[];return s(e)?(i=e.op,function e(t){for(var r=0;r<t.args.length;r++){var n=t.args[r];Object(ie.B)(n)&&i===n.op?e(n):a.push(n)}}(e),a):e.args}function c(t){return Object(ie.B)(t)?function(e){try{return new n(t.op,t.fn,e,t.implicit)}catch(e){return console.error(e),[]}}:function(e){return new r(new i(t.name),e)}}return{createMakeNodeFunction:c,isCommutative:function(e,t){if(!Object(ie.B)(e))return!0;var r=e.fn.toString();return t&&Object(ae.f)(t,r)&&Object(ae.f)(t[r],"commutative")?t[r].commutative:a[r]||!1},isAssociative:s,flatten:function e(t){if(!t.args||0===t.args.length)return t;t.args=u(t);for(var r=0;r<t.args.length;r++)e(t.args[r])},allChildren:u,unflattenr:function e(t){if(t.args&&0!==t.args.length){for(var r=c(t),n=t.args.length,i=0;i<n;i++)e(t.args[i]);if(2<n&&s(t)){for(var a=t.args.pop();0<t.args.length;)a=r([t.args.pop(),a]);t.args=a.args}}},unflattenl:function e(t){if(t.args&&0!==t.args.length){for(var r=c(t),n=t.args.length,i=0;i<n;i++)e(t.args[i]);if(2<n&&s(t)){for(var a=t.args.shift();0<t.args.length;)a=r([a,t.args.shift()]);t.args=a.args}}}}}),gm=["equal","isZero","add","subtract","multiply","divide","pow","ConstantNode","OperatorNode","FunctionNode","ParenthesisNode"],vm=Object(s.a)("simplifyCore",gm,function(e){var f=e.equal,l=e.isZero,p=e.add,m=e.subtract,h=e.multiply,d=e.divide,y=e.pow,g=e.ConstantNode,v=e.OperatorNode,b=e.FunctionNode,x=e.ParenthesisNode,w=new g(0),N=new g(1);return function e(t){if(Object(ie.B)(t)&&t.isUnary()){var r=e(t.args[0]);if("+"===t.op)return r;if("-"===t.op){if(Object(ie.B)(r)){if(r.isUnary()&&"-"===r.op)return r.args[0];if(r.isBinary()&&"subtract"===r.fn)return new v("-","subtract",[r.args[1],r.args[0]])}return new v(t.op,t.fn,[r])}}else if(Object(ie.B)(t)&&t.isBinary()){var n=e(t.args[0]),i=e(t.args[1]);if("+"===t.op){if(Object(ie.l)(n)){if(l(n.value))return i;if(Object(ie.l)(i))return new g(p(n.value,i.value))}return Object(ie.l)(i)&&l(i.value)?n:Object(ie.B)(i)&&i.isUnary()&&"-"===i.op?new v("-","subtract",[n,i.args[0]]):new v(t.op,t.fn,i?[n,i]:[n])}if("-"===t.op){if(Object(ie.l)(n)&&i){if(Object(ie.l)(i))return new g(m(n.value,i.value));if(l(n.value))return new v("-","unaryMinus",[i])}if("subtract"===t.fn)return Object(ie.l)(i)&&l(i.value)?n:Object(ie.B)(i)&&i.isUnary()&&"-"===i.op?e(new v("+","add",[n,i.args[0]])):new v(t.op,t.fn,[n,i])}else{if("*"===t.op){if(Object(ie.l)(n)){if(l(n.value))return w;if(f(n.value,1))return i;if(Object(ie.l)(i))return new g(h(n.value,i.value))}if(Object(ie.l)(i)){if(l(i.value))return w;if(f(i.value,1))return n;if(Object(ie.B)(n)&&n.isBinary()&&n.op===t.op){var a=n.args[0];if(Object(ie.l)(a)){var o=new g(h(a.value,i.value));return new v(t.op,t.fn,[o,n.args[1]],t.implicit)}}return new v(t.op,t.fn,[i,n],t.implicit)}return new v(t.op,t.fn,[n,i],t.implicit)}if("/"===t.op){if(Object(ie.l)(n)){if(l(n.value))return w;if(Object(ie.l)(i)&&(f(i.value,1)||f(i.value,2)||f(i.value,4)))return new g(d(n.value,i.value))}return new v(t.op,t.fn,[n,i])}if("^"===t.op){if(Object(ie.l)(i)){if(l(i.value))return N;if(f(i.value,1))return n;if(Object(ie.l)(n))return new g(y(n.value,i.value));if(Object(ie.B)(n)&&n.isBinary()&&"^"===n.op){var s=n.args[1];if(Object(ie.l)(s))return new v(t.op,t.fn,[n.args[0],new g(h(s.value,i.value))])}}return new v(t.op,t.fn,[n,i])}}}else{if(Object(ie.C)(t)){var u=e(t.content);return Object(ie.C)(u)||Object(ie.J)(u)||Object(ie.l)(u)?u:new x(u)}if(Object(ie.r)(t)){var c=t.args.map(e).map(function(e){return Object(ie.C)(e)?e.content:e});return new b(e(t.fn),c)}}return t}}),bm=["typed","config","mathWithTransform","?fraction","?bignumber","ConstantNode","OperatorNode","FunctionNode","SymbolNode"],xm=Object(s.a)("simplifyConstant",bm,function(e){var t=e.typed,r=e.config,p=e.mathWithTransform,n=e.fraction,i=e.bignumber,a=e.ConstantNode,o=e.OperatorNode,m=e.FunctionNode,s=e.SymbolNode,u=ym({FunctionNode:m,OperatorNode:o,SymbolNode:s}),h=u.isCommutative,d=u.isAssociative,y=u.allChildren,g=u.createMakeNodeFunction;function v(t,r,n){try{return x(p[t].apply(null,r),n)}catch(e){return r=r.map(function(e){return Object(ie.o)(e)?e.valueOf():e}),x(p[t].apply(null,r),n)}}var b=t({Fraction:function(e){var t,r=e.s*e.n;t=r<0?new o("-","unaryMinus",[new a(-r)]):new a(r);return 1!==e.d?new o("/","divide",[t,new a(e.d)]):t},number:function(e){return e<0?f(new a(-e)):new a(e)},BigNumber:function(e){return e<0?f(new a(-e)):new a(e)},Complex:function(e){throw new Error("Cannot convert Complex number to Node")}});function c(e,t){if(t&&!1!==t.exactFractions&&isFinite(e)&&n){var r=n(e);if(r.valueOf()===e)return r}return e}var x=t({"string, Object":function(e,t){return"BigNumber"===r.number?(void 0===i&&wi(),i(e)):"Fraction"===r.number?(void 0===n&&Ni(),n(e)):c(parseFloat(e),t)},"Fraction, Object":function(e,t){return e},"BigNumber, Object":function(e,t){return e},"number, Object":function(e,t){return c(e,t)},"Complex, Object":function(e,t){return 0!==e.im?e:c(e.re,t)}});function f(e){return new o("-","unaryMinus",[e])}function w(r,e,n,i){return e.reduce(function(e,t){if(Object(ie.w)(e)||Object(ie.w)(t))Object(ie.w)(e)?Object(ie.w)(t)||(t=b(t)):e=b(e);else{try{return v(r,[e,t],i)}catch(e){}e=b(e),t=b(t)}return n([e,t])})}return function(e,t){var r=function t(e,r){switch(e.type){case"SymbolNode":return e;case"ConstantNode":return"number"!=typeof e.value&&isNaN(e.value)?e:x(e.value,r);case"FunctionNode":if(p[e.name]&&p[e.name].rawArgs)return e;var n=["add","multiply"];if(-1===n.indexOf(e.name)){var i=e.args.map(function(e){return t(e,r)});if(!i.some(ie.w))try{return v(e.name,i,r)}catch(e){}return i=i.map(function(e){return Object(ie.w)(e)?e:b(e)}),new m(e.name,i)}case"OperatorNode":var a,o,s=e.fn.toString(),u=g(e);if(Object(ie.B)(e)&&e.isUnary())a=[t(e.args[0],r)],o=Object(ie.w)(a[0])?u(a):v(s,a,r);else if(d(e))if(a=(a=y(e)).map(function(e){return t(e,r)}),h(s)){for(var c=[],f=[],l=0;l<a.length;l++)Object(ie.w)(a[l])?f.push(a[l]):c.push(a[l]);o=1<c.length?(o=w(s,c,u,r),f.unshift(o),w(s,f,u,r)):w(s,a,u,r)}else o=w(s,a,u,r);else a=e.args.map(function(e){return t(e,r)}),o=w(s,a,u,r);return o;case"ParenthesisNode":return t(e.content,r);case"AccessorNode":case"ArrayNode":case"AssignmentNode":case"BlockNode":case"FunctionAssignmentNode":case"IndexNode":case"ObjectNode":case"RangeNode":case"ConditionalNode":default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(e.type))}}(e,t);return Object(ie.w)(r)?r:b(r)}}),wm=["parse","FunctionNode","OperatorNode","ParenthesisNode"],Nm=Object(s.a)("resolve",wm,function(e){var o=e.parse,s=e.FunctionNode,u=e.OperatorNode,c=e.ParenthesisNode;return function t(e,r){if(!r)return e;if(Object(ie.J)(e)){var n=r[e.name];if(Object(ie.w)(n))return t(n,r);if("number"==typeof n)return o(String(n))}else{if(Object(ie.B)(e)){var i=e.args.map(function(e){return t(e,r)});return new u(e.op,e.fn,i,e.implicit)}if(Object(ie.C)(e))return new c(t(e.content,r));if(Object(ie.r)(e)){var a=e.args.map(function(e){return t(e,r)});return new s(e.name,a)}}return e}});function Om(e){return(Om="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var Mm=["config","typed","parse","add","subtract","multiply","divide","pow","isZero","equal","?fraction","?bignumber","mathWithTransform","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],Em=Object(s.a)("simplify",Mm,function(e){var t=e.config,r=e.typed,c=e.parse,n=e.add,i=e.subtract,a=e.multiply,o=e.divide,s=e.pow,u=e.isZero,l=e.equal,f=e.fraction,p=e.bignumber,m=e.mathWithTransform,h=e.ConstantNode,d=e.FunctionNode,y=e.OperatorNode,g=e.ParenthesisNode,v=e.SymbolNode,b=xm({typed:r,config:t,mathWithTransform:m,fraction:f,bignumber:p,ConstantNode:h,OperatorNode:y,FunctionNode:d,SymbolNode:v}),x=vm({equal:l,isZero:u,add:n,subtract:i,multiply:a,divide:o,pow:s,ConstantNode:h,OperatorNode:y,FunctionNode:d,ParenthesisNode:g}),w=Nm({parse:c,FunctionNode:d,OperatorNode:y,ParenthesisNode:g}),N=ym({FunctionNode:d,OperatorNode:y,SymbolNode:v}),O=N.isCommutative,M=N.isAssociative,E=N.flatten,j=N.unflattenr,S=N.unflattenl,A=N.createMakeNodeFunction,C=r("simplify",{string:function(e){return C(c(e),C.rules,{},{})},"string, Object":function(e,t){return C(c(e),C.rules,t,{})},"string, Object, Object":function(e,t,r){return C(c(e),C.rules,t,r)},"string, Array":function(e,t){return C(c(e),t,{},{})},"string, Array, Object":function(e,t,r){return C(c(e),t,r,{})},"string, Array, Object, Object":function(e,t,r,n){return C(c(e),t,r,n)},"Node, Object":function(e,t){return C(e,C.rules,t,{})},"Node, Object, Object":function(e,t,r){return C(e,C.rules,t,r)},Node:function(e){return C(e,C.rules,{},{})},"Node, Array":function(e,t){return C(e,t,{},{})},"Node, Array, Object":function(e,t,r){return C(e,t,r,{})},"Node, Array, Object, Object":function(e,t,r,n){t=function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r],i=void 0,a=Om(n);switch(a){case"string":var o=n.split("->");if(2!==o.length)throw SyntaxError("Could not parse rule: "+n);n={l:o[0],r:o[1]};case"object":if(i={l:T(c(n.l)),r:T(c(n.r))},n.context&&(i.evaluate=n.context),n.evaluate&&(i.evaluate=c(n.evaluate)),M(i.l)){var s=A(i.l),u=new v("_p"+I++);i.expanded={},i.expanded.l=s([i.l.clone(),u]),E(i.expanded.l),j(i.expanded.l),i.expanded.r=s([i.r,u])}break;case"function":i=n;break;default:throw TypeError("Unsupported type of rule: "+a)}t.push(i)}return t}(t);for(var i=w(e,r),a={},o=(i=T(i)).toString({parenthesis:"all"});!a[o];){a[o]=!0;for(var s=I=0;s<t.length;s++)i="function"==typeof t[s]?t[s](i,n):(E(i),B(i,t[s])),S(i);o=i.toString({parenthesis:"all"})}return i}});function T(e){return e.transform(function(e,t,r){return Object(ie.C)(e)?T(e.content):e})}C.simplifyCore=x,C.resolve=w;var _={true:!0,false:!0,e:!0,i:!0,Infinity:!0,LN2:!0,LN10:!0,LOG2E:!0,LOG10E:!0,NaN:!0,phi:!0,pi:!0,SQRT1_2:!0,SQRT2:!0,tau:!0};C.rules=[x,{l:"log(e)",r:"1"},{l:"n-n1",r:"n+-n1"},{l:"-(c*v)",r:"(-c) * v"},{l:"-v",r:"(-1) * v"},{l:"n/n1^n2",r:"n*n1^-n2"},{l:"n/n1",r:"n*n1^-1"},{l:"(n ^ n1) ^ n2",r:"n ^ (n1 * n2)"},{l:"n*n",r:"n^2"},{l:"n * n^n1",r:"n^(n1+1)"},{l:"n^n1 * n^n2",r:"n^(n1+n2)"},{l:"n+n",r:"2*n"},{l:"n+-n",r:"0"},{l:"n1*n2 + n2",r:"(n1+1)*n2"},{l:"n1*n3 + n2*n3",r:"(n1+n2)*n3"},{l:"n1 + -1 * (n2 + n3)",r:"n1 + -1 * n2 + -1 * n3"},b,{l:"(-n)*n1",r:"-(n*n1)"},{l:"c+v",r:"v+c",context:{add:{commutative:!1}}},{l:"v*c",r:"c*v",context:{multiply:{commutative:!1}}},{l:"n+-n1",r:"n-n1"},{l:"n*(n1^-1)",r:"n/n1"},{l:"n*n1^-n2",r:"n/n1^n2"},{l:"n1^-1",r:"1/n1"},{l:"n*(n1/n2)",r:"(n*n1)/n2"},{l:"n-(n1+n2)",r:"n-n1-n2"},{l:"1*n",r:"n"}];var I=0;var B=r("applyRule",{"Node, Object":function(e,t){var r=e;if(r instanceof y||r instanceof d){if(r.args)for(var n=0;n<r.args.length;n++)r.args[n]=B(r.args[n],t)}else r instanceof g&&r.content&&(r.content=B(r.content,t));var i=t.r,a=z(t.l,r)[0];if(!a&&t.expanded&&(i=t.expanded.r,a=z(t.expanded.l,r)[0]),a){var o=r.implicit;r=i.clone(),o&&"implicit"in i&&(r.implicit=!0),r=r.transform(function(e){return e.isSymbolNode&&Object(ae.f)(a.placeholders,e.name)?a.placeholders[e.name].clone():e})}return r}});function q(e,t){var r={placeholders:{}};if(!e.placeholders&&!t.placeholders)return r;if(!e.placeholders)return t;if(!t.placeholders)return e;for(var n in e.placeholders)if(r.placeholders[n]=e.placeholders[n],Object(ae.f)(t.placeholders,n)&&!D(e.placeholders[n],t.placeholders[n]))return null;for(var i in t.placeholders)r.placeholders[i]=t.placeholders[i];return r}function k(e,t){var r,n=[];if(0===e.length||0===t.length)return n;for(var i=0;i<e.length;i++)for(var a=0;a<t.length;a++)(r=q(e[i],t[a]))&&n.push(r);return n}function z(e,t,r){var n=[{placeholders:{}}];if(e instanceof y&&t instanceof y||e instanceof d&&t instanceof d){if(e instanceof y){if(e.op!==t.op||e.fn!==t.fn)return[]}else if(e instanceof d&&e.name!==t.name)return[];if((1!==t.args.length||1!==e.args.length)&&M(t)&&!r){if(2<=t.args.length&&2===e.args.length){for(var i=function(e,t){var r,n,i=[],a=A(e);if(O(e,t))for(var o=0;o<e.args.length;o++)(n=e.args.slice(0)).splice(o,1),r=1===n.length?n[0]:a(n),i.push(a([e.args[o],r]));else r=1===(n=e.args.slice(1)).length?n[0]:a(n),i.push(a([e.args[0],r]));return i}(t,e.context),a=[],o=0;o<i.length;o++){var s=z(e,i[o],!0);a=a.concat(s)}return a}if(2<e.args.length)throw Error("Unexpected non-binary associative function: "+e.toString());return[]}for(var u=[],c=0;c<e.args.length;c++){var f=z(e.args[c],t.args[c]);if(0===f.length)return[];u.push(f)}n=function(e){if(0===e.length)return e;for(var t=e.reduce(k),r=[],n={},i=0;i<t.length;i++){var a=JSON.stringify(t[i]);n[a]||(n[a]=!0,r.push(t[i]))}return r}(u)}else if(e instanceof v){if(0===e.name.length)throw new Error("Symbol in rule has 0 length...!?");if(_[e.name]){if(e.name!==t.name)return[]}else if("n"===e.name[0]||"_p"===e.name.substring(0,2))n[0].placeholders[e.name]=t;else if("v"===e.name[0]){if(Object(ie.l)(t))return[];n[0].placeholders[e.name]=t}else{if("c"!==e.name[0])throw new Error("Invalid symbol in rule: "+e.name);if(!(t instanceof h))return[];n[0].placeholders[e.name]=t}}else{if(!(e instanceof h))return[];if(!l(e.value,t.value))return[]}return n}function D(e,t){if(e instanceof h&&t instanceof h){if(!l(e.value,t.value))return!1}else if(e instanceof v&&t instanceof v){if(e.name!==t.name)return!1}else{if(!(e instanceof y&&t instanceof y||e instanceof d&&t instanceof d))return!1;if(e instanceof y){if(e.op!==t.op||e.fn!==t.fn)return!1}else if(e instanceof d&&e.name!==t.name)return!1;if(e.args.length!==t.args.length)return!1;for(var r=0;r<e.args.length;r++)if(!D(e.args[r],t.args[r]))return!1}return!0}return C}),jm=["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],Sm=Object(s.a)("derivative",jm,function(e){var t=e.typed,r=e.config,n=e.parse,a=e.simplify,l=e.equal,p=e.isZero,i=e.numeric,o=e.ConstantNode,m=e.FunctionNode,h=e.OperatorNode,s=e.ParenthesisNode,f=e.SymbolNode,u=t("derivative",{"Node, SymbolNode, Object":function(e,t,r){var n={};d(n,e,t.name);var i=y(e,n);return r.simplify?a(i):i},"Node, SymbolNode":function(e,t){return u(e,t,{simplify:!0})},"string, SymbolNode":function(e,t){return u(n(e),t)},"string, SymbolNode, Object":function(e,t,r){return u(n(e),t,r)},"string, string":function(e,t){return u(n(e),n(t))},"string, string, Object":function(e,t,r){return u(n(e),n(t),r)},"Node, string":function(e,t){return u(e,n(t))},"Node, string, Object":function(e,t,r){return u(e,n(t),r)}});u._simplify=!0,u.toTex=function(e){return c.apply(null,e.args)};var c=t("_derivTex",{"Node, SymbolNode":function(e,t){return Object(ie.l)(e)&&"string"===Object(ie.M)(e.value)?c(n(e.value).toString(),t.toString(),1):c(e.toString(),t.toString(),1)},"Node, ConstantNode":function(e,t){if("string"===Object(ie.M)(t.value))return c(e,n(t.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(e,t,r){return c(e.toString(),t.name,r.value)},"string, string, number":function(e,t,r){return(1===r?"{d\\over d"+t+"}":"{d^{"+r+"}\\over d"+t+"^{"+r+"}}")+"\\left[".concat(e,"\\right]")}}),d=t("constTag",{"Object, ConstantNode, string":function(e,t){return e[t]=!0},"Object, SymbolNode, string":function(e,t,r){return t.name!==r&&(e[t]=!0)},"Object, ParenthesisNode, string":function(e,t,r){return d(e,t.content,r)},"Object, FunctionAssignmentNode, string":function(e,t,r){return-1===t.params.indexOf(r)?e[t]=!0:d(e,t.expr,r)},"Object, FunctionNode | OperatorNode, string":function(e,t,r){if(0<t.args.length){for(var n=d(e,t.args[0],r),i=1;i<t.args.length;++i)n=d(e,t.args[i],r)&&n;if(n)return e[t]=!0}return!1}}),y=t("_derivative",{"ConstantNode, Object":function(e){return g(0)},"SymbolNode, Object":function(e,t){return void 0!==t[e]?g(0):g(1)},"ParenthesisNode, Object":function(e,t){return new s(y(e.content,t))},"FunctionAssignmentNode, Object":function(e,t){return void 0!==t[e]?g(0):y(e.expr,t)},"FunctionNode, Object":function(e,t){if(1!==e.args.length&&function(e){if(("log"===e.name||"nthRoot"===e.name||"pow"===e.name)&&2===e.args.length)return;for(var t=0;t<e.args.length;++t)e.args[t]=g(0);throw e.compile().evaluate(),new Error("Expected TypeError, but none found")}(e),void 0!==t[e])return g(0);var r,n,i,a,o=e.args[0],s=!1,u=!1;switch(e.name){case"cbrt":s=!0,n=new h("*","multiply",[g(3),new h("^","pow",[o,new h("/","divide",[g(2),g(3)])])]);break;case"sqrt":case"nthRoot":if(1===e.args.length)s=!0,n=new h("*","multiply",[g(2),new m("sqrt",[o])]);else if(2===e.args.length)return t[r=new h("/","divide",[g(1),e.args[1]])]=t[e.args[1]],y(new h("^","pow",[o,r]),t);break;case"log10":r=g(10);case"log":if(r||1!==e.args.length){if(1===e.args.length&&r||2===e.args.length&&void 0!==t[e.args[1]])n=new h("*","multiply",[o.clone(),new m("log",[r||e.args[1]])]),s=!0;else if(2===e.args.length)return y(new h("/","divide",[new m("log",[o]),new m("log",[e.args[1]])]),t)}else n=o.clone(),s=!0;break;case"pow":return t[r]=t[e.args[1]],y(new h("^","pow",[o,e.args[1]]),t);case"exp":n=new m("exp",[o.clone()]);break;case"sin":n=new m("cos",[o.clone()]);break;case"cos":n=new h("-","unaryMinus",[new m("sin",[o.clone()])]);break;case"tan":n=new h("^","pow",[new m("sec",[o.clone()]),g(2)]);break;case"sec":n=new h("*","multiply",[e,new m("tan",[o.clone()])]);break;case"csc":u=!0,n=new h("*","multiply",[e,new m("cot",[o.clone()])]);break;case"cot":u=!0,n=new h("^","pow",[new m("csc",[o.clone()]),g(2)]);break;case"asin":s=!0,n=new m("sqrt",[new h("-","subtract",[g(1),new h("^","pow",[o.clone(),g(2)])])]);break;case"acos":u=s=!0,n=new m("sqrt",[new h("-","subtract",[g(1),new h("^","pow",[o.clone(),g(2)])])]);break;case"atan":s=!0,n=new h("+","add",[new h("^","pow",[o.clone(),g(2)]),g(1)]);break;case"asec":s=!0,n=new h("*","multiply",[new m("abs",[o.clone()]),new m("sqrt",[new h("-","subtract",[new h("^","pow",[o.clone(),g(2)]),g(1)])])]);break;case"acsc":u=s=!0,n=new h("*","multiply",[new m("abs",[o.clone()]),new m("sqrt",[new h("-","subtract",[new h("^","pow",[o.clone(),g(2)]),g(1)])])]);break;case"acot":u=s=!0,n=new h("+","add",[new h("^","pow",[o.clone(),g(2)]),g(1)]);break;case"sinh":n=new m("cosh",[o.clone()]);break;case"cosh":n=new m("sinh",[o.clone()]);break;case"tanh":n=new h("^","pow",[new m("sech",[o.clone()]),g(2)]);break;case"sech":u=!0,n=new h("*","multiply",[e,new m("tanh",[o.clone()])]);break;case"csch":u=!0,n=new h("*","multiply",[e,new m("coth",[o.clone()])]);break;case"coth":u=!0,n=new h("^","pow",[new m("csch",[o.clone()]),g(2)]);break;case"asinh":s=!0,n=new m("sqrt",[new h("+","add",[new h("^","pow",[o.clone(),g(2)]),g(1)])]);break;case"acosh":s=!0,n=new m("sqrt",[new h("-","subtract",[new h("^","pow",[o.clone(),g(2)]),g(1)])]);break;case"atanh":s=!0,n=new h("-","subtract",[g(1),new h("^","pow",[o.clone(),g(2)])]);break;case"asech":u=s=!0,n=new h("*","multiply",[o.clone(),new m("sqrt",[new h("-","subtract",[g(1),new h("^","pow",[o.clone(),g(2)])])])]);break;case"acsch":u=s=!0,n=new h("*","multiply",[new m("abs",[o.clone()]),new m("sqrt",[new h("+","add",[new h("^","pow",[o.clone(),g(2)]),g(1)])])]);break;case"acoth":u=s=!0,n=new h("-","subtract",[g(1),new h("^","pow",[o.clone(),g(2)])]);break;case"abs":n=new h("/","divide",[new m(new f("abs"),[o.clone()]),o.clone()]);break;case"gamma":default:throw new Error('Function "'+e.name+'" is not supported by derivative, or a wrong number of arguments is passed')}a=s?(i="/","divide"):(i="*","multiply");var c=y(o,t);return u&&(c=new h("-","unaryMinus",[c])),new h(i,a,[c,n])},"OperatorNode, Object":function(e,r){if(void 0!==r[e])return g(0);if("+"===e.op)return new h(e.op,e.fn,e.args.map(function(e){return y(e,r)}));if("-"===e.op){if(e.isUnary())return new h(e.op,e.fn,[y(e.args[0],r)]);if(e.isBinary())return new h(e.op,e.fn,[y(e.args[0],r),y(e.args[1],r)])}if("*"===e.op){var t=e.args.filter(function(e){return void 0!==r[e]});if(0<t.length){var n=e.args.filter(function(e){return void 0===r[e]}),i=1===n.length?n[0]:new h("*","multiply",n),a=t.concat(y(i,r));return new h("*","multiply",a)}return new h("+","add",e.args.map(function(t){return new h("*","multiply",e.args.map(function(e){return e===t?y(e,r):e.clone()}))}))}if("/"===e.op&&e.isBinary()){var o=e.args[0],s=e.args[1];return void 0!==r[s]?new h("/","divide",[y(o,r),s]):void 0!==r[o]?new h("*","multiply",[new h("-","unaryMinus",[o]),new h("/","divide",[y(s,r),new h("^","pow",[s.clone(),g(2)])])]):new h("/","divide",[new h("-","subtract",[new h("*","multiply",[y(o,r),s.clone()]),new h("*","multiply",[o.clone(),y(s,r)])]),new h("^","pow",[s.clone(),g(2)])])}if("^"===e.op&&e.isBinary()){var u=e.args[0],c=e.args[1];if(void 0!==r[u])return Object(ie.l)(u)&&(p(u.value)||l(u.value,1))?g(0):new h("*","multiply",[e,new h("*","multiply",[new m("log",[u.clone()]),y(c.clone(),r)])]);if(void 0===r[c])return new h("*","multiply",[new h("^","pow",[u.clone(),c.clone()]),new h("+","add",[new h("*","multiply",[y(u,r),new h("/","divide",[c.clone(),u.clone()])]),new h("*","multiply",[y(c,r),new m("log",[u.clone()])])])]);if(Object(ie.l)(c)){if(p(c.value))return g(0);if(l(c.value,1))return y(u,r)}var f=new h("^","pow",[u.clone(),new h("-","subtract",[c,g(1)])]);return new h("*","multiply",[c.clone(),new h("*","multiply",[y(u,r),f])])}throw new Error('Operator "'+e.op+'" is not supported by derivative, or a wrong number of arguments is passed')}});function g(e,t){return new o(i(e,t||r.number))}return u}),Am="rationalize",Cm=["config","typed","equal","isZero","add","subtract","multiply","divide","pow","parse","simplify","?bignumber","?fraction","mathWithTransform","ConstantNode","OperatorNode","FunctionNode","SymbolNode","ParenthesisNode"],Tm=Object(s.a)(Am,Cm,function(e){var t=e.config,r=e.typed,n=e.equal,i=e.isZero,a=e.add,o=e.subtract,s=e.multiply,u=e.divide,c=e.pow,f=e.parse,m=e.simplify,l=e.fraction,p=e.bignumber,h=e.mathWithTransform,d=e.ConstantNode,y=e.OperatorNode,g=e.FunctionNode,v=e.SymbolNode,b=e.ParenthesisNode,x=xm({typed:r,config:t,mathWithTransform:h,fraction:l,bignumber:p,ConstantNode:d,OperatorNode:y,FunctionNode:g,SymbolNode:v}),w=vm({equal:n,isZero:i,add:a,subtract:o,multiply:s,divide:u,pow:c,ConstantNode:d,OperatorNode:y,FunctionNode:g,ParenthesisNode:b}),N=r(Am,{string:function(e){return N(f(e),{},!1)},"string, boolean":function(e,t){return N(f(e),{},t)},"string, Object":function(e,t){return N(f(e),t,!1)},"string, Object, boolean":function(e,t,r){return N(f(e),t,r)},Node:function(e){return N(e,{},!1)},"Node, boolean":function(e,t){return N(e,{},t)},"Node, Object":function(e,t){return N(e,t,!1)},"Node, Object, boolean":function(e,t,r){var n=function(){var e=[w,{l:"n+n",r:"2*n"},{l:"n+-n",r:"0"},x,{l:"n*(n1^-1)",r:"n/n1"},{l:"n*n1^-n2",r:"n/n1^n2"},{l:"n1^-1",r:"1/n1"},{l:"n*(n1/n2)",r:"(n*n1)/n2"},{l:"1*n",r:"n"}],t=[{l:"(-n1)/(-n2)",r:"n1/n2"},{l:"(-n1)*(-n2)",r:"n1*n2"},{l:"n1--n2",r:"n1+n2"},{l:"n1-n2",r:"n1+(-n2)"},{l:"(n1+n2)*n3",r:"(n1*n3 + n2*n3)"},{l:"n1*(n2+n3)",r:"(n1*n2+n1*n3)"},{l:"c1*n + c2*n",r:"(c1+c2)*n"},{l:"c1*n + n",r:"(c1+1)*n"},{l:"c1*n - c2*n",r:"(c1-c2)*n"},{l:"c1*n - n",r:"(c1-1)*n"},{l:"v/c",r:"(1/c)*v"},{l:"v/-c",r:"-(1/c)*v"},{l:"-v*-c",r:"c*v"},{l:"-v*c",r:"-c*v"},{l:"v*-c",r:"-c*v"},{l:"v*c",r:"c*v"},{l:"-(-n1*n2)",r:"(n1*n2)"},{l:"-(n1*n2)",r:"(-n1*n2)"},{l:"-(-n1+n2)",r:"(n1-n2)"},{l:"-(n1+n2)",r:"(-n1-n2)"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"},{l:"-(-n1/n2)",r:"(n1/n2)"},{l:"-(n1/n2)",r:"(-n1/n2)"}],r=[{l:"(n1/(n2/n3))",r:"((n1*n3)/n2)"},{l:"(n1/n2/n3)",r:"(n1/(n2*n3))"}],n={};return n.firstRules=e.concat(t,r),n.distrDivRules=[{l:"(n1/n2 + n3/n4)",r:"((n1*n4 + n3*n2)/(n2*n4))"},{l:"(n1/n2 + n3)",r:"((n1 + n3*n2)/n2)"},{l:"(n1 + n2/n3)",r:"((n1*n3 + n2)/n3)"}],n.sucDivRules=r,n.firstRulesAgain=e.concat(t),n.finalRules=[w,{l:"n*-n",r:"-n^2"},{l:"n*n",r:"n^2"},x,{l:"n*-n^n1",r:"-n^(n1+1)"},{l:"n*n^n1",r:"n^(n1+1)"},{l:"n^n1*-n^n2",r:"-n^(n1+n2)"},{l:"n^n1*n^n2",r:"n^(n1+n2)"},{l:"n^n1*-n",r:"-n^(n1+1)"},{l:"n^n1*n",r:"n^(n1+1)"},{l:"n^n1/-n",r:"-n^(n1-1)"},{l:"n^n1/n",r:"n^(n1-1)"},{l:"n/-n^n1",r:"-n^(1-n1)"},{l:"n/n^n1",r:"n^(1-n1)"},{l:"n^n1/-n^n2",r:"n^(n1-n2)"},{l:"n^n1/n^n2",r:"n^(n1-n2)"},{l:"n1+(-n2*n3)",r:"n1-n2*n3"},{l:"v*(-c)",r:"-c*v"},{l:"n1+-n2",r:"n1-n2"},{l:"v*c",r:"c*v"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"}],n}(),i=function(e,t,r,n){var o=[],i=m(e,n,t,{exactFractions:!1}),s="+-*"+((r=!!r)?"/":"");!function e(t){var r=t.type;{if("FunctionNode"===r)throw new Error("There is an unsolved function call");if("OperatorNode"===r)if("^"===t.op){if("unaryMinus"===t.args[1].fn&&(t=t.args[0]),"ConstantNode"!==t.args[1].type||!Object(j.i)(parseFloat(t.args[1].value)))throw new Error("There is a non-integer exponent");e(t.args[0])}else{if(-1===s.indexOf(t.op))throw new Error("Operator "+t.op+" invalid in polynomial expression");for(var n=0;n<t.args.length;n++)e(t.args[n])}else if("SymbolNode"===r){var i=t.name,a=o.indexOf(i);-1===a&&o.push(i)}else if("ParenthesisNode"===r)e(t.content);else if("ConstantNode"!==r)throw new Error("type "+r+" is not allowed in polynomial expression")}}(i);var a={};return a.expression=i,a.variables=o,a}(e,t,!0,n.firstRules),a=i.variables.length;if(e=i.expression,1<=a){var o,s;e=function e(t,r,n){var i=t.type;var a=1<arguments.length;if("OperatorNode"===i&&t.isBinary()){var o,s=!1;if("^"===t.op&&("ParenthesisNode"!==t.args[0].type&&"OperatorNode"!==t.args[0].type||"ConstantNode"!==t.args[1].type||(o=parseFloat(t.args[1].value),s=2<=o&&Object(j.i)(o))),s){if(2<o){var u=t.args[0],c=new y("^","pow",[t.args[0].cloneDeep(),new d(o-1)]);t=new y("*","multiply",[u,c])}else t=new y("*","multiply",[t.args[0],t.args[0].cloneDeep()]);a&&("content"===n?r.content=t:r.args[n]=t)}}if("ParenthesisNode"===i)e(t.content,t,"content");else if("ConstantNode"!==i&&"SymbolNode"!==i)for(var f=0;f<t.args.length;f++)e(t.args[f],t,f);if(!a)return t}(e);var u,c=!0,f=!1;for(e=m(e,n.firstRules,{},{exactFractions:!1});s=c?n.distrDivRules:n.sucDivRules,c=!c,(u=(e=m(e,s)).toString())!==o;)f=!0,o=u;f&&(e=m(e,n.firstRulesAgain,{},{exactFractions:!1})),e=m(e,n.finalRules,{},{exactFractions:!1})}var l=[],p={};return"OperatorNode"===e.type&&e.isBinary()&&"/"===e.op?(1===a&&(e.args[0]=O(e.args[0],l),e.args[1]=O(e.args[1])),r&&(p.numerator=e.args[0],p.denominator=e.args[1])):(1===a&&(e=O(e,l)),r&&(p.numerator=e,p.denominator=null)),r?(p.coefficients=l,p.variables=i.variables,p.expression=e,p):e}});function O(e,u){void 0===u&&(u=[]);var t={cte:1,oper:"+",fire:""},c=u[0]=0,f="";!function e(t,r,n){var i=t.type;{if("FunctionNode"===i)throw new Error("There is an unsolved function call");if("OperatorNode"===i){if(-1==="+-*^".indexOf(t.op))throw new Error("Operator "+t.op+" invalid");if(null!==r){if(("unaryMinus"===t.fn||"pow"===t.fn)&&"add"!==r.fn&&"subtract"!==r.fn&&"multiply"!==r.fn)throw new Error("Invalid "+t.op+" placing");if(("subtract"===t.fn||"add"===t.fn||"multiply"===t.fn)&&"add"!==r.fn&&"subtract"!==r.fn)throw new Error("Invalid "+t.op+" placing");if(("subtract"===t.fn||"add"===t.fn||"unaryMinus"===t.fn)&&0!==n.noFil)throw new Error("Invalid "+t.op+" placing")}"^"!==t.op&&"*"!==t.op||(n.fire=t.op);for(var a=0;a<t.args.length;a++)"unaryMinus"===t.fn&&(n.oper="-"),"+"!==t.op&&"subtract"!==t.fn||(n.fire="",n.cte=1,n.oper=0===a?"+":t.op),n.noFil=a,e(t.args[a],t,n)}else if("SymbolNode"===i){if(t.name!==f&&""!==f)throw new Error("There is more than one variable");if(f=t.name,null===r)return void(u[1]=1);if("^"===r.op&&0!==n.noFil)throw new Error("In power the variable should be the first parameter");if("*"===r.op&&1!==n.noFil)throw new Error("In multiply the variable should be the second parameter");""!==n.fire&&"*"!==n.fire||(c<1&&(u[1]=0),u[1]+=n.cte*("+"===n.oper?1:-1),c=Math.max(1,c))}else{if("ConstantNode"!==i)throw new Error("Type "+i+" is not allowed");var o=parseFloat(t.value);if(null===r)return void(u[0]=o);if("^"===r.op){if(1!==n.noFil)throw new Error("Constant cannot be powered");if(!Object(j.i)(o)||o<=0)throw new Error("Non-integer exponent is not allowed");for(var s=c+1;s<o;s++)u[s]=0;return c<o&&(u[o]=0),u[o]+=n.cte*("+"===n.oper?1:-1),void(c=Math.max(o,c))}n.cte=o,""===n.fire&&(u[0]+=n.cte*("+"===n.oper?1:-1))}}}(e,null,t);for(var r,n=!0,i=c=u.length-1;0<=i;i--)if(0!==u[i]){var a=new d(n?u[i]:Math.abs(u[i])),o=u[i]<0?"-":"+";if(0<i){var s=new v(f);if(1<i){var l=new d(i);s=new y("^","pow",[s,l])}a=-1===u[i]&&n?new y("-","unaryMinus",[s]):1===Math.abs(u[i])?s:new y("*","multiply",[a,s])}r=n?a:"+"==o?new y("+","add",[r,a]):new y("-","subtract",[r,a]),n=!1}return n?new d(0):r}return N}),_m=["classes"],Im=Object(s.a)("reviver",_m,function(e){var n=e.classes;return function(e,t){var r=n[t&&t.mathjs];return r&&"function"==typeof r.fromJSON?r.fromJSON(t):t}}),Bm=Math.PI,qm=2*Math.PI,km=Math.E,zm=Object(s.a)("true",[],function(){return!0}),Dm=Object(s.a)("false",[],function(){return!1}),Rm=Object(s.a)("null",[],function(){return null}),Pm=th("Infinity",["config","?BigNumber"],function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?new r(1/0):1/0}),Fm=th("NaN",["config","?BigNumber"],function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?new r(NaN):NaN}),Um=th("pi",["config","?BigNumber"],function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?bs(r):Bm}),Lm=th("tau",["config","?BigNumber"],function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?xs(r):qm}),Hm=th("e",["config","?BigNumber"],function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?gs(r):km}),$m=th("phi",["config","?BigNumber"],function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?vs(r):1.618033988749895}),Gm=th("LN2",["config","?BigNumber"],function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?new r(2).ln():Math.LN2}),Zm=th("LN10",["config","?BigNumber"],function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?new r(10).ln():Math.LN10}),Vm=th("LOG2E",["config","?BigNumber"],function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?new r(1).div(new r(2).ln()):Math.LOG2E}),Jm=th("LOG10E",["config","?BigNumber"],function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?new r(1).div(new r(10).ln()):Math.LOG10E}),Wm=th("SQRT1_2",["config","?BigNumber"],function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?new r("0.5").sqrt():Math.SQRT1_2}),Ym=th("SQRT2",["config","?BigNumber"],function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?new r(2).sqrt():Math.SQRT2}),Xm=th("i",["Complex"],function(e){return e.Complex.I}),Qm=Object(s.a)("PI",["pi"],function(e){return e.pi}),Km=Object(s.a)("E",["e"],function(e){return e.e}),eh=Object(s.a)("version",[],function(){return"6.1.0"});function th(e,t,r){return Object(s.a)(e,t,r,{recreateOnConfigChange:!0})}var rh=Qh("speedOfLight","299792458","m s^-1"),nh=Qh("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),ih=Qh("planckConstant","6.62607015e-34","J s"),ah=Qh("reducedPlanckConstant","1.0545718176461565e-34","J s"),oh=Qh("magneticConstant","1.25663706212e-6","N A^-2"),sh=Qh("electricConstant","8.8541878128e-12","F m^-1"),uh=Qh("vacuumImpedance","376.730313667","ohm"),ch=Qh("coulomb","8.987551792261171e9","N m^2 C^-2"),fh=Qh("elementaryCharge","1.602176634e-19","C"),lh=Qh("bohrMagneton","9.2740100783e-24","J T^-1"),ph=Qh("conductanceQuantum","7.748091729863649e-5","S"),mh=Qh("inverseConductanceQuantum","12906.403729652257","ohm"),hh=Qh("magneticFluxQuantum","2.0678338484619295e-15","Wb"),dh=Qh("nuclearMagneton","5.0507837461e-27","J T^-1"),yh=Qh("klitzing","25812.807459304513","ohm"),gh=Qh("bohrRadius","5.29177210903e-11","m"),vh=Qh("classicalElectronRadius","2.8179403262e-15","m"),bh=Qh("electronMass","9.1093837015e-31","kg"),xh=Qh("fermiCoupling","1.1663787e-5","GeV^-2"),wh=Kh("fineStructure",.0072973525693),Nh=Qh("hartreeEnergy","4.3597447222071e-18","J"),Oh=Qh("protonMass","1.67262192369e-27","kg"),Mh=Qh("deuteronMass","3.3435830926e-27","kg"),Eh=Qh("neutronMass","1.6749271613e-27","kg"),jh=Qh("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),Sh=Qh("rydberg","10973731.568160","m^-1"),Ah=Qh("thomsonCrossSection","6.6524587321e-29","m^2"),Ch=Kh("weakMixingAngle",.2229),Th=Kh("efimovFactor",22.7),_h=Qh("atomicMass","1.66053906660e-27","kg"),Ih=Qh("avogadro","6.02214076e23","mol^-1"),Bh=Qh("boltzmann","1.380649e-23","J K^-1"),qh=Qh("faraday","96485.33212331001","C mol^-1"),kh=Qh("firstRadiation","3.7417718521927573e-16","W m^2"),zh=Qh("loschmidt","2.686780111798444e25","m^-3"),Dh=Qh("gasConstant","8.31446261815324","J K^-1 mol^-1"),Rh=Qh("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),Ph=Qh("molarVolume","0.022413969545014137","m^3 mol^-1"),Fh=Kh("sackurTetrode",-1.16487052358),Uh=Qh("secondRadiation","0.014387768775039337","m K"),Lh=Qh("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),Hh=Qh("wienDisplacement","2.897771955e-3","m K"),$h=Qh("molarMass","0.99999999965e-3","kg mol^-1"),Gh=Qh("molarMassC12","11.9999999958e-3","kg mol^-1"),Zh=Qh("gravity","9.80665","m s^-2"),Vh=Qh("planckLength","1.616255e-35","m"),Jh=Qh("planckMass","2.176435e-8","kg"),Wh=Qh("planckTime","5.391245e-44","s"),Yh=Qh("planckCharge","1.87554603778e-18","C"),Xh=Qh("planckTemperature","1.416785e+32","K");function Qh(e,a,o){return Object(s.a)(e,["config","Unit","BigNumber"],function(e){var t=e.config,r=e.Unit,n=e.BigNumber,i=new r("BigNumber"===t.number?new n(a):parseFloat(a),o);return i.fixPrefix=!0,i})}function Kh(e,n){return Object(s.a)(e,["config","BigNumber"],function(e){var t=e.config,r=e.BigNumber;return"BigNumber"===t.number?new r(n):n})}var ed=["typed","isInteger"],td=Object(s.a)("apply",ed,function(e){var t=e.typed,r=e.isInteger,n=Et({typed:t,isInteger:r});return t("apply",{"...any":function(e){var t=e[1];Object(ie.y)(t)?e[1]=t-1:Object(ie.e)(t)&&(e[1]=t.minus(1));try{return n.apply(null,e)}catch(e){throw Rc(e)}}})},{isTransformFunction:!0}),rd=["typed","Index","matrix","range"],nd=Object(s.a)("column",rd,function(e){var t=e.typed,r=e.Index,n=e.matrix,i=e.range,a=Hn({typed:t,Index:r,matrix:n,range:i});return t("column",{"...any":function(e){var t=e.length-1,r=e[t];Object(ie.y)(r)&&(e[t]=r-1);try{return a.apply(null,e)}catch(e){throw Rc(e)}}})},{isTransformFunction:!0});function id(e,t,r){var n=e.filter(function(e){return Object(ie.J)(e)&&!(e.name in t)&&!(e.name in r)})[0];if(!n)throw new Error('No undefined variable found in inline expression "'+e+'"');var i=n.name,a=Object.create(r),o=e.compile();return function(e){return a[i]=e,o.evaluate(a)}}var ad=["typed"],od=Object(s.a)("filter",ad,function(e){var t=e.typed;function r(e,t,r){var n,i;return e[0]&&(n=e[0].compile().evaluate(r)),e[1]&&(i=Object(ie.J)(e[1])||Object(ie.q)(e[1])?e[1].compile().evaluate(r):id(e[1],t,r)),a(n,i)}r.rawArgs=!0;var a=t("filter",{"Array, function":sd,"Matrix, function":function(e,t){return e.create(sd(e.toArray(),t))},"Array, RegExp":I.d,"Matrix, RegExp":function(e,t){return e.create(Object(I.d)(e.toArray(),t))}});return r},{isTransformFunction:!0});function sd(e,n){var i=Xn(n);return Object(I.c)(e,function(e,t,r){return 1===i?n(e):2===i?n(e,[t+1]):n(e,[t+1],r)})}var ud=["typed"],cd=Object(s.a)("forEach",ud,function(e){var t=e.typed;function r(e,t,r){var n,i;return e[0]&&(n=e[0].compile().evaluate(r)),e[1]&&(i=Object(ie.J)(e[1])||Object(ie.q)(e[1])?e[1].compile().evaluate(r):id(e[1],t,r)),a(n,i)}r.rawArgs=!0;var a=t("forEach",{"Array | Matrix, function":function(t,i){var a=Xn(i);!function r(e,n){Array.isArray(e)?Object(I.f)(e,function(e,t){r(e,n.concat(t+1))}):1===a?i(e):2===a?i(e,n):i(e,n,t)}(t.valueOf(),[])}});return r},{isTransformFunction:!0}),fd=["typed"],ld=Object(s.a)("map",fd,function(e){var t=e.typed;function r(e,t,r){var n,i;return e[0]&&(n=e[0].compile().evaluate(r)),e[1]&&(i=Object(ie.J)(e[1])||Object(ie.q)(e[1])?e[1].compile().evaluate(r):id(e[1],t,r)),a(n,i)}r.rawArgs=!0;var a=t("map",{"Array, function":function(e,t){return pd(e,t,e)},"Matrix, function":function(e,t){return e.create(pd(e.valueOf(),t,e))}});return r},{isTransformFunction:!0});function pd(e,t,i){var a=Xn(t);return function r(e,n){return Array.isArray(e)?Object(I.m)(e,function(e,t){return r(e,n.concat(t+1))}):1===a?t(e):2===a?t(e,n):t(e,n,i)}(e,[])}var md=["typed","larger"],hd=Object(s.a)("max",md,function(e){var t=e.typed,r=e.larger,n=os({typed:t,larger:r});return t("max",{"...any":function(e){if(2===e.length&&Object(ie.i)(e[0])){var t=e[1];Object(ie.y)(t)?e[1]=t-1:Object(ie.e)(t)&&(e[1]=t.minus(1))}try{return n.apply(null,e)}catch(e){throw Rc(e)}}})},{isTransformFunction:!0}),dd=["typed","add","divide"],yd=Object(s.a)("mean",dd,function(e){var t=e.typed,r=e.add,n=e.divide,i=rp({typed:t,add:r,divide:n});return t("mean",{"...any":function(e){if(2===e.length&&Object(ie.i)(e[0])){var t=e[1];Object(ie.y)(t)?e[1]=t-1:Object(ie.e)(t)&&(e[1]=t.minus(1))}try{return i.apply(null,e)}catch(e){throw Rc(e)}}})},{isTransformFunction:!0}),gd=["typed","smaller"],vd=Object(s.a)("min",gd,function(e){var t=e.typed,r=e.smaller,n=us({typed:t,smaller:r});return t("min",{"...any":function(e){if(2===e.length&&Object(ie.i)(e[0])){var t=e[1];Object(ie.y)(t)?e[1]=t-1:Object(ie.e)(t)&&(e[1]=t.minus(1))}try{return n.apply(null,e)}catch(e){throw Rc(e)}}})},{isTransformFunction:!0}),bd=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq"],xd=Object(s.a)("range",bd,function(e){var t=e.typed,r=e.config,n=e.matrix,i=e.bignumber,a=e.smaller,o=e.smallerEq,s=e.larger,u=e.largerEq,c=Ei({typed:t,config:r,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:u});return t("range",{"...any":function(e){return"boolean"!=typeof e[e.length-1]&&e.push(!0),c.apply(null,e)}})},{isTransformFunction:!0}),wd=["typed","Index","matrix","range"],Nd=Object(s.a)("row",wd,function(e){var t=e.typed,r=e.Index,n=e.matrix,i=e.range,a=Bi({typed:t,Index:r,matrix:n,range:i});return t("row",{"...any":function(e){var t=e.length-1,r=e[t];Object(ie.y)(r)&&(e[t]=r-1);try{return a.apply(null,e)}catch(e){throw Rc(e)}}})},{isTransformFunction:!0}),Od=["typed","matrix"],Md=Object(s.a)("subset",Od,function(e){var t=e.typed,r=e.matrix,n=Ji({typed:t,matrix:r});return t("subset",{"...any":function(e){try{return n.apply(null,e)}catch(e){throw Rc(e)}}})},{isTransformFunction:!0}),Ed=["typed","matrix","isInteger"],jd=Object(s.a)("concat",Ed,function(e){var t=e.typed,r=e.matrix,n=e.isInteger,i=Fn({typed:t,matrix:r,isInteger:n});return t("concat",{"...any":function(e){var t=e.length-1,r=e[t];Object(ie.y)(r)?e[t]=r-1:Object(ie.e)(r)&&(e[t]=r.minus(1));try{return i.apply(null,e)}catch(e){throw Rc(e)}}})},{isTransformFunction:!0}),Sd=["typed","sqrt","variance"],Ad=Object(s.a)("std",Sd,function(e){var t=e.typed,r=e.sqrt,n=e.variance,i=dp({typed:t,sqrt:r,variance:n});return t("std",{"...any":function(e){if(2<=e.length&&Object(ie.i)(e[0])){var t=e[1];Object(ie.y)(t)?e[1]=t-1:Object(ie.e)(t)&&(e[1]=t.minus(1))}try{return i.apply(null,e)}catch(e){throw Rc(e)}}})},{isTransformFunction:!0}),Cd=["typed","config","add","?bignumber","?fraction"],Td=Object(s.a)("sum",Cd,function(e){var t=e.typed,r=e.config,n=e.add,i=e.bignumber,a=e.fraction,o=ep({typed:t,config:r,add:n,bignumber:i,fraction:a});return t("sum",{"...any":function(e){if(2===e.length&&Object(ie.i)(e[0])){var t=e[1];Object(ie.y)(t)?e[1]=t-1:Object(ie.e)(t)&&(e[1]=t.minus(1))}try{return o.apply(null,e)}catch(e){throw Rc(e)}}})},{isTransformFunction:!0}),_d="variance",Id=["typed","add","subtract","multiply","divide","apply","isNaN"],Bd=Object(s.a)(_d,Id,function(e){var t=e.typed,r=e.add,n=e.subtract,i=e.multiply,a=e.divide,o=e.apply,s=e.isNaN,u=fp({typed:t,add:r,subtract:n,multiply:i,divide:a,apply:o,isNaN:s});return t(_d,{"...any":function(e){if(2<=e.length&&Object(ie.i)(e[0])){var t=e[1];Object(ie.y)(t)?e[1]=t-1:Object(ie.e)(t)&&(e[1]=t.minus(1))}try{return u.apply(null,e)}catch(e){throw Rc(e)}}})},{isTransformFunction:!0});r.d(t,"createTyped",function(){return u}),r.d(t,"createResultSet",function(){return m}),r.d(t,"createBigNumberClass",function(){return g}),r.d(t,"createComplexClass",function(){return N}),r.d(t,"createFractionClass",function(){return S}),r.d(t,"createRangeClass",function(){return C}),r.d(t,"createMatrixClass",function(){return _}),r.d(t,"createDenseMatrixClass",function(){return q}),r.d(t,"createClone",function(){return z}),r.d(t,"createIsInteger",function(){return Z}),r.d(t,"createIsNegative",function(){return te}),r.d(t,"createIsNumeric",function(){return se}),r.d(t,"createHasNumericValue",function(){return fe}),r.d(t,"createIsPositive",function(){return me}),r.d(t,"createIsZero",function(){return de}),r.d(t,"createIsNaN",function(){return ge}),r.d(t,"createTypeOf",function(){return xe}),r.d(t,"createDeprecatedTypeof",function(){return we}),r.d(t,"createEqualScalar",function(){return Ee}),r.d(t,"createSparseMatrixClass",function(){return Se}),r.d(t,"createNumber",function(){return Ce}),r.d(t,"createString",function(){return _e}),r.d(t,"createBoolean",function(){return qe}),r.d(t,"createBignumber",function(){return ze}),r.d(t,"createComplex",function(){return Re}),r.d(t,"createFraction",function(){return Fe}),r.d(t,"createMatrix",function(){return Le}),r.d(t,"createSplitUnit",function(){return Ge}),r.d(t,"createUnaryMinus",function(){return vt}),r.d(t,"createUnaryPlus",function(){return wt}),r.d(t,"createAbs",function(){return Ot}),r.d(t,"createApply",function(){return Et}),r.d(t,"createAddScalar",function(){return Ct}),r.d(t,"createCbrt",function(){return _t}),r.d(t,"createCeil",function(){return Bt}),r.d(t,"createCube",function(){return kt}),r.d(t,"createExp",function(){return Dt}),r.d(t,"createExpm1",function(){return Pt}),r.d(t,"createFix",function(){return Ut}),r.d(t,"createFloor",function(){return Ht}),r.d(t,"createGcd",function(){return tr}),r.d(t,"createLcm",function(){return cr}),r.d(t,"createLog10",function(){return lr}),r.d(t,"createLog2",function(){return mr}),r.d(t,"createMod",function(){return wr}),r.d(t,"createMultiplyScalar",function(){return Or}),r.d(t,"createMultiply",function(){return jr}),r.d(t,"createNthRoot",function(){return Cr}),r.d(t,"createSign",function(){return _r}),r.d(t,"createSqrt",function(){return Br}),r.d(t,"createSquare",function(){return kr}),r.d(t,"createSubtract",function(){return Rr}),r.d(t,"createXgcd",function(){return Ur}),r.d(t,"createDotMultiply",function(){return Zr}),r.d(t,"createBitAnd",function(){return ln}),r.d(t,"createBitNot",function(){return mn}),r.d(t,"createBitOr",function(){return dn}),r.d(t,"createBitXor",function(){return bn}),r.d(t,"createArg",function(){return wn}),r.d(t,"createConj",function(){return On}),r.d(t,"createIm",function(){return En}),r.d(t,"createRe",function(){return Sn}),r.d(t,"createNot",function(){return qn}),r.d(t,"createOr",function(){return zn}),r.d(t,"createXor",function(){return Rn}),r.d(t,"createConcat",function(){return Fn}),r.d(t,"createColumn",function(){return Hn}),r.d(t,"createCross",function(){return Gn}),r.d(t,"createDiag",function(){return Vn}),r.d(t,"createEye",function(){return Jn}),r.d(t,"createFilter",function(){return Kn}),r.d(t,"createFlatten",function(){return ni}),r.d(t,"createForEach",function(){return oi}),r.d(t,"createGetMatrixDataType",function(){return fi}),r.d(t,"createIdentity",function(){return mi}),r.d(t,"createKron",function(){return di}),r.d(t,"createMap",function(){return gi}),r.d(t,"createOnes",function(){return xi}),r.d(t,"createRange",function(){return Ei}),r.d(t,"createReshape",function(){return Ai}),r.d(t,"createResize",function(){return _i}),r.d(t,"createRow",function(){return Bi}),r.d(t,"createSize",function(){return ki}),r.d(t,"createSqueeze",function(){return Ri}),r.d(t,"createSubset",function(){return Ji}),r.d(t,"createTranspose",function(){return ea}),r.d(t,"createCtranspose",function(){return na}),r.d(t,"createZeros",function(){return aa}),r.d(t,"createErf",function(){return sa}),r.d(t,"createMode",function(){return ha}),r.d(t,"createProd",function(){return ga}),r.d(t,"createFormat",function(){return ba}),r.d(t,"createPrint",function(){return wa}),r.d(t,"createTo",function(){return Ma}),r.d(t,"createIsPrime",function(){return Sa}),r.d(t,"createNumeric",function(){return Ca}),r.d(t,"createDivideScalar",function(){return Ia}),r.d(t,"createPow",function(){return qa}),r.d(t,"createRound",function(){return Fa}),r.d(t,"createLog",function(){return Ha}),r.d(t,"createLog1p",function(){return Ga}),r.d(t,"createNthRoots",function(){return Ja}),r.d(t,"createDotPow",function(){return Ya}),r.d(t,"createDotDivide",function(){return Ka}),r.d(t,"createLsolve",function(){return ro}),r.d(t,"createUsolve",function(){return io}),r.d(t,"createLeftShift",function(){return co}),r.d(t,"createRightArithShift",function(){return po}),r.d(t,"createRightLogShift",function(){return yo}),r.d(t,"createAnd",function(){return vo}),r.d(t,"createCompare",function(){return wo}),r.d(t,"createCompareNatural",function(){return jo}),r.d(t,"createCompareText",function(){return Co}),r.d(t,"createEqual",function(){return Io}),r.d(t,"createEqualText",function(){return ko}),r.d(t,"createSmaller",function(){return Ro}),r.d(t,"createSmallerEq",function(){return Uo}),r.d(t,"createLarger",function(){return $o}),r.d(t,"createLargerEq",function(){return Vo}),r.d(t,"createDeepEqual",function(){return Yo}),r.d(t,"createUnequal",function(){return Ko}),r.d(t,"createPartitionSelect",function(){return rs}),r.d(t,"createSort",function(){return is}),r.d(t,"createMax",function(){return os}),r.d(t,"createMin",function(){return us}),r.d(t,"createImmutableDenseMatrixClass",function(){return fs}),r.d(t,"createIndexClass",function(){return ps}),r.d(t,"createFibonacciHeapClass",function(){return hs}),r.d(t,"createSpaClass",function(){return ys}),r.d(t,"createUnitClass",function(){return Es}),r.d(t,"createUnitFunction",function(){return Ss}),r.d(t,"createSparse",function(){return Cs}),r.d(t,"createCreateUnit",function(){return Is}),r.d(t,"createAcos",function(){return qs}),r.d(t,"createAcosh",function(){return Ks}),r.d(t,"createAcot",function(){return tu}),r.d(t,"createAcoth",function(){return nu}),r.d(t,"createAcsc",function(){return au}),r.d(t,"createAcsch",function(){return su}),r.d(t,"createAsec",function(){return cu}),r.d(t,"createAsech",function(){return lu}),r.d(t,"createAsin",function(){return mu}),r.d(t,"createAsinh",function(){return du}),r.d(t,"createAtan",function(){return gu}),r.d(t,"createAtan2",function(){return bu}),r.d(t,"createAtanh",function(){return wu}),r.d(t,"createCos",function(){return Ou}),r.d(t,"createCosh",function(){return Eu}),r.d(t,"createCot",function(){return Su}),r.d(t,"createCoth",function(){return Cu}),r.d(t,"createCsc",function(){return _u}),r.d(t,"createCsch",function(){return Bu}),r.d(t,"createSec",function(){return ku}),r.d(t,"createSech",function(){return Du}),r.d(t,"createSin",function(){return Pu}),r.d(t,"createSinh",function(){return Uu}),r.d(t,"createTan",function(){return Hu}),r.d(t,"createTanh",function(){return Gu}),r.d(t,"createSetCartesian",function(){return Ju}),r.d(t,"createSetDifference",function(){return Xu}),r.d(t,"createSetDistinct",function(){return ec}),r.d(t,"createSetIntersect",function(){return nc}),r.d(t,"createSetIsSubset",function(){return oc}),r.d(t,"createSetMultiplicity",function(){return cc}),r.d(t,"createSetPowerset",function(){return pc}),r.d(t,"createSetSize",function(){return dc}),r.d(t,"createSetSymDifference",function(){return vc}),r.d(t,"createSetUnion",function(){return wc}),r.d(t,"createAdd",function(){return Oc}),r.d(t,"createHypot",function(){return Ec}),r.d(t,"createNorm",function(){return Sc}),r.d(t,"createDot",function(){return Cc}),r.d(t,"createTrace",function(){return _c}),r.d(t,"createIndex",function(){return Bc}),r.d(t,"createNode",function(){return Dc}),r.d(t,"createAccessorNode",function(){return Lc}),r.d(t,"createArrayNode",function(){return $c}),r.d(t,"createAssignmentNode",function(){return Xc}),r.d(t,"createBlockNode",function(){return Kc}),r.d(t,"createConditionalNode",function(){return tf}),r.d(t,"createConstantNode",function(){return pf}),r.d(t,"createFunctionAssignmentNode",function(){return hf}),r.d(t,"createIndexNode",function(){return bf}),r.d(t,"createObjectNode",function(){return Nf}),r.d(t,"createOperatorNode",function(){return Mf}),r.d(t,"createParenthesisNode",function(){return jf}),r.d(t,"createRangeNode",function(){return Af}),r.d(t,"createRelationalNode",function(){return Tf}),r.d(t,"createSymbolNode",function(){return If}),r.d(t,"createFunctionNode",function(){return zf}),r.d(t,"createParse",function(){return Pf}),r.d(t,"createCompile",function(){return Lf}),r.d(t,"createEvaluate",function(){return Gf}),r.d(t,"createDeprecatedEval",function(){return Zf}),r.d(t,"createParserClass",function(){return Jf}),r.d(t,"createParser",function(){return Yf}),r.d(t,"createLup",function(){return Qf}),r.d(t,"createQr",function(){return el}),r.d(t,"createSlu",function(){return bl}),r.d(t,"createLusolve",function(){return Ol}),r.d(t,"createHelpClass",function(){return El}),r.d(t,"createChainClass",function(){return Sl}),r.d(t,"createHelp",function(){return kl}),r.d(t,"createChain",function(){return Dl}),r.d(t,"createDet",function(){return Pl}),r.d(t,"createInv",function(){return Ul}),r.d(t,"createExpm",function(){return Hl}),r.d(t,"createSqrtm",function(){return Gl}),r.d(t,"createDivide",function(){return Vl}),r.d(t,"createDistance",function(){return Yl}),r.d(t,"createIntersect",function(){return Ql}),r.d(t,"createSum",function(){return ep}),r.d(t,"createMean",function(){return rp}),r.d(t,"createMedian",function(){return ip}),r.d(t,"createMad",function(){return op}),r.d(t,"createVariance",function(){return fp}),r.d(t,"createDeprecatedVar",function(){return lp}),r.d(t,"createQuantileSeq",function(){return mp}),r.d(t,"createStd",function(){return dp}),r.d(t,"createCombinations",function(){return xp}),r.d(t,"createCombinationsWithRep",function(){return Mp}),r.d(t,"createGamma",function(){return Tp}),r.d(t,"createFactorial",function(){return Bp}),r.d(t,"createKldivergence",function(){return zp}),r.d(t,"createMultinomial",function(){return Pp}),r.d(t,"createPermutations",function(){return Lp}),r.d(t,"createPickRandom",function(){return Wp}),r.d(t,"createRandom",function(){return Kp}),r.d(t,"createRandomInt",function(){return rm}),r.d(t,"createStirlingS2",function(){return am}),r.d(t,"createBellNumbers",function(){return um}),r.d(t,"createCatalan",function(){return lm}),r.d(t,"createComposition",function(){return hm}),r.d(t,"createSimplify",function(){return Em}),r.d(t,"createDerivative",function(){return Sm}),r.d(t,"createRationalize",function(){return Tm}),r.d(t,"createReviver",function(){return Im}),r.d(t,"createE",function(){return Hm}),r.d(t,"createUppercaseE",function(){return Km}),r.d(t,"createFalse",function(){return Dm}),r.d(t,"createI",function(){return Xm}),r.d(t,"createInfinity",function(){return Pm}),r.d(t,"createLN10",function(){return Zm}),r.d(t,"createLN2",function(){return Gm}),r.d(t,"createLOG10E",function(){return Jm}),r.d(t,"createLOG2E",function(){return Vm}),r.d(t,"createNaN",function(){return Fm}),r.d(t,"createNull",function(){return Rm}),r.d(t,"createPhi",function(){return $m}),r.d(t,"createPi",function(){return Um}),r.d(t,"createUppercasePi",function(){return Qm}),r.d(t,"createSQRT1_2",function(){return Wm}),r.d(t,"createSQRT2",function(){return Ym}),r.d(t,"createTau",function(){return Lm}),r.d(t,"createTrue",function(){return zm}),r.d(t,"createVersion",function(){return eh}),r.d(t,"createAtomicMass",function(){return _h}),r.d(t,"createAvogadro",function(){return Ih}),r.d(t,"createBohrMagneton",function(){return lh}),r.d(t,"createBohrRadius",function(){return gh}),r.d(t,"createBoltzmann",function(){return Bh}),r.d(t,"createClassicalElectronRadius",function(){return vh}),r.d(t,"createConductanceQuantum",function(){return ph}),r.d(t,"createCoulomb",function(){return ch}),r.d(t,"createDeuteronMass",function(){return Mh}),r.d(t,"createEfimovFactor",function(){return Th}),r.d(t,"createElectricConstant",function(){return sh}),r.d(t,"createElectronMass",function(){return bh}),r.d(t,"createElementaryCharge",function(){return fh}),r.d(t,"createFaraday",function(){return qh}),r.d(t,"createFermiCoupling",function(){return xh}),r.d(t,"createFineStructure",function(){return wh}),r.d(t,"createFirstRadiation",function(){return kh}),r.d(t,"createGasConstant",function(){return Dh}),r.d(t,"createGravitationConstant",function(){return nh}),r.d(t,"createGravity",function(){return Zh}),r.d(t,"createHartreeEnergy",function(){return Nh}),r.d(t,"createInverseConductanceQuantum",function(){return mh}),r.d(t,"createKlitzing",function(){return yh}),r.d(t,"createLoschmidt",function(){return zh}),r.d(t,"createMagneticConstant",function(){return oh}),r.d(t,"createMagneticFluxQuantum",function(){return hh}),r.d(t,"createMolarMass",function(){return $h}),r.d(t,"createMolarMassC12",function(){return Gh}),r.d(t,"createMolarPlanckConstant",function(){return Rh}),r.d(t,"createMolarVolume",function(){return Ph}),r.d(t,"createNeutronMass",function(){return Eh}),r.d(t,"createNuclearMagneton",function(){return dh}),r.d(t,"createPlanckCharge",function(){return Yh}),r.d(t,"createPlanckConstant",function(){return ih}),r.d(t,"createPlanckLength",function(){return Vh}),r.d(t,"createPlanckMass",function(){return Jh}),r.d(t,"createPlanckTemperature",function(){return Xh}),r.d(t,"createPlanckTime",function(){return Wh}),r.d(t,"createProtonMass",function(){return Oh}),r.d(t,"createQuantumOfCirculation",function(){return jh}),r.d(t,"createReducedPlanckConstant",function(){return ah}),r.d(t,"createRydberg",function(){return Sh}),r.d(t,"createSackurTetrode",function(){return Fh}),r.d(t,"createSecondRadiation",function(){return Uh}),r.d(t,"createSpeedOfLight",function(){return rh}),r.d(t,"createStefanBoltzmann",function(){return Lh}),r.d(t,"createThomsonCrossSection",function(){return Ah}),r.d(t,"createVacuumImpedance",function(){return uh}),r.d(t,"createWeakMixingAngle",function(){return Ch}),r.d(t,"createWienDisplacement",function(){return Hh}),r.d(t,"createApplyTransform",function(){return td}),r.d(t,"createColumnTransform",function(){return nd}),r.d(t,"createFilterTransform",function(){return od}),r.d(t,"createForEachTransform",function(){return cd}),r.d(t,"createIndexTransform",function(){return yf}),r.d(t,"createMapTransform",function(){return ld}),r.d(t,"createMaxTransform",function(){return hd}),r.d(t,"createMeanTransform",function(){return yd}),r.d(t,"createMinTransform",function(){return vd}),r.d(t,"createRangeTransform",function(){return xd}),r.d(t,"createRowTransform",function(){return Nd}),r.d(t,"createSubsetTransform",function(){return Md}),r.d(t,"createConcatTransform",function(){return jd}),r.d(t,"createStdTransform",function(){return Ad}),r.d(t,"createSumTransform",function(){return Td}),r.d(t,"createVarianceTransform",function(){return Bd})},function(e,t,r){"use strict";r.r(t);var v=r(3),n=r(18),i=r.n(n);var b=r(1),x=r(0),w=r(2),N=r(13),O=r(8);function M(e){return(M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function c(u,c,f,l){function s(e,t,r){if(r.wrap&&"function"==typeof t&&(t=function(i){function e(){for(var e=[],t=0,r=arguments.length;t<r;t++){var n=arguments[t];e[t]=n&&n.valueOf()}return i.apply(f,e)}i.transform&&(e.transform=i.transform);return e}(t)),function(e){return"function"==typeof e&&"string"==typeof e.signature}(t)&&(t=u(e,function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}({},t.signature,t))),h(f[e])&&h(t))return t=r.override?u(e,t.signatures):u(f[e],t),f[e]=t,delete l[e],n(e,t),void f.emit("import",e,function(){return t});if(void 0===f[e]||r.override)return f[e]=t,delete l[e],n(e,t),void f.emit("import",e,function(){return t});if(!r.silent)throw new Error('Cannot import "'+e+'": already exists')}function n(e,t){t&&"function"==typeof t.transform?(f.expression.transform[e]=t.transform,r(e)&&(f.expression.mathWithTransform[e]=t.transform)):(delete f.expression.transform[e],r(e)&&(f.expression.mathWithTransform[e]=t))}function p(e){delete f.expression.transform[e],r(e)?f.expression.mathWithTransform[e]=f[e]:delete f.expression.mathWithTransform[e]}function m(r,n,e){var i=2<arguments.length&&void 0!==e?e:r.fn;if(Object(w.b)(i,"."))throw new Error("Factory name should not contain a nested path. Name: "+JSON.stringify(i));function t(){var t={};r.dependencies.map(x.c).forEach(function(e){if(Object(w.b)(e,"."))throw new Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(e));"math"===e?t.math=f:"mathWithTransform"===e?t.mathWithTransform=f.expression.mathWithTransform:"classes"===e?t.classes=f:t[e]=f[e]});var e=r(t);if(e&&"function"==typeof e.transform)throw new Error('Transforms cannot be attached to factory functions. Please create a separate function for it with exports.path="expression.transform"');if(void 0===s||n.override)return e;if(h(s)&&h(e))return u(s,e);if(n.silent)return s;throw new Error('Cannot import "'+i+'": already exists')}var a=g(r)?f.expression.transform:f,o=i in f.expression.transform,s=Object(v.f)(a,i)?a[i]:void 0;r.meta&&!1===r.meta.lazy?a[i]=t():Object(v.h)(a,i,t),s&&o?p(i):(g(r)||y(r))&&Object(v.h)(f.expression.mathWithTransform,i,function(){return a[i]}),l[i]=r,f.emit("import",i,t)}function h(e){return"function"==typeof e&&"object"===M(e.signatures)}function r(e){return!Object(v.f)(t,e)}function d(e){return void 0===e.path&&!Object(v.f)(t,e.name)}function y(e){return!(-1!==e.fn.indexOf(".")||Object(v.f)(t,e.fn)||e.meta&&e.meta.isClass)}function g(e){return void 0!==e&&void 0!==e.meta&&!0===e.meta.isTransformFunction||!1}var t={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return function(e,o){var t=arguments.length;if(1!==t&&2!==t)throw new N.a("import",t,1,2);o=o||{};var r,n={};for(var i in function t(r,e,n){if(Object(v.g)(e))!function(t,r){if(Object(O.a)("Factories of type { name, factory } are deprecated since v6. Please create your factory functions using the math.factory function."),"string"==typeof t.name){var n=t.name,e=n in f.expression.transform,i=t.path?Object(v.k)(f,t.path):f,a=Object(v.f)(i,n)?i[n]:void 0,o=function(){var e=c(t);if(e&&"function"==typeof e.transform)throw new Error('Transforms cannot be attached to factory functions. Please create a separate function for it with exports.path="expression.transform"');if(h(a)&&h(e))return r.override||(e=u(a,e)),e;if(void 0===a||r.override)return e;if(r.silent)return a;throw new Error('Cannot import "'+n+'": already exists')};!1!==t.lazy?(Object(v.h)(i,n,o),e?p(n):"expression.transform"!==t.path&&!d(t)||Object(v.h)(f.expression.mathWithTransform,n,o)):(i[n]=o(),e?p(n):"expression.transform"!==t.path&&!d(t)||(f.expression.mathWithTransform[n]=o()));var s=t.path?t.path+"."+t.name:t.name;l[s]=t,f.emit("import",n,o,t.path)}else c(t)}(e,o);else if(Array.isArray(e))e.forEach(function(e){return t(r,e)});else if("object"===M(e))for(var i in e)Object(v.f)(e,i)&&t(r,e[i],i);else if(Object(x.b)(e)||void 0!==n){var a=Object(x.b)(e)?g(e)?e.fn+".transform":e.fn:n;if(Object(v.f)(r,a)&&r[a]!==e&&!o.silent)throw new Error('Cannot import "'+a+'" twice');r[a]=e}else if(!o.silent)throw new TypeError("Factory, Object, or Array expected")}(n,e),n)if(Object(v.f)(n,i)){var a=n[i];if(Object(x.b)(a))m(a,o);else if("function"==typeof(r=a)||"number"==typeof r||"string"==typeof r||"boolean"==typeof r||null===r||Object(b.L)(r)||Object(b.j)(r)||Object(b.e)(r)||Object(b.o)(r)||Object(b.v)(r)||Array.isArray(r))s(i,a,o);else if(!o.silent)throw new TypeError("Factory, Object, or Array expected")}}}var f={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null},l=["Matrix","Array"],p=["number","BigNumber","Fraction"];function m(e,t,r){if(void 0!==e[t]&&!function(e,t){return-1!==e.indexOf(t)}(r,e[t])){var n=function(e,t){return e.map(function(e){return e.toLowerCase()}).indexOf(t.toLowerCase())}(r,e[t]);-1!==n?(console.warn('Warning: Wrong casing for configuration option "'+t+'", should be "'+r[n]+'" instead of "'+e[t]+'".'),e[t]=r[n]):console.warn('Warning: Unknown value "'+e[t]+'" for configuration option "'+t+'". Available options: '+r.map(JSON.stringify).join(", ")+".")}}var h=r(6),d=r(10);function y(){return(y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function g(e,t){var a=y({},f,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 o=function(e){var t=new i.a;return e.on=t.on.bind(t),e.off=t.off.bind(t),e.once=t.once.bind(t),e.emit=t.emit.bind(t),e}({isNumber:b.y,isComplex:b.j,isBigNumber:b.e,isFraction:b.o,isUnit:b.L,isString:b.I,isArray:b.b,isMatrix:b.v,isCollection:b.i,isDenseMatrix:b.n,isSparseMatrix:b.H,isRange:b.D,isIndex:b.t,isBoolean:b.g,isResultSet:b.G,isHelp:b.s,isFunction:b.p,isDate:b.m,isRegExp:b.F,isObject:b.z,isNull:b.x,isUndefined:b.K,isAccessorNode:b.a,isArrayNode:b.c,isAssignmentNode:b.d,isBlockNode:b.f,isConditionalNode:b.k,isConstantNode:b.l,isFunctionAssignmentNode:b.q,isFunctionNode:b.r,isIndexNode:b.u,isNode:b.w,isObjectNode:b.A,isOperatorNode:b.B,isParenthesisNode:b.C,isRangeNode:b.E,isSymbolNode:b.J,isChain:b.h});o.config=function(i,a){function t(e){if(e){var t=Object(v.i)(i,v.a);m(e,"matrix",l),m(e,"number",p),Object(v.b)(i,e);var r=Object(v.i)(i,v.a),n=Object(v.i)(e,v.a);return a("config",r,t,n),r}return Object(v.i)(i,v.a)}return t.MATRIX_OPTIONS=l,t.NUMBER_OPTIONS=p,Object.keys(f).forEach(function(e){Object.defineProperty(t,e,{get:function(){return i[e]},enumerable:!0,configurable:!0})}),t}(a,o.emit),o.expression={transform:{},mathWithTransform:{config:o.config}};var s=[],u=[];var r={};var n=c(function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return o.typed.apply(o.typed,t)},function e(t){if(Object(x.b)(t))return t(o);var r=t[Object.keys(t)[0]];if(Object(x.b)(r))return r(o);if(!Object(v.g)(t))throw console.warn("Factory object with properties `type`, `name`, and `factory` expected",t),new Error("Factory object with properties `type`, `name`, and `factory` expected");var n,i=s.indexOf(t);return-1===i?(n=!0===t.math?t.factory(o.type,a,e,o.typed,o):t.factory(o.type,a,e,o.typed),s.push(t),u.push(n)):n=u[i],n},o,r);o.import=n,o.on("config",function(){Object(v.l)(r).forEach(function(e){e&&e.meta&&e.meta.recreateOnConfigChange&&n(e,{override:!0})})}),o.create=g.bind(null,e),o.factory=x.a,o.import(Object(v.l)(Object(v.c)(e)));return["type.isNumber","type.isComplex","type.isBigNumber","type.isFraction","type.isUnit","type.isString","type.isArray","type.isMatrix","type.isDenseMatrix","type.isSparseMatrix","type.isCollection","type.isRange","type.isIndex","type.isBoolean","type.isResultSet","type.isHelp","type.isFunction","type.isDate","type.isRegExp","type.isObject","type.isNull","type.isUndefined","type.isAccessorNode","type.isArrayNode","type.isAssignmentNode","type.isBlockNode","type.isConditionalNode","type.isConstantNode","type.isFunctionAssignmentNode","type.isFunctionNode","type.isIndexNode","type.isNode","type.isObjectNode","type.isOperatorNode","type.isParenthesisNode","type.isRangeNode","type.isSymbolNode","type.isChain","type.BigNumber","type.Chain","type.Complex","type.Fraction","type.Matrix","type.DenseMatrix","type.SparseMatrix","type.Spa","type.FibonacciHeap","type.ImmutableDenseMatrix","type.Index","type.Range","type.ResultSet","type.Unit","type.Help","type.Parser","expression.parse","expression.Parser","expression.node.AccessorNode","expression.node.ArrayNode","expression.node.AssignmentNode","expression.node.BlockNode","expression.node.ConditionalNode","expression.node.ConstantNode","expression.node.IndexNode","expression.node.FunctionAssignmentNode","expression.node.FunctionNode","expression.node.Node","expression.node.ObjectNode","expression.node.OperatorNode","expression.node.ParenthesisNode","expression.node.RangeNode","expression.node.RelationalNode","expression.node.SymbolNode","json.reviver","error.ArgumentsError","error.DimensionError","error.IndexError"].forEach(function(e){var t=e.split("."),r=Object(w.j)(t),n=Object(w.l)(t),i=Object(v.k)(o,r);Object(v.h)(i,n,function(){return Object(O.a)("math.".concat(e," is moved to math.").concat(n," in v6.0.0. ")+"Please use the new location instead."),o[n]})}),Object(v.h)(o.expression,"docs",function(){throw new Error("math.expression.docs has been moved. Please import via \"import { docs } from 'mathjs'\"")}),o.ArgumentsError=N.a,o.DimensionError=h.a,o.IndexError=d.a,o}r.d(t,"create",function(){return g})}],i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(r,n,function(e){return t[e]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=19);function i(e){if(n[e])return n[e].exports;var t=n[e]={i:e,l:!1,exports:{}};return r[e].call(t.exports,t,t.exports,i),t.l=!0,t.exports}var r,n});
//# sourceMappingURL=math.min.map
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).jsyaml=e()}}(function(){return function o(a,s,c){function u(t,e){if(!s[t]){if(!a[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(l)return l(t,!0);var i=new Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}var r=s[t]={exports:{}};a[t][0].call(r.exports,function(e){return u(a[t][1][e]||e)},r,r.exports,o,a,s,c)}return s[t].exports}for(var l="function"==typeof require&&require,e=0;e<c.length;e++)u(c[e]);return u}({1:[function(e,t,n){"use strict";var i=e("./js-yaml/loader"),r=e("./js-yaml/dumper");function o(e){return function(){throw new Error("Function "+e+" is deprecated and cannot be used.")}}t.exports.Type=e("./js-yaml/type"),t.exports.Schema=e("./js-yaml/schema"),t.exports.FAILSAFE_SCHEMA=e("./js-yaml/schema/failsafe"),t.exports.JSON_SCHEMA=e("./js-yaml/schema/json"),t.exports.CORE_SCHEMA=e("./js-yaml/schema/core"),t.exports.DEFAULT_SAFE_SCHEMA=e("./js-yaml/schema/default_safe"),t.exports.DEFAULT_FULL_SCHEMA=e("./js-yaml/schema/default_full"),t.exports.load=i.load,t.exports.loadAll=i.loadAll,t.exports.safeLoad=i.safeLoad,t.exports.safeLoadAll=i.safeLoadAll,t.exports.dump=r.dump,t.exports.safeDump=r.safeDump,t.exports.YAMLException=e("./js-yaml/exception"),t.exports.MINIMAL_SCHEMA=e("./js-yaml/schema/failsafe"),t.exports.SAFE_SCHEMA=e("./js-yaml/schema/default_safe"),t.exports.DEFAULT_SCHEMA=e("./js-yaml/schema/default_full"),t.exports.scan=o("scan"),t.exports.parse=o("parse"),t.exports.compose=o("compose"),t.exports.addConstructor=o("addConstructor")},{"./js-yaml/dumper":3,"./js-yaml/exception":4,"./js-yaml/loader":5,"./js-yaml/schema":7,"./js-yaml/schema/core":8,"./js-yaml/schema/default_full":9,"./js-yaml/schema/default_safe":10,"./js-yaml/schema/failsafe":11,"./js-yaml/schema/json":12,"./js-yaml/type":13}],2:[function(e,t,n){"use strict";function i(e){return null==e}t.exports.isNothing=i,t.exports.isObject=function(e){return"object"==typeof e&&null!==e},t.exports.toArray=function(e){return Array.isArray(e)?e:i(e)?[]:[e]},t.exports.repeat=function(e,t){var n,i="";for(n=0;n<t;n+=1)i+=e;return i},t.exports.isNegativeZero=function(e){return 0===e&&Number.NEGATIVE_INFINITY===1/e},t.exports.extend=function(e,t){var n,i,r,o;if(t)for(n=0,i=(o=Object.keys(t)).length;n<i;n+=1)e[r=o[n]]=t[r];return e}},{}],3:[function(e,t,n){"use strict";var c=e("./common"),d=e("./exception"),i=e("./schema/default_full"),r=e("./schema/default_safe"),p=Object.prototype.toString,u=Object.prototype.hasOwnProperty,o=9,h=10,a=32,f=33,m=34,g=35,y=37,x=38,v=39,A=42,b=44,w=45,C=58,k=62,j=63,S=64,I=91,O=93,E=96,F=123,_=124,N=125,s={0:"\\0",7:"\\a",8:"\\b",9:"\\t",10:"\\n",11:"\\v",12:"\\f",13:"\\r",27:"\\e",34:'\\"',92:"\\\\",133:"\\N",160:"\\_",8232:"\\L",8233:"\\P"},l=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"];function M(e){var t,n,i;if(t=e.toString(16).toUpperCase(),e<=255)n="x",i=2;else if(e<=65535)n="u",i=4;else{if(!(e<=4294967295))throw new d("code point within a string may not be greater than 0xFFFFFFFF");n="U",i=8}return"\\"+n+c.repeat("0",i-t.length)+t}function T(e){this.schema=e.schema||i,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=c.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=function(e,t){var n,i,r,o,a,s,c;if(null===t)return{};for(n={},r=0,o=(i=Object.keys(t)).length;r<o;r+=1)a=i[r],s=String(t[a]),"!!"===a.slice(0,2)&&(a="tag:yaml.org,2002:"+a.slice(2)),(c=e.compiledTypeMap.fallback[a])&&u.call(c.styleAliases,s)&&(s=c.styleAliases[s]),n[a]=s;return n}(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function L(e,t){for(var n,i=c.repeat(" ",t),r=0,o=-1,a="",s=e.length;r<s;)r=-1===(o=e.indexOf("\n",r))?(n=e.slice(r),s):(n=e.slice(r,o+1),o+1),n.length&&"\n"!==n&&(a+=i),a+=n;return a}function D(e,t){return"\n"+c.repeat(" ",e.indent*t)}function U(e){return e===a||e===o}function q(e){return 32<=e&&e<=126||161<=e&&e<=55295&&8232!==e&&8233!==e||57344<=e&&e<=65533&&65279!==e||65536<=e&&e<=1114111}function Y(e){return q(e)&&65279!==e&&e!==b&&e!==I&&e!==O&&e!==F&&e!==N&&e!==C&&e!==g}function R(e){return/^\n* /.test(e)}var B=1,P=2,W=3,K=4,$=5;function H(e,t,n,i,r){var o,a,s=!1,c=!1,u=-1!==i,l=-1,p=function(e){return q(e)&&65279!==e&&!U(e)&&e!==w&&e!==j&&e!==C&&e!==b&&e!==I&&e!==O&&e!==F&&e!==N&&e!==g&&e!==x&&e!==A&&e!==f&&e!==_&&e!==k&&e!==v&&e!==m&&e!==y&&e!==S&&e!==E}(e.charCodeAt(0))&&!U(e.charCodeAt(e.length-1));if(t)for(o=0;o<e.length;o++){if(!q(a=e.charCodeAt(o)))return $;p=p&&Y(a)}else{for(o=0;o<e.length;o++){if((a=e.charCodeAt(o))===h)s=!0,u&&(c=c||i<o-l-1&&" "!==e[l+1],l=o);else if(!q(a))return $;p=p&&Y(a)}c=c||u&&i<o-l-1&&" "!==e[l+1]}return s||c?9<n&&R(e)?$:c?K:W:p&&!r(e)?B:P}function G(i,r,o,a){i.dump=function(){if(0===r.length)return"''";if(!i.noCompatMode&&-1!==l.indexOf(r))return"'"+r+"'";var e=i.indent*Math.max(1,o),t=-1===i.lineWidth?-1:Math.max(Math.min(i.lineWidth,40),i.lineWidth-e),n=a||-1<i.flowLevel&&o>=i.flowLevel;switch(H(r,n,i.indent,t,function(e){return function(e,t){var n,i;for(n=0,i=e.implicitTypes.length;n<i;n+=1)if(e.implicitTypes[n].resolve(t))return!0;return!1}(i,e)})){case B:return r;case P:return"'"+r.replace(/'/g,"''")+"'";case W:return"|"+V(r,i.indent)+Z(L(r,e));case K:return">"+V(r,i.indent)+Z(L(function(t,n){var e,i,r=/(\n+)([^\n]*)/g,o=function(){var e=t.indexOf("\n");return e=-1!==e?e:t.length,r.lastIndex=e,z(t.slice(0,e),n)}(),a="\n"===t[0]||" "===t[0];for(;i=r.exec(t);){var s=i[1],c=i[2];e=" "===c[0],o+=s+(a||e||""===c?"":"\n")+z(c,n),a=e}return o}(r,t),e));case $:return'"'+function(e){for(var t,n,i,r="",o=0;o<e.length;o++)55296<=(t=e.charCodeAt(o))&&t<=56319&&56320<=(n=e.charCodeAt(o+1))&&n<=57343?(r+=M(1024*(t-55296)+n-56320+65536),o++):(i=s[t],r+=!i&&q(t)?e[o]:i||M(t));return r}(r)+'"';default:throw new d("impossible error: invalid scalar style")}}()}function V(e,t){var n=R(e)?String(t):"",i="\n"===e[e.length-1];return n+(i&&("\n"===e[e.length-2]||"\n"===e)?"+":i?"":"-")+"\n"}function Z(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function z(e,t){if(""===e||" "===e[0])return e;for(var n,i,r=/ [^ ]/g,o=0,a=0,s=0,c="";n=r.exec(e);)t<(s=n.index)-o&&(i=o<a?a:s,c+="\n"+e.slice(o,i),o=i+1),a=s;return c+="\n",e.length-o>t&&o<a?c+=e.slice(o,a)+"\n"+e.slice(a+1):c+=e.slice(o),c.slice(1)}function J(e,t,n){var i,r,o,a,s,c;for(o=0,a=(r=n?e.explicitTypes:e.implicitTypes).length;o<a;o+=1)if(((s=r[o]).instanceOf||s.predicate)&&(!s.instanceOf||"object"==typeof t&&t instanceof s.instanceOf)&&(!s.predicate||s.predicate(t))){if(e.tag=n?s.tag:"?",s.represent){if(c=e.styleMap[s.tag]||s.defaultStyle,"[object Function]"===p.call(s.represent))i=s.represent(t,c);else{if(!u.call(s.represent,c))throw new d("!<"+s.tag+'> tag resolver accepts not "'+c+'" style');i=s.represent[c](t,c)}e.dump=i}return!0}return!1}function Q(e,t,n,i,r,o){e.tag=null,e.dump=n,J(e,n,!1)||J(e,n,!0);var a=p.call(e.dump);i&&(i=e.flowLevel<0||e.flowLevel>t);var s,c,u="[object Object]"===a||"[object Array]"===a;if(u&&(c=-1!==(s=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||c||2!==e.indent&&0<t)&&(r=!1),c&&e.usedDuplicates[s])e.dump="*ref_"+s;else{if(u&&c&&!e.usedDuplicates[s]&&(e.usedDuplicates[s]=!0),"[object Object]"===a)i&&0!==Object.keys(e.dump).length?(function(e,t,n,i){var r,o,a,s,c,u,l="",p=e.tag,f=Object.keys(n);if(!0===e.sortKeys)f.sort();else if("function"==typeof e.sortKeys)f.sort(e.sortKeys);else if(e.sortKeys)throw new d("sortKeys must be a boolean or a function");for(r=0,o=f.length;r<o;r+=1)u="",i&&0===r||(u+=D(e,t)),s=n[a=f[r]],Q(e,t+1,a,!0,!0,!0)&&((c=null!==e.tag&&"?"!==e.tag||e.dump&&1024<e.dump.length)&&(e.dump&&h===e.dump.charCodeAt(0)?u+="?":u+="? "),u+=e.dump,c&&(u+=D(e,t)),Q(e,t+1,s,!0,c)&&(e.dump&&h===e.dump.charCodeAt(0)?u+=":":u+=": ",l+=u+=e.dump));e.tag=p,e.dump=l||"{}"}(e,t,e.dump,r),c&&(e.dump="&ref_"+s+e.dump)):(function(e,t,n){var i,r,o,a,s,c="",u=e.tag,l=Object.keys(n);for(i=0,r=l.length;i<r;i+=1)s=e.condenseFlow?'"':"",0!==i&&(s+=", "),a=n[o=l[i]],Q(e,t,o,!1,!1)&&(1024<e.dump.length&&(s+="? "),s+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Q(e,t,a,!1,!1)&&(c+=s+=e.dump));e.tag=u,e.dump="{"+c+"}"}(e,t,e.dump),c&&(e.dump="&ref_"+s+" "+e.dump));else if("[object Array]"===a){var l=e.noArrayIndent&&0<t?t-1:t;i&&0!==e.dump.length?(function(e,t,n,i){var r,o,a="",s=e.tag;for(r=0,o=n.length;r<o;r+=1)Q(e,t+1,n[r],!0,!0)&&(i&&0===r||(a+=D(e,t)),e.dump&&h===e.dump.charCodeAt(0)?a+="-":a+="- ",a+=e.dump);e.tag=s,e.dump=a||"[]"}(e,l,e.dump,r),c&&(e.dump="&ref_"+s+e.dump)):(function(e,t,n){var i,r,o="",a=e.tag;for(i=0,r=n.length;i<r;i+=1)Q(e,t,n[i],!1,!1)&&(0!==i&&(o+=","+(e.condenseFlow?"":" ")),o+=e.dump);e.tag=a,e.dump="["+o+"]"}(e,l,e.dump),c&&(e.dump="&ref_"+s+" "+e.dump))}else{if("[object String]"!==a){if(e.skipInvalid)return!1;throw new d("unacceptable kind of an object to dump "+a)}"?"!==e.tag&&G(e,e.dump,t,o)}null!==e.tag&&"?"!==e.tag&&(e.dump="!<"+e.tag+"> "+e.dump)}return!0}function X(e,t){var n,i,r=[],o=[];for(function e(t,n,i){var r,o,a;if(null!==t&&"object"==typeof t)if(-1!==(o=n.indexOf(t)))-1===i.indexOf(o)&&i.push(o);else if(n.push(t),Array.isArray(t))for(o=0,a=t.length;o<a;o+=1)e(t[o],n,i);else for(r=Object.keys(t),o=0,a=r.length;o<a;o+=1)e(t[r[o]],n,i)}(e,r,o),n=0,i=o.length;n<i;n+=1)t.duplicates.push(r[o[n]]);t.usedDuplicates=new Array(i)}function ee(e,t){var n=new T(t=t||{});return n.noRefs||X(e,n),Q(n,0,e,!0,!0)?n.dump+"\n":""}t.exports.dump=ee,t.exports.safeDump=function(e,t){return ee(e,c.extend({schema:r},t))}},{"./common":2,"./exception":4,"./schema/default_full":9,"./schema/default_safe":10}],4:[function(e,t,n){"use strict";function i(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():""),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}((i.prototype=Object.create(Error.prototype)).constructor=i).prototype.toString=function(e){var t=this.name+": ";return t+=this.reason||"(unknown reason)",!e&&this.mark&&(t+=" "+this.mark.toString()),t},t.exports=i},{}],5:[function(e,t,n){"use strict";var g=e("./common"),i=e("./exception"),r=e("./mark"),o=e("./schema/default_safe"),a=e("./schema/default_full"),y=Object.prototype.hasOwnProperty,x=1,v=2,A=3,b=4,w=1,C=2,k=3,c=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,s=/[\x85\u2028\u2029]/,u=/[,\[\]\{\}]/,l=/^(?:!|!!|![a-z\-]+!)$/i,p=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function f(e){return Object.prototype.toString.call(e)}function j(e){return 10===e||13===e}function S(e){return 9===e||32===e}function I(e){return 9===e||32===e||10===e||13===e}function O(e){return 44===e||91===e||93===e||123===e||125===e}function d(e){return 48===e?"\0":97===e?"":98===e?"\b":116===e?"\t":9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"…":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}for(var E=new Array(256),F=new Array(256),h=0;h<256;h++)E[h]=d(h)?1:0,F[h]=d(h);function m(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||a,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function _(e,t){return new i(t,new r(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function N(e,t){throw _(e,t)}function M(e,t){e.onWarning&&e.onWarning.call(null,_(e,t))}var T={YAML:function(e,t,n){var i,r,o;null!==e.version&&N(e,"duplication of %YAML directive"),1!==n.length&&N(e,"YAML directive accepts exactly one argument"),null===(i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&N(e,"ill-formed argument of the YAML directive"),r=parseInt(i[1],10),o=parseInt(i[2],10),1!==r&&N(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,1!==o&&2!==o&&M(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var i,r;2!==n.length&&N(e,"TAG directive accepts exactly two arguments"),i=n[0],r=n[1],l.test(i)||N(e,"ill-formed tag handle (first argument) of the TAG directive"),y.call(e.tagMap,i)&&N(e,'there is a previously declared suffix for "'+i+'" tag handle'),p.test(r)||N(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[i]=r}};function L(e,t,n,i){var r,o,a,s;if(t<n){if(s=e.input.slice(t,n),i)for(r=0,o=s.length;r<o;r+=1)9===(a=s.charCodeAt(r))||32<=a&&a<=1114111||N(e,"expected valid JSON character");else c.test(s)&&N(e,"the stream contains non-printable characters");e.result+=s}}function D(e,t,n,i){var r,o,a,s;for(g.isObject(n)||N(e,"cannot merge mappings; the provided source object is unacceptable"),a=0,s=(r=Object.keys(n)).length;a<s;a+=1)o=r[a],y.call(t,o)||(t[o]=n[o],i[o]=!0)}function U(e,t,n,i,r,o,a,s){var c,u;if(Array.isArray(r))for(c=0,u=(r=Array.prototype.slice.call(r)).length;c<u;c+=1)Array.isArray(r[c])&&N(e,"nested arrays are not supported inside keys"),"object"==typeof r&&"[object Object]"===f(r[c])&&(r[c]="[object Object]");if("object"==typeof r&&"[object Object]"===f(r)&&(r="[object Object]"),r=String(r),null===t&&(t={}),"tag:yaml.org,2002:merge"===i)if(Array.isArray(o))for(c=0,u=o.length;c<u;c+=1)D(e,t,o[c],n);else D(e,t,o,n);else e.json||y.call(n,r)||!y.call(t,r)||(e.line=a||e.line,e.position=s||e.position,N(e,"duplicated mapping key")),t[r]=o,delete n[r];return t}function q(e){var t;10===(t=e.input.charCodeAt(e.position))?e.position++:13===t?(e.position++,10===e.input.charCodeAt(e.position)&&e.position++):N(e,"a line break is expected"),e.line+=1,e.lineStart=e.position}function Y(e,t,n){for(var i=0,r=e.input.charCodeAt(e.position);0!==r;){for(;S(r);)r=e.input.charCodeAt(++e.position);if(t&&35===r)for(;10!==(r=e.input.charCodeAt(++e.position))&&13!==r&&0!==r;);if(!j(r))break;for(q(e),r=e.input.charCodeAt(e.position),i++,e.lineIndent=0;32===r;)e.lineIndent++,r=e.input.charCodeAt(++e.position)}return-1!==n&&0!==i&&e.lineIndent<n&&M(e,"deficient indentation"),i}function R(e){var t,n=e.position;return!(45!==(t=e.input.charCodeAt(n))&&46!==t||t!==e.input.charCodeAt(n+1)||t!==e.input.charCodeAt(n+2)||(n+=3,0!==(t=e.input.charCodeAt(n))&&!I(t)))}function B(e,t){1===t?e.result+=" ":1<t&&(e.result+=g.repeat("\n",t-1))}function P(e,t){var n,i,r=e.tag,o=e.anchor,a=[],s=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),i=e.input.charCodeAt(e.position);0!==i&&45===i&&I(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,Y(e,!0,-1)&&e.lineIndent<=t)a.push(null),i=e.input.charCodeAt(e.position);else if(n=e.line,$(e,t,A,!1,!0),a.push(e.result),Y(e,!0,-1),i=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==i)N(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break;return!!s&&(e.tag=r,e.anchor=o,e.kind="sequence",e.result=a,!0)}function W(e){var t,n,i,r,o=!1,a=!1;if(33!==(r=e.input.charCodeAt(e.position)))return!1;if(null!==e.tag&&N(e,"duplication of a tag property"),60===(r=e.input.charCodeAt(++e.position))?(o=!0,r=e.input.charCodeAt(++e.position)):33===r?(a=!0,n="!!",r=e.input.charCodeAt(++e.position)):n="!",t=e.position,o){for(;0!==(r=e.input.charCodeAt(++e.position))&&62!==r;);e.position<e.length?(i=e.input.slice(t,e.position),r=e.input.charCodeAt(++e.position)):N(e,"unexpected end of the stream within a verbatim tag")}else{for(;0!==r&&!I(r);)33===r&&(a?N(e,"tag suffix cannot contain exclamation marks"):(n=e.input.slice(t-1,e.position+1),l.test(n)||N(e,"named tag handle cannot contain such characters"),a=!0,t=e.position+1)),r=e.input.charCodeAt(++e.position);i=e.input.slice(t,e.position),u.test(i)&&N(e,"tag suffix cannot contain flow indicator characters")}return i&&!p.test(i)&&N(e,"tag name cannot contain such characters: "+i),o?e.tag=i:y.call(e.tagMap,n)?e.tag=e.tagMap[n]+i:"!"===n?e.tag="!"+i:"!!"===n?e.tag="tag:yaml.org,2002:"+i:N(e,'undeclared tag handle "'+n+'"'),!0}function K(e){var t,n;if(38!==(n=e.input.charCodeAt(e.position)))return!1;for(null!==e.anchor&&N(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;0!==n&&!I(n)&&!O(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&N(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function $(e,t,n,i,r){var o,a,s,c,u,l,p,f,d=1,h=!1,m=!1;if(null!==e.listener&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,o=a=s=b===n||A===n,i&&Y(e,!0,-1)&&(h=!0,e.lineIndent>t?d=1:e.lineIndent===t?d=0:e.lineIndent<t&&(d=-1)),1===d)for(;W(e)||K(e);)Y(e,!0,-1)?(h=!0,s=o,e.lineIndent>t?d=1:e.lineIndent===t?d=0:e.lineIndent<t&&(d=-1)):s=!1;if(s&&(s=h||r),1!==d&&b!==n||(p=x===n||v===n?t:t+1,f=e.position-e.lineStart,1===d?s&&(P(e,f)||function(e,t,n){var i,r,o,a,s,c=e.tag,u=e.anchor,l={},p={},f=null,d=null,h=null,m=!1,g=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=l),s=e.input.charCodeAt(e.position);0!==s;){if(i=e.input.charCodeAt(e.position+1),o=e.line,a=e.position,63!==s&&58!==s||!I(i)){if(!$(e,n,v,!1,!0))break;if(e.line===o){for(s=e.input.charCodeAt(e.position);S(s);)s=e.input.charCodeAt(++e.position);if(58===s)I(s=e.input.charCodeAt(++e.position))||N(e,"a whitespace character is expected after the key-value separator within a block mapping"),m&&(U(e,l,p,f,d,null),f=d=h=null),r=m=!(g=!0),f=e.tag,d=e.result;else{if(!g)return e.tag=c,e.anchor=u,!0;N(e,"can not read an implicit mapping pair; a colon is missed")}}else{if(!g)return e.tag=c,e.anchor=u,!0;N(e,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===s?(m&&(U(e,l,p,f,d,null),f=d=h=null),r=m=g=!0):m?r=!(m=!1):N(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,s=i;if((e.line===o||e.lineIndent>t)&&($(e,t,b,!0,r)&&(m?d=e.result:h=e.result),m||(U(e,l,p,f,d,h,o,a),f=d=h=null),Y(e,!0,-1),s=e.input.charCodeAt(e.position)),e.lineIndent>t&&0!==s)N(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return m&&U(e,l,p,f,d,null),g&&(e.tag=c,e.anchor=u,e.kind="mapping",e.result=l),g}(e,f,p))||function(e,t){var n,i,r,o,a,s,c,u,l,p,f=!0,d=e.tag,h=e.anchor,m={};if(91===(p=e.input.charCodeAt(e.position)))s=!(r=93),i=[];else{if(123!==p)return!1;r=125,s=!0,i={}}for(null!==e.anchor&&(e.anchorMap[e.anchor]=i),p=e.input.charCodeAt(++e.position);0!==p;){if(Y(e,!0,t),(p=e.input.charCodeAt(e.position))===r)return e.position++,e.tag=d,e.anchor=h,e.kind=s?"mapping":"sequence",e.result=i,!0;f||N(e,"missed comma between flow collection entries"),l=null,o=a=!1,63===p&&I(e.input.charCodeAt(e.position+1))&&(o=a=!0,e.position++,Y(e,!0,t)),n=e.line,$(e,t,x,!1,!0),u=e.tag,c=e.result,Y(e,!0,t),p=e.input.charCodeAt(e.position),!a&&e.line!==n||58!==p||(o=!0,p=e.input.charCodeAt(++e.position),Y(e,!0,t),$(e,t,x,!1,!0),l=e.result),s?U(e,i,m,u,c,l):o?i.push(U(e,null,m,u,c,l)):i.push(c),Y(e,!0,t),44===(p=e.input.charCodeAt(e.position))?(f=!0,p=e.input.charCodeAt(++e.position)):f=!1}N(e,"unexpected end of the stream within a flow collection")}(e,p)?m=!0:(a&&function(e,t){var n,i,r,o,a,s=w,c=!1,u=!1,l=t,p=0,f=!1;if(124===(o=e.input.charCodeAt(e.position)))i=!1;else{if(62!==o)return!1;i=!0}for(e.kind="scalar",e.result="";0!==o;)if(43===(o=e.input.charCodeAt(++e.position))||45===o)w===s?s=43===o?k:C:N(e,"repeat of a chomping mode identifier");else{if(!(0<=(r=48<=(a=o)&&a<=57?a-48:-1)))break;0==r?N(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):u?N(e,"repeat of an indentation width identifier"):(l=t+r-1,u=!0)}if(S(o)){for(;S(o=e.input.charCodeAt(++e.position)););if(35===o)for(;!j(o=e.input.charCodeAt(++e.position))&&0!==o;);}for(;0!==o;){for(q(e),e.lineIndent=0,o=e.input.charCodeAt(e.position);(!u||e.lineIndent<l)&&32===o;)e.lineIndent++,o=e.input.charCodeAt(++e.position);if(!u&&e.lineIndent>l&&(l=e.lineIndent),j(o))p++;else{if(e.lineIndent<l){s===k?e.result+=g.repeat("\n",c?1+p:p):s===w&&c&&(e.result+="\n");break}for(i?S(o)?(f=!0,e.result+=g.repeat("\n",c?1+p:p)):f?(f=!1,e.result+=g.repeat("\n",p+1)):0===p?c&&(e.result+=" "):e.result+=g.repeat("\n",p):e.result+=g.repeat("\n",c?1+p:p),u=c=!0,p=0,n=e.position;!j(o)&&0!==o;)o=e.input.charCodeAt(++e.position);L(e,n,e.position,!1)}}return!0}(e,p)||function(e,t){var n,i,r;if(39!==(n=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,i=r=e.position;0!==(n=e.input.charCodeAt(e.position));)if(39===n){if(L(e,i,e.position,!0),39!==(n=e.input.charCodeAt(++e.position)))return!0;i=e.position,e.position++,r=e.position}else j(n)?(L(e,i,r,!0),B(e,Y(e,!1,t)),i=r=e.position):e.position===e.lineStart&&R(e)?N(e,"unexpected end of the document within a single quoted scalar"):(e.position++,r=e.position);N(e,"unexpected end of the stream within a single quoted scalar")}(e,p)||function(e,t){var n,i,r,o,a,s,c,u,l,p;if(34!==(s=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,n=i=e.position;0!==(s=e.input.charCodeAt(e.position));){if(34===s)return L(e,n,e.position,!0),e.position++,!0;if(92===s){if(L(e,n,e.position,!0),j(s=e.input.charCodeAt(++e.position)))Y(e,!1,t);else if(s<256&&E[s])e.result+=F[s],e.position++;else if(0<(a=120===(p=s)?2:117===p?4:85===p?8:0)){for(r=a,o=0;0<r;r--)s=e.input.charCodeAt(++e.position),l=void 0,0<=(a=48<=(u=s)&&u<=57?u-48:97<=(l=32|u)&&l<=102?l-97+10:-1)?o=(o<<4)+a:N(e,"expected hexadecimal character");e.result+=(c=o)<=65535?String.fromCharCode(c):String.fromCharCode(55296+(c-65536>>10),56320+(c-65536&1023)),e.position++}else N(e,"unknown escape sequence");n=i=e.position}else j(s)?(L(e,n,i,!0),B(e,Y(e,!1,t)),n=i=e.position):e.position===e.lineStart&&R(e)?N(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}N(e,"unexpected end of the stream within a double quoted scalar")}(e,p)?m=!0:!function(e){var t,n,i;if(42!==(i=e.input.charCodeAt(e.position)))return!1;for(i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!I(i)&&!O(i);)i=e.input.charCodeAt(++e.position);return e.position===t&&N(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),e.anchorMap.hasOwnProperty(n)||N(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],Y(e,!0,-1),!0}(e)?function(e,t,n){var i,r,o,a,s,c,u,l,p=e.kind,f=e.result;if(I(l=e.input.charCodeAt(e.position))||O(l)||35===l||38===l||42===l||33===l||124===l||62===l||39===l||34===l||37===l||64===l||96===l)return!1;if((63===l||45===l)&&(I(i=e.input.charCodeAt(e.position+1))||n&&O(i)))return!1;for(e.kind="scalar",e.result="",r=o=e.position,a=!1;0!==l;){if(58===l){if(I(i=e.input.charCodeAt(e.position+1))||n&&O(i))break}else if(35===l){if(I(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&R(e)||n&&O(l))break;if(j(l)){if(s=e.line,c=e.lineStart,u=e.lineIndent,Y(e,!1,-1),e.lineIndent>=t){a=!0,l=e.input.charCodeAt(e.position);continue}e.position=o,e.line=s,e.lineStart=c,e.lineIndent=u;break}}a&&(L(e,r,o,!1),B(e,e.line-s),r=o=e.position,a=!1),S(l)||(o=e.position+1),l=e.input.charCodeAt(++e.position)}return L(e,r,o,!1),!!e.result||(e.kind=p,e.result=f,!1)}(e,p,x===n)&&(m=!0,null===e.tag&&(e.tag="?")):(m=!0,null===e.tag&&null===e.anchor||N(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===d&&(m=s&&P(e,f))),null!==e.tag&&"!"!==e.tag)if("?"===e.tag){for(c=0,u=e.implicitTypes.length;c<u;c+=1)if((l=e.implicitTypes[c]).resolve(e.result)){e.result=l.construct(e.result),e.tag=l.tag,null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);break}}else y.call(e.typeMap[e.kind||"fallback"],e.tag)?(l=e.typeMap[e.kind||"fallback"][e.tag],null!==e.result&&l.kind!==e.kind&&N(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+l.kind+'", not "'+e.kind+'"'),l.resolve(e.result)?(e.result=l.construct(e.result),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):N(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")):N(e,"unknown tag !<"+e.tag+">");return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||m}function H(e){var t,n,i,r,o=e.position,a=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};0!==(r=e.input.charCodeAt(e.position))&&(Y(e,!0,-1),r=e.input.charCodeAt(e.position),!(0<e.lineIndent||37!==r));){for(a=!0,r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!I(r);)r=e.input.charCodeAt(++e.position);for(i=[],(n=e.input.slice(t,e.position)).length<1&&N(e,"directive name must not be less than one character in length");0!==r;){for(;S(r);)r=e.input.charCodeAt(++e.position);if(35===r){for(;0!==(r=e.input.charCodeAt(++e.position))&&!j(r););break}if(j(r))break;for(t=e.position;0!==r&&!I(r);)r=e.input.charCodeAt(++e.position);i.push(e.input.slice(t,e.position))}0!==r&&q(e),y.call(T,n)?T[n](e,n,i):M(e,'unknown document directive "'+n+'"')}Y(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,Y(e,!0,-1)):a&&N(e,"directives end mark is expected"),$(e,e.lineIndent-1,b,!1,!0),Y(e,!0,-1),e.checkLineBreaks&&s.test(e.input.slice(o,e.position))&&M(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&R(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,Y(e,!0,-1)):e.position<e.length-1&&N(e,"end of the stream or a document separator is expected")}function G(e,t){t=t||{},0!==(e=String(e)).length&&(10!==e.charCodeAt(e.length-1)&&13!==e.charCodeAt(e.length-1)&&(e+="\n"),65279===e.charCodeAt(0)&&(e=e.slice(1)));var n=new m(e,t);for(n.input+="\0";32===n.input.charCodeAt(n.position);)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)H(n);return n.documents}function V(e,t,n){var i,r,o=G(e,n);if("function"!=typeof t)return o;for(i=0,r=o.length;i<r;i+=1)t(o[i])}function Z(e,t){var n=G(e,t);if(0!==n.length){if(1===n.length)return n[0];throw new i("expected a single document in the stream, but found more")}}t.exports.loadAll=V,t.exports.load=Z,t.exports.safeLoadAll=function(e,t,n){if("function"!=typeof t)return V(e,g.extend({schema:o},n));V(e,t,g.extend({schema:o},n))},t.exports.safeLoad=function(e,t){return Z(e,g.extend({schema:o},t))}},{"./common":2,"./exception":4,"./mark":6,"./schema/default_full":9,"./schema/default_safe":10}],6:[function(e,t,n){"use strict";var s=e("./common");function i(e,t,n,i,r){this.name=e,this.buffer=t,this.position=n,this.line=i,this.column=r}i.prototype.getSnippet=function(e,t){var n,i,r,o,a;if(!this.buffer)return null;for(e=e||4,t=t||75,n="",i=this.position;0<i&&-1==="\0\r\n…\u2028\u2029".indexOf(this.buffer.charAt(i-1));)if(i-=1,this.position-i>t/2-1){n=" ... ",i+=5;break}for(r="",o=this.position;o<this.buffer.length&&-1==="\0\r\n…\u2028\u2029".indexOf(this.buffer.charAt(o));)if((o+=1)-this.position>t/2-1){r=" ... ",o-=5;break}return a=this.buffer.slice(i,o),s.repeat(" ",e)+n+a+r+"\n"+s.repeat(" ",e+this.position-i+n.length)+"^"},i.prototype.toString=function(e){var t,n="";return this.name&&(n+='in "'+this.name+'" '),n+="at line "+(this.line+1)+", column "+(this.column+1),e||(t=this.getSnippet())&&(n+=":\n"+t),n},t.exports=i},{"./common":2}],7:[function(e,t,n){"use strict";var i=e("./common"),r=e("./exception"),o=e("./type");function a(e,t,i){var r=[];return e.include.forEach(function(e){i=a(e,t,i)}),e[t].forEach(function(n){i.forEach(function(e,t){e.tag===n.tag&&e.kind===n.kind&&r.push(t)}),i.push(n)}),i.filter(function(e,t){return-1===r.indexOf(t)})}function s(e){this.include=e.include||[],this.implicit=e.implicit||[],this.explicit=e.explicit||[],this.implicit.forEach(function(e){if(e.loadKind&&"scalar"!==e.loadKind)throw new r("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")}),this.compiledImplicit=a(this,"implicit",[]),this.compiledExplicit=a(this,"explicit",[]),this.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{}};function i(e){n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e<t;e+=1)arguments[e].forEach(i);return n}(this.compiledImplicit,this.compiledExplicit)}s.DEFAULT=null,s.create=function(){var e,t;switch(arguments.length){case 1:e=s.DEFAULT,t=arguments[0];break;case 2:e=arguments[0],t=arguments[1];break;default:throw new r("Wrong number of arguments for Schema.create function")}if(e=i.toArray(e),t=i.toArray(t),!e.every(function(e){return e instanceof s}))throw new r("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");if(!t.every(function(e){return e instanceof o}))throw new r("Specified list of YAML types (or a single Type object) contains a non-Type object.");return new s({include:e,explicit:t})},t.exports=s},{"./common":2,"./exception":4,"./type":13}],8:[function(e,t,n){"use strict";var i=e("../schema");t.exports=new i({include:[e("./json")]})},{"../schema":7,"./json":12}],9:[function(e,t,n){"use strict";var i=e("../schema");t.exports=i.DEFAULT=new i({include:[e("./default_safe")],explicit:[e("../type/js/undefined"),e("../type/js/regexp"),e("../type/js/function")]})},{"../schema":7,"../type/js/function":18,"../type/js/regexp":19,"../type/js/undefined":20,"./default_safe":10}],10:[function(e,t,n){"use strict";var i=e("../schema");t.exports=new i({include:[e("./core")],implicit:[e("../type/timestamp"),e("../type/merge")],explicit:[e("../type/binary"),e("../type/omap"),e("../type/pairs"),e("../type/set")]})},{"../schema":7,"../type/binary":14,"../type/merge":22,"../type/omap":24,"../type/pairs":25,"../type/set":27,"../type/timestamp":29,"./core":8}],11:[function(e,t,n){"use strict";var i=e("../schema");t.exports=new i({explicit:[e("../type/str"),e("../type/seq"),e("../type/map")]})},{"../schema":7,"../type/map":21,"../type/seq":26,"../type/str":28}],12:[function(e,t,n){"use strict";var i=e("../schema");t.exports=new i({include:[e("./failsafe")],implicit:[e("../type/null"),e("../type/bool"),e("../type/int"),e("../type/float")]})},{"../schema":7,"../type/bool":15,"../type/float":16,"../type/int":17,"../type/null":23,"./failsafe":11}],13:[function(e,t,n){"use strict";var i=e("./exception"),r=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],o=["scalar","sequence","mapping"];t.exports=function(t,e){if(e=e||{},Object.keys(e).forEach(function(e){if(-1===r.indexOf(e))throw new i('Unknown option "'+e+'" is met in definition of "'+t+'" YAML type.')}),this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(e){return e},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.defaultStyle=e.defaultStyle||null,this.styleAliases=function(e){var n={};return null!==e&&Object.keys(e).forEach(function(t){e[t].forEach(function(e){n[String(e)]=t})}),n}(e.styleAliases||null),-1===o.indexOf(this.kind))throw new i('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}},{"./exception":4}],14:[function(e,t,n){"use strict";var c;try{c=e("buffer").Buffer}catch(e){}var i=e("../type"),u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";t.exports=new i("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,i=0,r=e.length,o=u;for(n=0;n<r;n++)if(!(64<(t=o.indexOf(e.charAt(n))))){if(t<0)return!1;i+=6}return i%8==0},construct:function(e){var t,n,i=e.replace(/[\r\n=]/g,""),r=i.length,o=u,a=0,s=[];for(t=0;t<r;t++)t%4==0&&t&&(s.push(a>>16&255),s.push(a>>8&255),s.push(255&a)),a=a<<6|o.indexOf(i.charAt(t));return 0==(n=r%4*6)?(s.push(a>>16&255),s.push(a>>8&255),s.push(255&a)):18==n?(s.push(a>>10&255),s.push(a>>2&255)):12==n&&s.push(a>>4&255),c?c.from?c.from(s):new c(s):s},predicate:function(e){return c&&c.isBuffer(e)},represent:function(e){var t,n,i="",r=0,o=e.length,a=u;for(t=0;t<o;t++)t%3==0&&t&&(i+=a[r>>18&63],i+=a[r>>12&63],i+=a[r>>6&63],i+=a[63&r]),r=(r<<8)+e[t];return 0==(n=o%3)?(i+=a[r>>18&63],i+=a[r>>12&63],i+=a[r>>6&63],i+=a[63&r]):2==n?(i+=a[r>>10&63],i+=a[r>>4&63],i+=a[r<<2&63],i+=a[64]):1==n&&(i+=a[r>>2&63],i+=a[r<<4&63],i+=a[64],i+=a[64]),i}})},{"../type":13}],15:[function(e,t,n){"use strict";var i=e("../type");t.exports=new i("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})},{"../type":13}],16:[function(e,t,n){"use strict";var i=e("../common"),r=e("../type"),o=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var a=/^[-+]?[0-9]+e/;t.exports=new r("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!o.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n,i,r;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,r=[],0<="+-".indexOf(t[0])&&(t=t.slice(1)),".inf"===t?1==n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:0<=t.indexOf(":")?(t.split(":").forEach(function(e){r.unshift(parseFloat(e,10))}),t=0,i=1,r.forEach(function(e){t+=e*i,i*=60}),n*t):n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||i.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(i.isNegativeZero(e))return"-0.0";return n=e.toString(10),a.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"})},{"../common":2,"../type":13}],17:[function(e,t,n){"use strict";var i=e("../common"),r=e("../type");t.exports=new r("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,i,r,o=e.length,a=0,s=!1;if(!o)return!1;if("-"!==(t=e[a])&&"+"!==t||(t=e[++a]),"0"===t){if(a+1===o)return!0;if("b"===(t=e[++a])){for(a++;a<o;a++)if("_"!==(t=e[a])){if("0"!==t&&"1"!==t)return!1;s=!0}return s&&"_"!==t}if("x"===t){for(a++;a<o;a++)if("_"!==(t=e[a])){if(!(48<=(i=e.charCodeAt(a))&&i<=57||65<=i&&i<=70||97<=i&&i<=102))return!1;s=!0}return s&&"_"!==t}for(;a<o;a++)if("_"!==(t=e[a])){if(!(48<=(n=e.charCodeAt(a))&&n<=55))return!1;s=!0}return s&&"_"!==t}if("_"===t)return!1;for(;a<o;a++)if("_"!==(t=e[a])){if(":"===t)break;if(!(48<=(r=e.charCodeAt(a))&&r<=57))return!1;s=!0}return!(!s||"_"===t)&&(":"!==t||/^(:[0-5]?[0-9])+$/.test(e.slice(a)))},construct:function(e){var t,n,i=e,r=1,o=[];return-1!==i.indexOf("_")&&(i=i.replace(/_/g,"")),"-"!==(t=i[0])&&"+"!==t||("-"===t&&(r=-1),t=(i=i.slice(1))[0]),"0"===i?0:"0"===t?"b"===i[1]?r*parseInt(i.slice(2),2):"x"===i[1]?r*parseInt(i,16):r*parseInt(i,8):-1!==i.indexOf(":")?(i.split(":").forEach(function(e){o.unshift(parseInt(e,10))}),i=0,n=1,o.forEach(function(e){i+=e*n,n*=60}),r*i):r*parseInt(i,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&e%1==0&&!i.isNegativeZero(e)},represent:{binary:function(e){return 0<=e?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return 0<=e?"0"+e.toString(8):"-0"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return 0<=e?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})},{"../common":2,"../type":13}],18:[function(e,t,n){"use strict";var o;try{o=e("esprima")}catch(e){"undefined"!=typeof window&&(o=window.esprima)}var i=e("../../type");t.exports=new i("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:function(e){if(null===e)return!1;try{var t="("+e+")",n=o.parse(t,{range:!0});return"Program"===n.type&&1===n.body.length&&"ExpressionStatement"===n.body[0].type&&("ArrowFunctionExpression"===n.body[0].expression.type||"FunctionExpression"===n.body[0].expression.type)}catch(e){return!1}},construct:function(e){var t,n="("+e+")",i=o.parse(n,{range:!0}),r=[];if("Program"!==i.type||1!==i.body.length||"ExpressionStatement"!==i.body[0].type||"ArrowFunctionExpression"!==i.body[0].expression.type&&"FunctionExpression"!==i.body[0].expression.type)throw new Error("Failed to resolve function");return i.body[0].expression.params.forEach(function(e){r.push(e.name)}),t=i.body[0].expression.body.range,"BlockStatement"===i.body[0].expression.body.type?new Function(r,n.slice(t[0]+1,t[1]-1)):new Function(r,"return "+n.slice(t[0],t[1]))},predicate:function(e){return"[object Function]"===Object.prototype.toString.call(e)},represent:function(e){return e.toString()}})},{"../../type":13}],19:[function(e,t,n){"use strict";var i=e("../../type");t.exports=new i("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:function(e){if(null===e)return!1;if(0===e.length)return!1;var t=e,n=/\/([gim]*)$/.exec(e),i="";if("/"===t[0]){if(n&&(i=n[1]),3<i.length)return!1;if("/"!==t[t.length-i.length-1])return!1}return!0},construct:function(e){var t=e,n=/\/([gim]*)$/.exec(e),i="";return"/"===t[0]&&(n&&(i=n[1]),t=t.slice(1,t.length-i.length-1)),new RegExp(t,i)},predicate:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},represent:function(e){var t="/"+e.source+"/";return e.global&&(t+="g"),e.multiline&&(t+="m"),e.ignoreCase&&(t+="i"),t}})},{"../../type":13}],20:[function(e,t,n){"use strict";var i=e("../../type");t.exports=new i("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:function(){return!0},construct:function(){},predicate:function(e){return void 0===e},represent:function(){return""}})},{"../../type":13}],21:[function(e,t,n){"use strict";var i=e("../type");t.exports=new i("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})},{"../type":13}],22:[function(e,t,n){"use strict";var i=e("../type");t.exports=new i("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}})},{"../type":13}],23:[function(e,t,n){"use strict";var i=e("../type");t.exports=new i("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})},{"../type":13}],24:[function(e,t,n){"use strict";var i=e("../type"),c=Object.prototype.hasOwnProperty,u=Object.prototype.toString;t.exports=new i("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,i,r,o,a=[],s=e;for(t=0,n=s.length;t<n;t+=1){if(i=s[t],o=!1,"[object Object]"!==u.call(i))return!1;for(r in i)if(c.call(i,r)){if(o)return!1;o=!0}if(!o)return!1;if(-1!==a.indexOf(r))return!1;a.push(r)}return!0},construct:function(e){return null!==e?e:[]}})},{"../type":13}],25:[function(e,t,n){"use strict";var i=e("../type"),s=Object.prototype.toString;t.exports=new i("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,i,r,o,a=e;for(o=new Array(a.length),t=0,n=a.length;t<n;t+=1){if(i=a[t],"[object Object]"!==s.call(i))return!1;if(1!==(r=Object.keys(i)).length)return!1;o[t]=[r[0],i[r[0]]]}return!0},construct:function(e){if(null===e)return[];var t,n,i,r,o,a=e;for(o=new Array(a.length),t=0,n=a.length;t<n;t+=1)i=a[t],r=Object.keys(i),o[t]=[r[0],i[r[0]]];return o}})},{"../type":13}],26:[function(e,t,n){"use strict";var i=e("../type");t.exports=new i("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}})},{"../type":13}],27:[function(e,t,n){"use strict";var i=e("../type"),r=Object.prototype.hasOwnProperty;t.exports=new i("tag:yaml.org,2002:set",{kind:"mapping",resolve:function(e){if(null===e)return!0;var t,n=e;for(t in n)if(r.call(n,t)&&null!==n[t])return!1;return!0},construct:function(e){return null!==e?e:{}}})},{"../type":13}],28:[function(e,t,n){"use strict";var i=e("../type");t.exports=new i("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}})},{"../type":13}],29:[function(e,t,n){"use strict";var i=e("../type"),p=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),f=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");t.exports=new i("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==p.exec(e)||null!==f.exec(e))},construct:function(e){var t,n,i,r,o,a,s,c,u=0,l=null;if(null===(t=p.exec(e))&&(t=f.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],i=+t[2]-1,r=+t[3],!t[4])return new Date(Date.UTC(n,i,r));if(o=+t[4],a=+t[5],s=+t[6],t[7]){for(u=t[7].slice(0,3);u.length<3;)u+="0";u=+u}return t[9]&&(l=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(l=-l)),c=new Date(Date.UTC(n,i,r,o,a,s,u)),l&&c.setTime(c.getTime()-l),c},instanceOf:Date,represent:function(e){return e.toISOString()}})},{"../type":13}],"/":[function(e,t,n){"use strict";var i=e("./lib/js-yaml.js");t.exports=i},{"./lib/js-yaml.js":1}]},{},[])("/")});
/// <reference path="../../kg.ts" />
'use strict';
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var KG;
(function (KG) {
/*
from underscorejs
Copyright (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative
Reporters & Editors
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.*/
// I adapted these functions from the amazing underscorejs library.
function isObject(obj) {
var type = typeof obj;
return type === 'function' || type === 'object' && !!obj;
}
function allKeys(obj) {
if (!isObject(obj))
return [];
var keys = [];
for (var key in obj)
keys.push(key);
return keys;
}
KG.allKeys = allKeys;
function defaults(obj, def) {
if (def == null || obj == null)
return obj;
var keys = allKeys(def), l = keys.length;
for (var i = 0; i < l; i++) {
var key = keys[i];
if (obj[key] === void 0)
obj[key] = def[key];
}
return obj;
}
// End of underscorejs functions
function setDefaults(def, defaultValues) {
def = defaults(def, defaultValues);
return def;
}
KG.setDefaults = setDefaults;
function setProperties(def, name, props) {
def[name] = (def[name] || []).concat(props);
return def;
}
KG.setProperties = setProperties;
})(KG || (KG = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
function extractTypeAndDef(def) {
if (def.hasOwnProperty('type')) {
return def;
}
else {
def.type = Object.keys(def)[0];
def.def = def[def.type];
return def;
}
}
KGAuthor.extractTypeAndDef = extractTypeAndDef;
function parse(data, parsedData) {
data.forEach(function (obj) {
if (KGAuthor.hasOwnProperty(obj.type)) {
parsedData = new KGAuthor[obj.type](obj.def).parse(parsedData);
}
else {
console.log("Sorry, there's no ", obj.type, " object type in KGAuthor. Maybe you have a typo?");
}
});
return parsedData;
}
KGAuthor.parse = parse;
function getDefinitionProperty(def) {
if (typeof def == 'string') {
if (def.match(/[\*/+-]/)) {
return '(' + def + ')';
}
else {
return def;
}
}
else {
return def;
}
}
KGAuthor.getDefinitionProperty = getDefinitionProperty;
function getPropertyAsString(def) {
var d = def;
if (typeof d == 'number') {
return d.toString();
}
else {
return "(" + d.toString() + ")";
}
}
KGAuthor.getPropertyAsString = getPropertyAsString;
function getParameterName(str) {
if (typeof str == 'string') {
return str.replace('params.', '');
}
else {
return str;
}
}
KGAuthor.getParameterName = getParameterName;
function negativeDef(def) {
return (typeof def == 'number') ? (-1) * def : "(-" + getDefinitionProperty(def) + ")";
}
KGAuthor.negativeDef = negativeDef;
function binaryFunction(def1, def2, fn) {
if (typeof def1 == 'number' && typeof def2 == 'number') {
switch (fn) {
case "+":
return def1 + def2;
case "-":
return def1 - def2;
case "/":
return def1 / def2;
case "*":
return def1 * def2;
case "^":
return Math.pow(def1, def2);
}
}
else {
return "(" + getDefinitionProperty(def1) + fn + getDefinitionProperty(def2) + ")";
}
}
KGAuthor.binaryFunction = binaryFunction;
function addDefs(def1, def2) {
if (def1 == 0) {
return def2;
}
if (def2 == 0) {
return def1;
}
return binaryFunction(def1, def2, '+');
}
KGAuthor.addDefs = addDefs;
function subtractDefs(def1, def2) {
if (def2 == 0) {
return def1;
}
return binaryFunction(def1, def2, '-');
}
KGAuthor.subtractDefs = subtractDefs;
function divideDefs(def1, def2) {
if (def1 == 0) {
return 0;
}
if (def2 == 1) {
return def1;
}
return binaryFunction(def1, def2, '/');
}
KGAuthor.divideDefs = divideDefs;
function invertDef(def) {
return binaryFunction(1, def, '/');
}
KGAuthor.invertDef = invertDef;
function multiplyDefs(def1, def2) {
if (def1 == 0 || def2 == 0) {
return 0;
}
if (def1 == 1) {
return def2;
}
if (def2 == 1) {
return def1;
}
return binaryFunction(def1, def2, '*');
}
KGAuthor.multiplyDefs = multiplyDefs;
function averageDefs(def1, def2, weight) {
weight = weight || 0.5;
return addDefs(multiplyDefs(weight, def1), multiplyDefs(subtractDefs(1, weight), def2));
}
KGAuthor.averageDefs = averageDefs;
function squareDef(def) {
return binaryFunction(def, def, '*');
}
KGAuthor.squareDef = squareDef;
function sqrtDef(def) {
return 'Math.sqrt(' + def + ')';
}
KGAuthor.sqrtDef = sqrtDef;
function raiseDefToDef(def1, def2) {
return binaryFunction(def1, def2, '^');
}
KGAuthor.raiseDefToDef = raiseDefToDef;
function paramName(def) {
if (typeof (def) == 'string') {
return def.replace('params.', '');
}
else {
return def;
}
}
KGAuthor.paramName = paramName;
function curvesFromFunctions(fns, def, graph) {
return fns.map(function (fn) {
var curveDef = copyJSON(def);
if (curveDef.hasOwnProperty('min')) {
fn.min = curveDef.min;
}
if (curveDef.hasOwnProperty('max')) {
fn.max = curveDef.max;
}
if (fn.hasOwnProperty('show')) {
curveDef.show = fn.show;
}
if (fn.hasOwnProperty('parametric')) {
curveDef.parametricFunction = fn;
}
else {
curveDef.univariateFunction = fn;
}
//console.log('creating curve from def', curveDef);
return new KGAuthor.Curve(curveDef, graph);
});
}
KGAuthor.curvesFromFunctions = curvesFromFunctions;
// allow author to set fill color either by "color" attribute or "fill" attribute
function setFillColor(def) {
if (def.open) {
def.fill = 'white';
return KG.setDefaults(def, {
color: def.stroke,
stroke: def.color
});
}
return KG.setDefaults(def, {
color: def.fill,
fill: def.color
});
}
KGAuthor.setFillColor = setFillColor;
// allow author to set stroke color either by "color" attribute or "stroke" attribute
function setStrokeColor(def) {
return KG.setDefaults(def, {
color: def.stroke,
stroke: def.color
});
}
KGAuthor.setStrokeColor = setStrokeColor;
// create a fresh copy of a JSON object
function copyJSON(def) {
return JSON.parse(JSON.stringify(def));
}
KGAuthor.copyJSON = copyJSON;
function replaceVariable(target, search, replacement) {
return "(" + target.split(search).join(replacement) + ")";
}
KGAuthor.replaceVariable = replaceVariable;
// allow author to specify a function using a single string rather than a function object
function parseFn(def, authorName, codeName) {
if (!def.hasOwnProperty(codeName) && def.hasOwnProperty(authorName)) {
def[codeName] = {
fn: def[authorName],
ind: (def[authorName].indexOf('(y)') > -1) ? 'y' : 'x',
min: def.min,
max: def.max,
samplePoints: def[authorName].samplePoints
};
}
}
KGAuthor.parseFn = parseFn;
// allow author to set a fill color rather than a fill object
function parseFill(def, attr) {
var v = def[attr];
if (typeof v == 'string') {
def[attr] = { fill: v };
}
if (typeof v == 'boolean' && v) {
var fillColor = def.hasOwnProperty('fill') ? def.fill : def.color;
def[attr] = { fill: fillColor };
}
}
KGAuthor.parseFill = parseFill;
// inherit properties from a parent
function inheritFromParent(props, parent, child) {
props.forEach(function (prop) {
if (parent.hasOwnProperty(prop) && !child.hasOwnProperty(prop)) {
child[prop] = parent[prop];
}
});
}
KGAuthor.inheritFromParent = inheritFromParent;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var AuthoringObject = /** @class */ (function () {
function AuthoringObject(def) {
this.def = def;
this.name = def.name;
this.subObjects = [];
}
AuthoringObject.prototype.parseSelf = function (parsedData) {
return parsedData;
};
AuthoringObject.prototype.parse = function (parsedData) {
this.subObjects.forEach(function (obj) {
parsedData = obj.parse(parsedData);
});
delete this.subObjects;
parsedData = this.parseSelf(parsedData);
return parsedData;
};
AuthoringObject.prototype.addSecondGraph = function (graph2) {
var def = this.def;
if (def.hasOwnProperty('yScale2Name')) {
def.xScale2Name = graph2.xScale.name;
def.yScale2Name = graph2.yScale.name;
}
this.subObjects.forEach(function (obj) {
obj.addSecondGraph(graph2);
});
};
return AuthoringObject;
}());
KGAuthor.AuthoringObject = AuthoringObject;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var Schema = /** @class */ (function (_super) {
__extends(Schema, _super);
function Schema(def) {
var _this = this;
var palette = {
blue: 'd3.schemeCategory10[0]',
orange: 'd3.schemeCategory10[1]',
green: 'd3.schemeCategory10[2]',
red: 'd3.schemeCategory10[3]',
purple: 'd3.schemeCategory10[4]',
brown: 'd3.schemeCategory10[5]',
magenta: 'd3.schemeCategory10[6]',
grey: 'd3.schemeCategory10[7]',
gray: 'd3.schemeCategory10[7]',
olive: 'd3.schemeCategory10[8]' //#637939
};
for (var color in def.colors) {
var colorName = def.colors[color];
if (palette.hasOwnProperty(colorName)) {
def.colors[color] = palette[colorName];
}
}
def.colors = KG.setDefaults(def.colors || {}, palette);
_this = _super.call(this, def) || this;
_this.colors = def.colors;
return _this;
}
Schema.prototype.parseSelf = function (parsedData) {
var colors = this.colors;
parsedData.colors = KG.setDefaults(parsedData.colors || {}, colors);
return parsedData;
};
return Schema;
}(KGAuthor.AuthoringObject));
KGAuthor.Schema = Schema;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var Layout = /** @class */ (function (_super) {
__extends(Layout, _super);
function Layout(def) {
var _this = _super.call(this, def) || this;
_this.aspectRatio = 2;
_this.nosvg = false;
return _this;
}
Layout.prototype.parseSelf = function (parsedData) {
parsedData.aspectRatio = this.aspectRatio;
parsedData.nosvg = this.nosvg;
return parsedData;
};
return Layout;
}(KGAuthor.AuthoringObject));
KGAuthor.Layout = Layout;
var SquareLayout = /** @class */ (function (_super) {
__extends(SquareLayout, _super);
// creates a square layout (aspect ratio of 1) within the main body of the text
// to make a square graph, the ratio of width to height should be 0.82
function SquareLayout(def) {
var _this = _super.call(this, def) || this;
_this.aspectRatio = 1.22;
return _this;
}
return SquareLayout;
}(Layout));
KGAuthor.SquareLayout = SquareLayout;
var WideRectangleLayout = /** @class */ (function (_super) {
__extends(WideRectangleLayout, _super);
// creates a rectangle, twice as wide as it is high, within the main body of the text
// to make a square graph, the ratio of width to height should be 0.41
function WideRectangleLayout(def) {
var _this = _super.call(this, def) || this;
_this.aspectRatio = 2.44;
return _this;
}
return WideRectangleLayout;
}(Layout));
KGAuthor.WideRectangleLayout = WideRectangleLayout;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var HTMLLayout = /** @class */ (function (_super) {
__extends(HTMLLayout, _super);
function HTMLLayout(def) {
var _this = _super.call(this, def) || this;
var l = _this;
l.nosvg = true;
var divDef = { "html": def['html'] };
l.subObjects.push(new KGAuthor.Div(divDef));
return _this;
}
return HTMLLayout;
}(KGAuthor.Layout));
KGAuthor.HTMLLayout = HTMLLayout;
var HTMLPlusSidebarLayout = /** @class */ (function (_super) {
__extends(HTMLPlusSidebarLayout, _super);
function HTMLPlusSidebarLayout(def) {
var _this = _super.call(this, def) || this;
var l = _this;
l.nosvg = true;
var sidebarDef = def['sidebar'];
l.subObjects.push(new KGAuthor.Sidebar(sidebarDef));
return _this;
}
return HTMLPlusSidebarLayout;
}(HTMLLayout));
KGAuthor.HTMLPlusSidebarLayout = HTMLPlusSidebarLayout;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var OneGraph = /** @class */ (function (_super) {
__extends(OneGraph, _super);
function OneGraph(def) {
var _this = _super.call(this, def) || this;
var l = _this;
var graphDef = def['graph'];
graphDef.position = {
"x": 0.15,
"y": 0.025,
"width": 0.74,
"height": 0.9
};
l.subObjects.push(new KGAuthor.Graph(graphDef));
return _this;
}
return OneGraph;
}(KGAuthor.SquareLayout));
KGAuthor.OneGraph = OneGraph;
var OneWideGraph = /** @class */ (function (_super) {
__extends(OneWideGraph, _super);
function OneWideGraph(def) {
var _this = _super.call(this, def) || this;
var l = _this;
var graphDef = def['graph'];
graphDef.position = {
"x": 0.15,
"y": 0.025,
"width": 0.74,
"height": 0.9
};
l.subObjects.push(new KGAuthor.Graph(graphDef));
return _this;
}
return OneWideGraph;
}(KGAuthor.WideRectangleLayout));
KGAuthor.OneWideGraph = OneWideGraph;
var OneGraphPlusSidebar = /** @class */ (function (_super) {
__extends(OneGraphPlusSidebar, _super);
function OneGraphPlusSidebar(def) {
var _this = _super.call(this, def) || this;
var l = _this;
var graphDef = def['graph'], sidebarDef = def['sidebar'];
graphDef.position = {
"x": 0.15,
"y": 0.025,
"width": 0.738,
"height": 0.9
};
l.subObjects.push(new KGAuthor.Graph(graphDef));
l.subObjects.push(new KGAuthor.Sidebar(sidebarDef));
return _this;
}
return OneGraphPlusSidebar;
}(KGAuthor.SquareLayout));
KGAuthor.OneGraphPlusSidebar = OneGraphPlusSidebar;
var OneWideGraphPlusSidebar = /** @class */ (function (_super) {
__extends(OneWideGraphPlusSidebar, _super);
function OneWideGraphPlusSidebar(def) {
var _this = _super.call(this, def) || this;
var l = _this;
var graphDef = def['graph'], sidebarDef = def['sidebar'];
graphDef.position = {
"x": 0.15,
"y": 0.025,
"width": 0.738,
"height": 0.9
};
l.subObjects.push(new KGAuthor.Graph(graphDef));
l.subObjects.push(new KGAuthor.Sidebar(sidebarDef));
return _this;
}
return OneWideGraphPlusSidebar;
}(KGAuthor.WideRectangleLayout));
KGAuthor.OneWideGraphPlusSidebar = OneWideGraphPlusSidebar;
var OneGraphPlusSidebarRoom200 = /** @class */ (function (_super) {
__extends(OneGraphPlusSidebarRoom200, _super);
function OneGraphPlusSidebarRoom200(def) {
var _this = _super.call(this, def) || this;
_this.aspectRatio = 2;
return _this;
}
return OneGraphPlusSidebarRoom200;
}(OneGraphPlusSidebar));
KGAuthor.OneGraphPlusSidebarRoom200 = OneGraphPlusSidebarRoom200;
var GeoGebraPlusSidebar = /** @class */ (function (_super) {
__extends(GeoGebraPlusSidebar, _super);
function GeoGebraPlusSidebar(def) {
var _this = _super.call(this, def) || this;
var l = _this;
var ggbAppletDef = def['ggbApplet'], sidebarDef = def['sidebar'];
ggbAppletDef.position = {
"x": 0.15,
"y": 0.025,
"width": 0.738,
"height": 0.9
};
l.subObjects.push(new KGAuthor.GeoGebraContainer(ggbAppletDef));
l.subObjects.push(new KGAuthor.Sidebar(sidebarDef));
return _this;
}
return GeoGebraPlusSidebar;
}(KGAuthor.SquareLayout));
KGAuthor.GeoGebraPlusSidebar = GeoGebraPlusSidebar;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var TwoHorizontalGraphs = /** @class */ (function (_super) {
__extends(TwoHorizontalGraphs, _super);
function TwoHorizontalGraphs(def) {
var _this = _super.call(this, def) || this;
var l = _this;
var leftGraphDef = def['leftGraph'], rightGraphDef = def['rightGraph'];
var leftX = 0.15, rightX = 0.65, topY = 0.1, bottomY = 0.9, width = 0.3, controlHeight = 0.25;
var includeControls = false;
console.log('layout: ', l);
if (def.hasOwnProperty('leftControls')) {
l.subObjects.push(new KGAuthor.DivContainer({
position: {
x: leftX,
y: bottomY,
width: width,
height: controlHeight
},
children: [
{
type: "Controls",
def: def['leftControls']
}
]
}));
includeControls = true;
}
if (def.hasOwnProperty('rightControls')) {
l.subObjects.push(new KGAuthor.DivContainer({
position: {
x: rightX,
y: bottomY,
width: width,
height: controlHeight
},
children: [
{
type: "Controls",
def: def['rightControls']
}
]
}));
includeControls = true;
}
var graphHeight = includeControls ? 0.5 : 0.9;
_this.aspectRatio = includeControls ? 2 : 4;
leftGraphDef.position = {
x: leftX,
y: topY,
width: width,
height: graphHeight
};
l.subObjects.push(new KGAuthor.Graph(leftGraphDef));
rightGraphDef.position = {
"x": rightX,
"y": topY,
"width": width,
"height": graphHeight
};
l.subObjects.push(new KGAuthor.Graph(rightGraphDef));
return _this;
}
return TwoHorizontalGraphs;
}(KGAuthor.Layout));
KGAuthor.TwoHorizontalGraphs = TwoHorizontalGraphs;
var TwoHorizontalGraphsPlusSidebar = /** @class */ (function (_super) {
__extends(TwoHorizontalGraphsPlusSidebar, _super);
function TwoHorizontalGraphsPlusSidebar(def) {
var _this = _super.call(this, def) || this;
var l = _this;
var leftGraphDef = def['leftGraph'], rightGraphDef = def['rightGraph'], sidebarDef = def['sidebar'];
var leftX = 0.1, rightX = 0.6, topY = 0.025, bottomY = 1.2, width = 0.369, graphHeight = 0.9, controlHeight = 0.3;
leftGraphDef.position = {
"x": leftX,
"y": topY,
"width": width,
"height": graphHeight
};
rightGraphDef.position = {
"x": rightX,
"y": topY,
"width": width,
"height": graphHeight
};
var leftGraph = new KGAuthor.Graph(leftGraphDef), rightGraph = new KGAuthor.Graph(rightGraphDef), sidebar = new KGAuthor.Sidebar(sidebarDef);
l.subObjects.push(leftGraph);
l.subObjects.push(rightGraph);
l.subObjects.push(sidebar);
if (def.hasOwnProperty('leftControls')) {
var leftControlsContainer = {
position: {
x: leftX,
y: bottomY,
width: width,
height: controlHeight
},
children: [
{
type: "Controls",
def: def['leftControls']
}
]
};
l.subObjects.push(new KGAuthor.DivContainer(leftControlsContainer));
}
if (def.hasOwnProperty('rightControls')) {
var rightControlsContainer = {
position: {
x: rightX,
y: bottomY,
width: width,
height: controlHeight
},
children: [
{
type: "Controls",
def: def['rightControls']
}
]
};
l.subObjects.push(new KGAuthor.DivContainer(rightControlsContainer));
}
return _this;
}
return TwoHorizontalGraphsPlusSidebar;
}(KGAuthor.WideRectangleLayout));
KGAuthor.TwoHorizontalGraphsPlusSidebar = TwoHorizontalGraphsPlusSidebar;
var MathboxPlusGraph = /** @class */ (function (_super) {
__extends(MathboxPlusGraph, _super);
function MathboxPlusGraph(def) {
var _this = _super.call(this, def) || this;
var l = _this;
var mathboxDef = def['mathbox'], graphDef = def['graph'];
mathboxDef.position = {
"x": 0.05,
"y": 0.025,
"width": 0.45,
"height": 0.9
};
graphDef.position = {
"x": 0.6,
"y": 0.2,
"width": 0.3,
"height": 0.6
};
l.subObjects.push(new KGAuthor.Mathbox(mathboxDef));
l.subObjects.push(new KGAuthor.Graph(graphDef));
return _this;
}
return MathboxPlusGraph;
}(KGAuthor.Layout));
KGAuthor.MathboxPlusGraph = MathboxPlusGraph;
var GameMatrixPlusGraph = /** @class */ (function (_super) {
__extends(GameMatrixPlusGraph, _super);
function GameMatrixPlusGraph(def) {
var _this = _super.call(this, def) || this;
var l = _this;
var graphDef = def['graph'];
var gameDivDef = {
position: {
x: 0.05,
y: 0.1,
width: 0.35,
height: 0.7
},
children: [
{
type: "GameMatrix",
def: def.game
}
]
};
graphDef.position = {
x: 0.6,
y: 0.1,
width: 0.35,
height: 0.7
};
l.subObjects.push(new KGAuthor.DivContainer(gameDivDef));
l.subObjects.push(new KGAuthor.Graph(graphDef));
return _this;
}
return GameMatrixPlusGraph;
}(KGAuthor.Layout));
KGAuthor.GameMatrixPlusGraph = GameMatrixPlusGraph;
var GeoGebraPlusGraph = /** @class */ (function (_super) {
__extends(GeoGebraPlusGraph, _super);
function GeoGebraPlusGraph(def) {
var _this = _super.call(this, def) || this;
var l = _this;
var ggbAppletDef = def['ggbApplet'], graphDef = def['graph'];
ggbAppletDef.position = {
"x": 0.05,
"y": 0.025,
"width": 0.45,
"height": 0.9
};
graphDef.position = {
"x": 0.6,
"y": 0.2,
"width": 0.3,
"height": 0.6
};
l.subObjects.push(new KGAuthor.GeoGebraContainer(ggbAppletDef));
l.subObjects.push(new KGAuthor.Graph(graphDef));
return _this;
}
return GeoGebraPlusGraph;
}(KGAuthor.Layout));
KGAuthor.GeoGebraPlusGraph = GeoGebraPlusGraph;
var GeoGebraPlusGraphPlusSidebar = /** @class */ (function (_super) {
__extends(GeoGebraPlusGraphPlusSidebar, _super);
function GeoGebraPlusGraphPlusSidebar(def) {
var _this = _super.call(this, def) || this;
var l = _this;
var ggbAppletDef = def['ggbApplet'], graphDef = def['graph'], sidebarDef = def['sidebar'];
ggbAppletDef.position = {
"x": 0.1,
"y": 0.025,
"width": 0.369,
"height": 0.9
};
graphDef.position = {
"x": 0.6,
"y": 0.025,
"width": 0.369,
"height": 0.9
};
l.subObjects.push(new KGAuthor.GeoGebraContainer(ggbAppletDef));
l.subObjects.push(new KGAuthor.Graph(graphDef));
l.subObjects.push(new KGAuthor.Sidebar(sidebarDef));
return _this;
}
return GeoGebraPlusGraphPlusSidebar;
}(KGAuthor.WideRectangleLayout));
KGAuthor.GeoGebraPlusGraphPlusSidebar = GeoGebraPlusGraphPlusSidebar;
var MathboxPlusGraphPlusSidebar = /** @class */ (function (_super) {
__extends(MathboxPlusGraphPlusSidebar, _super);
function MathboxPlusGraphPlusSidebar(def) {
var _this = _super.call(this, def) || this;
var l = _this;
var mathboxDef = def['mathbox'], graphDef = def['graph'], sidebarDef = def['sidebar'];
mathboxDef.position = {
"x": 0.025,
"y": 0.025,
"width": 0.444,
"height": 0.95
};
graphDef.position = {
"x": 0.6,
"y": 0.025,
"width": 0.369,
"height": 0.9
};
l.subObjects.push(new KGAuthor.MathboxContainer(mathboxDef));
l.subObjects.push(new KGAuthor.Graph(graphDef));
l.subObjects.push(new KGAuthor.Sidebar(sidebarDef));
return _this;
}
return MathboxPlusGraphPlusSidebar;
}(KGAuthor.WideRectangleLayout));
KGAuthor.MathboxPlusGraphPlusSidebar = MathboxPlusGraphPlusSidebar;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var ThreeHorizontalGraphs = /** @class */ (function (_super) {
__extends(ThreeHorizontalGraphs, _super);
function ThreeHorizontalGraphs(def) {
var _this = _super.call(this, def) || this;
var l = _this;
var leftGraphDef = def['leftGraph'], middleGraphDef = def['middleGraph'], rightGraphDef = def['rightGraph'];
var leftX = 0.05, middleX = 0.35, rightX = 0.65, topY = 0.025, bottomY = 0.65, width = 0.25, controlHeight = 0.3;
var includeControls = false;
console.log('layout: ', l);
if (def.hasOwnProperty('leftControls')) {
l.subObjects.push(new KGAuthor.DivContainer({
position: {
x: leftX,
y: bottomY,
width: width,
height: controlHeight
},
children: [
{
type: "Controls",
def: def['leftControls']
}
]
}));
includeControls = true;
}
if (def.hasOwnProperty('middleControls')) {
l.subObjects.push(new KGAuthor.DivContainer({
position: {
x: middleX,
y: bottomY,
width: width,
height: controlHeight
},
children: [
{
type: "Controls",
def: def['middleControls']
}
]
}));
includeControls = true;
}
if (def.hasOwnProperty('rightControls')) {
l.subObjects.push(new KGAuthor.DivContainer({
position: {
x: rightX,
y: bottomY,
width: width,
height: controlHeight
},
children: [
{
type: "Controls",
def: def['rightControls']
}
]
}));
includeControls = true;
}
var graphHeight = includeControls ? 0.5 : 0.9;
_this.aspectRatio = includeControls ? 2 : 4;
leftGraphDef.position = {
x: leftX,
y: topY,
width: width,
height: graphHeight
};
l.subObjects.push(new KGAuthor.Graph(leftGraphDef));
middleGraphDef.position = {
"x": middleX,
"y": topY,
"width": width,
"height": graphHeight
};
l.subObjects.push(new KGAuthor.Graph(middleGraphDef));
rightGraphDef.position = {
"x": rightX,
"y": topY,
"width": width,
"height": graphHeight
};
l.subObjects.push(new KGAuthor.Graph(rightGraphDef));
return _this;
}
return ThreeHorizontalGraphs;
}(KGAuthor.Layout));
KGAuthor.ThreeHorizontalGraphs = ThreeHorizontalGraphs;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var TwoVerticalGraphs = /** @class */ (function (_super) {
__extends(TwoVerticalGraphs, _super);
function TwoVerticalGraphs(def) {
var _this = _super.call(this, def) || this;
var l = _this;
var topGraphDef = def['topGraph'], bottomGraphDef = def['bottomGraph'];
topGraphDef.position = {
"x": 0.15,
"y": 0.025,
"width": 0.8,
"height": 0.4
};
bottomGraphDef.position = {
"x": 0.15,
"y": 0.525,
"width": 0.8,
"height": 0.4
};
var topGraph = new KGAuthor.Graph(topGraphDef), bottomGraph = new KGAuthor.Graph(bottomGraphDef);
topGraph.subObjects.forEach(function (obj) { obj.addSecondGraph(bottomGraph); });
bottomGraph.subObjects.forEach(function (obj) { obj.addSecondGraph(topGraph); });
l.subObjects.push(topGraph);
l.subObjects.push(bottomGraph);
return _this;
}
return TwoVerticalGraphs;
}(KGAuthor.SquareLayout));
KGAuthor.TwoVerticalGraphs = TwoVerticalGraphs;
var TwoVerticalGraphsPlusSidebar = /** @class */ (function (_super) {
__extends(TwoVerticalGraphsPlusSidebar, _super);
function TwoVerticalGraphsPlusSidebar(def) {
var _this = _super.call(this, def) || this;
var l = _this;
var topGraphDef = def['topGraph'], bottomGraphDef = def['bottomGraph'], sidebarDef = def['sidebar'];
topGraphDef.position = {
"x": 0.15,
"y": 0.025,
"width": 0.738,
"height": 0.4
};
bottomGraphDef.position = {
"x": 0.15,
"y": 0.525,
"width": 0.738,
"height": 0.4
};
var topGraph = new KGAuthor.Graph(topGraphDef), bottomGraph = new KGAuthor.Graph(bottomGraphDef), sidebar = new KGAuthor.Sidebar(sidebarDef);
topGraph.subObjects.forEach(function (obj) { obj.addSecondGraph(bottomGraph); });
bottomGraph.subObjects.forEach(function (obj) { obj.addSecondGraph(topGraph); });
l.subObjects.push(topGraph);
l.subObjects.push(bottomGraph);
l.subObjects.push(sidebar);
return _this;
}
return TwoVerticalGraphsPlusSidebar;
}(KGAuthor.SquareLayout));
KGAuthor.TwoVerticalGraphsPlusSidebar = TwoVerticalGraphsPlusSidebar;
var TwoVerticalGraphsRoom200 = /** @class */ (function (_super) {
__extends(TwoVerticalGraphsRoom200, _super);
function TwoVerticalGraphsRoom200(def) {
var _this = _super.call(this, def) || this;
var l = _this;
var topGraphDef = def['topGraph'], bottomGraphDef = def['bottomGraph'];
topGraphDef.position = {
"x": 0.1,
"y": 0,
"width": 0.85,
"height": 0.4
};
bottomGraphDef.position = {
"x": 0.1,
"y": 0.62,
"width": 0.85,
"height": 0.38
};
var topGraph = new KGAuthor.Graph(topGraphDef), bottomGraph = new KGAuthor.Graph(bottomGraphDef);
topGraph.subObjects.forEach(function (obj) { obj.addSecondGraph(bottomGraph); });
bottomGraph.subObjects.forEach(function (obj) { obj.addSecondGraph(topGraph); });
l.subObjects.push(topGraph);
l.subObjects.push(bottomGraph);
l.aspectRatio = 1.3;
return _this;
}
return TwoVerticalGraphsRoom200;
}(KGAuthor.Layout));
KGAuthor.TwoVerticalGraphsRoom200 = TwoVerticalGraphsRoom200;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var SquarePlusTwoVerticalGraphs = /** @class */ (function (_super) {
__extends(SquarePlusTwoVerticalGraphs, _super);
function SquarePlusTwoVerticalGraphs(def) {
var _this = _super.call(this, def) || this;
var l = _this;
var bigGraphDef = def['bigGraph'], topGraphDef = def['topGraph'], bottomGraphDef = def['bottomGraph'];
bigGraphDef.position = {
"x": 0.05,
"y": 0.025,
"width": 0.5,
"height": 0.9
};
topGraphDef.position = {
"x": 0.6,
"y": 0.025,
"width": 0.35,
"height": 0.4
};
bottomGraphDef.position = {
"x": 0.6,
"y": 0.525,
"width": 0.35,
"height": 0.4
};
l.subObjects.push(new KGAuthor.Graph(bigGraphDef));
l.subObjects.push(new KGAuthor.Graph(topGraphDef));
l.subObjects.push(new KGAuthor.Graph(bottomGraphDef));
return _this;
}
return SquarePlusTwoVerticalGraphs;
}(KGAuthor.Layout));
KGAuthor.SquarePlusTwoVerticalGraphs = SquarePlusTwoVerticalGraphs;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var FourGraphs = /** @class */ (function (_super) {
__extends(FourGraphs, _super);
function FourGraphs(def) {
var _this = _super.call(this, def) || this;
var l = _this;
var topLeftGraphDef = def['topLeftGraph'], bottomLeftGraphDef = def['bottomLeftGraph'], topRightGraphDef = def['topRightGraph'], bottomRightGraphDef = def['bottomRightGraph'];
var leftX = 0.05, rightX = 0.55, topY = 0.025, bottomY = 0.525;
topLeftGraphDef.position = {
"x": leftX,
"y": topY,
"width": 0.4,
"height": 0.4
};
bottomLeftGraphDef.position = {
"x": leftX,
"y": bottomY,
"width": 0.4,
"height": 0.4
};
topRightGraphDef.position = {
"x": rightX,
"y": topY,
"width": 0.4,
"height": 0.4
};
bottomRightGraphDef.position = {
"x": rightX,
"y": bottomY,
"width": 0.4,
"height": 0.4
};
l.subObjects.push(new KGAuthor.Graph(topLeftGraphDef));
l.subObjects.push(new KGAuthor.Graph(bottomLeftGraphDef));
l.subObjects.push(new KGAuthor.Graph(topRightGraphDef));
l.subObjects.push(new KGAuthor.Graph(bottomRightGraphDef));
return _this;
}
return FourGraphs;
}(KGAuthor.Layout));
KGAuthor.FourGraphs = FourGraphs;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var GameMatrixLayout = /** @class */ (function (_super) {
__extends(GameMatrixLayout, _super);
function GameMatrixLayout(def) {
var _this = _super.call(this, def) || this;
var l = _this;
l.nosvg = true;
l.subObjects.push(new KGAuthor.GameMatrix(def.gameMatrix));
return _this;
}
return GameMatrixLayout;
}(KGAuthor.Layout));
KGAuthor.GameMatrixLayout = GameMatrixLayout;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var Scale = /** @class */ (function (_super) {
__extends(Scale, _super);
function Scale(def) {
var _this = this;
KG.setDefaults(def, {
intercept: 0
});
_this = _super.call(this, def) || this;
_this.min = def.domainMin;
_this.max = def.domainMax;
_this.intercept = def.intercept;
return _this;
}
Scale.prototype.parseSelf = function (parsedData) {
parsedData.scales.push(this.def);
return parsedData;
};
return Scale;
}(KGAuthor.AuthoringObject));
KGAuthor.Scale = Scale;
var PositionedObject = /** @class */ (function (_super) {
__extends(PositionedObject, _super);
function PositionedObject(def) {
var _this = this;
KG.setDefaults(def, { xAxis: {}, yAxis: {} });
KG.setDefaults(def.xAxis, { min: 0, max: 10, title: '', orient: 'bottom' });
KG.setDefaults(def.yAxis, { min: 0, max: 10, title: '', orient: 'left' });
_this = _super.call(this, def) || this;
var po = _this, xMin = def.xAxis.min, xMax = def.xAxis.max, xLog = def.xAxis.log, yMin = def.yAxis.min, yMax = def.yAxis.max, yLog = def.yAxis.log, leftEdge = def.position.x, rightEdge = KGAuthor.addDefs(def.position.x, def.position.width), bottomEdge = KGAuthor.addDefs(def.position.y, def.position.height), topEdge = def.position.y;
po.xScale = new Scale({
"name": KG.randomString(10),
"axis": "x",
"domainMin": xMin,
"domainMax": xMax,
"rangeMin": leftEdge,
"rangeMax": rightEdge,
"log": xLog
});
po.yScale = new Scale({
"name": KG.randomString(10),
"axis": "y",
"domainMin": yMin,
"domainMax": yMax,
"rangeMin": bottomEdge,
"rangeMax": topEdge,
"log": yLog
});
po.subObjects = [po.xScale, po.yScale];
return _this;
}
return PositionedObject;
}(KGAuthor.AuthoringObject));
KGAuthor.PositionedObject = PositionedObject;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var Graph = /** @class */ (function (_super) {
__extends(Graph, _super);
function Graph(def) {
var _this = this;
def = KG.setDefaults(def, { objects: [] });
_this = _super.call(this, def) || this;
var g = _this;
//axes need to update when the other one's domain changes
def.xAxis.otherMin = def.yAxis.min;
def.xAxis.otherMax = def.yAxis.max;
def.yAxis.otherMin = def.xAxis.min;
def.yAxis.otherMax = def.xAxis.max;
g.clipPath = new KGAuthor.ClipPath({
"name": KG.randomString(10),
"paths": [new KGAuthor.Rectangle({
x1: def.xAxis.min,
x2: def.xAxis.max,
y1: def.yAxis.min,
y2: def.yAxis.max,
inDef: true
}, g)]
}, g);
g.subObjects.push(g.clipPath);
g.def.objects.unshift({
type: 'Axis',
def: g.def.xAxis
});
g.def.objects.unshift({
type: 'Axis',
def: g.def.yAxis
});
g.def.objects.forEach(function (obj) {
obj = KGAuthor.extractTypeAndDef(obj);
g.subObjects.push(new KGAuthor[obj.type](obj.def, g));
});
console.log(g);
return _this;
}
Graph.prototype.getMarkerName = function (lookup) {
var g = this;
var name = '', found = false;
// look to see if there is already a marker of that name and type
g.subObjects.forEach(function (obj) {
if (obj.hasOwnProperty('color') && obj['color'] == lookup.color && obj.hasOwnProperty('markerType') && obj['markerType'] == lookup.markerType) {
name = obj.name;
found = true;
}
});
// if there is, return its name
if (found) {
return name;
}
// otherwise create a new marker, add to the graph's subobjects, and return the new marker's name
else {
var newMarker = new KGAuthor[lookup.markerType]({ color: lookup.color });
g.subObjects.push(newMarker);
return newMarker.name;
}
};
Graph.prototype.getEndArrowName = function (color) {
return this.getMarkerName({
markerType: 'EndArrow',
color: color
});
};
Graph.prototype.getStartArrowName = function (color) {
return this.getMarkerName({
markerType: 'StartArrow',
color: color
});
};
return Graph;
}(KGAuthor.PositionedObject));
KGAuthor.Graph = Graph;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var GeoGebraContainer = /** @class */ (function (_super) {
__extends(GeoGebraContainer, _super);
function GeoGebraContainer(def) {
var _this = this;
def.xAxis = { min: 0, max: 1 };
def.yAxis = { min: 0, max: 1 };
_this = _super.call(this, def) || this;
var ggb = _this;
def.xScaleName = ggb.xScale.name;
def.yScaleName = ggb.yScale.name;
ggb.subObjects.push(new KGAuthor.GeoGebraApplet(def));
return _this;
}
return GeoGebraContainer;
}(KGAuthor.PositionedObject));
KGAuthor.GeoGebraContainer = GeoGebraContainer;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var MathboxContainer = /** @class */ (function (_super) {
__extends(MathboxContainer, _super);
function MathboxContainer(def) {
var _this = this;
// the container, as a div, must have an x and y axis of its own.
// so we must first push down the author's specified x, y, and z axes down to be objects
def.objects.push({
"type": "MathboxXAxis",
"def": def.xAxis
});
def.objects.push({
"type": "MathboxYAxis",
"def": def.yAxis
});
def.objects.push({
"type": "MathboxZAxis",
"def": def.zAxis
});
delete def.zAxis;
def.xAxis = { min: 0, max: 1 };
def.yAxis = { min: 0, max: 1 };
_this = _super.call(this, def) || this;
var mb = _this;
def.xScaleName = mb.xScale.name;
def.yScaleName = mb.yScale.name;
mb.subObjects.push(new KGAuthor.Mathbox(def));
return _this;
}
return MathboxContainer;
}(KGAuthor.PositionedObject));
KGAuthor.MathboxContainer = MathboxContainer;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var DivContainer = /** @class */ (function (_super) {
__extends(DivContainer, _super);
function DivContainer(def) {
var _this = this;
def.xAxis = { min: 0, max: 1 };
def.yAxis = { min: 0, max: 1 };
_this = _super.call(this, def) || this;
var dc = _this;
dc.subObjects.push(new KGAuthor.PositionedDiv(def, dc));
return _this;
}
return DivContainer;
}(KGAuthor.PositionedObject));
KGAuthor.DivContainer = DivContainer;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var GraphObjectGenerator = /** @class */ (function (_super) {
__extends(GraphObjectGenerator, _super);
function GraphObjectGenerator(def, graph) {
var _this = _super.call(this, def) || this;
if (graph) {
_this.def.xScaleName = graph.xScale.name;
_this.def.yScaleName = graph.yScale.name;
if (!def.inDef) {
_this.def.clipPathName = def.clipPathName || graph.clipPath.name;
}
}
_this.subObjects = [];
return _this;
}
GraphObjectGenerator.prototype.extractCoordinates = function (coordinatesKey, xKey, yKey) {
coordinatesKey = coordinatesKey || 'coordinates';
xKey = xKey || 'x';
yKey = yKey || 'y';
var obj = this, def = this.def;
if (def.hasOwnProperty(coordinatesKey) && def[coordinatesKey] != undefined) {
def[xKey] = def[coordinatesKey][0].toString();
def[yKey] = def[coordinatesKey][1].toString();
delete def[coordinatesKey];
}
obj[xKey] = def[xKey].toString();
obj[yKey] = def[yKey].toString();
};
return GraphObjectGenerator;
}(KGAuthor.AuthoringObject));
KGAuthor.GraphObjectGenerator = GraphObjectGenerator;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var DefObject = /** @class */ (function (_super) {
__extends(DefObject, _super);
function DefObject(def, graph) {
var _this = this;
def.inDef = true;
_this = _super.call(this, def, graph) || this;
return _this;
}
DefObject.prototype.parseSelf = function (parsedData) {
delete this.def.clipPathName;
parsedData.clipPaths.push(this.def);
return parsedData;
};
return DefObject;
}(KGAuthor.GraphObjectGenerator));
KGAuthor.DefObject = DefObject;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var ClipPath = /** @class */ (function (_super) {
__extends(ClipPath, _super);
function ClipPath() {
return _super !== null && _super.apply(this, arguments) || this;
}
ClipPath.prototype.parseSelf = function (parsedData) {
delete this.def.clipPathName;
parsedData.clipPaths.push(this.def);
return parsedData;
};
return ClipPath;
}(KGAuthor.DefObject));
KGAuthor.ClipPath = ClipPath;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var Marker = /** @class */ (function (_super) {
__extends(Marker, _super);
function Marker(def, graph) {
var _this = _super.call(this, def, graph) || this;
_this.maskPath = def.maskPath;
return _this;
}
Marker.prototype.parseSelf = function (parsedData) {
parsedData.markers.push(this.def);
return parsedData;
};
return Marker;
}(KGAuthor.DefObject));
KGAuthor.Marker = Marker;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var ArrowDef = /** @class */ (function (_super) {
__extends(ArrowDef, _super);
function ArrowDef(def, graph) {
var _this = this;
def.name = KG.randomString(10);
_this = _super.call(this, def, graph) || this;
_this.color = def.color;
_this.arrowPath = def.arrowPath;
return _this;
}
return ArrowDef;
}(KGAuthor.Marker));
KGAuthor.ArrowDef = ArrowDef;
var StartArrow = /** @class */ (function (_super) {
__extends(StartArrow, _super);
function StartArrow(def, graph) {
var _this = this;
def.refX = 2;
def.maskPath = "M10,1 L10,12 L0,7 L0,5 L10,1";
def.arrowPath = "M11,2 L11,11 L2,6 L11,2";
_this = _super.call(this, def, graph) || this;
_this.markerType = 'StartArrow';
return _this;
}
return StartArrow;
}(ArrowDef));
KGAuthor.StartArrow = StartArrow;
var EndArrow = /** @class */ (function (_super) {
__extends(EndArrow, _super);
function EndArrow(def, graph) {
var _this = this;
def.refX = 11;
def.maskPath = "M3,1 L3,12 L12,7 L12,5 L3,1";
def.arrowPath = "M2,2 L2,11 L10,6 L2,2";
_this = _super.call(this, def, graph) || this;
_this.markerType = 'EndArrow';
return _this;
}
return EndArrow;
}(ArrowDef));
KGAuthor.EndArrow = EndArrow;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var GraphObject = /** @class */ (function (_super) {
__extends(GraphObject, _super);
function GraphObject(def, graph) {
var _this = this;
if (def.hasOwnProperty('clipPaths')) {
def.clipPathName = KG.randomString(10);
}
KG.setDefaults(def, {
name: KG.randomString(10)
});
_this = _super.call(this, def, graph) || this;
var g = _this;
if (def.hasOwnProperty('color')) {
g.color = def.color;
}
if (def.hasOwnProperty("clipPaths")) {
var clipPathObjects = def.clipPaths.map(function (shape) {
var shapeType = Object.keys(shape)[0];
var shapeDef = shape[shapeType];
shapeDef.inDef = true;
return new KGAuthor[shapeType](shapeDef, graph);
});
g.subObjects.push(new KGAuthor.ClipPath({ name: def.clipPathName, paths: clipPathObjects }, graph));
}
return _this;
}
GraphObject.prototype.parseSelf = function (parsedData) {
parsedData.layers[this.layer].push(this);
return parsedData;
};
return GraphObject;
}(KGAuthor.GraphObjectGenerator));
KGAuthor.GraphObject = GraphObject;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var Axis = /** @class */ (function (_super) {
__extends(Axis, _super);
function Axis(def, graph) {
var _this = _super.call(this, def, graph) || this;
var a = _this;
a.type = 'Axis';
a.layer = 2;
if (def.hasOwnProperty('title') && ("" != def.title)) {
if (def.orient == 'bottom') {
a.subObjects.push(new KGAuthor.Label({
text: "\\text{" + def.title + "}",
x: KGAuthor.averageDefs(graph.xScale.min, graph.xScale.max),
y: graph.yScale.min,
yPixelOffset: -40
}, graph));
}
else if (def.orient == 'left') {
a.subObjects.push(new KGAuthor.Label({
text: "\\text{" + def.title + "}",
x: graph.xScale.min,
y: KGAuthor.averageDefs(graph.yScale.min, graph.yScale.max),
xPixelOffset: -50,
rotate: 90
}, graph));
}
else if (def.orient == 'top') {
a.subObjects.push(new KGAuthor.Label({
text: "\\text{" + def.title + "}",
x: KGAuthor.averageDefs(graph.xScale.min, graph.xScale.max),
y: graph.yScale.min,
yPixelOffset: 40
}, graph));
}
else {
a.subObjects.push(new KGAuthor.Label({
text: "\\text{" + def.title + "}",
x: graph.xScale.max,
y: KGAuthor.averageDefs(graph.yScale.min, graph.yScale.max),
xPixelOffset: 50,
rotate: 270
}, graph));
}
}
return _this;
}
return Axis;
}(KGAuthor.GraphObject));
KGAuthor.Axis = Axis;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var Grid = /** @class */ (function (_super) {
__extends(Grid, _super);
function Grid(def, graph) {
var _this = this;
def = def || {};
_this = _super.call(this, def, graph) || this;
KG.setDefaults(def, {
strokeWidth: 1,
stroke: 'lightgrey',
lineStyle: 'dotted',
layer: 0,
xStep: 1,
yStep: 1
});
var g = _this;
g.subObjects = [];
for (var i = 0; i < 10; i++) {
var x = KGAuthor.multiplyDefs(i, def.xStep), y = KGAuthor.multiplyDefs(i, def.yStep);
var gxDef = KGAuthor.copyJSON(def), gyDef = KGAuthor.copyJSON(def);
gxDef.a = [x, graph.yScale.min];
gxDef.b = [x, graph.yScale.max];
gyDef.a = [graph.xScale.min, y];
gyDef.b = [graph.xScale.max, y];
g.subObjects.push(new KGAuthor.Segment(gxDef, graph));
g.subObjects.push(new KGAuthor.Segment(gyDef, graph));
}
return _this;
}
return Grid;
}(KGAuthor.GraphObjectGenerator));
KGAuthor.Grid = Grid;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var Curve = /** @class */ (function (_super) {
__extends(Curve, _super);
function Curve(def, graph) {
var _this = this;
def = KGAuthor.setStrokeColor(def);
KGAuthor.parseFn(def, 'fn', 'univariateFunction');
_this = _super.call(this, def, graph) || this;
var c = _this;
c.type = 'Curve';
c.layer = def.layer || 1;
c.pts = def.pts || [];
if (def.hasOwnProperty('areaBelow')) {
KG.setDefaults(def.areaBelow, {
color: def.color
});
KGAuthor.parseFill(def, 'areaBelow');
KG.setDefaults(def.areaBelow, def.univariateFunction);
KGAuthor.parseFn(def.areaBelow, 'fn', 'univariateFunction1');
c.subObjects.push(new KGAuthor.Area(def.areaBelow, graph));
}
if (def.hasOwnProperty('areaAbove')) {
KG.setDefaults(def.areaBelow, {
color: def.color
});
KGAuthor.parseFill(def, 'areaAbove');
KG.setDefaults(def.areaAbove, def.univariateFunction);
KGAuthor.parseFn(def.areaBelow, 'fn', 'univariateFunction1');
def.areaAbove.above = true;
c.subObjects.push(new KGAuthor.Area(def.areaAbove, graph));
}
if (def.hasOwnProperty('label')) {
var labelDef = KGAuthor.copyJSON(def);
delete labelDef.label;
labelDef = KG.setDefaults(labelDef, def.label);
labelDef = KG.setDefaults(labelDef, {
fontSize: 12,
color: def.color
});
if (def.hasOwnProperty('univariateFunction')) {
if (labelDef.hasOwnProperty('x') && def.univariateFunction.ind != 'y') {
labelDef.coordinates = [labelDef.x, c.yOfX(labelDef.x)];
c.subObjects.push(new KGAuthor.Label(labelDef, graph));
}
else if (labelDef.hasOwnProperty('y') && def.univariateFunction.ind != 'x') {
labelDef.coordinates = [c.xOfY(labelDef.y), labelDef.y];
c.subObjects.push(new KGAuthor.Label(labelDef, graph));
}
}
if (def.hasOwnProperty('parametricFunction')) {
if (labelDef.hasOwnProperty('t')) {
labelDef.coordinates = c.xyOfT(labelDef.t);
c.subObjects.push(new KGAuthor.Label(labelDef, graph));
}
}
}
return _this;
}
Curve.prototype.yOfX = function (x) {
return "(" + KGAuthor.replaceVariable(this.def.univariateFunction.fn, '(x)', "(" + x + ")") + ")";
};
Curve.prototype.xOfY = function (y) {
var c = this;
if (c.def.univariateFunction.hasOwnProperty('yFn')) {
return "(" + KGAuthor.replaceVariable(c.def.univariateFunction.yFn, '(y)', "(" + y + ")") + ")";
}
else {
return "(" + KGAuthor.replaceVariable(c.def.univariateFunction.fn, '(y)', "(" + y + ")") + ")";
}
};
Curve.prototype.xyOfT = function (t) {
return [
KGAuthor.replaceVariable(this.def.parametricFunction.xFunction, '(t)', "(" + t + ")"),
KGAuthor.replaceVariable(this.def.parametricFunction.yFunction, '(t)', "(" + t + ")")
];
};
Curve.prototype.parseSelf = function (parsedData) {
var c = this;
parsedData = _super.prototype.parseSelf.call(this, parsedData);
parsedData.calcs[c.name] = parsedData.calcs[c.name] || {};
c.pts.forEach(function (p) {
if (p.hasOwnProperty('x')) {
parsedData.calcs[c.name][p['name']] = {
x: p['x'],
y: c.yOfX(p['x'])
};
}
if (p.hasOwnProperty('y')) {
parsedData.calcs[c.name][p['name']] = {
x: c.xOfY(p['y']),
y: p['y']
};
}
});
return parsedData;
};
return Curve;
}(KGAuthor.GraphObject));
KGAuthor.Curve = Curve;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var Line = /** @class */ (function (_super) {
__extends(Line, _super);
function Line(def, graph) {
var _this = this;
KG.setDefaults(def, {
color: 'colors.orange'
});
// may define line with two points
var xIntercept = def.xIntercept, yIntercept = def.yIntercept, slope = def.slope, invSlope = def.invSlope;
if (def.hasOwnProperty('point') && def.hasOwnProperty('point2')) {
// still need to handle infinite case
slope = KGAuthor.divideDefs(KGAuthor.subtractDefs(def.point[1], def.point2[1]), KGAuthor.subtractDefs(def.point[0], def.point2[0]));
yIntercept = KGAuthor.subtractDefs(def.point[1], KGAuthor.multiplyDefs(slope, def.point[0]));
invSlope = KGAuthor.divideDefs(KGAuthor.subtractDefs(def.point[0], def.point2[0]), KGAuthor.subtractDefs(def.point[1], def.point2[1]));
xIntercept = KGAuthor.subtractDefs(def.point[0], KGAuthor.multiplyDefs(invSlope, def.point[1]));
}
else if (def.hasOwnProperty('xIntercept') && def.hasOwnProperty('yIntercept')) {
slope = KGAuthor.negativeDef(KGAuthor.divideDefs(def.yIntercept, def.xIntercept));
invSlope = KGAuthor.negativeDef(KGAuthor.divideDefs(def.xIntercept, def.yIntercept));
}
else if (def.hasOwnProperty('point') && def.hasOwnProperty('yIntercept')) {
slope = KGAuthor.divideDefs(KGAuthor.subtractDefs(def.point[1], def.yIntercept), def.point[0]);
invSlope = KGAuthor.divideDefs(def.point[0], KGAuthor.subtractDefs(def.point[1], def.yIntercept));
xIntercept = KGAuthor.negativeDef(KGAuthor.multiplyDefs(yIntercept, invSlope));
}
else if (def.hasOwnProperty('slope') && def.hasOwnProperty('yIntercept')) {
invSlope = KGAuthor.invertDef(def.slope);
xIntercept = KGAuthor.negativeDef(KGAuthor.divideDefs(yIntercept, slope));
}
else if (def.hasOwnProperty('invSlope') && def.hasOwnProperty('xIntercept')) {
slope = KGAuthor.invertDef(def.invSlope);
yIntercept = KGAuthor.negativeDef(KGAuthor.divideDefs(xIntercept, invSlope));
}
else if (def.hasOwnProperty('invSlope') && def.hasOwnProperty('yIntercept')) {
slope = KGAuthor.invertDef(def.invSlope);
}
else if (def.hasOwnProperty('slope') && def.hasOwnProperty('point')) {
invSlope = KGAuthor.invertDef(def.slope);
xIntercept = KGAuthor.subtractDefs(def.point[0], KGAuthor.divideDefs(def.point[1], def.slope));
yIntercept = KGAuthor.subtractDefs(def.point[1], KGAuthor.multiplyDefs(def.point[0], def.slope));
}
else if (def.hasOwnProperty('invSlope') && def.hasOwnProperty('point')) {
slope = KGAuthor.invertDef(def.invSlope);
xIntercept = KGAuthor.subtractDefs(def.point[0], KGAuthor.divideDefs(def.point[1], slope));
yIntercept = KGAuthor.subtractDefs(def.point[1], KGAuthor.multiplyDefs(def.point[0], slope));
}
else if (def.hasOwnProperty('slope')) {
invSlope = KGAuthor.invertDef(def.slope);
xIntercept = 0;
yIntercept = 0;
}
else if (def.hasOwnProperty('yIntercept')) {
invSlope = Infinity;
xIntercept = null;
yIntercept = def.yIntercept;
slope = 0;
}
else if (def.hasOwnProperty('xIntercept')) {
invSlope = 0;
xIntercept = def.xIntercept;
yIntercept = null;
slope = Infinity;
}
else {
xIntercept = 0;
yIntercept = 0;
slope = KGAuthor.divideDefs(def.point[1], def.point[0]);
invSlope = KGAuthor.divideDefs(def.point[0], def.point[1]);
}
def.univariateFunction = {
fn: yIntercept + " + (" + slope + ")*(x)",
yFn: xIntercept + " + (" + invSlope + ")*(y)",
ind: "((" + invSlope + " == 0) ? 'y' : 'x')",
samplePoints: 2
};
if (def.hasOwnProperty('min')) {
def.univariateFunction.min = def.min;
delete def.min;
}
if (def.hasOwnProperty('max')) {
def.univariateFunction.max = def.max;
delete def.max;
}
_this = _super.call(this, def, graph) || this;
_this.xIntercept = xIntercept;
_this.yIntercept = yIntercept;
_this.slope = slope;
_this.invSlope = invSlope;
return _this;
}
Line.prototype.parseSelf = function (parsedData) {
var l = this;
parsedData = _super.prototype.parseSelf.call(this, parsedData);
var d = {
slope: l.slope.toString(),
invSlope: l.invSlope.toString()
};
if (l.xIntercept) {
d.xIntercept = l.xIntercept.toString();
}
if (l.yIntercept) {
d.yIntercept = l.yIntercept.toString();
}
if (!l.xIntercept) {
d.fixedPoint = "((" + d.yIntercept + ")/(1 - " + l.slope.toString() + "))";
}
else if (!l.yIntercept) {
d.fixedPoint = "((" + d.xIntercept + ")/(1 - " + l.invSlope.toString() + "))";
}
else {
d.fixedPoint = "(" + d.invSlope + " == 0 ? (" + d.xIntercept + ")/(1 - " + l.invSlope.toString() + ") : (" + d.yIntercept + ")/(1 - " + l.slope.toString() + "))";
}
parsedData.calcs[l.name] = KG.setDefaults(parsedData.calcs[l.name] || {}, d);
return parsedData;
};
return Line;
}(KGAuthor.Curve));
KGAuthor.Line = Line;
function lineIntersection(l1, l2) {
var x = KGAuthor.divideDefs(KGAuthor.addDefs(l1.xIntercept, KGAuthor.multiplyDefs(l1.invSlope, l2.yIntercept)), KGAuthor.subtractDefs("1", KGAuthor.multiplyDefs(l1.invSlope, l2.slope)));
var y = l2.yOfX(x);
return [x, y];
}
KGAuthor.lineIntersection = lineIntersection;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var Ellipse = /** @class */ (function (_super) {
__extends(Ellipse, _super);
function Ellipse(def, graph) {
var _this = this;
KG.setDefaults(def, {
color: 'colors.blue',
opacity: 0.2,
rx: 1,
ry: def.rx
});
def = KGAuthor.setFillColor(def);
def = KGAuthor.setStrokeColor(def);
_this = _super.call(this, def, graph) || this;
var c = _this;
c.type = 'Circle';
c.layer = def.layer || 0;
// may define the center using 'coordinates' or 'center' or 'c':
if (def.hasOwnProperty('c')) {
c.extractCoordinates('c');
}
else if (def.hasOwnProperty('center')) {
c.extractCoordinates('center');
}
else {
c.extractCoordinates();
}
if (def.hasOwnProperty('draggable') && def.draggable == true && !def.hasOwnProperty('drag')) {
def.drag = [];
if (def.x == "params." + KGAuthor.paramName(def.x)) {
def.drag.push({ horizontal: KGAuthor.paramName(def.x) });
}
if (def.y == "params." + KGAuthor.paramName(def.y)) {
def.drag.push({ vertical: KGAuthor.paramName(def.y) });
}
}
if (def.hasOwnProperty('label')) {
var labelDef = KGAuthor.copyJSON(def);
delete labelDef.label;
labelDef = KG.setDefaults(labelDef, def.label);
labelDef = KG.setDefaults(labelDef, {
fontSize: 10,
color: def.color,
bgcolor: null
});
c.subObjects.push(new KGAuthor.Label(labelDef, graph));
}
return _this;
}
return Ellipse;
}(KGAuthor.GraphObject));
KGAuthor.Ellipse = Ellipse;
var Circle = /** @class */ (function (_super) {
__extends(Circle, _super);
function Circle(def, graph) {
var _this = this;
if (def.hasOwnProperty('radius')) {
def.r = def.radius;
delete def.radius;
}
if (def.hasOwnProperty('r')) {
def.rx = def.r;
def.ry = def.r;
}
_this = _super.call(this, def, graph) || this;
return _this;
}
return Circle;
}(Ellipse));
KGAuthor.Circle = Circle;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var Point = /** @class */ (function (_super) {
__extends(Point, _super);
function Point(def, graph) {
var _this = this;
KG.setDefaults(def, {
color: 'colors.blue'
});
def = KGAuthor.setFillColor(def);
_this = _super.call(this, def, graph) || this;
var p = _this;
p.type = 'Point';
p.layer = 3;
p.extractCoordinates();
if (def.hasOwnProperty('draggable') && def.draggable == true && !def.hasOwnProperty('drag')) {
def.drag = [];
if (def.x == "params." + KGAuthor.paramName(def.x)) {
def.drag.push({ horizontal: KGAuthor.paramName(def.x) });
}
if (def.y == "params." + KGAuthor.paramName(def.y)) {
def.drag.push({ vertical: KGAuthor.paramName(def.y) });
}
}
if (def.hasOwnProperty('label')) {
var labelDef = KGAuthor.copyJSON(def);
delete labelDef.label;
labelDef = KG.setDefaults(labelDef, def.label);
labelDef = KG.setDefaults(labelDef, {
fontSize: 10,
position: 'bl',
color: def.color,
bgcolor: null
});
p.subObjects.push(new KGAuthor.Label(labelDef, graph));
}
if (def.hasOwnProperty('droplines')) {
if (def.droplines.hasOwnProperty('vertical')) {
var verticalDroplineDef = KGAuthor.copyJSON(def);
// only drag vertical droplines horizontally
if (verticalDroplineDef.hasOwnProperty('drag')) {
verticalDroplineDef.drag = verticalDroplineDef.drag.filter(function (value, index, arr) { return ((value.directions == 'x') || value.hasOwnProperty('horizontal')); });
}
if (def.droplines.hasOwnProperty('top')) {
verticalDroplineDef.y = graph.yScale.max;
var xTopAxisLabelDef = KGAuthor.copyJSON(verticalDroplineDef);
xTopAxisLabelDef.y = 'OPPAXIS';
KG.setDefaults(xTopAxisLabelDef, {
text: def.droplines.top,
fontSize: 10
});
p.subObjects.push(new KGAuthor.Label(xTopAxisLabelDef, graph));
}
p.subObjects.push(new KGAuthor.VerticalDropline(verticalDroplineDef, graph));
var xAxisLabelDef = KGAuthor.copyJSON(verticalDroplineDef);
xAxisLabelDef.y = 'AXIS';
KG.setDefaults(xAxisLabelDef, {
text: def.droplines.vertical,
fontSize: 10
});
p.subObjects.push(new KGAuthor.Label(xAxisLabelDef, graph));
}
if (def.droplines.hasOwnProperty('horizontal')) {
var horizontalDroplineDef = KGAuthor.copyJSON(def);
// only drag horizontal droplines vertically
if (horizontalDroplineDef.hasOwnProperty('drag')) {
horizontalDroplineDef.drag = horizontalDroplineDef.drag.filter(function (value, index, arr) { return ((value.directions == 'y') || value.hasOwnProperty('vertical')); });
}
p.subObjects.push(new KGAuthor.HorizontalDropline(horizontalDroplineDef, graph));
var yAxisLabelDef = KGAuthor.copyJSON(horizontalDroplineDef);
yAxisLabelDef.x = 'AXIS';
KG.setDefaults(yAxisLabelDef, {
text: def.droplines.horizontal,
fontSize: 10
});
p.subObjects.push(new KGAuthor.Label(yAxisLabelDef, graph));
}
}
return _this;
}
return Point;
}(KGAuthor.GraphObject));
KGAuthor.Point = Point;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var Segment = /** @class */ (function (_super) {
__extends(Segment, _super);
function Segment(def, graph) {
var _this = this;
def = KGAuthor.setStrokeColor(def);
if (def.hasOwnProperty('startArrow')) {
def.startArrowName = graph.getStartArrowName(def.color);
}
if (def.hasOwnProperty('endArrow')) {
def.endArrowName = graph.getEndArrowName(def.color);
}
_this = _super.call(this, def, graph) || this;
var s = _this;
s.type = 'Segment';
s.layer = 1;
s.extractCoordinates('a', 'x1', 'y1');
s.extractCoordinates('b', 'x2', 'y2');
if (def.hasOwnProperty('label')) {
var labelDef = KGAuthor.copyJSON(def);
delete labelDef.label;
labelDef = KG.setDefaults(labelDef, def.label);
labelDef = KG.setDefaults(labelDef, {
fontSize: 12,
color: def.color,
location: 0.5
});
labelDef.coordinates = [
KGAuthor.averageDefs(s.x1, s.x2, labelDef.location),
KGAuthor.averageDefs(s.y1, s.y2, labelDef.location)
];
s.subObjects.push(new KGAuthor.Label(labelDef, graph));
}
return _this;
}
return Segment;
}(KGAuthor.GraphObject));
KGAuthor.Segment = Segment;
var CrossGraphSegment = /** @class */ (function (_super) {
__extends(CrossGraphSegment, _super);
function CrossGraphSegment(def, graph) {
var _this = this;
def.xScale2Name = '';
_this = _super.call(this, def, graph) || this;
return _this;
}
return CrossGraphSegment;
}(Segment));
KGAuthor.CrossGraphSegment = CrossGraphSegment;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var Arrow = /** @class */ (function (_super) {
__extends(Arrow, _super);
function Arrow(def, graph) {
var _this = this;
def.endArrow = true;
if (def.hasOwnProperty('double')) {
def.startArrow = def.double;
}
if (def.hasOwnProperty('trim')) {
def.a = [KGAuthor.averageDefs(def.end[0], def.begin[0], def.trim), KGAuthor.averageDefs(def.end[1], def.begin[1], def.trim)];
def.b = [KGAuthor.averageDefs(def.begin[0], def.end[0], def.trim), KGAuthor.averageDefs(def.begin[1], def.end[1], def.trim)];
}
else {
def.a = def.begin;
def.b = def.end;
}
_this = _super.call(this, def, graph) || this;
return _this;
}
return Arrow;
}(KGAuthor.Segment));
KGAuthor.Arrow = Arrow;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var Dropline = /** @class */ (function (_super) {
__extends(Dropline, _super);
function Dropline(def, graph) {
var _this = this;
def.lineStyle = 'dotted';
delete def.label;
_this = _super.call(this, def, graph) || this;
return _this;
}
return Dropline;
}(KGAuthor.Segment));
KGAuthor.Dropline = Dropline;
var VerticalDropline = /** @class */ (function (_super) {
__extends(VerticalDropline, _super);
function VerticalDropline(def, graph) {
var _this = this;
def.a = [def.x, graph.xScale.intercept];
def.b = [def.x, def.y];
_this = _super.call(this, def, graph) || this;
return _this;
}
return VerticalDropline;
}(Dropline));
KGAuthor.VerticalDropline = VerticalDropline;
var CrossGraphVerticalDropline = /** @class */ (function (_super) {
__extends(CrossGraphVerticalDropline, _super);
function CrossGraphVerticalDropline(def, graph) {
var _this = this;
def.xScale2Name = '';
_this = _super.call(this, def, graph) || this;
return _this;
}
return CrossGraphVerticalDropline;
}(VerticalDropline));
KGAuthor.CrossGraphVerticalDropline = CrossGraphVerticalDropline;
var HorizontalDropline = /** @class */ (function (_super) {
__extends(HorizontalDropline, _super);
function HorizontalDropline(def, graph) {
var _this = this;
def.a = [graph.yScale.intercept, def.y];
def.b = [def.x, def.y];
_this = _super.call(this, def, graph) || this;
return _this;
}
return HorizontalDropline;
}(Dropline));
KGAuthor.HorizontalDropline = HorizontalDropline;
var CrossGraphHorizontalDropline = /** @class */ (function (_super) {
__extends(CrossGraphHorizontalDropline, _super);
function CrossGraphHorizontalDropline(def, graph) {
var _this = this;
def.xScale2Name = '';
_this = _super.call(this, def, graph) || this;
return _this;
}
return CrossGraphHorizontalDropline;
}(HorizontalDropline));
KGAuthor.CrossGraphHorizontalDropline = CrossGraphHorizontalDropline;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var Area = /** @class */ (function (_super) {
__extends(Area, _super);
function Area(def, graph) {
var _this = this;
KG.setDefaults(def, {
color: 'colors.blue',
opacity: 0.2
});
def = KGAuthor.setFillColor(def);
KGAuthor.parseFn(def, 'fn', 'univariateFunction1');
KGAuthor.parseFn(def, 'fn1', 'univariateFunction1');
KGAuthor.parseFn(def, 'fn2', 'univariateFunction2');
_this = _super.call(this, def, graph) || this;
_this.type = 'Area';
_this.layer = def.layer || 0;
return _this;
}
return Area;
}(KGAuthor.GraphObject));
KGAuthor.Area = Area;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var Rectangle = /** @class */ (function (_super) {
__extends(Rectangle, _super);
function Rectangle(def, graph) {
var _this = this;
KGAuthor.setFillColor(def);
_this = _super.call(this, def, graph) || this;
var rect = _this;
rect.type = 'Rectangle';
rect.layer = def.layer || 0;
rect.extractCoordinates('a', 'x1', 'y1');
rect.extractCoordinates('b', 'x2', 'y2');
if (def.hasOwnProperty('label')) {
var labelDef = KGAuthor.copyJSON(def);
delete labelDef.label;
labelDef = KG.setDefaults(labelDef, def.label);
labelDef = KG.setDefaults(labelDef, {
fontSize: 10,
color: def.color,
bgcolor: null,
x: KGAuthor.averageDefs(rect['x1'], rect['x2']),
y: KGAuthor.averageDefs(rect['y1'], rect['y2'])
});
rect.subObjects.push(new KGAuthor.Label(labelDef, graph));
}
return _this;
}
return Rectangle;
}(KGAuthor.GraphObject));
KGAuthor.Rectangle = Rectangle;
var Overlap = /** @class */ (function (_super) {
__extends(Overlap, _super);
function Overlap(def, graph) {
var _this = this;
var shape1name = KG.randomString(10), shape2name = KG.randomString(10);
def = KGAuthor.setFillColor(def);
KG.setDefaults(def, {
x1: graph.def.xAxis.min,
x2: graph.def.xAxis.max,
y1: graph.def.yAxis.min,
y2: graph.def.yAxis.max,
clipPathName: shape1name,
clipPathName2: shape2name
});
_this = _super.call(this, def, graph) || this;
var r = _this;
var clipPathObjects = def.shapes.map(function (shape) {
var shapeType = Object.keys(shape)[0];
var shapeDef = shape[shapeType];
shapeDef.inDef = true;
return new KGAuthor[shapeType](shapeDef, graph);
});
// As of now this does at most two; can make more recursive in the future but this handles 80% of the use cases
r.subObjects.push(new KGAuthor.ClipPath({ name: shape1name, paths: [clipPathObjects[0]] }, graph));
r.subObjects.push(new KGAuthor.ClipPath({ name: shape2name, paths: [clipPathObjects[1]] }, graph));
return _this;
}
return Overlap;
}(Rectangle));
KGAuthor.Overlap = Overlap;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var Contour = /** @class */ (function (_super) {
__extends(Contour, _super);
function Contour(def, graph) {
var _this = this;
def = KGAuthor.setStrokeColor(def);
_this = _super.call(this, def, graph) || this;
var c = _this;
c.type = 'Contour';
c.layer = def.layer || 1;
if (def.hasOwnProperty('coordinates')) {
c.extractCoordinates();
}
if (!def.hasOwnProperty('level')) {
def.level = def.fn.replace('(x)', "(" + def.x + ")").replace('(y)', "(" + def.y + ")");
}
return _this;
}
return Contour;
}(KGAuthor.GraphObject));
KGAuthor.Contour = Contour;
var ContourMap = /** @class */ (function (_super) {
__extends(ContourMap, _super);
function ContourMap(def, graph) {
var _this = this;
KG.setDefaults(def, {
color: "grey",
strokeWidth: 0.5
});
_this = _super.call(this, def, graph) || this;
var m = _this;
m.type = 'ContourMap';
m.layer = def.layer || 1;
m.subObjects = def.levels.map(function (level) {
var contourDef = KGAuthor.copyJSON(def);
delete contourDef.levels;
contourDef.level = level;
return new Contour(contourDef, graph);
});
console.log('contours: ', m.subObjects);
return _this;
}
return ContourMap;
}(KGAuthor.GraphObject));
KGAuthor.ContourMap = ContourMap;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var AngleMarker = /** @class */ (function (_super) {
__extends(AngleMarker, _super);
function AngleMarker(def, graph) {
var _this = this;
KG.setDefaults(def, {
name: 'angle',
color: 'colors.grey',
point: [0, 0],
radians: false,
start: 0,
r: KGAuthor.multiplyDefs(0.05, KGAuthor.subtractDefs(graph.def.xAxis.max, graph.def.xAxis.min)),
strokeWidth: 0.75
});
def = KGAuthor.setStrokeColor(def);
if (def.hasOwnProperty("measure")) {
def.end = KGAuthor.addDefs(def.start, def.measure);
}
else {
def.measure = KGAuthor.subtractDefs(def.end, def.start);
}
// convert to radians unless already radians
var start = def.radians ? def.start : KGAuthor.multiplyDefs(def.start, 0.01745329252), measure = def.radians ? def.measure : KGAuthor.multiplyDefs(def.measure, 0.01745329252), end = def.radians ? def.end : KGAuthor.multiplyDefs(def.end, 0.01745329252), mid = KGAuthor.addDefs(start, KGAuthor.multiplyDefs(0.5, measure));
def.parametricFunction = {
xFunction: KGAuthor.addDefs(def.point[0], KGAuthor.multiplyDefs(def.r, "cos(t)")),
yFunction: KGAuthor.addDefs(def.point[1], KGAuthor.multiplyDefs(def.r, "sin(t)")),
min: start,
max: end
};
_this = _super.call(this, def, graph) || this;
var dm = _this;
dm.measureDegrees = def.radians ? KGAuthor.multiplyDefs(def.measure, 57.2957795131) : def.measure;
dm.measureRadians = KGAuthor.divideDefs(measure, Math.PI);
var labelDef = KG.setDefaults(def.label || {}, {
x: KGAuthor.addDefs(def.point[0], KGAuthor.multiplyDefs(KGAuthor.multiplyDefs(1.7, def.r), "cos(" + mid + ")")),
y: KGAuthor.addDefs(def.point[1], KGAuthor.multiplyDefs(KGAuthor.multiplyDefs(1.7, def.r), "sin(" + mid + ")")),
fontSize: 8,
color: def.stroke,
bgcolor: "none",
radians: false
});
var labelTextRadians = "`${calcs." + dm.name + ".measureRadians.toFixed(2)}\\\\pi`", labelTextDegrees = "`${calcs." + dm.name + ".measureDegrees.toFixed(0)}^{\\\\circ}`";
labelDef.text = labelDef.hasOwnProperty('text') ? def.label.text : labelDef.radians ? labelTextRadians : labelTextDegrees;
dm.subObjects.push(new KGAuthor.Label(labelDef, graph));
return _this;
}
AngleMarker.prototype.parseSelf = function (parsedData) {
var dm = this;
parsedData = _super.prototype.parseSelf.call(this, parsedData);
parsedData.calcs[dm.name] = {
measureDegrees: dm.measureDegrees.toString(),
measureRadians: dm.measureRadians.toString()
};
return parsedData;
};
return AngleMarker;
}(KGAuthor.Curve));
KGAuthor.AngleMarker = AngleMarker;
var Angle = /** @class */ (function (_super) {
__extends(Angle, _super);
function Angle(def, graph) {
var _this = this;
var A = new KGAuthor.Point(def.pointA, graph), B = new KGAuthor.Point(def.pointB, graph), C = new KGAuthor.Point(def.pointC, graph);
def.start = "atan2(" + A.y + " - " + B.y + "," + A.x + " - " + B.x + ")";
def.end = "atan2(" + C.y + " - " + B.y + "," + C.x + " - " + B.x + ")";
def.point = [B.x, B.y];
def.radians = true;
KG.setDefaults(def, {
label: {
radians: false
}
});
_this = _super.call(this, def, graph) || this;
var a = _this;
a.subObjects.push(A);
a.subObjects.push(B);
a.subObjects.push(C);
if (def.showSegments) {
var ABdef = KGAuthor.copyJSON(def), CBdef = KGAuthor.copyJSON(def);
ABdef.a = [B.x, B.y];
ABdef.b = [A.x, A.y];
delete ABdef.label;
a.subObjects.push(new KGAuthor.Segment(ABdef, graph));
CBdef.a = [B.x, B.y];
CBdef.b = [C.x, C.y];
delete CBdef.label;
a.subObjects.push(new KGAuthor.Segment(CBdef, graph));
}
return _this;
}
return Angle;
}(AngleMarker));
KGAuthor.Angle = Angle;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var MathboxObject = /** @class */ (function (_super) {
__extends(MathboxObject, _super);
function MathboxObject(def) {
var _this = _super.call(this, def) || this;
_this.mb = def.mb;
return _this;
}
return MathboxObject;
}(KGAuthor.AuthoringObject));
KGAuthor.MathboxObject = MathboxObject;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var MathboxAxis = /** @class */ (function (_super) {
__extends(MathboxAxis, _super);
function MathboxAxis(def) {
var _this = _super.call(this, def) || this;
var a = _this;
a.type = 'MathboxAxis';
a.mb.addObject({
"type": "MathboxLabel",
"def": {
"x": 50,
"y": 0,
"z": 0,
"text": "Good 1"
}
});
return _this;
}
return MathboxAxis;
}(KGAuthor.MathboxObject));
KGAuthor.MathboxAxis = MathboxAxis;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var MathboxPoint = /** @class */ (function (_super) {
__extends(MathboxPoint, _super);
function MathboxPoint(def) {
var _this = _super.call(this, def) || this;
var a = _this;
a.type = 'MathboxPoint';
return _this;
}
return MathboxPoint;
}(KGAuthor.MathboxObject));
KGAuthor.MathboxPoint = MathboxPoint;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var MathboxLine = /** @class */ (function (_super) {
__extends(MathboxLine, _super);
function MathboxLine(def) {
var _this = _super.call(this, def) || this;
var a = _this;
a.type = 'MathboxAxis';
return _this;
}
return MathboxLine;
}(KGAuthor.MathboxObject));
KGAuthor.MathboxLine = MathboxLine;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
var KGAuthor;
(function (KGAuthor) {
var MathboxArea = /** @class */ (function (_super) {
__extends(MathboxArea, _super);
function MathboxArea(def) {
var _this = _super.call(this, def) || this;
var a = _this;
a.type = 'MathboxAxis';
return _this;
}
return MathboxArea;
}(KGAuthor.MathboxObject));
KGAuthor.MathboxArea = MathboxArea;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../../kg.ts" />
var KGAuthor;
(function (KGAuthor) {
var DivObject = /** @class */ (function (_super) {
__extends(DivObject, _super);
function DivObject() {
return _super !== null && _super.apply(this, arguments) || this;
}
DivObject.prototype.parseSelf = function (parsedData) {
parsedData.divs.push(this);
return parsedData;
};
return DivObject;
}(KGAuthor.GraphObject));
KGAuthor.DivObject = DivObject;
var Div = /** @class */ (function (_super) {
__extends(Div, _super);
function Div(def) {
var _this = _super.call(this, def) || this;
_this.type = "Div";
return _this;
}
return Div;
}(DivObject));
KGAuthor.Div = Div;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../../kg.ts" />
var KGAuthor;
(function (KGAuthor) {
var PositionedDiv = /** @class */ (function (_super) {
__extends(PositionedDiv, _super);
function PositionedDiv(def, divContainer) {
var _this = this;
delete def.xAxis;
delete def.yAxis;
def.xScaleName = divContainer.xScale.name;
def.yScaleName = divContainer.yScale.name;
_this = _super.call(this, def) || this;
_this.type = 'PositionedDiv';
return _this;
}
return PositionedDiv;
}(KGAuthor.DivObject));
KGAuthor.PositionedDiv = PositionedDiv;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../../kg.ts" />
var KGAuthor;
(function (KGAuthor) {
var Label = /** @class */ (function (_super) {
__extends(Label, _super);
function Label(def, graph) {
var _this = this;
if (def.hasOwnProperty('position')) {
if (def.position.toLowerCase() == 'bl') {
def.xPixelOffset = 5;
def.yPixelOffset = 10;
def.align = 'left';
}
if (def.position.toLowerCase() == 'tl') {
def.xPixelOffset = 5;
def.yPixelOffset = -12;
def.align = 'left';
}
if (def.position.toLowerCase() == 'tr') {
def.xPixelOffset = -5;
def.yPixelOffset = -12;
def.align = 'right';
}
if (def.position.toLowerCase() == 'br') {
def.xPixelOffset = -5;
def.yPixelOffset = 10;
def.align = 'right';
}
if (def.position.toLowerCase() == 'tr') {
def.xPixelOffset = -5;
def.yPixelOffset = -12;
def.align = 'right';
}
if (def.position.toLowerCase() == 't') {
def.yPixelOffset = -15;
}
if (def.position.toLowerCase() == 'b') {
def.yPixelOffset = 12;
}
if (def.position.toLowerCase() == 'l') {
def.xPixelOffset = -8;
def.align = 'right';
}
if (def.position.toLowerCase() == 'r') {
def.xPixelOffset = 8;
def.align = 'left';
}
}
_this = _super.call(this, def, graph) || this;
_this.type = 'Label';
_this.extractCoordinates();
return _this;
}
return Label;
}(KGAuthor.DivObject));
KGAuthor.Label = Label;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../../kg.ts" />
var KGAuthor;
(function (KGAuthor) {
var Sidebar = /** @class */ (function (_super) {
__extends(Sidebar, _super);
function Sidebar(def) {
var _this = _super.call(this, def) || this;
_this.type = 'Sidebar';
return _this;
}
return Sidebar;
}(KGAuthor.DivObject));
KGAuthor.Sidebar = Sidebar;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../../kg.ts" />
var KGAuthor;
(function (KGAuthor) {
var Controls = /** @class */ (function (_super) {
__extends(Controls, _super);
function Controls(def) {
var _this = _super.call(this, def) || this;
_this.type = 'Controls';
return _this;
}
return Controls;
}(KGAuthor.DivObject));
KGAuthor.Controls = Controls;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../../kg.ts" />
var KGAuthor;
(function (KGAuthor) {
var GameMatrix = /** @class */ (function (_super) {
__extends(GameMatrix, _super);
function GameMatrix(def) {
var _this = _super.call(this, def) || this;
_this.type = 'GameMatrix';
return _this;
}
return GameMatrix;
}(KGAuthor.DivObject));
KGAuthor.GameMatrix = GameMatrix;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../../kg.ts" />
var KGAuthor;
(function (KGAuthor) {
var GeoGebraApplet = /** @class */ (function (_super) {
__extends(GeoGebraApplet, _super);
function GeoGebraApplet(def) {
var _this = _super.call(this, def) || this;
_this.type = 'GeoGebraApplet';
return _this;
}
return GeoGebraApplet;
}(KGAuthor.DivObject));
KGAuthor.GeoGebraApplet = GeoGebraApplet;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../../kg.ts" />
var KGAuthor;
(function (KGAuthor) {
var Mathbox = /** @class */ (function (_super) {
__extends(Mathbox, _super);
function Mathbox(def) {
var _this = _super.call(this, def) || this;
var mb = _this;
mb.type = 'Mathbox';
def.objects.forEach(function (mbo) { mbo.def.mb = mb; });
return _this;
}
Mathbox.prototype.addObject = function (mbo) {
this.def.objects.push(mbo);
return this;
};
return Mathbox;
}(KGAuthor.DivObject));
KGAuthor.Mathbox = Mathbox;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../eg.ts" />
var KGAuthor;
(function (KGAuthor) {
var EconSchema = /** @class */ (function (_super) {
__extends(EconSchema, _super);
function EconSchema(def) {
var _this = this;
def.colors = KG.setDefaults(def.colors || {}, {
// consumer theory
utility: 'purple',
mrs: 'blue',
dispreferred: 'red',
preferred: 'purple',
offer: 'blue',
incomeOffer: 'orange',
demand: 'blue',
budget: 'green',
costlier: 'red',
endowment: 'grey',
incEffect: 'orange',
subEffect: 'red',
// producer theory
production: 'blue',
marginalCost: 'orange',
marginalRevenue: 'olive',
supply: 'orange',
shortRun: 'red',
longRun: 'orange',
profit: 'green',
loss: 'red',
// equilibrium
price: 'grey',
paretoLens: "'#ffff99'",
equilibriumPrice: 'green',
// macro
consumption: 'blue',
depreciation: "red",
savings: "green",
tax: 'red'
});
_this = _super.call(this, def) || this;
return _this;
}
return EconSchema;
}(KGAuthor.Schema));
KGAuthor.EconSchema = EconSchema;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../eg.ts" />
var KGAuthor;
(function (KGAuthor) {
var BowlesHallidaySchema = /** @class */ (function (_super) {
__extends(BowlesHallidaySchema, _super);
function BowlesHallidaySchema(def) {
var _this = this;
// create color scheme here; I took these from the spreadsheet
var purple = "'#3f007d'", blue = "'#084081'", green = "'#005824'";
// define any overrides to the defined Econ schema here
def.colors = {
// consumer theory
demand: purple,
supply: blue,
equilibriumPrice: green
};
_this = _super.call(this, def) || this;
return _this;
}
return BowlesHallidaySchema;
}(KGAuthor.EconSchema));
KGAuthor.BowlesHallidaySchema = BowlesHallidaySchema;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../eg.ts" />
var KGAuthor;
(function (KGAuthor) {
var EdgeworthBoxPlusSidebar = /** @class */ (function (_super) {
__extends(EdgeworthBoxPlusSidebar, _super);
function EdgeworthBoxPlusSidebar(def) {
var _this = _super.call(this, def) || this;
var l = _this;
var agentA = def['agentA'], agentB = def['agentB'], sidebarDef = def['sidebar'];
var width = 0.738, height = 0.9;
if (def.totalGood1 > def.totalGood2) {
height = def.totalGood2 * height / def.totalGood1;
}
if (def.totalGood2 > def.totalGood1) {
height = def.totalGood1 * width / def.totalGood2;
}
agentA.position = {
"x": 0.15,
"y": 0.05,
"width": width,
"height": height
};
agentB.position = {
"x": 0.15 + width,
"y": 0.05 + height,
"width": -1 * width,
"height": -1 * height
};
agentA.xAxis.max = agentB.xAxis.max = def.totalGood1;
agentA.yAxis.max = agentB.yAxis.max = def.totalGood2;
agentB.xAxis.orient = 'top';
agentB.yAxis.orient = 'right';
l.subObjects.push(new KGAuthor.Graph(agentA));
l.subObjects.push(new KGAuthor.Graph(agentB));
l.subObjects.push(new KGAuthor.Sidebar(sidebarDef));
return _this;
}
return EdgeworthBoxPlusSidebar;
}(KGAuthor.SquareLayout));
KGAuthor.EdgeworthBoxPlusSidebar = EdgeworthBoxPlusSidebar;
var EdgeworthBoxPlusTwoGraphsPlusSidebar = /** @class */ (function (_super) {
__extends(EdgeworthBoxPlusTwoGraphsPlusSidebar, _super);
function EdgeworthBoxPlusTwoGraphsPlusSidebar(def) {
var _this = _super.call(this, def) || this;
var l = _this;
var agentA = def['agentA'], agentB = def['agentB'], graph1 = def['graph1'], graph2 = def['graph2'], sidebarDef = def['sidebar'];
var width = 0.738, height = 0.9;
if (def.totalGood1 > def.totalGood2) {
height = def.totalGood2 * height / def.totalGood1;
}
if (def.totalGood2 > def.totalGood1) {
height = def.totalGood1 * width / def.totalGood2;
}
agentA.position = {
"x": 0.15,
"y": 0.05,
"width": width,
"height": height
};
agentB.position = {
"x": 0.15 + width,
"y": 0.05 + height,
"width": -1 * width,
"height": -1 * height
};
graph1.position = {
"x": 0.1,
"y": height + 0.15,
"width": 0.35,
"height": 0.85 - height
};
graph2.position = {
"x": 0.6,
"y": height + 0.15,
"width": 0.35,
"height": 0.85 - height
};
agentA.xAxis.max = agentB.xAxis.max = def.totalGood1;
agentA.yAxis.max = agentB.yAxis.max = def.totalGood2;
agentB.xAxis.orient = 'top';
agentB.yAxis.orient = 'right';
l.subObjects.push(new KGAuthor.Graph(agentB));
l.subObjects.push(new KGAuthor.Graph(agentA));
l.subObjects.push(new KGAuthor.Graph(graph1));
l.subObjects.push(new KGAuthor.Graph(graph2));
l.subObjects.push(new KGAuthor.Sidebar(sidebarDef));
return _this;
}
return EdgeworthBoxPlusTwoGraphsPlusSidebar;
}(KGAuthor.SquareLayout));
KGAuthor.EdgeworthBoxPlusTwoGraphsPlusSidebar = EdgeworthBoxPlusTwoGraphsPlusSidebar;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../../eg.ts"/>
var KGAuthor;
(function (KGAuthor) {
var EconMultivariateFunction = /** @class */ (function (_super) {
__extends(EconMultivariateFunction, _super);
function EconMultivariateFunction(def) {
var _this = this;
KG.setDefaults(def, {
name: KG.randomString(10)
});
_this = _super.call(this, def) || this;
var fn = _this;
fn.interpolation = 'curveMonotoneX';
if (def.hasOwnProperty('alpha')) {
fn.alpha = def.alpha;
fn.exponents = def.exponents || [def.alpha, KGAuthor.subtractDefs(1, def.alpha)];
fn.coefficients = def.coefficients || [def.alpha, KGAuthor.subtractDefs(1, def.alpha)];
}
else if (def.hasOwnProperty('exponents')) {
fn.exponents = def.exponents;
fn.alpha = KGAuthor.divideDefs(fn.exponents[0], KGAuthor.addDefs(fn.exponents[0], fn.exponents[1]));
fn.coefficients = def.coefficients;
}
else if (def.hasOwnProperty('coefficients')) {
fn.exponents = def.coefficients;
fn.coefficients = def.coefficients;
fn.alpha = KGAuthor.divideDefs(fn.coefficients[0], KGAuthor.addDefs(fn.coefficients[0], fn.coefficients[1]));
}
return _this;
}
EconMultivariateFunction.prototype.value = function (x) {
return null;
};
EconMultivariateFunction.prototype.extractLevel = function (def) {
var u = this;
if (def.hasOwnProperty('level') && def.level != undefined) {
return KGAuthor.getDefinitionProperty(def.level);
}
else if (def.hasOwnProperty('point') && def.point != undefined) {
return u.value(def.point);
}
else if (def.hasOwnProperty('budgetLine')) {
var bl = new KGAuthor.EconBudgetLine(def.budgetLine, null);
return u.value(u.optimalBundle(bl));
}
};
EconMultivariateFunction.prototype.levelSet = function (def) {
return [];
};
EconMultivariateFunction.prototype.levelCurve = function (def, graph) {
def.interpolation = this.interpolation;
return KGAuthor.curvesFromFunctions(this.levelSet(def), def, graph);
};
EconMultivariateFunction.prototype.levelCurveSlope = function (x) {
return null;
};
EconMultivariateFunction.prototype.areaBelowLevelCurve = function (def, graph) {
var fn = this;
fn.fillBelowRect = null;
def.interpolation = fn.interpolation;
var fns = fn.levelSet(def);
var objs = [];
fns.forEach(function (fn) {
var areaDef = KGAuthor.copyJSON(def);
areaDef.univariateFunction1 = fn;
objs.push(new KGAuthor.Area(areaDef, graph));
});
if (fn.fillBelowRect) {
fn.fillBelowRect.show = def.show;
fn.fillBelowRect.fill = def.fill;
objs.push(new KGAuthor.Rectangle(fn.fillBelowRect, graph));
}
return objs;
};
EconMultivariateFunction.prototype.areaAboveLevelCurve = function (def, graph) {
var fn = this;
fn.fillAboveRect = null;
def.interpolation = fn.interpolation;
var fns = fn.levelSet(def);
var objs = [];
fns.forEach(function (fn) {
var areaDef = KGAuthor.copyJSON(def);
areaDef.univariateFunction1 = fn;
areaDef.above = true;
objs.push(new KGAuthor.Area(areaDef, graph));
});
if (fn.fillAboveRect) {
fn.fillAboveRect.show = def.show;
fn.fillAboveRect.fill = def.fill;
fn.fillAboveRect.inDef = true;
objs.push(new KGAuthor.Rectangle(fn.fillAboveRect, graph));
}
var clipPathName = def.hasOwnProperty('name') ? def.name + "_above" : KG.randomString(10);
return [
new KGAuthor.Rectangle({
clipPathName: clipPathName,
x1: graph.def.xAxis.min,
x2: graph.def.xAxis.max,
y1: graph.def.yAxis.min,
y2: graph.def.yAxis.max,
fill: def.fill,
show: def.show
}, graph),
new KGAuthor.ClipPath({
"name": clipPathName,
"paths": objs
}, graph)
];
};
EconMultivariateFunction.prototype.lowestCostBundle = function (level, prices) {
return []; // defined at the subclass level
};
/* Optimization with an exogenous income */
EconMultivariateFunction.prototype.cornerCondition = function (budgetLine) {
return 'false';
};
EconMultivariateFunction.prototype.lagrangeBundle = function (budgetLine) {
return [];
};
EconMultivariateFunction.prototype.optimalBundle = function (budgetLine) {
return [];
};
EconMultivariateFunction.prototype.quantityDemanded = function (budgetLine, good) {
return this.optimalBundle(budgetLine)[good - 1];
};
EconMultivariateFunction.prototype.priceOfferFunction = function (budgetLine, good, min, max, graph) {
var u = this;
var blDef;
if (budgetLine.hasOwnProperty('point') && budgetLine.point != undefined) {
min = 0.01;
max = 0.99;
blDef = {
p1: '(t)',
p2: '1 - (t)',
m: budgetLine.point[0] + "*(t) + " + budgetLine.point[1] + "*(1-(t))"
};
}
else {
blDef = (good == 1) ? { p1: '(t)', p2: budgetLine.p2, m: budgetLine.m } : {
p1: budgetLine.p1,
p2: '(t)',
m: budgetLine.m
};
}
var optimalBundle = u.optimalBundle(new KGAuthor.EconBudgetLine(blDef, graph));
return [
{
xFunction: optimalBundle[0],
yFunction: optimalBundle[1],
min: min,
max: max,
samplePoints: 100,
parametric: true
}
];
};
EconMultivariateFunction.prototype.priceOfferCurve = function (budgetLine, good, min, max, def, graph) {
var u = this;
def.interpolation = 'curveMonotoneX';
return KGAuthor.curvesFromFunctions(u.priceOfferFunction(budgetLine, good, min, max, graph), def, graph);
};
EconMultivariateFunction.prototype.demandFunction = function (budgetLine, good, graph) {
var u = this, blDef = (good == 1) ? { p1: '(y)', p2: budgetLine.p2, m: budgetLine.m } : {
p1: budgetLine.p1,
p2: '(y)',
m: budgetLine.m
};
return [
{
"fn": u.quantityDemanded(new KGAuthor.EconBudgetLine(blDef, graph), good),
"ind": "y",
"samplePoints": 30
}
];
};
EconMultivariateFunction.prototype.demandCurve = function (budgetLine, good, def, graph) {
var u = this;
def.interpolation = 'curveMonotoneX';
return KGAuthor.curvesFromFunctions(u.demandFunction(budgetLine, good, graph), def, graph);
};
/* Net demand and supply from an endowment */
EconMultivariateFunction.prototype.endowmentDemandFunction = function (budgetLine, good, graph) {
var u = this;
var netDemand = '', netSupply = '', grossDemand = '';
var x1 = budgetLine.point[0], x2 = budgetLine.point[1];
if (good == 2) {
var optimalBundle = u.optimalBundle(new KGAuthor.EconBudgetLine({
p1: budgetLine.p1,
p2: '(y)',
m: "(" + x1 + "*" + budgetLine.p1 + " + " + x2 + "*(y))"
}, graph));
grossDemand = optimalBundle[1];
netDemand = KGAuthor.subtractDefs(grossDemand, x2);
netSupply = KGAuthor.subtractDefs(x2, grossDemand);
}
else {
var optimalBundle = u.optimalBundle(new KGAuthor.EconBudgetLine({
p1: '(y)',
p2: budgetLine.p2,
m: "(" + x1 + "*(y) + " + x2 + "*" + budgetLine.p2 + ")"
}, graph));
grossDemand = optimalBundle[0];
netDemand = KGAuthor.subtractDefs(grossDemand, x1);
netSupply = KGAuthor.subtractDefs(x1, grossDemand);
}
return {
grossDemand: [
{
fn: grossDemand,
ind: 'y'
}
],
netDemand: [
{
fn: netDemand,
ind: 'y'
}
],
netSupply: [
{
fn: netSupply,
ind: 'y'
}
]
};
};
EconMultivariateFunction.prototype.grossDemandCurve = function (budgetLine, good, def, graph) {
var u = this;
def.interpolation = 'curveMonotoneX';
return KGAuthor.curvesFromFunctions(u.endowmentDemandFunction(budgetLine, good, graph).grossDemand, def, graph);
};
EconMultivariateFunction.prototype.netDemandCurve = function (budgetLine, good, def, graph) {
var u = this;
def.interpolation = 'curveMonotoneX';
return KGAuthor.curvesFromFunctions(u.endowmentDemandFunction(budgetLine, good, graph).netDemand, def, graph);
};
EconMultivariateFunction.prototype.netSupplyCurve = function (budgetLine, good, def, graph) {
var u = this;
def.interpolation = 'curveMonotoneX';
return KGAuthor.curvesFromFunctions(u.endowmentDemandFunction(budgetLine, good, graph).netSupply, def, graph);
};
EconMultivariateFunction.prototype.indirectUtility = function (income, prices) {
return this.extractLevel({ budgetLine: { p1: prices[0], p2: prices[1], m: income } });
};
EconMultivariateFunction.prototype.expenditure = function (level, prices) {
var b = this.lowestCostBundle(level, prices);
return KGAuthor.addDefs(KGAuthor.multiplyDefs(b[0], prices[0]), KGAuthor.multiplyDefs(b[1], prices[1]));
};
EconMultivariateFunction.prototype.laborRequirement = function (level, capital) {
// defined at subclass level
};
return EconMultivariateFunction;
}(KGAuthor.AuthoringObject));
KGAuthor.EconMultivariateFunction = EconMultivariateFunction;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../../eg.ts"/>
var KGAuthor;
(function (KGAuthor) {
var CobbDouglasFunction = /** @class */ (function (_super) {
__extends(CobbDouglasFunction, _super);
function CobbDouglasFunction() {
return _super !== null && _super.apply(this, arguments) || this;
}
CobbDouglasFunction.prototype.value = function (x) {
var e = this.exponents, scalar = this.coefficients.length == 1 ? this.coefficients[0] : 1;
return "(" + scalar + "*(" + x[0] + ")^(" + e[0] + "))*((" + x[1] + ")^(" + e[1] + "))";
};
CobbDouglasFunction.prototype.levelSet = function (def) {
var e = this.exponents, scalar = this.coefficients.length == 1 ? this.coefficients[0] : 1, level = KGAuthor.divideDefs(this.extractLevel(def), scalar), xMin = "(" + level + ")^(1/(" + e[0] + " + " + e[1] + "))", yMin = "(" + level + ")^(1/(" + e[0] + " + " + e[1] + "))";
this.fillBelowRect = {
x1: 0,
x2: xMin,
y1: 0,
y2: yMin,
show: def.show
};
return [
{
"fn": "((" + level + ")/(y)^(" + e[1] + "))^(1/(" + e[0] + "))",
"ind": "y",
"min": yMin,
"samplePoints": 30
},
{
"fn": "((" + level + ")/(x)^(" + e[0] + "))^(1/(" + e[1] + "))",
"ind": "x",
"min": xMin,
"samplePoints": 30
}
];
};
CobbDouglasFunction.prototype.levelCurveSlope = function (x) {
var c = this.coefficients;
return KGAuthor.negativeDef(KGAuthor.divideDefs(KGAuthor.multiplyDefs(c[0], x[1]), KGAuthor.multiplyDefs(c[1], x[0])));
};
CobbDouglasFunction.prototype.optimalBundle = function (budgetLine) {
var a = this.alpha;
return [KGAuthor.multiplyDefs(a, budgetLine.xIntercept), KGAuthor.multiplyDefs(KGAuthor.subtractDefs(1, a), budgetLine.yIntercept)];
};
CobbDouglasFunction.prototype.lowestCostBundle = function (level, prices) {
var e = this.exponents, ratio = KGAuthor.multiplyDefs(KGAuthor.divideDefs(prices[0], prices[1]), KGAuthor.divideDefs(e[1], e[0])), scale = KGAuthor.addDefs(e[0], e[1]), scaledLevel = KGAuthor.raiseDefToDef(level, KGAuthor.divideDefs(1, scale));
return [
KGAuthor.divideDefs(scaledLevel, KGAuthor.raiseDefToDef(ratio, KGAuthor.divideDefs(e[1], scale))),
KGAuthor.multiplyDefs(scaledLevel, KGAuthor.raiseDefToDef(ratio, KGAuthor.divideDefs(e[0], scale)))
];
};
CobbDouglasFunction.prototype.laborRequirement = function (level, capital) {
var e = this.exponents;
return "((" + level + ")/(" + capital + ")^(" + e[1] + "))^(1/(" + e[0] + "))";
};
return CobbDouglasFunction;
}(KGAuthor.EconMultivariateFunction));
KGAuthor.CobbDouglasFunction = CobbDouglasFunction;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../../eg.ts"/>
var KGAuthor;
(function (KGAuthor) {
var MinFunction = /** @class */ (function (_super) {
__extends(MinFunction, _super);
function MinFunction(def) {
var _this = _super.call(this, def) || this;
var fn = _this;
fn.interpolation = 'curveLinear';
if (def.hasOwnProperty('alpha')) {
fn.coefficients = [KGAuthor.divideDefs(0.5, def.alpha), KGAuthor.divideDefs(0.5, KGAuthor.subtractDefs(1, def.alpha))];
}
return _this;
}
MinFunction.prototype.value = function (x) {
var c = this.coefficients;
console.log('foo');
return "(min((" + x[0] + ")*(" + c[0] + "),(" + x[1] + ")*(" + c[1] + ")))";
};
MinFunction.prototype.levelSet = function (def) {
var c = this.coefficients, level = def.level || this.value(def.point), xMin = KGAuthor.divideDefs(level, c[0]), yMin = KGAuthor.divideDefs(level, c[1]);
this.fillBelowRect = {
x1: 0,
x2: xMin,
y1: 0,
y2: yMin,
show: def.show
};
return [
{
"fn": KGAuthor.divideDefs(level, c[1]),
"ind": "x",
"min": xMin,
"samplePoints": 2
}, {
"fn": KGAuthor.divideDefs(level, c[0]),
"ind": "y",
"min": yMin,
"samplePoints": 2
}
];
};
MinFunction.prototype.optimalBundle = function (budgetLine) {
var good1perBundle = KGAuthor.invertDef(this.coefficients[0]), good2perBundle = KGAuthor.invertDef(this.coefficients[1]), bundles = KGAuthor.divideDefs(budgetLine.m, KGAuthor.addDefs(KGAuthor.multiplyDefs(budgetLine.p1, good1perBundle), KGAuthor.multiplyDefs(budgetLine.p2, good2perBundle)));
return [KGAuthor.multiplyDefs(good1perBundle, bundles), KGAuthor.multiplyDefs(good2perBundle, bundles)];
};
MinFunction.prototype.lowestCostBundle = function (level, prices) {
var a = this.coefficients[0], b = this.coefficients[1];
return [
KGAuthor.divideDefs(level, a),
KGAuthor.divideDefs(level, b)
];
};
return MinFunction;
}(KGAuthor.EconMultivariateFunction));
KGAuthor.MinFunction = MinFunction;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../../eg.ts"/>
var KGAuthor;
(function (KGAuthor) {
var LinearFunction = /** @class */ (function (_super) {
__extends(LinearFunction, _super);
function LinearFunction(def) {
var _this = _super.call(this, def) || this;
var fn = _this;
_this.interpolation = 'curveLinear';
if (def.hasOwnProperty('alpha')) {
fn.coefficients = [def.alpha, KGAuthor.subtractDefs(1, def.alpha)];
}
return _this;
}
LinearFunction.prototype.value = function (x) {
var c = this.coefficients;
return "((" + x[0] + ")*(" + c[0] + ")+(" + x[1] + ")*(" + c[1] + "))";
};
LinearFunction.prototype.levelSet = function (def) {
var c = this.coefficients, level = def.level || this.value(def.point);
return [
{
"fn": "(" + level + " - (" + c[0] + ")*(x))/(" + c[1] + ")",
"ind": "x",
"samplePoints": 2
}
];
};
return LinearFunction;
}(KGAuthor.EconMultivariateFunction));
KGAuthor.LinearFunction = LinearFunction;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../../eg.ts"/>
var KGAuthor;
(function (KGAuthor) {
var CESFunction = /** @class */ (function (_super) {
__extends(CESFunction, _super);
function CESFunction(def) {
var _this = _super.call(this, def) || this;
var fn = _this;
fn.interpolation = 'curveMonotoneX';
if (def.hasOwnProperty('r')) {
fn.r = def.r;
fn.s = KGAuthor.divideDefs(1, KGAuthor.subtractDefs(1, def.r));
}
else if (def.hasOwnProperty('s')) {
fn.s = def.s;
fn.r = KGAuthor.subtractDefs(1, KGAuthor.divideDefs(1, def.s));
}
return _this;
}
CESFunction.prototype.value = function (x) {
var c = this.coefficients, r = this.r;
return KGAuthor.raiseDefToDef(KGAuthor.addDefs(KGAuthor.multiplyDefs(c[0], KGAuthor.raiseDefToDef(x[0], r)), KGAuthor.multiplyDefs(c[1], KGAuthor.raiseDefToDef(x[1], r))), KGAuthor.divideDefs(1, r));
};
CESFunction.prototype.levelSet = function (def) {
var u = this, a = KGAuthor.getDefinitionProperty(u.alpha), r = KGAuthor.getDefinitionProperty(u.r), b = KGAuthor.subtractDefs(1, u.alpha), level = this.extractLevel(def);
this.fillBelowRect = {
x1: 0,
x2: level,
y1: 0,
y2: level,
show: def.show
};
return [
{
fn: "((" + level + "^" + r + " - " + a + "*(x)^" + r + ")/" + b + ")^(1/" + r + ")",
ind: "x",
min: level
},
{
fn: "((" + level + "^" + r + " - " + b + "*(y)^" + r + ")/" + a + ")^(1/" + r + ")",
ind: "y",
min: level
}
];
};
// see http://www.gamsworld.org/mpsge/debreu/ces.pdf
CESFunction.prototype.optimalBundle = function (budgetLine) {
var s = this.s, oneMinusS = KGAuthor.subtractDefs(1, s), a = this.alpha, oneMinusA = KGAuthor.subtractDefs(1, a), theta = KGAuthor.divideDefs(budgetLine.m, KGAuthor.addDefs(KGAuthor.multiplyDefs(KGAuthor.raiseDefToDef(a, s), KGAuthor.raiseDefToDef(budgetLine.p1, oneMinusS)), KGAuthor.multiplyDefs(KGAuthor.raiseDefToDef(oneMinusA, s), KGAuthor.raiseDefToDef(budgetLine.p2, oneMinusS)))), optimalX1 = KGAuthor.multiplyDefs(KGAuthor.raiseDefToDef(KGAuthor.divideDefs(a, budgetLine.p1), s), theta), optimalX2 = KGAuthor.multiplyDefs(KGAuthor.raiseDefToDef(KGAuthor.divideDefs(oneMinusA, budgetLine.p2), s), theta);
return [optimalX1, optimalX2];
};
CESFunction.prototype.denominator = function (p1, p2) {
var a1 = this.alpha, a2 = KGAuthor.subtractDefs(1, a1), r = this.r, pOverA1 = KGAuthor.divideDefs(p1, a1), pOverA2 = KGAuthor.divideDefs(p2, a2), oneOverR = KGAuthor.divideDefs(1, r), rOverRminusOne = KGAuthor.divideDefs(r, KGAuthor.subtractDefs(r, 1));
return KGAuthor.raiseDefToDef(KGAuthor.addDefs(KGAuthor.multiplyDefs(a1, KGAuthor.raiseDefToDef(pOverA1, rOverRminusOne)), KGAuthor.multiplyDefs(a2, KGAuthor.raiseDefToDef(pOverA2, rOverRminusOne))), oneOverR);
};
// see http://personal.stthomas.edu/csmarcott/ec418/ces_cost_minimization.pdf
CESFunction.prototype.lowestCostBundle = function (level, prices) {
var a1 = this.alpha, a2 = KGAuthor.subtractDefs(1, a1), p1 = prices[0], p2 = prices[1], r = this.r, pOverA1 = KGAuthor.divideDefs(p1, a1), pOverA2 = KGAuthor.divideDefs(p2, a2), oneOverRminusOne = KGAuthor.divideDefs(1, KGAuthor.subtractDefs(r, 1)), denominator = this.denominator(p1, p2), numerator1 = KGAuthor.raiseDefToDef(pOverA1, oneOverRminusOne), numerator2 = KGAuthor.raiseDefToDef(pOverA2, oneOverRminusOne);
return [
KGAuthor.divideDefs(KGAuthor.multiplyDefs(level, numerator1), denominator),
KGAuthor.divideDefs(KGAuthor.multiplyDefs(level, numerator2), denominator)
];
};
return CESFunction;
}(KGAuthor.EconMultivariateFunction));
KGAuthor.CESFunction = CESFunction;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../../eg.ts"/>
var KGAuthor;
(function (KGAuthor) {
var ConcaveFunction = /** @class */ (function (_super) {
__extends(ConcaveFunction, _super);
function ConcaveFunction() {
return _super !== null && _super.apply(this, arguments) || this;
}
ConcaveFunction.prototype.value = function (x) {
var c = this.coefficients;
return "(" + c[0] + ")*(" + x[0] + ")^2+(" + c[1] + ")*(" + x[1] + ")^2";
};
ConcaveFunction.prototype.levelSet = function (def) {
var c = this.coefficients, level = def.level || this.value(def.point), max = "((" + level + ")/(" + c[0] + "+" + c[1] + "))^(0.5)";
this.fillAboveRect = {
x1: max,
x2: 50,
y1: max,
y2: 50,
show: def.show
};
return [
{
"fn": "((" + level + "-(" + c[1] + ")*(y)*(y))/(" + c[0] + "))^(0.5)",
"ind": "y",
"min": 0,
"max": max,
"samplePoints": 30
},
{
"fn": "((" + level + "-(" + c[0] + ")*(x)*(x))/(" + c[1] + "))^(0.5)",
"ind": "x",
"min": 0,
"max": max,
"samplePoints": 30
}
];
};
return ConcaveFunction;
}(KGAuthor.EconMultivariateFunction));
KGAuthor.ConcaveFunction = ConcaveFunction;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../../eg.ts"/>
var KGAuthor;
(function (KGAuthor) {
var QuasilinearFunction = /** @class */ (function (_super) {
__extends(QuasilinearFunction, _super);
function QuasilinearFunction() {
return _super !== null && _super.apply(this, arguments) || this;
}
QuasilinearFunction.prototype.value = function (x) {
var c = this.coefficients;
return "(" + c[0] + "*log(" + x[0] + ")+" + x[1] + ")";
};
QuasilinearFunction.prototype.levelSet = function (def) {
var c = this.coefficients, level = this.extractLevel(def);
return [
{
"fn": "((" + level + ")-(" + c[0] + ")*log((x)))",
"ind": "x",
"samplePoints": 100
}
];
};
QuasilinearFunction.prototype.cornerCondition = function (budgetLine) {
return "(" + this.lagrangeBundle(budgetLine)[1] + " < 0)";
};
QuasilinearFunction.prototype.lagrangeBundle = function (budgetLine) {
var c = this.coefficients;
return [KGAuthor.divideDefs(KGAuthor.multiplyDefs(c[0], budgetLine.p2), budgetLine.p1), KGAuthor.subtractDefs(budgetLine.yIntercept, c[0])];
};
QuasilinearFunction.prototype.optimalBundle = function (budgetLine) {
var lagr = this.lagrangeBundle(budgetLine), cornerCondition = this.cornerCondition(budgetLine);
return ["(" + cornerCondition + " ? " + budgetLine.xIntercept + " : " + lagr[0] + ")", "(" + cornerCondition + " ? 0 : " + lagr[1] + ")"];
};
return QuasilinearFunction;
}(KGAuthor.EconMultivariateFunction));
KGAuthor.QuasilinearFunction = QuasilinearFunction;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../../../eg.ts"/>
var KGAuthor;
(function (KGAuthor) {
function extractBudgetLine(def, graph) {
if (def.hasOwnProperty('budgetLineObject')) {
return def.budgetLineObject;
}
if (def.hasOwnProperty('budgetLine')) {
var budgetDef = JSON.parse(JSON.stringify(def.budgetLine));
budgetDef.show = budgetDef.show || def.show;
if (!budgetDef.hasOwnProperty('m')) {
if (def.hasOwnProperty('point') && def.point.length == 2) {
budgetDef.point = def.point;
}
if (def.hasOwnProperty('coordinates') && def.coordinates.length == 2) {
budgetDef.point = def.coordinates;
}
if (def.hasOwnProperty('x') && def.hasOwnProperty('y')) {
budgetDef.x = def.x;
budgetDef.y = def.y;
}
}
budgetDef.color = budgetDef.color || def.color;
return new EconBudgetLine(budgetDef, graph);
}
//console.log('tried to instantiate a budget line without either a budget line def or object')
}
KGAuthor.extractBudgetLine = extractBudgetLine;
var EconBudgetLine = /** @class */ (function (_super) {
__extends(EconBudgetLine, _super);
function EconBudgetLine(def, graph) {
var _this = this;
def = KGAuthor.setStrokeColor(def);
def.name = def.name || 'BL' + KG.randomString(5);
// may define income either by income m or value of endowment point
if (!def.hasOwnProperty('m')) {
if (def.hasOwnProperty('x') && def.hasOwnProperty('y')) {
def.point = [def.x, def.y];
}
if (def.hasOwnProperty('point') && def.point.length == 2) {
def.m = KGAuthor.addDefs(KGAuthor.multiplyDefs(def.p1, def.point[0]), KGAuthor.multiplyDefs(def.p2, def.point[1]));
}
}
var xIntercept = KGAuthor.divideDefs(def.m, def.p1), yIntercept = KGAuthor.divideDefs(def.m, def.p2), priceRatio = KGAuthor.divideDefs(def.p1, def.p2), endowment = { x: def.x, y: def.y };
console.log('xIntercept', xIntercept);
if (def.inMap) {
def.strokeWidth = 1;
def.lineStyle = 'dotted';
def.layer = 0;
def.handles = false;
def.draggable = false;
}
KG.setDefaults(def, {
a: ["calcs." + def.name + ".xIntercept", 0],
b: [0, "calcs." + def.name + ".yIntercept"],
color: 'colors.budget',
strokeWidth: 2,
lineStyle: 'solid',
buyOnly: false,
sellOnly: false
});
if (def.sellOnly) {
def.a = [def.x, def.y];
}
if (def.buyOnly) {
def.b = [def.x, def.y];
}
if (def.draggable && typeof (def.m) == 'string') {
def.drag = [{
'directions': 'xy',
'param': KGAuthor.paramName(def.m),
'expression': KGAuthor.addDefs(KGAuthor.multiplyDefs('drag.x', def.p1), KGAuthor.multiplyDefs('drag.y', def.p2))
}];
}
if (!def.inMap) {
def.label = KG.setDefaults(def.label || {}, {
text: "BL",
location: def.sellOnly ? 0.1 : 0.9
});
}
_this = _super.call(this, def, graph) || this;
var bl = _this;
bl.p1 = def.p1;
bl.p2 = def.p2;
bl.m = def.m;
bl.xIntercept = xIntercept;
bl.yIntercept = yIntercept;
bl.priceRatio = priceRatio;
bl.point = def.point;
bl.endowment = endowment;
if (graph) {
var subObjects = bl.subObjects;
var xInterceptPointDef = {
coordinates: ["calcs." + bl.name + ".xIntercept", 0],
fill: def.stroke,
r: 4
};
if (def.draggable && typeof (def.p1) == 'string') {
xInterceptPointDef['drag'] = [{
directions: 'x',
param: KGAuthor.paramName(def.p1),
expression: KGAuthor.divideDefs("calcs." + bl.name + ".m", 'drag.x')
}];
}
if (def.hasOwnProperty('xInterceptLabel')) {
xInterceptPointDef['droplines'] = {
vertical: def.xInterceptLabel
};
}
bl.xInterceptPoint = new KGAuthor.Point(xInterceptPointDef, graph);
var yInterceptPointDef = {
coordinates: [0, "calcs." + bl.name + ".yIntercept"],
fill: def.stroke,
r: 4
};
if (def.draggable && typeof (def.p2) == 'string') {
yInterceptPointDef['drag'] = [{
directions: 'y',
param: KGAuthor.paramName(def.p2),
expression: KGAuthor.divideDefs('calcs.' + bl.name + '.m', 'drag.y')
}];
}
if (def.hasOwnProperty('yInterceptLabel')) {
yInterceptPointDef['droplines'] = {
horizontal: def.yInterceptLabel
};
}
bl.yInterceptPoint = new KGAuthor.Point(yInterceptPointDef, graph);
bl.budgetSetArea = new KGAuthor.Area({
fill: "colors.budget",
univariateFunction1: {
fn: "calcs." + bl.name + ".yIntercept - calcs." + bl.name + ".priceRatio*(x)",
samplePoints: 2,
max: "calcs." + bl.name + ".xIntercept"
},
show: def.set
}, graph);
bl.costlierArea = new KGAuthor.Area({
fill: "colors.costlier",
univariateFunction1: {
fn: "calcs." + bl.name + ".yIntercept - calcs." + bl.name + ".priceRatio*(x)",
samplePoints: 2
},
show: def.costlier,
above: true
}, graph);
if (def.handles) {
subObjects.push(bl.xInterceptPoint);
subObjects.push(bl.yInterceptPoint);
}
if (def.set) {
subObjects.push(bl.budgetSetArea);
}
if (def.costlier) {
subObjects.push(bl.costlierArea);
}
}
return _this;
}
EconBudgetLine.prototype.cost = function (bundle) {
var c = "((" + this.p1 + ")*(" + bundle.x + ") + (" + this.p2 + ")*(" + bundle.y + "))";
//console.log(c);
return c;
};
EconBudgetLine.prototype.parseSelf = function (parsedData) {
var bl = this;
parsedData = _super.prototype.parseSelf.call(this, parsedData);
parsedData.calcs[bl.name] = {
xIntercept: bl.xIntercept.toString(),
yIntercept: bl.yIntercept.toString(),
m: bl.m.toString(),
p1: bl.p1.toString(),
p2: bl.p2.toString(),
priceRatio: bl.priceRatio.toString(),
endowment: bl.endowment.toString()
};
return parsedData;
};
return EconBudgetLine;
}(KGAuthor.Segment));
KGAuthor.EconBudgetLine = EconBudgetLine;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../../../eg.ts"/>
var KGAuthor;
(function (KGAuthor) {
function getUtilityFunction(def) {
if (def != undefined) {
def = KGAuthor.extractTypeAndDef(def);
if (def.type == 'CobbDouglas') {
return new KGAuthor.CobbDouglasFunction(def.def);
}
else if (def.type == 'Substitutes' || def.type == 'PerfectSubstitutes') {
return new KGAuthor.LinearFunction(def.def);
}
else if (def.type == 'Complements' || def.type == 'PerfectComplements') {
return new KGAuthor.MinFunction(def.def);
}
else if (def.type == 'Concave') {
return new KGAuthor.ConcaveFunction(def.def);
}
else if (def.type == 'Quasilinear') {
return new KGAuthor.QuasilinearFunction(def.def);
}
else if (def.type == 'CESFunction' || def.type == 'CES') {
return new KGAuthor.CESFunction(def.def);
}
}
}
KGAuthor.getUtilityFunction = getUtilityFunction;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../../../eg.ts"/>
var KGAuthor;
(function (KGAuthor) {
function extractIndifferenceCurve(def, graph) {
if (def.hasOwnProperty('indifferenceCurveObject')) {
return def.indifferenceCurveObject;
}
if (def.hasOwnProperty('indifferenceCurve')) {
var indifferenceCurveDef = KGAuthor.copyJSON(def.indifferenceCurve);
indifferenceCurveDef.show = indifferenceCurveDef.show || def.show;
indifferenceCurveDef.name = def.name + "_IC";
return new EconIndifferenceCurve(indifferenceCurveDef, graph);
}
console.log('tried to instantiate a budget line without either a budget line def or object');
}
KGAuthor.extractIndifferenceCurve = extractIndifferenceCurve;
var EconIndifferenceCurve = /** @class */ (function (_super) {
__extends(EconIndifferenceCurve, _super);
function EconIndifferenceCurve(def, graph) {
var _this = this;
if (def.inMap) {
def.strokeWidth = 1;
def.color = 'lightgrey';
def.layer = 0;
}
KG.setDefaults(def, {
strokeWidth: 2,
color: 'colors.utility',
layer: 1,
showPreferred: false,
showDispreferred: false,
inMap: false,
showMapLevels: false
});
if (def.inMap) {
if (def.showMapLevels) {
def.label = KG.setDefaults(def.label || {}, {
fontSize: 8,
x: KGAuthor.multiplyDefs(0.98, graph.xScale.max),
text: def.level + ".toFixed(0)",
color: def.color,
bgcolor: null
});
}
}
else {
def.label = KG.setDefaults(def.label || {}, {
x: KGAuthor.multiplyDefs(0.95, graph.xScale.max),
text: "U",
color: def.color,
bgcolor: null,
position: 'bl'
});
}
_this = _super.call(this, def, graph) || this;
var curve = _this;
var utilityFunction = KGAuthor.extractUtilityFunction(def);
curve.utilityFunction = utilityFunction;
curve.subObjects = curve.subObjects.concat(utilityFunction.levelCurve(def, graph));
if (!def.inMap) {
if (!!def.showPreferred) {
var preferredDef = KGAuthor.copyJSON(def);
preferredDef.fill = def.color || 'colors.preferred';
preferredDef.show = def.showPreferred;
curve.subObjects = curve.subObjects.concat(utilityFunction.areaAboveLevelCurve(preferredDef, graph));
}
if (!!def.showDispreferred) {
var dispreferredDef = KGAuthor.copyJSON(def);
dispreferredDef.fill = 'colors.dispreferred';
dispreferredDef.show = def.showDispreferred;
curve.subObjects = curve.subObjects.concat(utilityFunction.areaBelowLevelCurve(dispreferredDef, graph));
}
}
return _this;
}
return EconIndifferenceCurve;
}(KGAuthor.GraphObjectGenerator));
KGAuthor.EconIndifferenceCurve = EconIndifferenceCurve;
var EconIndifferenceMap = /** @class */ (function (_super) {
__extends(EconIndifferenceMap, _super);
function EconIndifferenceMap(def, graph) {
var _this = _super.call(this, def, graph) || this;
_this.subObjects = def.levels.map(function (level) {
var icDef = KGAuthor.copyJSON(def);
icDef.inMap = true;
delete icDef.levels;
if (Array.isArray(level)) {
icDef.point = level;
}
else {
icDef.level = level;
}
return new EconIndifferenceCurve(icDef, graph);
});
return _this;
}
return EconIndifferenceMap;
}(KGAuthor.GraphObjectGenerator));
KGAuthor.EconIndifferenceMap = EconIndifferenceMap;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../../../eg.ts"/>
var KGAuthor;
(function (KGAuthor) {
function extractUtilityFunction(def) {
return def.utilityFunctionObject || KGAuthor.getUtilityFunction(def.utilityFunction);
}
KGAuthor.extractUtilityFunction = extractUtilityFunction;
var EconBundle = /** @class */ (function (_super) {
__extends(EconBundle, _super);
function EconBundle(def, graph) {
var _this = this;
KG.setDefaults(def, {
label: { text: 'X' },
droplines: {
vertical: "x_1",
horizontal: "x_2"
},
color: "colors.utility"
});
KGAuthor.setFillColor(def);
_this = _super.call(this, def, graph) || this;
var bundle = _this;
bundle.budgetLine = KGAuthor.extractBudgetLine(def, graph);
if (bundle.budgetLine) {
bundle.subObjects.push(bundle.budgetLine);
}
bundle.utilityFunction = extractUtilityFunction(def);
if (bundle.utilityFunction) {
bundle.subObjects.push(bundle.utilityFunction);
if (def.hasOwnProperty('indifferenceCurve')) {
def.indifferenceCurve.level = "calcs." + bundle.name + ".level";
def.indifferenceCurve.utilityFunction = def.utilityFunction;
bundle.subObjects.push(KGAuthor.extractIndifferenceCurve(def, graph));
}
}
return _this;
}
EconBundle.prototype.parseSelf = function (parsedData) {
var bundle = this;
parsedData = _super.prototype.parseSelf.call(this, parsedData);
parsedData.calcs[bundle.name] = {
x: bundle.x,
y: bundle.y,
level: bundle.utilityFunction ? bundle.utilityFunction.value([bundle.x, bundle.y]) : '',
cost: bundle.budgetLine ? bundle.budgetLine.cost(bundle) : '',
mrs: bundle.utilityFunction ? KGAuthor.negativeDef(bundle.utilityFunction.levelCurveSlope([bundle.x, bundle.y])) : ''
};
return parsedData;
};
return EconBundle;
}(KGAuthor.Point));
KGAuthor.EconBundle = EconBundle;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../../../eg.ts"/>
var KGAuthor;
(function (KGAuthor) {
var EconOptimalBundle = /** @class */ (function (_super) {
__extends(EconOptimalBundle, _super);
function EconOptimalBundle(def, graph) {
var _this = this;
var bl = KGAuthor.extractBudgetLine(def, graph), u = KGAuthor.extractUtilityFunction(def), coords = u.optimalBundle(bl);
KG.setDefaults(def, {
coordinates: coords,
label: { text: 'X^*' },
color: bl.color,
droplines: {
vertical: "x_1^*",
horizontal: "x_2^*"
},
indifferenceCurve: {}
});
console.log('coords: ', coords);
if (bl.hasOwnProperty('endowment')) {
if (bl.def.sellOnly) {
def.show = "(" + (def.show || true) + " && (" + coords[0] + " < " + bl.endowment.x + "))";
}
if (bl.def.buyOnly) {
def.show = "(" + (def.show || true) + " && (" + coords[0] + " > " + bl.endowment.x + "))";
}
}
def.budgetLineObject = bl;
_this = _super.call(this, def, graph) || this;
_this.level = u.value(coords);
return _this;
}
return EconOptimalBundle;
}(KGAuthor.EconBundle));
KGAuthor.EconOptimalBundle = EconOptimalBundle;
var EconLagrangeBundle = /** @class */ (function (_super) {
__extends(EconLagrangeBundle, _super);
function EconLagrangeBundle(def, graph) {
var _this = this;
if (def.hasOwnProperty('utilityFunction') && def.hasOwnProperty('budgetLine')) {
var u = KGAuthor.getUtilityFunction(def.utilityFunction), bl = new KGAuthor.EconBudgetLine(def.budgetLine, graph);
KG.setDefaults(def, {
coordinates: u.lagrangeBundle(bl),
color: 'colors.incomeOffer',
show: u.cornerCondition(bl),
label: { text: 'X^*_L' }
});
}
else {
console.log('oops, need to define an EconOptimalBundle with a utility function and budget line.');
}
_this = _super.call(this, def, graph) || this;
return _this;
}
return EconLagrangeBundle;
}(EconOptimalBundle));
KGAuthor.EconLagrangeBundle = EconLagrangeBundle;
var LowestCostBundle = /** @class */ (function (_super) {
__extends(LowestCostBundle, _super);
function LowestCostBundle(def, graph) {
var _this = this;
var u = KGAuthor.extractUtilityFunction(def), p1 = def.prices[0], p2 = def.prices[1], m = u.expenditure(def.level, def.prices);
delete def.prices;
delete def.level;
def.budgetLine = KG.setDefaults(def.budgetLine || {}, {
p1: p1,
p2: p2,
m: m
});
_this = _super.call(this, def, graph) || this;
return _this;
}
return LowestCostBundle;
}(EconOptimalBundle));
KGAuthor.LowestCostBundle = LowestCostBundle;
var EconSlutskyBundle = /** @class */ (function (_super) {
__extends(EconSlutskyBundle, _super);
function EconSlutskyBundle(def, graph) {
var _this = this;
var bl = KGAuthor.extractBudgetLine(def, graph), u = KGAuthor.extractUtilityFunction(def);
def.budgetLine = def.budgetLine || {};
if (def.hasOwnProperty('p1')) {
def.budgetLine.p1 = def.p1;
delete def.budgetLine.m;
}
if (def.hasOwnProperty('p2')) {
def.budgetLine.p2 = def.p2;
delete def.budgetLine.m;
}
def.budgetLine.label = KG.setDefaults(def.budgetLine.label || {}, {
text: "BL_D"
});
def.budgetLine.point = u.optimalBundle(bl);
delete def.budgetLineObject;
_this = _super.call(this, def, graph) || this;
return _this;
}
return EconSlutskyBundle;
}(EconOptimalBundle));
KGAuthor.EconSlutskyBundle = EconSlutskyBundle;
var EconHicksBundle = /** @class */ (function (_super) {
__extends(EconHicksBundle, _super);
function EconHicksBundle(def, graph) {
var _this = this;
var bl = KGAuthor.extractBudgetLine(def, graph), u = KGAuthor.extractUtilityFunction(def), p1 = def.hasOwnProperty('p1') ? def.p1 : def.budgetLine.p1, p2 = def.hasOwnProperty('p2') ? def.p2 : def.budgetLine.p2, level = u.value(u.optimalBundle(bl));
def.budgetLine.p1 = p1;
def.budgetLine.p2 = p2;
def.budgetLine.m = u.expenditure(level, [p1, p2]);
def.budgetLine.label = KG.setDefaults(def.budgetLine.label || {}, {
text: "BL_C"
});
def.coordinates = u.lowestCostBundle(level, [p1, p2]);
delete def.budgetLineObject;
_this = _super.call(this, def, graph) || this;
return _this;
}
return EconHicksBundle;
}(EconOptimalBundle));
KGAuthor.EconHicksBundle = EconHicksBundle;
var EconShortRunProductionBundle = /** @class */ (function (_super) {
__extends(EconShortRunProductionBundle, _super);
function EconShortRunProductionBundle(def, graph) {
var _this = this;
var u = KGAuthor.extractUtilityFunction(def), p1 = def.prices[0], p2 = def.prices[1];
def.coordinates = [u.laborRequirement(def.level, def.capital), def.capital];
def.budgetLine = KG.setDefaults(def.budgetLine || {}, {
p1: p1,
p2: p2
});
def.budgetLine.label = KG.setDefaults(def.budgetLine.label || {}, {
text: "c_s(y)"
});
delete def.budgetLineObject;
_this = _super.call(this, def, graph) || this;
return _this;
}
return EconShortRunProductionBundle;
}(KGAuthor.EconBundle));
KGAuthor.EconShortRunProductionBundle = EconShortRunProductionBundle;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../../../eg.ts"/>
var KGAuthor;
(function (KGAuthor) {
var EconDemandCurve = /** @class */ (function (_super) {
__extends(EconDemandCurve, _super);
function EconDemandCurve(def, graph) {
var _this = this;
var u = KGAuthor.getUtilityFunction(def.utilityFunction), bl = new KGAuthor.EconBudgetLine(def.budgetLine, graph);
KG.setDefaults(def, {
stroke: 'colors.demand',
strokeWidth: 2
});
_this = _super.call(this, def, graph) || this;
_this.subObjects = u.demandCurve(bl, def.good, def, graph);
return _this;
}
return EconDemandCurve;
}(KGAuthor.GraphObjectGenerator));
KGAuthor.EconDemandCurve = EconDemandCurve;
var EconDemandPoint = /** @class */ (function (_super) {
__extends(EconDemandPoint, _super);
function EconDemandPoint(def, graph) {
var _this = this;
if (def.hasOwnProperty('utilityFunction') && def.hasOwnProperty('budgetLine')) {
var u = KGAuthor.getUtilityFunction(def.utilityFunction), bl = new KGAuthor.EconBudgetLine(def.budgetLine, graph);
KG.setDefaults(def, {
coordinates: [u.quantityDemanded(bl, def.good), bl['p' + def.good]],
fill: 'colors.demand',
label: { text: "x_" + def.good + "(p_" + def.good + "|p_" + (3 - def.good) + ",m)" },
droplines: { vertical: "x_" + def.good + "^*" }
});
}
else {
console.log('oops, need to define an EconOptimalBundle with a utility function and budget line.');
}
_this = _super.call(this, def, graph) || this;
return _this;
}
return EconDemandPoint;
}(KGAuthor.Point));
KGAuthor.EconDemandPoint = EconDemandPoint;
var EconNetDemandCurve = /** @class */ (function (_super) {
__extends(EconNetDemandCurve, _super);
function EconNetDemandCurve(def, graph) {
var _this = this;
var u = KGAuthor.getUtilityFunction(def.utilityFunction), bl = new KGAuthor.EconBudgetLine(def.budgetLine, graph);
KG.setDefaults(def, {
color: 'colors.demand',
strokeWidth: 2
});
_this = _super.call(this, def, graph) || this;
_this.subObjects = u.netDemandCurve(bl, def.good, def, graph);
return _this;
}
return EconNetDemandCurve;
}(KGAuthor.GraphObjectGenerator));
KGAuthor.EconNetDemandCurve = EconNetDemandCurve;
var EconNetDemandPoint = /** @class */ (function (_super) {
__extends(EconNetDemandPoint, _super);
function EconNetDemandPoint(def, graph) {
var _this = this;
if (def.hasOwnProperty('utilityFunction') && def.hasOwnProperty('budgetLine')) {
var u = KGAuthor.getUtilityFunction(def.utilityFunction), bl = new KGAuthor.EconBudgetLine(def.budgetLine, graph);
KG.setDefaults(def, {
coordinates: [KGAuthor.subtractDefs(u.quantityDemanded(bl, def.good), bl.point[def.good - 1]), bl['p' + def.good]],
fill: 'colors.demand',
label: { text: "d_" + def.good + "(p_" + def.good + "|p_" + (3 - def.good) + ")" },
droplines: { vertical: "d_" + def.good + "^*" }
});
}
else {
console.log('oops, need to define an EconOptimalBundle with a utility function and budget line.');
}
_this = _super.call(this, def, graph) || this;
return _this;
}
return EconNetDemandPoint;
}(KGAuthor.Point));
KGAuthor.EconNetDemandPoint = EconNetDemandPoint;
var EconNetSupplyCurve = /** @class */ (function (_super) {
__extends(EconNetSupplyCurve, _super);
function EconNetSupplyCurve(def, graph) {
var _this = this;
var u = KGAuthor.getUtilityFunction(def.utilityFunction), bl = new KGAuthor.EconBudgetLine(def.budgetLine, graph);
KG.setDefaults(def, {
color: 'colors.supply',
strokeWidth: 2
});
_this = _super.call(this, def, graph) || this;
_this.subObjects = u.netSupplyCurve(bl, def.good, def, graph);
return _this;
}
return EconNetSupplyCurve;
}(KGAuthor.GraphObjectGenerator));
KGAuthor.EconNetSupplyCurve = EconNetSupplyCurve;
var EconNetSupplyPoint = /** @class */ (function (_super) {
__extends(EconNetSupplyPoint, _super);
function EconNetSupplyPoint(def, graph) {
var _this = this;
if (def.hasOwnProperty('utilityFunction') && def.hasOwnProperty('budgetLine')) {
var u = KGAuthor.getUtilityFunction(def.utilityFunction), bl = new KGAuthor.EconBudgetLine(def.budgetLine, graph);
KG.setDefaults(def, {
coordinates: [KGAuthor.subtractDefs(bl.point[def.good - 1], u.quantityDemanded(bl, def.good)), bl['p' + def.good]],
fill: 'colors.supply',
label: { text: "s_" + def.good + "(p_" + def.good + "|p_" + (3 - def.good) + ")" },
droplines: { vertical: "s_" + def.good + "^*" }
});
}
else {
console.log('oops, need to define an EconOptimalBundle with a utility function and budget line.');
}
_this = _super.call(this, def, graph) || this;
return _this;
}
return EconNetSupplyPoint;
}(KGAuthor.Point));
KGAuthor.EconNetSupplyPoint = EconNetSupplyPoint;
var EconPriceOfferCurve = /** @class */ (function (_super) {
__extends(EconPriceOfferCurve, _super);
function EconPriceOfferCurve(def, graph) {
var _this = this;
var u = KGAuthor.getUtilityFunction(def.utilityFunction), bl = new KGAuthor.EconBudgetLine(def.budgetLine, graph);
KG.setDefaults(def, {
stroke: 'colors.offer',
strokeWidth: 2
});
_this = _super.call(this, def, graph) || this;
_this.subObjects = u.priceOfferCurve(bl, def.good, def.min, def.max, def, graph);
return _this;
}
return EconPriceOfferCurve;
}(KGAuthor.GraphObjectGenerator));
KGAuthor.EconPriceOfferCurve = EconPriceOfferCurve;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../../eg.ts"/>
var KGAuthor;
(function (KGAuthor) {
var EconOneInputProductionFunction = /** @class */ (function (_super) {
__extends(EconOneInputProductionFunction, _super);
function EconOneInputProductionFunction(def, graph) {
var _this = this;
KG.setDefaults(def, {
coefficient: 1,
exponent: 0.5,
wage: 1,
price: 1
});
_this = _super.call(this, def) || this;
var f = _this;
f.coefficient = def.coefficient;
f.exponent = def.exponent;
f.wage = def.wage;
f.price = def.price;
// if y(L) = AL^b, L(y) = [A^(-1/b)] * y^[1/b]
f.laborRequirementExponent = KGAuthor.invertDef(def.exponent);
f.laborRequirementCoefficient = KGAuthor.raiseDefToDef(def.coefficient, KGAuthor.negativeDef(f.laborRequirementExponent));
// if f(L) = AL^b, f'(L) = [bA] * L^[b-1]
f.marginalProductExponent = KGAuthor.subtractDefs(def.exponent, 1);
f.marginalProductCoefficient = KGAuthor.multiplyDefs(def.exponent, def.coefficient);
// if c(y) = wL(y) = w*LRC * y^LRE, c'(y) = [w*LRC*LRE] * y^[LRE - 1]
f.marginalCostCoefficient = KGAuthor.multiplyDefs(def.wage, KGAuthor.multiplyDefs(f.laborRequirementExponent, f.laborRequirementCoefficient));
f.marginalCostExponent = KGAuthor.subtractDefs(f.laborRequirementExponent, 1);
// if c'(y) = MCC * y^MCE, y*(p) = MCC^(-1/MCE) * p^(1/MCE)
f.outputSupplyCoefficient = KGAuthor.raiseDefToDef(f.marginalCostCoefficient, KGAuthor.negativeDef(KGAuthor.invertDef(f.marginalCostExponent)));
f.outputSupplyExponent = KGAuthor.invertDef(f.marginalCostExponent);
// if MRPL = [p * MPC] * L^MPE, L*(w) = (p*MPC)^(-1/MPE) * w^(1/MPE)
f.laborDemandCoefficient = KGAuthor.raiseDefToDef(KGAuthor.multiplyDefs(f.price, f.marginalProductCoefficient), KGAuthor.negativeDef(KGAuthor.invertDef(f.marginalProductExponent)));
f.laborDemandExponent = KGAuthor.invertDef(f.marginalProductExponent);
return _this;
}
// output produced by L units of olabor
EconOneInputProductionFunction.prototype.f = function (L) {
var f = this;
return KGAuthor.multiplyDefs(f.coefficient, KGAuthor.raiseDefToDef(L, f.exponent));
};
// labor required to produce y units of output
EconOneInputProductionFunction.prototype.laborRequirement = function (y) {
var f = this;
return KGAuthor.multiplyDefs(f.laborRequirementCoefficient, KGAuthor.raiseDefToDef(y, f.laborRequirementExponent));
};
// marginal product of labor
EconOneInputProductionFunction.prototype.MPL = function (L) {
var f = this;
return KGAuthor.multiplyDefs(f.marginalProductCoefficient, KGAuthor.raiseDefToDef(L, f.marginalProductExponent));
};
// marginal revenue product of labor is price times MPL
EconOneInputProductionFunction.prototype.MRPL = function (L) {
var f = this;
return KGAuthor.multiplyDefs(f.price, f.MPL(L));
};
// cost is wage times labor requirement
EconOneInputProductionFunction.prototype.cost = function (y) {
var f = this;
return KGAuthor.multiplyDefs(f.wage, f.laborRequirement(y));
};
EconOneInputProductionFunction.prototype.marginalCost = function (y) {
var f = this;
return KGAuthor.multiplyDefs(f.marginalCostCoefficient, KGAuthor.raiseDefToDef(y, f.marginalCostExponent));
};
// labor demand
EconOneInputProductionFunction.prototype.laborDemand = function (w) {
var f = this;
return KGAuthor.multiplyDefs(f.laborDemandCoefficient, KGAuthor.raiseDefToDef(w, f.laborDemandExponent));
};
// optimal output
EconOneInputProductionFunction.prototype.optimalOutput = function (p) {
var f = this;
return KGAuthor.multiplyDefs(f.outputSupplyCoefficient, KGAuthor.raiseDefToDef(p, f.outputSupplyCoefficient));
};
EconOneInputProductionFunction.prototype.parseSelf = function (parsedData) {
var ppf = this;
parsedData = _super.prototype.parseSelf.call(this, parsedData);
parsedData.calcs[ppf.name] = {
coefficient: ppf.coefficient,
exponent: ppf.exponent,
curve: ppf.f('(x)')
};
return parsedData;
};
return EconOneInputProductionFunction;
}(KGAuthor.AuthoringObject));
KGAuthor.EconOneInputProductionFunction = EconOneInputProductionFunction;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../../eg.ts"/>
var KGAuthor;
(function (KGAuthor) {
var EconLinearDemand = /** @class */ (function (_super) {
__extends(EconLinearDemand, _super);
function EconLinearDemand(def, graph) {
var _this = this;
def = KGAuthor.setStrokeColor(def);
KG.setDefaults(def, {
name: "demand",
point: [0, def.yIntercept],
slope: 0,
color: 'colors.demand',
strokeWidth: 2,
lineStyle: 'solid',
pts: []
});
if (def.draggable && typeof (def.xIntercept) == 'string') {
def.drag = [{
'directions': 'x',
'param': KGAuthor.paramName(def.xIntercept),
'expression': KGAuthor.addDefs(def.xIntercept, 'drag.dx')
}];
}
else if (def.draggable && typeof (def.yIntercept) == 'string') {
def.drag = [{
'directions': 'y',
'param': KGAuthor.paramName(def.yIntercept),
'expression': KGAuthor.addDefs(def.yIntercept, 'drag.dy')
}];
}
def.max = def.xIntercept;
if (def.hasOwnProperty("price")) {
def.pts.push({
name: "PQ",
y: def.price
});
}
if (def.hasOwnProperty("surplus")) {
if (!def.hasOwnProperty("price") && def.surplus.hasOwnProperty("quantity")) {
def.pts.push({
name: "PQ",
x: def.surplus.quantity
});
}
}
_this = _super.call(this, def, graph) || this;
var ld = _this;
if (graph) {
var subObjects = ld.subObjects;
var xInterceptPointDef = {
coordinates: [ld.xIntercept, 0],
color: def.color,
r: 4
};
if (def.draggable && typeof (ld.xIntercept) == 'string') {
xInterceptPointDef['drag'] = [{
directions: 'x',
param: KGAuthor.paramName(ld.xIntercept),
expression: KGAuthor.addDefs(ld.xIntercept, 'drag.dx')
}];
}
if (def.hasOwnProperty('xInterceptLabel')) {
xInterceptPointDef['droplines'] = {
vertical: def.xInterceptLabel
};
}
ld.xInterceptPoint = new KGAuthor.Point(xInterceptPointDef, graph);
var yInterceptPointDef = {
coordinates: [0, ld.yIntercept],
color: def.color,
r: 4
};
if (def.draggable && typeof (ld.yIntercept) == 'string') {
yInterceptPointDef['drag'] = [{
directions: 'y',
param: KGAuthor.paramName(ld.invSlope),
expression: KGAuthor.negativeDef(KGAuthor.divideDefs(ld.xIntercept, 'drag.y'))
}];
}
if (def.hasOwnProperty('yInterceptLabel')) {
yInterceptPointDef['droplines'] = {
horizontal: def.yInterceptLabel
};
}
ld.yInterceptPoint = new KGAuthor.Point(yInterceptPointDef, graph);
if (def.handles) {
subObjects.push(ld.xInterceptPoint);
subObjects.push(ld.yInterceptPoint);
}
if (def.hasOwnProperty('marginalRevenue')) {
var marginalRevenueDef = KG.setDefaults(def.marginalRevenue || {}, {
"color": "colors.marginalRevenue",
"yIntercept": ld.yIntercept,
"slope": KGAuthor.multiplyDefs(2, ld.slope),
"label": {
"text": "MR",
"x": KGAuthor.multiplyDefs(0.6, ld.xIntercept)
}
});
ld.marginalRevenue = new KGAuthor.Line(marginalRevenueDef, graph);
ld.subObjects.push(ld.marginalRevenue);
}
if (def.hasOwnProperty('surplus')) {
var surplusDef = KG.setDefaults(def.surplus || {}, {
"fill": "colors.demand"
});
var price = def.price || "calcs." + ld.name + ".PQ.y", quantity = surplusDef.quantity || "calcs." + ld.name + ".PQ.x";
surplusDef.univariateFunction1 = {
fn: ld.def.univariateFunction.fn,
min: 0,
max: quantity,
samplePoints: 2
};
surplusDef.univariateFunction2 = {
fn: price,
min: 0,
max: quantity,
samplePoints: 2
};
ld.subObjects.push(new KGAuthor.Area(surplusDef, graph));
}
}
return _this;
}
return EconLinearDemand;
}(KGAuthor.Line));
KGAuthor.EconLinearDemand = EconLinearDemand;
var EconCompetitiveDemand = /** @class */ (function (_super) {
__extends(EconCompetitiveDemand, _super);
function EconCompetitiveDemand() {
return _super !== null && _super.apply(this, arguments) || this;
}
return EconCompetitiveDemand;
}(EconLinearDemand));
KGAuthor.EconCompetitiveDemand = EconCompetitiveDemand;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../../eg.ts"/>
var KGAuthor;
(function (KGAuthor) {
var EconLinearSupply = /** @class */ (function (_super) {
__extends(EconLinearSupply, _super);
function EconLinearSupply(def, graph) {
var _this = this;
def = KGAuthor.setStrokeColor(def);
KG.setDefaults(def, {
name: 'supply',
color: 'colors.supply',
strokeWidth: 2,
lineStyle: 'solid',
pts: []
});
if (def.draggable && typeof (def.slope) == 'string') {
def.drag = [{
'directions': 'xy',
'param': KGAuthor.paramName(def.slope),
'expression': KGAuthor.divideDefs(KGAuthor.subtractDefs('drag.y', def.yIntercept), 'drag.x')
}];
}
else if (def.draggable && typeof (def.invSlope) == 'string') {
def.drag = [{
'directions': 'xy',
'param': KGAuthor.paramName(def.invSlope),
'expression': KGAuthor.divideDefs('drag.x', KGAuthor.subtractDefs('drag.y', def.yIntercept))
}];
}
else if (def.draggable && typeof (def.yIntercept) == 'string') {
def.drag = [{
'directions': 'y',
'param': KGAuthor.paramName(def.yIntercept),
'expression': KGAuthor.addDefs(def.yIntercept, 'drag.dy')
}];
}
if (def.hasOwnProperty("price")) {
def.pts.push({
name: "PQ",
y: def.price
});
}
_this = _super.call(this, def, graph) || this;
var ls = _this;
if (graph) {
var subObjects = ls.subObjects;
var yInterceptPointDef = {
coordinates: [0, ls.yIntercept],
color: def.color,
r: 4
};
if (def.draggable && typeof (ls.yIntercept) == 'string') {
yInterceptPointDef['drag'] = [{
directions: 'y',
param: KGAuthor.paramName(ls.yIntercept),
expression: KGAuthor.addDefs(ls.yIntercept, 'drag.dy')
}];
}
if (def.hasOwnProperty('yInterceptLabel')) {
yInterceptPointDef['droplines'] = {
horizontal: def.yInterceptLabel
};
}
ls.yInterceptPoint = new KGAuthor.Point(yInterceptPointDef, graph);
if (def.handles) {
subObjects.push(ls.yInterceptPoint);
}
if (def.hasOwnProperty('surplus')) {
var surplusDef = KG.setDefaults(def.surplus || {}, {
"fill": "colors.supply"
});
var price = def.price || "calcs." + ls.name + ".PQ.y", quantity = surplusDef.quantity || "calcs." + ls.name + ".PQ.x";
surplusDef.univariateFunction1 = {
fn: ls.def.univariateFunction.fn,
min: 0,
max: quantity,
samplePoints: 2
};
surplusDef.univariateFunction2 = {
fn: price,
min: 0,
max: quantity,
samplePoints: 2
};
ls.subObjects.push(new KGAuthor.Area(surplusDef, graph));
}
}
return _this;
}
return EconLinearSupply;
}(KGAuthor.Line));
KGAuthor.EconLinearSupply = EconLinearSupply;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../../eg.ts"/>
var KGAuthor;
(function (KGAuthor) {
var EconLinearEquilibrium = /** @class */ (function (_super) {
__extends(EconLinearEquilibrium, _super);
function EconLinearEquilibrium(def, graph) {
var _this = this;
KG.setDefaults(def, {
name: 'equilibrium',
showCS: false,
showPS: false
});
_this = _super.call(this, def, graph) || this;
var le = _this;
def.demand.price = "calcs." + le.name + ".P";
def.supply.price = "calcs." + le.name + ".P";
le.demand = new KGAuthor.EconLinearDemand(def.demand, graph);
le.supply = new KGAuthor.EconLinearSupply(def.supply, graph);
le.subObjects.push(_this.demand);
le.subObjects.push(_this.supply);
var eq = KGAuthor.lineIntersection(le.demand, le.supply);
le.Q = eq[0];
le.P = eq[1];
if (graph) {
if (def.hasOwnProperty('equilibrium')) {
def.equilibrium = KG.setDefaults(def.equilibrium, {
"color": "colors.equilibriumPrice",
"x": le.Q,
"y": le.P,
"droplines": {
"vertical": "Q^*",
"horizontal": "P^*"
}
});
le.subObjects.push(new KGAuthor.Point(def.equilibrium, graph));
}
}
return _this;
}
EconLinearEquilibrium.prototype.parseSelf = function (parsedData) {
var le = this;
parsedData = _super.prototype.parseSelf.call(this, parsedData);
parsedData.calcs[le.name] = {
Q: le.Q.toString(),
P: le.P.toString()
};
return parsedData;
};
return EconLinearEquilibrium;
}(KGAuthor.GraphObjectGenerator));
KGAuthor.EconLinearEquilibrium = EconLinearEquilibrium;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../../eg.ts"/>
var KGAuthor;
(function (KGAuthor) {
var EconPPF = /** @class */ (function (_super) {
__extends(EconPPF, _super);
function EconPPF(def, graph) {
var _this = this;
def = KGAuthor.setStrokeColor(def);
KG.setDefaults(def, {
name: 'ppf',
color: 'colors.supply',
strokeWidth: 2,
lineStyle: 'solid',
labor: 100,
L1: 50,
p1: 1,
p2: 1,
max1: 100,
max2: 100,
curvature: 0.5
});
if (def.linear) {
def.curvature = 1;
}
var fn1coeff = KGAuthor.divideDefs(def.max1, KGAuthor.raiseDefToDef(def.labor, def.curvature)), fn2coeff = KGAuthor.divideDefs(def.max2, KGAuthor.raiseDefToDef(def.labor, def.curvature));
var fn1 = new KGAuthor.EconOneInputProductionFunction({
name: def.name + '_prodFn1',
coefficient: fn1coeff,
exponent: def.curvature
}), fn2 = new KGAuthor.EconOneInputProductionFunction({
name: def.name + '_prodFn2',
coefficient: fn2coeff,
exponent: def.curvature
});
def.parametricFunction = {
xFunction: fn1.f("(t)"),
yFunction: fn2.f(KGAuthor.subtractDefs(def.labor, "(t)")),
max: def.labor
};
if (def.draggable) {
var dragLaborRequirement = KGAuthor.addDefs(fn1.laborRequirement('drag.x'), fn2.laborRequirement('drag.y'));
def.drag = [{
'directions': 'xy',
'param': KGAuthor.paramName(def.max1),
'expression': fn1.f(dragLaborRequirement)
},
{
'directions': 'xy',
'param': KGAuthor.paramName(def.max2),
'expression': fn2.f(dragLaborRequirement)
}];
}
_this = _super.call(this, def, graph) || this;
var ppf = _this;
ppf.labor = def.labor;
ppf.prodFn1 = fn1;
ppf.prodFn2 = fn2;
ppf.subObjects.push(fn1);
ppf.subObjects.push(fn2);
ppf.L1 = def.L1;
ppf.L2 = KGAuthor.subtractDefs(def.labor, def.L1);
ppf.y1 = ppf.prodFn1.f(ppf.L1);
ppf.y2 = ppf.prodFn2.f(ppf.L2);
var coefficientRatio = KGAuthor.divideDefs(def.max2, def.max1), laborRatio = KGAuthor.divideDefs(ppf.L2, def.L1), priceRatio = KGAuthor.divideDefs(def.p1, def.p2);
if (def.curvature == 1) {
ppf.mrt = coefficientRatio;
ppf.optimalL1 = "((" + coefficientRatio + " > " + priceRatio + ") ? 0 : " + ppf.labor + ")";
ppf.optimalL1 = "((" + coefficientRatio + " > " + priceRatio + ") ? " + ppf.labor + " : 0)";
}
else {
ppf.mrt = KGAuthor.multiplyDefs(coefficientRatio, KGAuthor.raiseDefToDef(laborRatio, KGAuthor.subtractDefs(def.curvature, 1)));
var theta = KGAuthor.raiseDefToDef(KGAuthor.divideDefs(coefficientRatio, priceRatio), KGAuthor.invertDef(KGAuthor.subtractDefs(def.curvature, 1)));
ppf.optimalL1 = KGAuthor.multiplyDefs(KGAuthor.divideDefs(theta, KGAuthor.addDefs(1, theta)), ppf.labor);
ppf.optimalL2 = KGAuthor.multiplyDefs(KGAuthor.divideDefs(1, KGAuthor.addDefs(1, theta)), ppf.labor);
}
ppf.optimaly1 = ppf.prodFn1.f(ppf.optimalL1);
ppf.optimaly2 = ppf.prodFn2.f(ppf.optimalL2);
if (graph) {
var subObjects = ppf.subObjects;
var xInterceptPointDef = {
coordinates: [def.max1, 0],
fill: def.stroke,
r: 4
};
if (def.draggable && typeof (def.max1) == 'string') {
xInterceptPointDef['drag'] = [{
directions: 'x',
param: KGAuthor.paramName(def.max1),
expression: KGAuthor.addDefs(def.max1, 'drag.dx')
}];
}
if (def.hasOwnProperty('xInterceptLabel')) {
xInterceptPointDef['droplines'] = {
vertical: def.xInterceptLabel
};
}
ppf.xInterceptPoint = new KGAuthor.Point(xInterceptPointDef, graph);
var yInterceptPointDef = {
coordinates: [0, def.max2],
fill: def.stroke,
r: 4
};
if (def.draggable && typeof (def.max2) == 'string') {
yInterceptPointDef['drag'] = [{
directions: 'y',
param: KGAuthor.paramName(def.max2),
expression: KGAuthor.addDefs(def.max2, 'drag.dy')
}];
}
if (def.hasOwnProperty('yInterceptLabel')) {
yInterceptPointDef['droplines'] = {
horizontal: def.yInterceptLabel
};
}
ppf.yInterceptPoint = new KGAuthor.Point(yInterceptPointDef, graph);
if (def.handles) {
subObjects.push(ppf.xInterceptPoint);
subObjects.push(ppf.yInterceptPoint);
}
}
return _this;
}
EconPPF.prototype.parseSelf = function (parsedData) {
var ppf = this;
parsedData = _super.prototype.parseSelf.call(this, parsedData);
parsedData.calcs[ppf.name] = {
L1: ppf.L1,
L2: ppf.L2,
y1: ppf.y1,
y2: ppf.y2,
optimalL1: ppf.optimalL1,
optimalL2: ppf.optimalL2,
optimaly1: ppf.optimaly1,
optimaly2: ppf.optimaly2,
mrt: ppf.mrt
};
return parsedData;
};
return EconPPF;
}(KGAuthor.Curve));
KGAuthor.EconPPF = EconPPF;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../../eg.ts"/>
var KGAuthor;
(function (KGAuthor) {
var EconLinearMC = /** @class */ (function (_super) {
__extends(EconLinearMC, _super);
function EconLinearMC(def, graph) {
return _super.call(this, def, graph) || this;
}
return EconLinearMC;
}(KGAuthor.EconLinearSupply));
KGAuthor.EconLinearMC = EconLinearMC;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../../eg.ts"/>
var KGAuthor;
(function (KGAuthor) {
var EconLinearMonopoly = /** @class */ (function (_super) {
__extends(EconLinearMonopoly, _super);
function EconLinearMonopoly(def, graph) {
var _this = this;
KG.setDefaults(def, {
name: 'monopoly',
showCS: false,
showPS: false,
showProfit: false
});
_this = _super.call(this, def, graph) || this;
var lm = _this;
def.demand.price = "calcs." + lm.name + ".P";
def.cost.price = "calcs." + lm.name + ".P";
if (def.cost.hasOwnProperty('surplus')) {
def.cost.surplus.quantity = "calcs." + lm.name + ".Q";
}
lm.demand = new KGAuthor.EconLinearDemand(def.demand, graph);
lm.cost = new KGAuthor.EconLinearMC(def.cost, graph);
var intersectMRMC = KGAuthor.lineIntersection(lm.demand.marginalRevenue, lm.cost);
lm.Q = intersectMRMC[0];
lm.P = lm.demand.yOfX(lm.Q);
lm.MRMC =
lm.subObjects.push(_this.demand);
lm.subObjects.push(_this.cost);
if (graph) {
}
return _this;
}
EconLinearMonopoly.prototype.parseSelf = function (parsedData) {
var lm = this;
parsedData = _super.prototype.parseSelf.call(this, parsedData);
parsedData.calcs[lm.name] = {
Q: lm.Q.toString(),
P: lm.P.toString()
};
return parsedData;
};
return EconLinearMonopoly;
}(KGAuthor.GraphObjectGenerator));
KGAuthor.EconLinearMonopoly = EconLinearMonopoly;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../../../eg.ts"/>
var KGAuthor;
(function (KGAuthor) {
var ExchangeEquilibriumBundle = /** @class */ (function (_super) {
__extends(ExchangeEquilibriumBundle, _super);
function ExchangeEquilibriumBundle(def, graph) {
var _this = this;
var agentA = new KGAuthor.EconBundle(def.agentA, graph), agentB = new KGAuthor.EconBundle(def.agentB, graph);
var p;
if (def.agentA.utilityFunction.type == 'CobbDouglas' && def.agentB.utilityFunction.type == 'CobbDouglas') {
var alphaW2 = function (agent) {
return KGAuthor.multiplyDefs(agent.y, agent.utilityFunction.alpha);
}, oneMinusAlphaW1 = function (agent) {
return KGAuthor.multiplyDefs(agent.x, KGAuthor.subtractDefs(1, agent.utilityFunction.alpha));
};
p = KGAuthor.divideDefs(KGAuthor.addDefs(alphaW2(agentA), alphaW2(agentB)), KGAuthor.addDefs(oneMinusAlphaW1(agentA), oneMinusAlphaW1(agentB)));
}
else {
console.log("We're just handling Edgeworth equilibrium with Cobb-Douglas so far...");
}
KG.setDefaults(def, {
label: { text: 'E' },
color: "colors.budget"
});
def.utilityFunctionObject = agentA.utilityFunction;
def.budgetLine = {
p1: p,
p2: 1,
point: [agentA.x, agentA.y]
};
_this = _super.call(this, def, graph) || this;
return _this;
}
return ExchangeEquilibriumBundle;
}(KGAuthor.EconOptimalBundle));
KGAuthor.ExchangeEquilibriumBundle = ExchangeEquilibriumBundle;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../../../eg.ts"/>
var KGAuthor;
(function (KGAuthor) {
var EconContractCurve = /** @class */ (function (_super) {
__extends(EconContractCurve, _super);
function EconContractCurve(def, graph) {
var _this = this;
var a = def.a, b = def.b, ab = KGAuthor.multiplyDefs(a, b), aMinusABtimesX = KGAuthor.multiplyDefs(KGAuthor.subtractDefs(a, ab), def.totalGood1), bMinusABtimesY = KGAuthor.multiplyDefs(KGAuthor.subtractDefs(b, ab), def.totalGood2), bMinusA = KGAuthor.subtractDefs(b, a), fnString = bMinusABtimesY + "*(x)/(" + aMinusABtimesX + " + " + bMinusA + "*(x))";
def.univariateFunction = { fn: fnString };
KG.setDefaults(def, {
interpolation: 'curveMonotoneX',
color: 'colors.budget'
});
_this = _super.call(this, def, graph) || this;
_this.fnString = fnString;
return _this;
}
EconContractCurve.prototype.parseSelf = function (parsedData) {
var cc = this;
parsedData = _super.prototype.parseSelf.call(this, parsedData);
parsedData.calcs['cc'] = cc.fnString;
return parsedData;
};
return EconContractCurve;
}(KGAuthor.Curve));
KGAuthor.EconContractCurve = EconContractCurve;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../../../eg.ts"/>
var KGAuthor;
(function (KGAuthor) {
var EconParetoLens = /** @class */ (function (_super) {
__extends(EconParetoLens, _super);
function EconParetoLens(def, graph) {
var _this = _super.call(this, def, graph) || this;
_this.subObjects.push(new KGAuthor.Rectangle({
clipPathName: def.bundleA + "_IC_above",
clipPathName2: def.bundleB + "_IC_above",
x1: graph.def.xAxis.min,
x2: graph.def.xAxis.max,
y1: graph.def.yAxis.min,
y2: graph.def.yAxis.max,
fill: "colors.paretoLens",
opacity: "0.2",
show: def.show
}, graph));
return _this;
}
return EconParetoLens;
}(KGAuthor.GraphObjectGenerator));
KGAuthor.EconParetoLens = EconParetoLens;
})(KGAuthor || (KGAuthor = {}));
/// <reference path="../kgAuthor.ts" />
/* SCHEMAS */
/// <reference path="schemas/econSchema.ts"/>
/// <reference path="schemas/bowlesHallidaySchema.ts"/>
/* LAYOUTS */
/// <reference path="layouts/edgeworth.ts"/>
/* FUNCTIONAL FORMS */
/// <reference path="functional_forms/multivariate/multivariate.ts"/>
/// <reference path="functional_forms/multivariate/cobbDouglas.ts"/>
/// <reference path="functional_forms/multivariate/complements.ts"/>
/// <reference path="functional_forms/multivariate/substitutes.ts"/>
/// <reference path="functional_forms/multivariate/ces.ts"/>
/// <reference path="functional_forms/multivariate/concave.ts"/>
/// <reference path="functional_forms/multivariate/quasilinear.ts"/>
/* MICRO */
/* Consumer Theory */
/// <reference path="micro/consumer_theory/constraints/budgetLine.ts"/>
/// <reference path="micro/consumer_theory/two_good_utility/utilitySelector.ts"/>
/// <reference path="micro/consumer_theory/two_good_utility/indifferenceCurve.ts"/>
/// <reference path="micro/consumer_theory/two_good_utility/bundle.ts"/>
/// <reference path="micro/consumer_theory/optimization/optimalBundle.ts"/>
/// <reference path="micro/consumer_theory/optimization/demandCurve.ts"/>
/* Producer Theory */
/// <reference path="micro/producer_theory/oneInputProductionFunction.ts"/>
/* Equilibrium */
/// <reference path="micro/equilibrium/linearDemand.ts"/>
/// <reference path="micro/equilibrium/linearSupply.ts"/>
/// <reference path="micro/equilibrium/linearEquilibrium.ts"/>
/// <reference path="micro/equilibrium/ppf.ts"/>
/* Monopoly */
/// <reference path="micro/monopoly/linearMC.ts"/>
/// <reference path="micro/monopoly/linearMonopoly.ts"/>
/* Exchange */
/// <reference path="micro/exchange/edgeworth/exchange_equilibrium.ts"/>
/// <reference path="micro/exchange/edgeworth/contract_curve.ts"/>
/// <reference path="micro/exchange/edgeworth/pareto_lens.ts"/>
/// <reference path="../kg.ts"/>
/// <reference path="parsers/parsingFunctions.ts"/>
/// <reference path="parsers/authoringObject.ts"/>
/// <reference path="schemas/schema.ts"/>
/// <reference path="layouts/layout.ts"/>
/// <reference path="layouts/html.ts"/>
/// <reference path="layouts/oneGraph.ts"/>
/// <reference path="layouts/twoHorizontalGraphs.ts"/>
/// <reference path="layouts/threeHorizontalGraphs.ts"/>
/// <reference path="layouts/twoVerticalGraphs.ts"/>
/// <reference path="layouts/squarePlusTwoVerticalGraphs.ts"/>
/// <reference path="layouts/fourGraphs.ts"/>
/// <reference path="layouts/gameMatrix.ts"/>
/// <reference path="positionedObjects/positionedObject.ts"/>
/// <reference path="positionedObjects/graph.ts"/>
/// <reference path="positionedObjects/ggbContainer.ts"/>
/// <reference path="positionedObjects/mathboxContainer.ts"/>
/// <reference path="positionedObjects/divContainer.ts"/>
/// <reference path="defObjects/graphObjectGenerator.ts"/>
/// <reference path="defObjects/defObject.ts"/>
/// <reference path="defObjects/clipPath.ts"/>
/// <reference path="defObjects/marker.ts"/>
/// <reference path="defObjects/arrowDef.ts"/>
/// <reference path="graphObjects/graphObject.ts"/>
/// <reference path="graphObjects/axis.ts"/>
/// <reference path="graphObjects/grid.ts"/>
/// <reference path="graphObjects/curve.ts"/>
/// <reference path="graphObjects/line.ts"/>
/// <reference path="graphObjects/circle.ts"/>
/// <reference path="graphObjects/point.ts"/>
/// <reference path="graphObjects/segment.ts"/>
/// <reference path="graphObjects/arrow.ts"/>
/// <reference path="graphObjects/dropline.ts"/>
/// <reference path="graphObjects/area.ts"/>
/// <reference path="graphObjects/rectangle.ts"/>
/// <reference path="graphObjects/contour.ts"/>
/// <reference path="graphObjects/angle.ts"/>
/// <reference path="mathboxObjects/mathboxObject.ts"/>
/// <reference path="mathboxObjects/mathboxAxis.ts"/>
/// <reference path="mathboxObjects/mathboxPoint.ts"/>
/// <reference path="mathboxObjects/mathboxLine.ts"/>
/// <reference path="mathboxObjects/mathboxArea.ts"/>
/// <reference path="divObjects/divObject.ts"/>
/// <reference path="divObjects/positionedDiv.ts"/>
/// <reference path="divObjects/label.ts"/>
/// <reference path="divObjects/sidebar.ts"/>
/// <reference path="divObjects/controls.ts"/>
/// <reference path="divObjects/gameMatrix.ts"/>
/// <reference path="divObjects/ggbApplet.ts"/>
/// <reference path="divObjects/mathbox.ts"/>
/// <reference path="econ/eg.ts"/>
/// <reference path="../kg.ts" />
var KG;
(function (KG) {
var Model = /** @class */ (function () {
function Model(parsedData) {
var model = this;
model.params = parsedData.params.map(function (def) {
return new KG.Param(def);
});
model.calcs = parsedData.calcs;
model.colors = parsedData.colors;
model.restrictions = (parsedData.restrictions || []).map(function (def) {
return new KG.Restriction(def);
});
model.updateListeners = [];
model.currentParamValues = model.evalParams();
model.evalCalcs();
model.currentColors = model.evalObject(model.colors);
}
Model.prototype.addUpdateListener = function (updateListener) {
this.updateListeners.push(updateListener);
return this;
};
Model.prototype.evalParams = function () {
var p = {};
this.params.forEach(function (param) {
p[param.name] = param.value;
});
return p;
};
// evaluates the calcs object; then re-evaluates to capture calcs that depend on other calcs
Model.prototype.evalCalcs = function () {
var model = this;
// clear calculatios so old values aren't used;
model.currentCalcValues = {};
// generate as many calculations from params as possible
model.currentCalcValues = model.evalObject(model.calcs, true);
// calculate values based on other calculations (up to a depth of 5)
for (var i = 0; i < 5; i++) {
for (var calcName in model.currentCalcValues) {
if (typeof model.calcs[calcName] == 'object') {
model.currentCalcValues[calcName] = model.evalObject(model.calcs[calcName], true);
}
else if (isNaN(model.currentCalcValues[calcName]) && typeof model.calcs[calcName] == 'string') {
model.currentCalcValues[calcName] = model.evaluate(model.calcs[calcName], true);
}
}
}
return model.currentCalcValues;
};
Model.prototype.evalObject = function (obj, onlyJSMath) {
var model = this;
var newObj = {};
for (var stringOrObj in obj) {
var def = obj[stringOrObj];
if (typeof def === 'string') {
newObj[stringOrObj] = model.evaluate(def, onlyJSMath);
}
else {
newObj[stringOrObj] = model.evalObject(def, onlyJSMath);
}
}
return newObj;
};
// the model serves as a model, and can evaluate expressions within the context of that model
// if onlyJSMath is selected, it will only try to evaluate using JSMath; this is especially important for calculations.
Model.prototype.evaluate = function (name, onlyJSMath) {
var model = this;
// don't just evaluate numbers
if (!isNaN(parseFloat(name))) {
//console.log('interpreted ', name, 'as a number.');
return parseFloat(name);
}
// collect current values in a scope object
var params = model.currentParamValues, calcs = model.currentCalcValues, colors = model.currentColors;
// try to evaluate using mathjs
try {
var compiledMath = math.compile(name);
var result = compiledMath.evaluate({
params: params,
calcs: calcs,
colors: colors
});
//console.log('parsed', name, 'as a pure math expression with value', result);
return result;
}
catch (err) {
// if that doesn't work, try to evaluate using native js eval
//console.log('unable to parse', name, 'as a pure math function, trying general eval');
if (onlyJSMath) {
return name;
}
else {
try {
var result = eval(name);
//console.log('parsed', name, 'as an expression with value', result);
return result;
}
catch (err) {
//console.log('unable to parse', name, 'as a valid expression; generates error:', err.message);
return name;
}
}
}
};
// This is a utility for exporting currently used colors for use in LaTex documents.
Model.prototype.latexColors = function () {
var result = '%% econ colors %%\n', model = this;
for (var color in model.colors) {
result += "\\definecolor{" + color + "}{HTML}{" + model.evaluate(model.colors[color]).replace('#', '') + "}\n";
}
console.log(result);
};
Model.prototype.getParam = function (paramName) {
var params = this.params;
for (var i = 0; i < params.length; i++) {
if (params[i].name == paramName) {
return params[i];
}
}
};
// method exposed to viewObjects to allow them to try to change a parameter
Model.prototype.updateParam = function (name, newValue) {
var model = this, param = model.getParam(name);
var oldValue = param.value;
param.update(newValue);
// if param has changed, check to make sure the change is val
if (oldValue != param.value) {
//restrictions aren't working right now
var valid_1 = true;
model.restrictions.forEach(function (r) {
if (!r.valid(model)) {
valid_1 = false;
}
});
if (valid_1) {
model.update(false);
}
else {
param.update(oldValue);
}
model.update(false);
}
};
// method exposed to viewObjects to allow them to toggle a binary param
Model.prototype.toggleParam = function (name) {
var currentValue = this.getParam(name).value;
this.updateParam(name, !currentValue);
};
// method exposed to viewObjects to allow them to cycle a discrete param
// increments by 1 if below max value, otherwise sets to zero
Model.prototype.cycleParam = function (name) {
var param = this.getParam(name);
this.updateParam(name, param.value < param.max ? param.value++ : 0);
};
Model.prototype.update = function (force) {
var model = this;
model.currentParamValues = model.evalParams();
model.evalCalcs();
console.log('calcs', model.currentCalcValues);
model.currentColors = model.evalObject(model.colors);
model.updateListeners.forEach(function (listener) {
listener.update(force);
});
};
return Model;
}());
KG.Model = Model;
})(KG || (KG = {}));
/// <reference path="model.ts" />
var KG;
(function (KG) {
var Param = /** @class */ (function () {
function Param(def) {
function decimalPlaces(numAsString) {
var match = ('' + numAsString).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
if (!match) {
return 0;
}
return Math.max(0,
// Number of digits right of decimal point.
(match[1] ? match[1].length : 0)
// Adjust for scientific notation.
- (match[2] ? +match[2] : 0));
}
KG.setDefaults(def, { min: 0, max: 10, round: 1, label: '' });
this.name = def.name;
this.label = def.label;
if (typeof def.value == 'boolean') {
this.value = +def.value;
this.min = 0;
this.max = 100;
this.round = 1;
}
else {
this.value = parseFloat(def.value);
this.min = parseFloat(def.min);
this.max = parseFloat(def.max);
this.round = parseFloat(def.round);
this.precision = parseInt(def.precision) || decimalPlaces(this.round.toString());
}
}
// Receives an instruction to update the parameter to a new value
// Updates to the closest rounded value to the desired newValue within accepted range
Param.prototype.update = function (newValue) {
var param = this;
if (newValue < param.min) {
param.value = param.min;
}
else if (newValue > param.max) {
param.value = param.max;
}
else {
param.value = Math.round(newValue / param.round) * param.round;
}
return param.value;
};
// Displays current value of the parameter to desired precision
// If no precision is given, uses the implied precision given by the rounding parameter
Param.prototype.formatted = function (precision) {
precision = precision || this.precision;
return d3.format("." + precision + "f")(this.value);
};
return Param;
}());
KG.Param = Param;
})(KG || (KG = {}));
/// <reference path="model.ts" />
var KG;
(function (KG) {
var Restriction = /** @class */ (function () {
function Restriction(def) {
this.expression = def.expression;
this.type = def.type;
this.min = def.min;
this.max = def.max;
}
Restriction.prototype.valid = function (model) {
var r = this, value = model.evaluate(r.expression), min = model.evaluate(r.min), max = model.evaluate(r.max);
// restrictions aren't working right now
return true;
//return (value >= min && value <= max);
};
return Restriction;
}());
KG.Restriction = Restriction;
})(KG || (KG = {}));
/// <reference path="../kg.ts" />
var KG;
(function (KG) {
function randomString(length) {
var text = "KGID_";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for (var i = 0; i < length; i++) {
text += possible.charAt(Math.floor(Math.random() * possible.length));
}
return text;
}
KG.randomString = randomString;
var UpdateListener = /** @class */ (function () {
function UpdateListener(def) {
def.constants = (def.constants || []).concat(['model', 'updatables', 'name']);
var ul = this;
ul.def = def;
def.constants.forEach(function (c) {
ul[c] = isNaN(parseFloat(def[c])) ? def[c] : +def[c];
});
ul.id = randomString(10);
ul.model.addUpdateListener(this);
}
UpdateListener.prototype.updateArray = function (a) {
var u = this;
return a.map(function (d) {
if (Array.isArray(d)) {
return u.updateArray(d);
}
else {
var initialValue = d;
var newValue = u.model.evaluate(d);
if (initialValue != newValue) {
u.hasChanged = true;
}
return newValue;
}
});
};
UpdateListener.prototype.updateDef = function (name) {
var u = this;
if (u.def.hasOwnProperty(name)) {
var d = u.def[name], initialValue = u[name];
if (Array.isArray(d)) {
u[name] = u.updateArray(d);
}
else {
var newValue = u.model.evaluate(d);
if (initialValue != newValue) {
u.hasChanged = true;
u[name] = newValue;
}
}
//console.log(u.constructor['name'],name,'changed from',initialValue,'to',u[name]);
}
return u;
};
UpdateListener.prototype.update = function (force) {
var u = this;
u.hasChanged = !!force;
if (u.hasOwnProperty('updatables') && u.updatables != undefined) {
u.updatables.forEach(function (name) {
u.updateDef(name);
});
}
return u;
};
return UpdateListener;
}());
KG.UpdateListener = UpdateListener;
})(KG || (KG = {}));
/// <reference path="../kg.ts" />
var KG;
(function (KG) {
var MathFunction = /** @class */ (function (_super) {
__extends(MathFunction, _super);
function MathFunction(def) {
var _this = this;
KG.setDefaults(def, {
samplePoints: 50
});
KG.setProperties(def, 'constants', ['samplePoints']);
KG.setProperties(def, 'updatables', ['min', 'max']);
_this = _super.call(this, def) || this;
return _this;
}
MathFunction.prototype.updateFunctionString = function (str, scope) {
function getCalc(o, s) {
s = s.replace(/\[(\w+)\]/g, '.$1'); // convert indexes to properties
s = s.replace(/^\./, ''); // strip a leading dot
var a = s.split('.');
for (var i = 0, n = a.length; i < n; ++i) {
var k = a[i];
if (k in o) {
o = o[k];
}
else {
return;
}
}
return o;
}
str = str.toString();
if (str.indexOf('null') > -1 || str.indexOf('Infinity') > -1) {
return null;
}
var re = /((calcs|params).[.\w]*)+/g;
var references = str.match(re);
if (references) {
references.forEach(function (name) {
str = KGAuthor.replaceVariable(str, name, getCalc(scope, name));
});
}
//console.log('updated function to ',str);
return str;
};
return MathFunction;
}(KG.UpdateListener));
KG.MathFunction = MathFunction;
})(KG || (KG = {}));
/// <reference path="../kg.ts" />
var KG;
(function (KG) {
var MathFunction = KG.MathFunction;
var UnivariateFunction = /** @class */ (function (_super) {
__extends(UnivariateFunction, _super);
function UnivariateFunction(def) {
var _this = this;
KG.setDefaults(def, {
ind: 'x'
});
KG.setProperties(def, 'constants', ['fn', 'yFn']);
KG.setProperties(def, 'updatables', ['ind', 'min', 'max']);
_this = _super.call(this, def) || this;
_this.fnStringDef = def.fn;
_this.fnZStringDef = def.fnZ;
_this.yFnStringDef = def.yFn;
_this.yFnZStringDef = def.yFnZ;
return _this;
}
UnivariateFunction.prototype.evaluate = function (input, z) {
var fn = this;
if (z) {
if (fn.hasOwnProperty('yzCompiledFunction') && fn.ind == 'y') {
return fn.yzCompiledFunction.evaluate({ y: input });
}
else if (fn.hasOwnProperty('zCompiledFunction') && fn.ind == 'y') {
return fn.zCompiledFunction.evaluate({ y: input });
}
else if (fn.hasOwnProperty('zCompiledFunction')) {
return fn.zCompiledFunction.evaluate({ x: input });
}
}
else {
if (fn.hasOwnProperty('yCompiledFunction') && fn.ind == 'y') {
return fn.yCompiledFunction.evaluate({ y: input });
}
else if (fn.hasOwnProperty('compiledFunction') && fn.ind == 'y') {
return fn.compiledFunction.evaluate({ y: input });
}
else if (fn.hasOwnProperty('compiledFunction')) {
return fn.compiledFunction.evaluate({ x: input });
}
}
};
UnivariateFunction.prototype.generateData = function (min, max) {
var fn = this, data = [];
if (undefined != fn.min) {
min = fn.min;
}
if (undefined != fn.max) {
max = fn.max;
}
for (var i = 0; i < fn.samplePoints + 1; i++) {
var a = i / fn.samplePoints, input = a * min + (1 - a) * max, output = fn.evaluate(input);
if (!isNaN(output) && output != Infinity && output != -Infinity) {
data.push((fn.ind == 'x') ? { x: input, y: output } : { x: output, y: input });
}
}
this.data = data;
return data;
};
UnivariateFunction.prototype.mathboxFn = function () {
var fn = this;
return function (emit, x) {
var y = fn.evaluate(x), z = fn.evaluate(x, true);
if (y <= 50 && z <= 50) {
emit(y, z, x);
}
};
};
UnivariateFunction.prototype.update = function (force) {
var fn = _super.prototype.update.call(this, force);
//console.log('updating; currently ', fn.fnString);
fn.scope = {
params: fn.model.currentParamValues,
calcs: fn.model.currentCalcValues,
colors: fn.model.currentColors
};
var originalString = fn.fnString;
if (originalString != fn.updateFunctionString(fn.fnStringDef, fn.scope)) {
fn.hasChanged = true;
fn.fnString = fn.updateFunctionString(fn.fnStringDef, fn.scope);
fn.compiledFunction = math.compile(fn.fnString);
}
if (fn.def.hasOwnProperty('yFn')) {
if (fn.yFnString != fn.updateFunctionString(fn.yFnStringDef, fn.scope)) {
fn.hasChanged = true;
fn.yFnString = fn.updateFunctionString(fn.yFnStringDef, fn.scope);
fn.yCompiledFunction = math.compile(fn.yFnString);
}
}
if (fn.def.hasOwnProperty('fnZ')) {
if (fn.fnZString != fn.updateFunctionString(fn.fnZStringDef, fn.scope)) {
fn.hasChanged = true;
fn.fnZString = fn.updateFunctionString(fn.fnZStringDef, fn.scope);
fn.zCompiledFunction = math.compile(fn.fnZString);
}
}
if (fn.def.hasOwnProperty('yFnZ')) {
if (fn.yFnZString != fn.updateFunctionString(fn.yFnZStringDef, fn.scope)) {
fn.hasChanged = true;
fn.yFnZString = fn.updateFunctionString(fn.yFnZStringDef, fn.scope);
fn.yzCompiledFunction = math.compile(fn.yFnZString);
}
}
return fn;
};
return UnivariateFunction;
}(MathFunction));
KG.UnivariateFunction = UnivariateFunction;
})(KG || (KG = {}));
/// <reference path="../kg.ts" />
var KG;
(function (KG) {
var ParametricFunction = /** @class */ (function (_super) {
__extends(ParametricFunction, _super);
function ParametricFunction(def) {
var _this = this;
KG.setDefaults(def, {
min: 0,
max: 10
});
_this = _super.call(this, def) || this;
_this.xFunctionStringDef = def.xFunction;
_this.yFunctionStringDef = def.yFunction;
return _this;
}
ParametricFunction.prototype.evaluate = function (input) {
var fn = this;
fn.scope = fn.scope || { params: fn.model.currentParamValues };
fn.scope.t = input;
return { x: fn.xCompiledFunction.evaluate(fn.scope), y: fn.yCompiledFunction.evaluate(fn.scope) };
};
ParametricFunction.prototype.generateData = function (min, max) {
var fn = this, data = [];
if (undefined != fn.min) {
min = fn.min;
}
if (undefined != fn.max) {
max = fn.max;
}
for (var i = 0; i < fn.samplePoints + 1; i++) {
var a = i / fn.samplePoints, input = a * min + (1 - a) * max, output = fn.evaluate(input);
if (!isNaN(output.x) && output.x != Infinity && output.x != -Infinity && !isNaN(output.y) && output.y != Infinity && output.y != -Infinity) {
data.push(output);
}
}
this.data = data;
return data;
};
ParametricFunction.prototype.update = function (force) {
var fn = _super.prototype.update.call(this, force);
//console.log('updating; currently ', fn.fnString);
fn.scope = {
params: fn.model.currentParamValues,
calcs: fn.model.currentCalcValues,
colors: fn.model.currentColors
};
var originalXFunctionString = fn.xFunctionString;
if (originalXFunctionString != fn.updateFunctionString(fn.xFunctionStringDef, fn.scope)) {
fn.hasChanged = true;
fn.xFunctionString = fn.updateFunctionString(fn.xFunctionStringDef, fn.scope);
fn.xCompiledFunction = math.compile(fn.xFunctionString);
}
var originalYFunctionString = fn.yFunctionString;
if (originalYFunctionString != fn.updateFunctionString(fn.yFunctionStringDef, fn.scope)) {
fn.hasChanged = true;
fn.yFunctionString = fn.updateFunctionString(fn.yFunctionStringDef, fn.scope);
fn.yCompiledFunction = math.compile(fn.yFunctionString);
}
return fn;
};
return ParametricFunction;
}(KG.MathFunction));
KG.ParametricFunction = ParametricFunction;
})(KG || (KG = {}));
/// <reference path="../kg.ts" />
var KG;
(function (KG) {
var MathFunction = KG.MathFunction;
var MultivariateFunction = /** @class */ (function (_super) {
__extends(MultivariateFunction, _super);
function MultivariateFunction(def) {
var _this = this;
def.samplePoints = 100;
KG.setProperties(def, 'constants', ['fn']);
_this = _super.call(this, def) || this;
_this.fnStringDef = def.fn;
_this.domainConditionStringDef = def.domainCondition;
return _this;
}
MultivariateFunction.prototype.inDomain = function (x, y, z) {
var fn = this;
if (fn.hasOwnProperty('compiledDomainCondition')) {
return fn.compiledDomainCondition.evaluate({ x: x, y: y, z: z });
}
else {
return true;
}
};
MultivariateFunction.prototype.evaluate = function (x, y) {
var fn = this;
if (fn.hasOwnProperty('compiledFunction')) {
var z = fn.compiledFunction.evaluate({ x: x, y: y });
if (fn.inDomain(x, y, z)) {
return z;
}
}
};
MultivariateFunction.prototype.mathboxFn = function () {
var fn = this;
return function (emit, x, y) {
emit(y, fn.evaluate(x, y), x);
};
};
MultivariateFunction.prototype.contour = function (level, xScale, yScale) {
var fn = this;
var xMax = xScale.domainMax, yMax = yScale.domainMax;
var n = 110, m = 110, values = new Array(n * m);
for (var j = 0.5, k = 0; j < m; ++j) {
for (var i = 0.5; i < n; ++i, ++k) {
var x = i * xMax * 1.1 / n, y = j * yMax * 1.1 / m;
values[k] = fn.evaluate(x, y);
}
}
var transform = function (_a) {
var type = _a.type, value = _a.value, coordinates = _a.coordinates;
return {
type: type, value: value, coordinates: coordinates.map(function (rings) {
return rings.map(function (points) {
return points.map(function (_a) {
var x = _a[0], y = _a[1];
return ([xScale.scale(x * xMax / 100), yScale.scale(y * yMax / 100)]);
});
});
})
};
};
var p = d3.geoPath();
// Compute the contour polygons at log-spaced intervals; returns an array of MultiPolygon.
var contourLine = d3.contours().size([n, m]).contour(values, level);
return p(transform(contourLine));
};
MultivariateFunction.prototype.update = function (force) {
var fn = _super.prototype.update.call(this, force);
//console.log('updating; currently ', fn.fnString);
fn.scope = {
params: fn.model.currentParamValues,
calcs: fn.model.currentCalcValues,
colors: fn.model.currentColors
};
var originalString = fn.fnString, originalDomainCondition = fn.domainConditionString;
if (originalString != fn.updateFunctionString(fn.fnStringDef, fn.scope)) {
fn.hasChanged = true;
fn.fnString = fn.updateFunctionString(fn.fnStringDef, fn.scope);
fn.compiledFunction = math.compile(fn.fnString);
}
if (fn.domainConditionStringDef != undefined) {
if (originalDomainCondition != fn.updateFunctionString(fn.domainConditionStringDef, fn.scope)) {
fn.hasChanged = true;
fn.domainConditionString = fn.updateFunctionString(fn.domainConditionStringDef, fn.scope);
fn.compiledDomainCondition = math.compile(fn.domainConditionString);
}
}
return fn;
};
return MultivariateFunction;
}(MathFunction));
KG.MultivariateFunction = MultivariateFunction;
})(KG || (KG = {}));
/// <reference path="../../kg.ts" />
var KG;
(function (KG) {
/*
A listener is defined by a param and an expression.
When the interactionHandler senses a change, it generates a scope of the current state of the model.
The listener then determines the current value of its expression within the context of that scope,
and sends a signal to the model to update its param.
*/
var Listener = /** @class */ (function (_super) {
__extends(Listener, _super);
function Listener(def) {
var _this = this;
KG.setProperties(def, 'updatables', ['expression']);
KG.setProperties(def, 'constants', ['param']);
_this = _super.call(this, def) || this;
return _this;
}
Listener.prototype.onChange = function (scope) {
var l = this, compiledMath = math.compile(l.expression);
var parsedMath = compiledMath.evaluate(scope);
l.model.updateParam(l.param, parsedMath);
};
return Listener;
}(KG.UpdateListener));
KG.Listener = Listener;
})(KG || (KG = {}));
/// <reference path="../../kg.ts" />
var KG;
(function (KG) {
/*
A DragListener is a special kind of Listener that listens for drag events.
In addition to a param and an expression, it has properties for whether it is draggable
and, if so, in which directions it is draggable.
*/
var DragListener = /** @class */ (function (_super) {
__extends(DragListener, _super);
function DragListener(def) {
var _this = this;
if (def.hasOwnProperty('vertical')) {
def.directions = 'y';
def.param = def.vertical;
def.expression = "params." + def.vertical + " + drag.dy";
}
if (def.hasOwnProperty('horizontal')) {
def.directions = 'x';
def.param = def.horizontal;
def.expression = "params." + def.horizontal + " + drag.dx";
}
KG.setDefaults(def, {
directions: "xy"
});
KG.setProperties(def, 'updatables', ['draggable', 'directions']);
_this = _super.call(this, def) || this;
return _this;
}
DragListener.prototype.update = function (force) {
var dl = _super.prototype.update.call(this, force);
if (!dl.def.hasOwnProperty('draggable')) {
dl.draggable = (dl.directions.length > 0);
}
return dl;
};
return DragListener;
}(KG.Listener));
KG.DragListener = DragListener;
})(KG || (KG = {}));
/// <reference path="../../kg.ts" />
var KG;
(function (KG) {
var ClickListener = /** @class */ (function (_super) {
__extends(ClickListener, _super);
function ClickListener(def) {
return _super.call(this, def) || this;
}
return ClickListener;
}(KG.Listener));
KG.ClickListener = ClickListener;
})(KG || (KG = {}));
/// <reference path="../kg.ts" />
var KG;
(function (KG) {
var InteractionHandler = /** @class */ (function (_super) {
__extends(InteractionHandler, _super);
function InteractionHandler(def) {
var _this = this;
KG.setDefaults(def, { dragListeners: [], clickListeners: [] });
KG.setProperties(def, 'constants', ["viewObject", "dragListeners", "clickListeners"]);
_this = _super.call(this, def) || this;
_this.update(true);
_this.scope = { params: {}, calcs: {}, colors: {}, drag: {} };
return _this;
}
InteractionHandler.prototype.update = function (force) {
var ih = _super.prototype.update.call(this, force);
// first update dragListeners
if (ih.hasChanged && ih.hasOwnProperty('dragListeners') && (ih.element != undefined)) {
var xDrag_1 = false, yDrag_1 = false;
ih.dragListeners.forEach(function (dul) {
dul.update(force);
if (dul.directions == "x") {
xDrag_1 = true;
}
else if (dul.directions == "y") {
yDrag_1 = true;
}
else if (dul.directions == "xy") {
xDrag_1 = true;
yDrag_1 = true;
}
});
ih.element.style("pointer-events", (xDrag_1 || yDrag_1) ? "all" : "none");
ih.element.style("cursor", (xDrag_1 && yDrag_1) ? "move" : xDrag_1 ? "ew-resize" : "ns-resize");
}
return ih;
};
InteractionHandler.prototype.addTrigger = function (element) {
var handler = this;
handler.element = element;
// add click listeners
if (handler.clickListeners.length > 0) {
element.on("click", function () {
if (d3.event.defaultPrevented)
return; //dragged)
handler.scope.params = handler.model.currentParamValues;
handler.scope.calcs = handler.model.currentCalcValues;
handler.scope.colors = handler.model.currentColors;
handler.clickListeners.forEach(function (d) {
d.onChange(handler.scope);
});
});
}
// add drag listeners
if (handler.dragListeners.length > 0) {
element.call(d3.drag()
.on('start', function () {
handler.scope.params = handler.model.currentParamValues;
handler.scope.calcs = handler.model.currentCalcValues;
handler.scope.colors = handler.model.currentColors;
handler.scope.drag.x0 = handler.viewObject.xScale.scale.invert(d3.event.x);
handler.scope.drag.y0 = handler.viewObject.yScale.scale.invert(d3.event.y);
})
.on('drag', function () {
var drag = handler.scope.drag;
drag.x = handler.viewObject.xScale.scale.invert(d3.event.x);
drag.y = handler.viewObject.yScale.scale.invert(d3.event.y);
drag.dx = drag.x - drag.x0;
drag.dy = drag.y - drag.y0;
handler.dragListeners.forEach(function (d) {
d.onChange(handler.scope);
});
})
.on('end', function () {
//handler.element.style("cursor","default");
}));
}
handler.update(true);
};
return InteractionHandler;
}(KG.UpdateListener));
KG.InteractionHandler = InteractionHandler;
})(KG || (KG = {}));
/// <reference path='../kg.ts' />
var KG;
(function (KG) {
KG.viewData = {};
function addView(name, def) {
KG.viewData[name] = def;
}
KG.addView = addView;
var View = /** @class */ (function () {
function View(div, data) {
this.render(data, div);
}
View.prototype.parse = function (data, div) {
data.schema = data.schema || "Schema";
data.params = (data.params || []).map(function (paramData) {
// allow author to override initial parameter values by specifying them as div attributes
if (div.hasAttribute(paramData.name)) {
paramData.value = div.getAttribute(paramData.name);
}
// convert numerical params from strings to numbers
paramData.value = isNaN(+paramData.value) ? paramData.value : +paramData.value;
return paramData;
});
var parsedData = {
aspectRatio: data.aspectRatio || 1,
params: data.params || [],
calcs: data.calcs || {},
colors: data.colors || {},
restrictions: data.restrictions,
clipPaths: data.clipPaths || [],
markers: data.markers || [],
scales: data.scales || [{
name: 'x',
axis: 'x',
rangeMin: 0,
rangeMax: 1,
domainMin: 0,
domainMax: 1
},
{
name: 'y',
axis: 'y',
rangeMin: 0,
rangeMax: 1,
domainMin: 0,
domainMax: 1
}],
layers: data.layers || [[], [], [], []],
divs: data.divs || []
};
data.objects = data.objects || [];
if (data.hasOwnProperty('layout')) {
if (data.layout.hasOwnProperty('type')) {
data.objects.push(data.layout);
}
else {
var layoutType = Object.keys(data.layout)[0], layoutDef = data.layout[layoutType];
data.objects.push({ type: layoutType, def: layoutDef });
}
}
if (data.hasOwnProperty('schema')) {
data.objects.push({ type: data.schema, def: {} });
}
return KGAuthor.parse(data.objects, parsedData);
};
View.prototype.render = function (data, div) {
var view = this;
var parsedData = view.parse(data, div);
div.innerHTML = "";
view.aspectRatio = parsedData.aspectRatio || 1;
view.model = new KG.Model(parsedData);
// create scales
view.scales = parsedData.scales.map(function (def) {
def.model = view.model;
return new KG.Scale(def);
});
// create the div for the view
view.div = d3.select(div)
.style('position', 'relative');
// create the SVG element for the view
if (!parsedData.nosvg) {
view.svg = view.div.append('svg')
.style('overflow', 'visible')
.style('pointer-events', 'none');
}
view.addViewObjects(parsedData);
view.parsedData = parsedData;
console.log('parsedData: ', parsedData);
};
// add view information (model, layer, scales) to an object
View.prototype.addViewToDef = function (def, layer) {
var view = this;
function getScale(name) {
var result = null;
view.scales.forEach(function (scale) {
if (scale.name == name) {
result = scale;
}
});
return result;
}
def.model = view.model;
def.layer = layer;
def.xScale = getScale(def['xScaleName']);
def.yScale = getScale(def['yScaleName']);
if (def.hasOwnProperty('xScale2Name')) {
def.xScale2 = getScale(def['xScale2Name']);
def.yScale2 = getScale(def['yScale2Name']);
}
return def;
};
// create view objects
View.prototype.addViewObjects = function (data) {
var view = this;
var defURLS = {};
if (view.svg) {
var defLayer_1 = view.svg.append('defs');
// create ClipPaths, generate their URLs, and add their paths to the SVG defs element.
if (data.clipPaths.length > 0) {
data.clipPaths.forEach(function (def) {
var clipPathURL = KG.randomString(10);
var clipPathLayer = defLayer_1.append('clipPath').attr('id', clipPathURL);
def.paths.forEach(function (td) {
td.def.inDef = true;
new KG[td.type](view.addViewToDef(td.def, clipPathLayer));
});
defURLS[def.name] = clipPathURL;
});
}
// create Markers, generate their URLs, and add their paths to the SVG defs element.
if (data.markers.length > 0) {
data.markers.forEach(function (def) {
var markerURL = KG.randomString(10);
def.url = markerURL;
defURLS[def.name] = markerURL;
var markerLayer = defLayer_1.append('marker')
.attr('id', markerURL)
.attr("refX", def.refX)
.attr("refY", 6)
.attr("markerWidth", 13)
.attr("markerHeight", 13)
.attr("orient", "auto")
.attr("markerUnits", "userSpaceOnUse");
view.addViewToDef(def, markerLayer);
new KG.Marker(def);
});
}
// add layers of objects
data.layers.forEach(function (layerTds) {
if (layerTds.length > 0) {
var layer_1 = view.svg.append('g');
layerTds.forEach(function (td) {
var def = td.def;
if (def.hasOwnProperty('clipPathName')) {
def.clipPath = defURLS[def['clipPathName']];
}
if (def.hasOwnProperty('clipPathName2')) {
def.clipPath2 = defURLS[def['clipPathName2']];
}
if (def.hasOwnProperty('startArrowName')) {
def.startArrow = defURLS[def['startArrowName']];
}
if (def.hasOwnProperty('endArrowName')) {
def.endArrow = defURLS[def['endArrowName']];
}
def = view.addViewToDef(def, layer_1);
new KG[td.type](def);
});
}
});
}
// add divs
if (data.divs.length > 0) {
data.divs.forEach(function (td) {
var def = view.addViewToDef(td.def, view.div), newDiv = new KG[td.type](def);
if (td.type == 'Sidebar') {
view.sidebar = newDiv;
}
});
}
view.updateDimensions();
};
// update dimensions, either when first rendering or when the window is resized
View.prototype.updateDimensions = function () {
var view = this;
// read the client width of the enclosing div and calculate the height using the aspectRatio
var width = view.div.node().clientWidth;
if (view.sidebar) {
if (width > view.sidebar.triggerWidth) {
view.sidebar.positionRight(width);
width = width * 77 / 126; // make width of graph the same width as main Tufte column
}
else {
view.sidebar.positionBelow();
}
}
var height = width / view.aspectRatio;
// set the height of the div
view.div.style.height = height + 'px';
if (view.svg) {
// set the dimensions of the svg
view.svg.style('width', width);
view.svg.style('height', height);
}
// adjust all of the scales to be proportional to the new dimensions
view.scales.forEach(function (scale) {
scale.updateDimensions(width, height);
});
// once the scales are updated, update the coordinates of all view objects
view.model.update(true);
};
return View;
}());
KG.View = View;
})(KG || (KG = {}));
/// <reference path="../kg.ts" />
var KG;
(function (KG) {
var Scale = /** @class */ (function (_super) {
__extends(Scale, _super);
function Scale(def) {
var _this = this;
KG.setDefaults(def, {
log: false
});
def.constants = ['rangeMin', 'rangeMax', 'axis', 'name'];
def.updatables = ['domainMin', 'domainMax'];
_this = _super.call(this, def) || this;
_this.scale = def.log ? d3.scaleLog() : d3.scaleLinear();
_this.update(true);
return _this;
}
Scale.prototype.update = function (force) {
var s = _super.prototype.update.call(this, force);
if (s.extent != undefined) {
var rangeMin = s.rangeMin * s.extent, rangeMax = s.rangeMax * s.extent;
s.scale.domain([s.domainMin, s.domainMax]);
s.scale.range([rangeMin, rangeMax]);
}
return s;
};
Scale.prototype.updateDimensions = function (width, height) {
var s = this;
s.extent = (s.axis == 'x') ? width : height;
return s.update(true);
};
return Scale;
}(KG.UpdateListener));
KG.Scale = Scale;
})(KG || (KG = {}));
/// <reference path="../../kg.ts" />
var KG;
(function (KG) {
var ViewObject = /** @class */ (function (_super) {
__extends(ViewObject, _super);
function ViewObject(def) {
var _this = this;
KG.setDefaults(def, {
alwaysUpdate: false,
interactive: true,
fill: 'colors.blue',
fillOpacity: 0.2,
stroke: 'colors.blue',
strokeWidth: 1,
stokeOpacity: 1,
show: true,
inDef: false,
lineStyle: 'solid'
});
KG.setProperties(def, 'updatables', ['fill', 'stroke', 'strokeWidth', 'opacity', 'strokeOpacity', 'show', 'lineStyle']);
KG.setProperties(def, 'constants', ['xScale', 'yScale', 'clipPath', 'clipPath2', 'interactive', 'alwaysUpdate', 'inDef']);
KG.setProperties(def, 'colorAttributes', ['stroke', 'fill', 'color']);
if (def.inDef) {
def.show = true;
}
;
_this = _super.call(this, def) || this;
var vo = _this;
def.colorAttributes.forEach(function (attr) {
var c = def[attr];
if (vo.model.colors.hasOwnProperty(c)) {
def[attr] = vo.model.colors[c];
}
});
// the interaction handler manages drag and hover events
if (def.interactive) {
def.drag = def.drag || [];
var dragListeners = def.drag.map(function (dragDef) {
dragDef.model = vo.model;
return new KG.DragListener(dragDef);
});
def.click = def.click || [];
var clickListeners = def.click.map(function (clickDef) {
clickDef.model = vo.model;
return new KG.ClickListener(clickDef);
});
vo.interactionHandler = new KG.InteractionHandler({
viewObject: vo,
model: vo.model,
dragListeners: dragListeners,
clickListeners: clickListeners
});
}
// the draw method creates the DOM elements for the view object
// the update method updates their attributes
if (def.hasOwnProperty('layer')) {
vo.draw(def.layer).update(true).init();
}
return _this;
}
ViewObject.prototype.init = function () {
return this; //defined at subclass level
};
ViewObject.prototype.addClipPathAndArrows = function () {
var vo = this;
if (vo.hasOwnProperty('clipPath') && vo.clipPath != undefined) {
vo.rootElement.attr('clip-path', "url(#" + vo.clipPath + ")");
}
if (vo.hasOwnProperty('clipPath2') && vo.clipPath2 != undefined) {
vo.rootElement2.attr('clip-path', "url(#" + vo.clipPath2 + ")");
}
if (vo.hasOwnProperty('endArrow') && vo.endArrow != undefined) {
vo.markedElement.attr("marker-end", "url(#" + vo.endArrow + ")");
}
if (vo.hasOwnProperty('startArrow') && vo.endArrow != undefined) {
vo.markedElement.attr("marker-start", "url(#" + vo.startArrow + ")");
}
return vo;
};
ViewObject.prototype.addInteraction = function () {
var vo = this;
vo.interactionHandler.addTrigger(vo.rootElement);
return vo;
};
ViewObject.prototype.draw = function (layer, inDef) {
return this;
};
ViewObject.prototype.redraw = function () {
return this;
};
ViewObject.prototype.drawStroke = function (el) {
var vo = this;
el.attr('stroke', vo.stroke);
el.attr('stroke-width', vo.strokeWidth);
el.style('stroke-opacity', vo.strokeOpacity);
if (vo.lineStyle == 'dashed') {
el.style('stroke-dashArray', '10,10');
}
if (vo.lineStyle == 'dotted') {
el.style('stroke-dashArray', '1,2');
}
};
ViewObject.prototype.drawFill = function (el) {
var vo = this;
el.style('fill', vo.fill);
el.style('fill-opacity', vo.opacity);
};
ViewObject.prototype.displayElement = function (show) {
var vo = this;
if (vo.hasOwnProperty('rootElement')) {
vo.rootElement.style('display', show ? null : 'none');
}
};
ViewObject.prototype.onGraph = function () {
var vo = this;
if (vo.hasOwnProperty('x')) {
if (vo.x < vo.xScale.domainMin || vo.x > vo.xScale.domainMax) {
return false;
}
}
if (vo.hasOwnProperty('y')) {
if (vo.y < vo.yScale.domainMin || vo.y > vo.yScale.domainMax) {
return false;
}
}
return true;
};
ViewObject.prototype.update = function (force) {
var vo = _super.prototype.update.call(this, force);
if ((vo.show && vo.onGraph()) || vo.inDef) {
vo.displayElement(true);
if (vo.hasChanged) {
vo.redraw();
}
}
else {
vo.displayElement(false);
}
return vo;
};
return ViewObject;
}(KG.UpdateListener));
KG.ViewObject = ViewObject;
})(KG || (KG = {}));
var KG;
(function (KG) {
var Marker = /** @class */ (function (_super) {
__extends(Marker, _super);
function Marker(def) {
var _this = this;
KG.setProperties(def, 'constants', ['maskPath', 'arrowPath']);
KG.setProperties(def, 'updatables', ['color']);
_this = _super.call(this, def) || this;
return _this;
}
Marker.prototype.draw = function (layer) {
var m = this;
layer.append("svg:path")
.attr("d", m.maskPath)
.attr("fill", "white");
m.arrowElement = layer.append("svg:path")
.attr("d", m.arrowPath);
return m;
};
Marker.prototype.redraw = function () {
var m = this;
m.arrowElement.attr("fill", m.color);
return m;
};
return Marker;
}(KG.ViewObject));
KG.Marker = Marker;
})(KG || (KG = {}));
/// <reference path="../../kg.ts" />
var KG;
(function (KG) {
var Segment = /** @class */ (function (_super) {
__extends(Segment, _super);
function Segment(def) {
var _this = this;
KG.setDefaults(def, {
xScale2: def.xScale,
yScale2: def.yScale,
strokeWidth: 2
});
KG.setProperties(def, 'constants', ['xScale2', 'yScale2', 'startArrow', 'endArrow']);
KG.setProperties(def, 'updatables', ['x1', 'y1', 'x2', 'y2']);
_this = _super.call(this, def) || this;
return _this;
}
// create SVG elements
Segment.prototype.draw = function (layer) {
var segment = this;
segment.rootElement = layer.append('g');
segment.dragLine = segment.rootElement.append('line').attr('stroke-width', '20px').style('stroke-opacity', 0);
segment.line = segment.rootElement.append('line');
segment.markedElement = segment.line;
return segment.addClipPathAndArrows().addInteraction();
};
// update properties
Segment.prototype.redraw = function () {
var segment = this;
var x1 = segment.xScale.scale(segment.x1), x2 = segment.xScale.scale(segment.x2), y1 = segment.yScale2.scale(segment.y1), y2 = segment.yScale2.scale(segment.y2);
segment.dragLine
.attr("x1", x1)
.attr("y1", y1)
.attr("x2", x2)
.attr("y2", y2);
segment.line
.attr("x1", x1)
.attr("y1", y1)
.attr("x2", x2)
.attr("y2", y2);
segment.drawStroke(segment.line);
return segment;
};
return Segment;
}(KG.ViewObject));
KG.Segment = Segment;
})(KG || (KG = {}));
/// <reference path='../../kg.ts' />
var KG;
(function (KG) {
var Curve = /** @class */ (function (_super) {
__extends(Curve, _super);
function Curve(def) {
var _this = this;
var univariateFunction, parametricFunction;
KG.setDefaults(def, {
interpolation: 'curveBasis',
strokeWidth: 2
});
KG.setProperties(def, 'constants', ['interpolation']);
if (def.hasOwnProperty('univariateFunction')) {
def.univariateFunction.model = def.model;
univariateFunction = new KG.UnivariateFunction(def.univariateFunction);
KG.setProperties(def, 'updatables', []);
}
else if (def.hasOwnProperty('parametricFunction')) {
def.parametricFunction.model = def.model;
parametricFunction = new KG.ParametricFunction(def.parametricFunction);
KG.setProperties(def, 'updatables', []);
}
_this = _super.call(this, def) || this;
var curve = _this;
if (def.hasOwnProperty('univariateFunction')) {
curve.univariateFunction = univariateFunction;
}
else if (def.hasOwnProperty('parametricFunction')) {
def.parametricFunction.model = def.model;
curve.parametricFunction = parametricFunction;
}
return _this;
}
// create SVG elements
Curve.prototype.draw = function (layer) {
var curve = this;
curve.dataLine = d3.line()
.curve(d3[curve.interpolation])
.x(function (d) {
return curve.xScale.scale(d.x);
})
.y(function (d) {
return curve.yScale.scale(d.y);
});
curve.rootElement = layer.append('g');
curve.dragPath = curve.rootElement.append('path').attr('stroke-width', '20px').style('stroke-opacity', 0).style('fill', 'none');
curve.path = curve.rootElement.append('path').style('fill', 'none');
return curve.addClipPathAndArrows().addInteraction();
};
// update properties
Curve.prototype.redraw = function () {
var curve = this;
if (curve.hasOwnProperty('univariateFunction')) {
var fn = curve.univariateFunction, scale = fn.ind == 'y' ? curve.yScale : curve.xScale;
fn.generateData(scale.domainMin, scale.domainMax);
curve.dragPath.data([fn.data]).attr('d', curve.dataLine);
curve.path.data([fn.data]).attr('d', curve.dataLine);
}
if (curve.hasOwnProperty('parametricFunction')) {
var fn = curve.parametricFunction;
fn.generateData();
curve.dragPath.data([fn.data]).attr('d', curve.dataLine);
curve.path.data([fn.data]).attr('d', curve.dataLine);
}
curve.drawStroke(curve.path);
return curve;
};
// update self and functions
Curve.prototype.update = function (force) {
var curve = _super.prototype.update.call(this, force);
if (!curve.hasChanged) {
if (curve.hasOwnProperty('univariateFunction')) {
if (curve.univariateFunction.hasChanged) {
curve.redraw();
}
}
if (curve.hasOwnProperty('parametricFunction')) {
if (curve.parametricFunction.hasChanged) {
curve.redraw();
}
}
}
return curve;
};
return Curve;
}(KG.ViewObject));
KG.Curve = Curve;
})(KG || (KG = {}));
var KG;
(function (KG) {
var Axis = /** @class */ (function (_super) {
__extends(Axis, _super);
function Axis(def) {
var _this = this;
KG.setDefaults(def, {
ticks: 5,
intercept: 0
});
KG.setProperties(def, 'constants', ['orient']);
KG.setProperties(def, 'updatables', ['ticks', 'intercept', 'label', 'min', 'max', 'otherMin', 'otherMax']);
_this = _super.call(this, def) || this;
return _this;
}
Axis.prototype.draw = function (layer) {
var a = this;
a.rootElement = layer.append('g').attr('class', 'axis');
return a;
};
Axis.prototype.redraw = function () {
var a = this;
switch (a.orient) {
case 'bottom':
a.rootElement.attr('transform', "translate(0, " + a.yScale.scale(a.intercept) + ")");
a.rootElement.call(d3.axisBottom(a.xScale.scale).ticks(a.ticks));
return a;
case 'left':
a.rootElement.attr('transform', "translate(" + a.xScale.scale(a.intercept) + ",0)");
a.rootElement.call(d3.axisLeft(a.yScale.scale).ticks(a.ticks));
return a;
case 'top':
a.rootElement.attr('transform', "translate(0, " + a.yScale.scale(a.intercept) + ")");
a.rootElement.call(d3.axisTop(a.xScale.scale).ticks(a.ticks));
return a;
case 'right':
a.rootElement.attr('transform', "translate(" + a.xScale.scale(a.intercept) + ",0)");
a.rootElement.call(d3.axisRight(a.yScale.scale).ticks(a.ticks));
return a;
}
return a;
};
return Axis;
}(KG.ViewObject));
KG.Axis = Axis;
})(KG || (KG = {}));
/// <reference path="../../kg.ts" />
var KG;
(function (KG) {
var Point = /** @class */ (function (_super) {
__extends(Point, _super);
function Point(def) {
var _this = this;
KG.setDefaults(def, {
fill: 'colors.blue',
opacity: 1,
stroke: 'white',
strokeWidth: 1,
strokeOpacity: 1,
r: 6
});
KG.setProperties(def, 'updatables', ['x', 'y', 'r']);
_this = _super.call(this, def) || this;
return _this;
}
// create SVG elements
Point.prototype.draw = function (layer) {
var p = this;
p.rootElement = layer.append('g'); // SVG group
p.dragCircle = p.rootElement.append('circle').style('fill-opacity', 0).attr('r', 20);
p.circle = p.rootElement.append('circle');
//p.addClipPathAndArrows()
return p.addInteraction();
};
// update properties
Point.prototype.redraw = function () {
var p = this;
p.rootElement.attr('transform', "translate(" + p.xScale.scale(p.x) + " " + p.yScale.scale(p.y) + ")");
p.circle.attr('r', p.r);
p.circle.style('fill', p.fill);
p.circle.style('fill-opacity', p.opacity);
p.circle.style('stroke', p.stroke);
p.circle.style('stroke-width', p.strokeWidth + "px");
p.circle.style('stroke-opacity', p.strokeOpacity);
return p;
};
return Point;
}(KG.ViewObject));
KG.Point = Point;
})(KG || (KG = {}));
/// <reference path="../../kg.ts" />
var KG;
(function (KG) {
var Ellipse = /** @class */ (function (_super) {
__extends(Ellipse, _super);
function Ellipse(def) {
var _this = this;
KG.setDefaults(def, {
fill: 'colors.blue',
opacity: 1,
stroke: 'colors.blue',
strokeWidth: 1,
strokeOpacity: 1,
rx: 1,
ry: 1
});
KG.setProperties(def, 'updatables', ['x', 'y', 'rx', 'ry']);
_this = _super.call(this, def) || this;
return _this;
}
// create SVG elements
Ellipse.prototype.draw = function (layer) {
var c = this;
c.rootElement = layer.append('ellipse');
return c.addClipPathAndArrows().addInteraction();
};
// update properties
Ellipse.prototype.redraw = function () {
var c = this;
c.rootElement.attr('cx', c.xScale.scale(c.x));
c.rootElement.attr('cy', c.yScale.scale(c.y));
c.rootElement.attr('rx', Math.abs(c.xScale.scale(c.rx) - c.xScale.scale(0)));
c.rootElement.attr('ry', Math.abs(c.yScale.scale(c.ry) - c.yScale.scale(0)));
c.drawFill(c.rootElement);
c.drawStroke(c.rootElement);
return c;
};
return Ellipse;
}(KG.ViewObject));
KG.Ellipse = Ellipse;
var Circle = /** @class */ (function (_super) {
__extends(Circle, _super);
function Circle(def) {
return _super.call(this, def) || this;
}
return Circle;
}(Ellipse));
KG.Circle = Circle;
})(KG || (KG = {}));
/// <reference path="../../kg.ts" />
var KG;
(function (KG) {
var Rectangle = /** @class */ (function (_super) {
__extends(Rectangle, _super);
function Rectangle(def) {
var _this = this;
KG.setDefaults(def, {
opacity: 0.2,
stroke: "none"
});
KG.setProperties(def, 'updatables', ['x1', 'x2', 'y1', 'y2']);
_this = _super.call(this, def) || this;
return _this;
}
// create SVG elements
Rectangle.prototype.draw = function (layer) {
var rect = this;
if (rect.inDef) {
rect.rootElement = layer;
}
else {
rect.rootElement = layer.append('g');
}
rect.rootElement2 = rect.rootElement.append('rect');
//rect.interactionHandler.addTrigger(rect.rootElement);
return rect.addClipPathAndArrows().addInteraction();
};
// update properties
Rectangle.prototype.redraw = function () {
var rect = this;
var x1 = rect.xScale.scale(rect.x1);
var y1 = rect.yScale.scale(rect.y1);
var x2 = rect.xScale.scale(rect.x2);
var y2 = rect.yScale.scale(rect.y2);
rect.rootElement2
.attr('x', Math.min(x1, x2))
.attr('y', Math.min(y1, y2))
.attr('width', Math.abs(x2 - x1))
.attr('height', Math.abs(y2 - y1))
.style('fill', rect.fill)
.style('fill-opacity', rect.opacity)
.style('stroke', rect.stroke)
.style('stroke-width', rect.strokeWidth + "px")
.style('stroke-opacity', rect.strokeOpacity);
return rect;
};
return Rectangle;
}(KG.ViewObject));
KG.Rectangle = Rectangle;
})(KG || (KG = {}));
/// <reference path='../../kg.ts' />
var KG;
(function (KG) {
var Area = /** @class */ (function (_super) {
__extends(Area, _super);
function Area(def) {
var _this = this;
var minValue = def.univariateFunction1.ind == 'x' ? def.yScale.domainMin : def.xScale.domainMin;
var maxValue = def.univariateFunction1.ind == 'x' ? def.yScale.domainMax : def.xScale.domainMax;
KG.setDefaults(def, {
interpolation: 'curveBasis',
ind: 'x',
fill: 'lightsteelblue',
opacity: 0.2,
univariateFunction2: {
"fn": ((def.above && !def.useTopScale) || (!def.above && def.useTopScale)) ? maxValue : minValue,
"ind": def.univariateFunction1['ind'],
"min": def.univariateFunction1['min'],
"max": def.univariateFunction1['max'],
"samplePoints": def.univariateFunction1['samplePoints']
}
});
KG.setProperties(def, 'constants', ['interpolation']);
def.univariateFunction1.model = def.model;
def.univariateFunction2.model = def.model;
// need to initialize the functions before the area, so they exist when it's time to draw the area
var univariateFunction1 = new KG.UnivariateFunction(def.univariateFunction1), univariateFunction2 = new KG.UnivariateFunction(def.univariateFunction2);
_this = _super.call(this, def) || this;
_this.univariateFunction1 = univariateFunction1;
_this.univariateFunction2 = univariateFunction2;
return _this;
}
// create SVG elements
Area.prototype.draw = function (layer) {
var ab = this;
ab.rootElement = layer.append('path');
ab.areaShape = d3.area()
.x0(function (d) {
return ab.xScale.scale(d[0].x);
})
.y0(function (d) {
return ab.yScale.scale(d[0].y);
})
.x1(function (d) {
return ab.xScale.scale(d[1].x);
})
.y1(function (d) {
return ab.yScale.scale(d[1].y);
});
ab.areaPath = ab.rootElement;
return ab.addClipPathAndArrows();
};
// update properties
Area.prototype.redraw = function () {
var area = this;
if (area.univariateFunction1 != undefined && area.univariateFunction2 != undefined) {
var fn1 = area.univariateFunction1, fn2 = area.univariateFunction2, scale = fn1.ind == 'y' ? area.yScale : area.xScale;
fn1.generateData(scale.domainMin, scale.domainMax);
fn2.generateData(scale.domainMin, scale.domainMax);
area.areaPath
.data([d3.zip(fn1.data, fn2.data)])
.attr('d', area.areaShape);
area.drawFill(area.areaPath);
}
else {
//console.log('area functions undefined')
}
return area;
};
// update self and functions
Area.prototype.update = function (force) {
var area = _super.prototype.update.call(this, force);
if (!area.hasChanged) {
if (area.univariateFunction1.hasChanged || area.univariateFunction2.hasChanged) {
area.redraw();
}
}
return area;
};
return Area;
}(KG.ViewObject));
KG.Area = Area;
})(KG || (KG = {}));
/// <reference path="../../kg.ts" />
var KG;
(function (KG) {
var GeoGebraObject = /** @class */ (function (_super) {
__extends(GeoGebraObject, _super);
function GeoGebraObject(def) {
var _this = this;
KG.setDefaults(def, {
color: '#999999',
lineThickness: 1,
lineStyle: 0
});
KG.setProperties(def, 'constants', ['command', 'color', 'lineThickness', 'lineStyle']);
_this = _super.call(this, def) || this;
return _this;
}
GeoGebraObject.prototype.establishGGB = function (applet) {
// from https://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb
function hexToRgb(hex) {
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result ? {
r: parseInt(result[1], 16),
g: parseInt(result[2], 16),
b: parseInt(result[3], 16)
} : null;
}
var obj = this;
//console.log('sending commands to applet', applet);
// set command
var command = obj.name + " = " + obj.command;
//console.log('sending command ', obj.name + " = " + obj.command);
applet.evalCommand(command);
if (obj.hasOwnProperty('opacity')) {
applet.setFilling(obj.opacity);
}
var color = hexToRgb(obj.color);
//console.log('sending command setColor(', obj.name, ', ', color.r, ',', color.g, ', ', color.b, ')');
applet.setColor(obj.name, color.r, color.g, color.b);
//console.log('sending command setLineThickness(', obj.name, ', ', obj.lineThickness, ')')
applet.evalCommand('SetLineThickness[' + obj.name + ', ' + obj.lineThickness + ']');
//console.log('sending command setLineStyle(', obj.name, ', ', obj.lineStyle, ')')
applet.setLineStyle(obj.name, obj.lineStyle);
};
return GeoGebraObject;
}(KG.ViewObject));
KG.GeoGebraObject = GeoGebraObject;
})(KG || (KG = {}));
/// <reference path='../../kg.ts' />
var KG;
(function (KG) {
var Contour = /** @class */ (function (_super) {
__extends(Contour, _super);
function Contour(def) {
var _this = this;
KG.setDefaults(def, {
opacity: 0.2,
stroke: "grey",
fillAbove: "none",
fillBelow: "none",
strokeOpacity: 1
});
KG.setProperties(def, 'colorAttributes', ['fillAbove', 'fillBelow']);
KG.setProperties(def, 'updatables', ['level', 'fillBelow', 'fillAbove']);
_this = _super.call(this, def) || this;
// used for shading area above
_this.fn = new KG.MultivariateFunction({
fn: def.fn,
model: def.model
}).update(true);
// used for shading area below
_this.negativeFn = new KG.MultivariateFunction({
fn: "-1*(" + def.fn + ")",
model: def.model
}).update(true);
return _this;
}
Contour.prototype.draw = function (layer) {
var c = this;
c.rootElement = layer.append('g');
c.negativePath = c.rootElement.append('path');
c.path = c.rootElement.append('path');
return c.addClipPathAndArrows();
};
Contour.prototype.redraw = function () {
var c = this;
if (undefined != c.fn) {
c.path.attr("d", c.fn.contour(c.level, c.xScale, c.yScale));
c.path.style('fill', c.fillAbove);
c.path.style('fill-opacity', c.opacity);
c.path.style('stroke', c.stroke);
c.path.style('stroke-width', c.strokeWidth);
c.path.style('stroke-opacity', c.strokeOpacity);
c.negativePath.attr("d", c.negativeFn.contour(-1 * c.level, c.xScale, c.yScale));
c.negativePath.style('fill', c.fillBelow);
c.negativePath.style('fill-opacity', c.opacity);
}
return c;
};
// update self and functions
Contour.prototype.update = function (force) {
var c = _super.prototype.update.call(this, force);
if (!c.hasChanged) {
if (c.fn.hasChanged) {
c.redraw();
}
}
return c;
};
return Contour;
}(KG.ViewObject));
KG.Contour = Contour;
var ContourMap = /** @class */ (function (_super) {
__extends(ContourMap, _super);
function ContourMap(def) {
return _super.call(this, def) || this;
}
return ContourMap;
}(KG.ViewObject));
KG.ContourMap = ContourMap;
})(KG || (KG = {}));
/// <reference path="../../kg.ts" />
var KG;
(function (KG) {
var DivObject = /** @class */ (function (_super) {
__extends(DivObject, _super);
function DivObject() {
return _super !== null && _super.apply(this, arguments) || this;
}
DivObject.prototype.redraw = function () {
var div = this;
var width = Math.abs(div.xScale.scale(1) - div.xScale.scale(0)), height = Math.abs(div.yScale.scale(1) - div.yScale.scale(0));
div.rootElement.style('left', div.xScale.scale(0) + 'px');
div.rootElement.style('top', div.yScale.scale(1) + 'px');
div.rootElement.style('width', width + 'px');
div.rootElement.style('height', height + 'px');
return div;
};
return DivObject;
}(KG.ViewObject));
KG.DivObject = DivObject;
})(KG || (KG = {}));
/// <reference path="../../kg.ts" />
var KG;
(function (KG) {
var PositionedDiv = /** @class */ (function (_super) {
__extends(PositionedDiv, _super);
function PositionedDiv() {
return _super !== null && _super.apply(this, arguments) || this;
}
PositionedDiv.prototype.draw = function (layer) {
var div = this;
div.rootElement = layer.append('div');
div.rootElement.style('position', 'absolute');
if (div.def.hasOwnProperty('children')) {
div.def['children'].forEach(function (child) {
child.def.layer = div.rootElement;
child.def.model = div.model;
new KG[child.type](child.def);
});
}
return div;
};
PositionedDiv.prototype.redraw = function () {
var div = this;
var width = Math.abs(div.xScale.scale(1) - div.xScale.scale(0)), height = Math.abs(div.yScale.scale(1) - div.yScale.scale(0));
div.rootElement.style('left', div.xScale.scale(0) + 'px');
div.rootElement.style('top', div.yScale.scale(1) + 'px');
div.rootElement.style('width', width + 'px');
div.rootElement.style('height', height + 'px');
return div;
};
return PositionedDiv;
}(KG.DivObject));
KG.PositionedDiv = PositionedDiv;
})(KG || (KG = {}));
/// <reference path="../../kg.ts" />
var KG;
(function (KG) {
var Div = /** @class */ (function (_super) {
__extends(Div, _super);
function Div(def) {
var _this = this;
//establish property defaults
KG.setDefaults(def, {
xPixelOffset: 0,
yPixelOffset: 0,
fontSize: 12
});
// define constant and updatable properties
KG.setProperties(def, 'constants', ['fontSize']);
KG.setProperties(def, 'updatables', ['html']);
_this = _super.call(this, def) || this;
return _this;
}
// create div for text
Div.prototype.draw = function (layer) {
var div = this;
div.rootElement = layer.append('div')
.style('font-size', div.fontSize + 'pt')
.style('padding-top', '10px')
.style('padding-bottom', '10px');
return div;
};
// update properties
Div.prototype.redraw = function () {
var div = this;
if (div.show) {
div.rootElement.html(div.html);
renderMathInElement(div.rootElement.node(), {
delimiters: [
{ left: "$$", right: "$$", display: true },
{ left: "\\[", right: "\\]", display: true },
{ left: "$", right: "$", display: false },
{ left: "\\(", right: "\\)", display: false }
]
});
}
else {
div.rootElement.html(null);
}
return div;
};
return Div;
}(KG.DivObject));
KG.Div = Div;
})(KG || (KG = {}));
/// <reference path="../../kg.ts" />
var KG;
(function (KG) {
var ParamControl = /** @class */ (function (_super) {
__extends(ParamControl, _super);
function ParamControl(def) {
var _this = this;
// establish property defaults
KG.setDefaults(def, {
value: 'params.' + def.param,
alwaysUpdate: true
});
// define constant and updatable properties
KG.setProperties(def, 'constants', ['param']);
KG.setProperties(def, 'updatables', ['label', 'value']);
_this = _super.call(this, def) || this;
return _this;
}
return ParamControl;
}(KG.DivObject));
KG.ParamControl = ParamControl;
})(KG || (KG = {}));
/// <reference path="../../kg.ts" />
var KG;
(function (KG) {
var Slider = /** @class */ (function (_super) {
__extends(Slider, _super);
function Slider(def) {
var _this = this;
// establish property defaults
KG.setDefaults(def, {
noAxis: false
});
// define constant and updatable properties
KG.setProperties(def, 'constants', ['noAxis']);
_this = _super.call(this, def) || this;
return _this;
}
Slider.prototype.draw = function (layer) {
var slider = this;
slider.rootElement = layer.append('tr');
var param = slider.model.getParam(slider.param);
slider.labelElement = slider.rootElement.append('td')
.style('font-size', '14pt')
.style('text-align', 'right');
function inputUpdate() {
slider.model.updateParam(slider.param, +this.value);
}
slider.numberInput = slider.rootElement.append('td').append('input')
.attr('type', 'number')
.attr('min', param.min)
.attr('max', param.max)
.attr('step', param.round)
.style('font-size', '14pt')
.style('border', 'none')
.style('background', 'none')
.style('padding-left', '5px')
.style('font-family', 'KaTeX_Main')
.style('width', '100%');
slider.numberInput.on("blur", inputUpdate);
slider.numberInput.on("click", inputUpdate);
slider.numberInput.on("keyup", function () {
if (event['keyCode'] == 13) {
slider.model.updateParam(slider.param, +this.value);
}
});
slider.rangeInput = slider.rootElement.append('td').append('input')
.attr('type', 'range')
.attr('min', param.min)
.attr('max', param.max)
.attr('step', param.round)
.style('width', '100%');
slider.rangeInput.on("input", inputUpdate);
return slider;
};
// update properties
Slider.prototype.redraw = function () {
var slider = this;
katex.render(slider.label + " = ", slider.labelElement.node());
slider.numberInput.property('value', slider.value.toFixed(slider.model.getParam(slider.param).precision));
slider.rangeInput.property('value', slider.value);
return slider;
};
return Slider;
}(KG.ParamControl));
KG.Slider = Slider;
})(KG || (KG = {}));
/// <reference path="../../kg.ts" />
var KG;
(function (KG) {
var Checkbox = /** @class */ (function (_super) {
__extends(Checkbox, _super);
function Checkbox() {
return _super !== null && _super.apply(this, arguments) || this;
}
Checkbox.prototype.draw = function (layer) {
var checkbox = this;
checkbox.rootElement = layer.append('div').append('label');
checkbox.inputElement = checkbox.rootElement.append('input');
checkbox.inputElement
.attr('type', 'checkbox');
checkbox.inputElement.on("change", function () {
checkbox.model.toggleParam(checkbox.param);
});
checkbox.labelElement = checkbox.rootElement.append('span');
checkbox.labelElement.style('padding-left', '10px');
return checkbox;
};
Checkbox.prototype.redraw = function () {
var checkbox = this;
checkbox.inputElement.property('checked', Boolean(checkbox.value));
katex.render(checkbox.label, checkbox.labelElement.node());
return checkbox;
};
return Checkbox;
}(KG.ParamControl));
KG.Checkbox = Checkbox;
})(KG || (KG = {}));
/// <reference path="../../kg.ts" />
var KG;
(function (KG) {
var Radio = /** @class */ (function (_super) {
__extends(Radio, _super);
function Radio(def) {
var _this = this;
KG.setProperties(def, 'updatables', ['optionValue']);
_this = _super.call(this, def) || this;
return _this;
}
Radio.prototype.draw = function (layer) {
var radio = this;
radio.rootElement = layer.append('div').append('label');
radio.inputElement = radio.rootElement.append('input');
radio.inputElement
.attr('type', 'radio')
.attr('name', 'r_' + radio.param)
.attr('value', radio.optionValue);
radio.inputElement.on("change", function () {
radio.model.updateParam(radio.param, radio.optionValue);
});
radio.labelElement = radio.rootElement.append('span');
radio.labelElement.style('padding-left', '10px');
return radio;
};
Radio.prototype.redraw = function () {
var radio = this;
radio.inputElement.property('checked', radio.value == radio.optionValue);
katex.render(radio.label, radio.labelElement.node());
return radio;
};
return Radio;
}(KG.ParamControl));
KG.Radio = Radio;
})(KG || (KG = {}));
/// <reference path="../../kg.ts" />
var KG;
(function (KG) {
var Controls = /** @class */ (function (_super) {
__extends(Controls, _super);
function Controls(def) {
var _this = this;
KG.setDefaults(def, {
title: '',
description: '',
sliders: [],
checkboxes: [],
radios: [],
divs: []
});
KG.setProperties(def, 'constants', ['sliders', 'checkboxes', 'radios', 'divs']);
KG.setProperties(def, 'updatables', ['title', 'description']);
_this = _super.call(this, def) || this;
return _this;
}
// create div for text
Controls.prototype.draw = function (layer) {
var controls = this;
controls.rootElement = layer.append('div');
controls.titleElement = controls.rootElement.append('p').style('width', '100%').style('font-size', '10pt').style('margin-bottom', 10);
controls.rootElement.append('hr');
controls.descriptionElement = controls.rootElement.append('div');
var sliderTable = controls.rootElement.append('table').style('padding', '10px').style('width', '100%');
controls.sliders.forEach(function (slider) {
new KG.Slider({ layer: sliderTable, param: slider.param, label: slider.label, model: controls.model });
});
controls.checkboxes.forEach(function (checkbox) {
checkbox = KG.setDefaults(checkbox, {
layer: controls.rootElement,
model: controls.model
});
new KG.Checkbox(checkbox);
});
controls.radios.forEach(function (radio) {
radio = KG.setDefaults(radio, {
layer: controls.rootElement,
model: controls.model
});
new KG.Radio(radio);
});
controls.divs.forEach(function (div) {
div = KG.setDefaults(div, {
layer: controls.rootElement,
model: controls.model,
fontSize: 14
});
new KG.Div(div);
});
return controls;
};
// update properties
Controls.prototype.redraw = function () {
var controls = this;
if (controls.title.length > 0) {
controls.titleElement.text(controls.title.toUpperCase());
}
controls.descriptionElement.text(controls.description);
return controls;
};
return Controls;
}(KG.DivObject));
KG.Controls = Controls;
})(KG || (KG = {}));
/// <reference path="../../kg.ts" />
var KG;
(function (KG) {
var GameMatrix = /** @class */ (function (_super) {
__extends(GameMatrix, _super);
function GameMatrix(def) {
var _this = this;
KG.setDefaults(def, {
players: ["Player 1", "Player 2"]
});
KG.setProperties(def, 'constants', ['players', 'strategies']);
KG.setProperties(def, 'updatables', ['payoffs']);
_this = _super.call(this, def) || this;
return _this;
}
// create div for text
GameMatrix.prototype.draw = function (layer) {
var gameMatrix = this;
var numStrategies1 = gameMatrix.strategies[0].length, numStrategies2 = gameMatrix.strategies[1].length;
gameMatrix.rootElement = layer.append('div');
var table = gameMatrix.rootElement.append('table').attr('class', 'gameMatrix');
var topRow = table.append('tr');
topRow.append('td').attr('colspan', '2').attr('class', 'empty');
topRow.append('td')
.attr('colspan', numStrategies2 * 2)
.attr('class', 'player2 strategy empty')
.text(gameMatrix.players[1]);
var secondRow = table.append('tr');
secondRow.append('td').attr('colspan', '2').attr('class', 'empty');
gameMatrix.strategies[1].forEach(function (s) {
secondRow.append('td').attr('colspan', '2').attr('class', 'player2 strategy').text(s);
});
gameMatrix.payoffNodes = [];
for (var i = 0; i < numStrategies1; i++) {
var row = table.append('tr');
var payoffRow = [];
if (i == 0) {
row.append('td')
.attr('rowSpan', numStrategies1)
.attr('class', 'player1 strategy empty')
.text(gameMatrix.players[0]);
}
row.append('td').text(gameMatrix.strategies[0][i]).attr('class', 'player1 strategy');
for (var j = 0; j < numStrategies2; j++) {
var payoff1 = row.append('td').attr('class', 'player1 payoff');
var payoff2 = row.append('td').attr('class', 'player2 payoff');
payoffRow.push([payoff1, payoff2]);
}
gameMatrix.payoffNodes.push(payoffRow);
}
return gameMatrix;
};
GameMatrix.prototype.redraw = function () {
var gameMatrix = this;
var strategies1 = gameMatrix.strategies[0], strategies2 = gameMatrix.strategies[1];
var numStrategies1 = strategies1.length, numStrategies2 = strategies2.length;
for (var i = 0; i < numStrategies1; i++) {
for (var j = 0; j < numStrategies2; j++) {
var cell = gameMatrix.payoffNodes[i][j];
katex.render(gameMatrix.payoffs[i][j][0].toString(), cell[0].node());
katex.render(gameMatrix.payoffs[i][j][1].toString(), cell[1].node());
}
}
return gameMatrix;
};
return GameMatrix;
}(KG.DivObject));
KG.GameMatrix = GameMatrix;
})(KG || (KG = {}));
/// <reference path="../../kg.ts" />
var KG;
(function (KG) {
var GeoGebraApplet = /** @class */ (function (_super) {
__extends(GeoGebraApplet, _super);
function GeoGebraApplet(def) {
var _this = this;
KG.setDefaults(def, {
params: [],
objects: [],
axisLabels: []
});
def.params.forEach(function (param) {
def[param] = 'params.' + param;
});
KG.setProperties(def, 'updatables', def.params);
KG.setProperties(def, 'constants', ['axes', 'params']);
_this = _super.call(this, def) || this;
var div = _this;
div.objects = def.objects.map(function (objDef) {
objDef.model = def.model;
return new KG.GeoGebraObject(objDef);
});
//console.log('created GGB javascript object ', this)
div.axesEstablished = false;
return _this;
}
// create div for text
GeoGebraApplet.prototype.draw = function (layer) {
var div = _super.prototype.draw.call(this, layer);
var id = KG.randomString(10);
div.rootElement.append('div').attr('id', id);
var applet = new GGBApplet({
allowStyleBar: true,
perspective: "T",
borderColor: "#FFFFFF",
dataParamId: id
}, true);
applet.setHTML5Codebase('../../../../GeoGebra/HTML5/5.0/web3d/');
applet.inject(id);
return div;
};
GeoGebraApplet.prototype.establishGGB = function (width, height) {
var div = this;
//console.log('called establishGGB');
if (undefined != document['ggbApplet']) {
//console.log('applet exists');
div.applet = document['ggbApplet'];
div.params.forEach(function (p) {
var establishParamCommand = p + " = " + div.model.currentParamValues[p];
//console.log('setting param using command ', establishParamCommand);
div.applet.evalCommand(establishParamCommand);
});
div.objects.forEach(function (obj) {
obj.establishGGB(div.applet);
});
div.updateGGB(div.applet, width, height);
}
else {
//console.log('applet does not exist')
}
};
GeoGebraApplet.prototype.updateGGB = function (applet, width, height) {
var div = this;
console.log('called updateGGB');
if (undefined != applet) {
//console.log('applet exists');
//console.log('setting width to ', width);
applet.setWidth(width);
//console.log('setting height to ', height);
applet.setHeight(height);
if (div.axes.length == 3) {
//console.log('setting coordinate system ', div.axes[0].min, div.axes[0].max, div.axes[1].min, div.axes[1].max, div.axes[2].min, div.axes[2].max)
applet.setCoordSystem(div.axes[0].min, div.axes[0].max, div.axes[1].min, div.axes[1].max, div.axes[2].min, div.axes[2].max);
//console.log('setting axis steps ', div.axes[0].step, div.axes[1].step, div.axes[2].step);
applet.setAxisSteps(3, div.axes[0].step, div.axes[1].step, div.axes[2].step);
//console.log('setting axis labels ', div.axes[0].label, div.axes[1].label, div.axes[2].label);
applet.setAxisLabels(3, div.axes[0].label, div.axes[1].label, div.axes[2].label);
applet.setColor('xAxis', 0, 0, 0);
applet.setColor('yAxis', 0, 0, 0);
applet.setColor('zAxis', 0, 0, 0);
}
else {
applet.setCoordSystem(div.axes[0].scale.domainMin, div.axes[0].scale.domainMax, div.axes[1].scale.domainMin, div.axes[1].scale.domainMax);
applet.setAxisSteps(2, div.axes[0].step, div.axes[1].step);
applet.setAxisLabels(2, div.axes[0].label, div.axes[1].label);
applet.setColor('xAxis', 0, 0, 0);
applet.setColor('yAxis', 0, 0, 0);
}
if (div.hasOwnProperty('params')) {
div.params.forEach(function (param) {
applet.setValue(param, div[param]);
});
}
}
else {
//console.log('applet does not exist')
}
};
// update properties
GeoGebraApplet.prototype.redraw = function () {
var div = _super.prototype.redraw.call(this);
var width = Math.abs(div.xScale.scale(1) - div.xScale.scale(0)), height = Math.abs(div.yScale.scale(1) - div.yScale.scale(0));
var checkExist = setInterval(function () {
if (undefined != div.applet) {
div.updateGGB(div.applet, width, height);
clearInterval(checkExist);
}
else {
div.establishGGB(width, height);
}
}, 100); // check every 100ms
return div;
};
return GeoGebraApplet;
}(KG.PositionedDiv));
KG.GeoGebraApplet = GeoGebraApplet;
})(KG || (KG = {}));
/// <reference path="../../kg.ts" />
var KG;
(function (KG) {
var Mathbox = /** @class */ (function (_super) {
__extends(Mathbox, _super);
function Mathbox(def) {
var _this = this;
KG.setDefaults(def, {
objects: []
});
_this = _super.call(this, def) || this;
var mb = _this;
mb.objectDefs = def.objects;
mb.objects = [];
mb.objectDefs.forEach(function (td) {
td.def.mathbox = mb;
td.def.model = mb.model;
mb.objects.push(new KG[td.type](td.def));
});
console.log('created mathbox', mb);
return _this;
}
Mathbox.prototype.initMathbox = function () {
var mb = this;
mb.mathbox = mathBox({
plugins: ['core', 'controls', 'cursor', 'mathbox'],
controls: { klass: THREE.OrbitControls },
element: mb.rootElement.node()
});
if (mb.mathbox.fallback)
throw "WebGL not supported";
mb.three = mb.mathbox.three;
mb.three.renderer.setClearColor(new THREE.Color(0xFFFFFF), 1.0);
mb.mathbox.camera({ proxy: true, position: [-3, 1, 1], eulerOrder: "yzx" });
mb.mathboxView = mb.mathbox.cartesian({ scale: [0.9, 0.9, 0.9] });
mb.mathboxView.grid({ axes: [1, 3], width: 2, divideX: 10, divideY: 10, opacity: 0.3 });
mb.xAxis.redraw();
mb.yAxis.redraw();
mb.zAxis.redraw();
mb.objects.forEach(function (o) { o.draw().update(); });
return mb;
};
// create mb for mathbox
Mathbox.prototype.draw = function (layer) {
console.log('creating mathbox container');
var mb = this;
mb.rootElement = layer.append('div').style('position', 'absolute');
return mb;
};
Mathbox.prototype.redraw = function () {
var mb = _super.prototype.redraw.call(this);
console.log('called redraw');
if (mb.mathbox == undefined && mb.rootElement.node().clientWidth > 10 && mb.zAxis != undefined) {
mb.initMathbox();
}
else {
return mb;
}
return mb;
};
return Mathbox;
}(KG.PositionedDiv));
KG.Mathbox = Mathbox;
})(KG || (KG = {}));
/// <reference path="../../kg.ts" />
var KG;
(function (KG) {
var Sidebar = /** @class */ (function (_super) {
__extends(Sidebar, _super);
function Sidebar(def) {
var _this = this;
KG.setDefaults(def, {
controls: [],
triggerWidth: 563
});
KG.setProperties(def, 'constants', ['controls', 'triggerWidth']);
_this = _super.call(this, def) || this;
return _this;
}
Sidebar.prototype.positionRight = function (width) {
var sidebar = this;
sidebar.rootElement
.style('position', 'absolute')
.style('left', width * 847 / 1260 + 'px')
.style('top', '0px')
.style('width', width * 385 / 1260 + 'px');
};
Sidebar.prototype.positionBelow = function () {
var sidebar = this;
sidebar.rootElement
.style('position', null)
.style('left', null)
.style('width', null)
.style('padding-top', '40px');
};
Sidebar.prototype.draw = function (layer) {
var sidebar = this;
sidebar.rootElement = layer.append('div').style('position', 'absolute');
sidebar.controls.forEach(function (controlsDef) {
controlsDef.layer = sidebar.rootElement;
controlsDef.model = sidebar.model;
new KG.Controls(controlsDef);
});
return sidebar;
};
return Sidebar;
}(KG.ViewObject));
KG.Sidebar = Sidebar;
})(KG || (KG = {}));
/// <reference path="../../kg.ts" />
var KG;
(function (KG) {
var Label = /** @class */ (function (_super) {
__extends(Label, _super);
function Label(def) {
var _this = this;
var xAxisReversed = (def.xScale.rangeMin > def.xScale.rangeMax), yAxisReversed = (def.yScale.rangeMin < def.yScale.rangeMax);
var xOffset = xAxisReversed ? 3 : -3, yOffset = yAxisReversed ? 14 : -14;
if (def.x == 'AXIS') {
def.x = 0;
def.align = xAxisReversed ? 'left' : 'right';
def.xPixelOffset = xOffset;
}
if (def.x == 'OPPAXIS') {
def.x = def.xScale.domainMax;
def.align = xAxisReversed ? 'right' : 'left';
def.xPixelOffset = -xOffset;
}
if (def.y == 'AXIS') {
def.y = 0;
def.yPixelOffset = yOffset;
}
if (def.y == 'OPPAXIS') {
def.y = def.yScale.domainMax;
def.yPixelOffset = -yOffset;
}
//establish property defaults
KG.setDefaults(def, {
xPixelOffset: 0,
yPixelOffset: 0,
fontSize: 12,
align: 'center',
valign: 'middle',
rotate: 0,
color: 'black',
bgcolor: 'white'
});
// define constant and updatable properties
KG.setProperties(def, 'constants', ['xPixelOffset', 'yPixelOffset', 'fontSize']);
KG.setProperties(def, 'updatables', ['x', 'y', 'text', 'align', 'valign', 'rotate', 'color', 'bgcolor']);
_this = _super.call(this, def) || this;
return _this;
}
// create div for text
Label.prototype.draw = function (layer) {
var label = this;
label.rootElement = layer.append('div')
.attr('class', 'draggable')
.style('position', 'absolute')
.style('font-size', label.fontSize + 'pt')
.style('text-align', 'center')
.style('padding-left', '3px')
.style('padding-right', '3px');
return label.addInteraction();
};
// update properties
Label.prototype.redraw = function () {
var label = this;
label.rootElement.style('color', label.color).style('background-color', label.bgcolor);
var x = label.xScale.scale(label.x) + (+label.xPixelOffset), y = label.yScale.scale(label.y) - (+label.yPixelOffset);
if (undefined != label.text) {
//console.log('drawing label with text ',label.text);
try {
katex.render(label.text.toString(), label.rootElement.node());
}
catch (e) {
console.log("Error rendering KaTeX: ", label.text);
}
}
label.rootElement.style('left', x + 'px');
label.rootElement.style('top', y + 'px');
var width = label.rootElement.node().clientWidth, height = label.rootElement.node().clientHeight;
// Set left pixel margin; default to centered on x coordinate
var alignDelta = width * 0.5;
if (label.align == 'left') {
alignDelta = 0;
}
else if (label.align == 'right') {
// move left by half the width of the div if right aligned
alignDelta = width;
}
label.rootElement.style('left', (x - alignDelta) + 'px');
// Set top pixel margin; default to centered on y coordinate
var vAlignDelta = height * 0.5;
// Default to centered on x coordinate
if (label.valign == 'top') {
vAlignDelta = 0;
}
else if (label.valign == 'bottom') {
vAlignDelta = height;
}
label.rootElement.style('top', (y - vAlignDelta) + 'px');
var rotate = "rotate(-" + label.rotate + "deg)";
label.rootElement.style('-webkit-transform', rotate)
.style('transform', rotate);
return label;
};
return Label;
}(KG.ViewObject));
KG.Label = Label;
})(KG || (KG = {}));
/// <reference path="../../kg.ts" />
var KG;
(function (KG) {
var MathboxObject = /** @class */ (function (_super) {
__extends(MathboxObject, _super);
function MathboxObject(def) {
var _this = this;
KG.setProperties(def, 'constants', ['mathbox']);
_this = _super.call(this, def) || this;
return _this;
}
MathboxObject.prototype.onGraph = function () {
return true; // we won't check yet to see if it's on the graph...
};
MathboxObject.prototype.displayElement = function (show) {
var mbo = this;
if (mbo.hasOwnProperty("mo")) {
this.mo.set("visible", show);
}
};
return MathboxObject;
}(KG.ViewObject));
KG.MathboxObject = MathboxObject;
})(KG || (KG = {}));
var KG;
(function (KG) {
var MathboxAxis = /** @class */ (function (_super) {
__extends(MathboxAxis, _super);
function MathboxAxis(def) {
var _this = this;
KG.setDefaults(def, {
ticks: 5,
min: 0,
max: 10
});
KG.setProperties(def, 'constants', ['axisNumber', 'ticks']);
KG.setProperties(def, 'updatables', ['ticks', 'label', 'min', 'max']);
_this = _super.call(this, def) || this;
return _this;
}
MathboxAxis.prototype.redraw = function () {
var a = this;
console.log(a);
var view = a.mathbox.mathboxView;
if (view == undefined) {
return a;
}
view.set("range", [[a.mathbox.yAxis.min, a.mathbox.yAxis.max], [a.mathbox.zAxis.min, a.mathbox.zAxis.max], [a.mathbox.xAxis.min, a.mathbox.xAxis.max]]);
var axis = view.axis({ axis: a.axisNumber, width: 8, detail: 40, color: "black" });
var scale = view.scale({ axis: a.axisNumber, divide: a.ticks, nice: true, zero: true });
var ticks = view.ticks({ width: 5, size: 15, color: "black", zBias: 2 });
var format = view.format({ digits: 2, font: "KaTeX_Main", style: "normal", source: scale });
var ticklabel = view.label({ color: "black", zIndex: 1, offset: [0, 0], points: scale, text: format });
return a;
};
return MathboxAxis;
}(KG.MathboxObject));
KG.MathboxAxis = MathboxAxis;
var MathboxXAxis = /** @class */ (function (_super) {
__extends(MathboxXAxis, _super);
function MathboxXAxis(def) {
var _this = this;
def.axisNumber = 3;
_this = _super.call(this, def) || this;
var xAxis = _this;
xAxis.mathbox.xAxis = xAxis;
return _this;
}
return MathboxXAxis;
}(MathboxAxis));
KG.MathboxXAxis = MathboxXAxis;
var MathboxYAxis = /** @class */ (function (_super) {
__extends(MathboxYAxis, _super);
function MathboxYAxis(def) {
var _this = this;
def.axisNumber = 1;
_this = _super.call(this, def) || this;
var yAxis = _this;
yAxis.mathbox.yAxis = yAxis;
return _this;
}
return MathboxYAxis;
}(MathboxAxis));
KG.MathboxYAxis = MathboxYAxis;
var MathboxZAxis = /** @class */ (function (_super) {
__extends(MathboxZAxis, _super);
function MathboxZAxis(def) {
var _this = this;
def.axisNumber = 2;
_this = _super.call(this, def) || this;
var zAxis = _this;
zAxis.mathbox.zAxis = zAxis;
return _this;
}
return MathboxZAxis;
}(MathboxAxis));
KG.MathboxZAxis = MathboxZAxis;
})(KG || (KG = {}));
var KG;
(function (KG) {
var MathboxPoint = /** @class */ (function (_super) {
__extends(MathboxPoint, _super);
function MathboxPoint(def) {
var _this = this;
KG.setDefaults(def, {
x: 0,
y: 0,
z: 0
});
KG.setProperties(def, 'updatables', ['x', 'y', 'z']);
_this = _super.call(this, def) || this;
return _this;
}
MathboxPoint.prototype.draw = function () {
var p = this;
p.pointData = p.mathbox.mathboxView.array({
width: 1,
channels: 3
});
p.mo = p.mathbox.mathboxView.point({
size: 20,
points: p.pointData,
zIndex: 4
});
return p;
};
MathboxPoint.prototype.redraw = function () {
var p = this;
p.pointData.set("data", [[p.y, p.z, p.x]]);
p.mo.set("color", p.stroke);
return p;
};
return MathboxPoint;
}(KG.MathboxObject));
KG.MathboxPoint = MathboxPoint;
})(KG || (KG = {}));
var KG;
(function (KG) {
var MathboxCurve = /** @class */ (function (_super) {
__extends(MathboxCurve, _super);
function MathboxCurve(def) {
var _this = this;
KG.setDefaults(def, {
text: "#666666",
strokeWidth: 10
});
_this = _super.call(this, def) || this;
def.fn = KG.setDefaults(def.fn, {
model: def.model,
samplePoints: 100
});
_this.fn = new KG.UnivariateFunction(def.fn).update(true);
return _this;
}
MathboxCurve.prototype.draw = function () {
var c = this;
c.curveData = c.mathbox.mathboxView.interval({
axis: 1,
channels: 3,
width: c.fn.samplePoints
});
c.mo = c.mathbox.mathboxView.line({
points: c.curveData,
zIndex: 3
});
return c;
};
MathboxCurve.prototype.redraw = function () {
var c = this;
console.log(c);
c.curveData.set("expr", c.fn.mathboxFn());
c.mo.set("color", c.stroke);
c.mo.set("width", c.strokeWidth);
return c;
};
return MathboxCurve;
}(KG.MathboxObject));
KG.MathboxCurve = MathboxCurve;
})(KG || (KG = {}));
var KG;
(function (KG) {
var MathboxSurface = /** @class */ (function (_super) {
__extends(MathboxSurface, _super);
function MathboxSurface(def) {
var _this = this;
KG.setDefaults(def, {
fill: "#666666",
strokeWidth: 10,
opacity: 0.2
});
_this = _super.call(this, def) || this;
def.fn = KG.setDefaults(def.fn, {
model: def.model,
samplePoints: 100
});
_this.fn = new KG.MultivariateFunction(def.fn).update(true);
return _this;
}
MathboxSurface.prototype.draw = function () {
var s = this;
s.surfaceData = s.mathbox.mathboxView.area({
axes: [1, 3],
channels: 3,
width: s.fn.samplePoints,
height: s.fn.samplePoints
});
s.mo = s.mathbox.mathboxView.surface({
points: s.surfaceData,
shaded: false,
fill: true,
lineX: false,
lineY: false,
width: 0,
zIndex: 2
});
return s;
};
MathboxSurface.prototype.redraw = function () {
var c = this;
console.log(c);
c.surfaceData.set("expr", c.fn.mathboxFn());
c.mo.set("color", c.fill);
c.mo.set("opacity", c.opacity);
return c;
};
return MathboxSurface;
}(KG.MathboxObject));
KG.MathboxSurface = MathboxSurface;
})(KG || (KG = {}));
var KG;
(function (KG) {
var MathboxLabel = /** @class */ (function (_super) {
__extends(MathboxLabel, _super);
function MathboxLabel(def) {
var _this = this;
KG.setDefaults(def, {
text: "foo"
});
KG.setProperties(def, 'updatables', ['text']);
_this = _super.call(this, def) || this;
return _this;
}
MathboxLabel.prototype.draw = function () {
var l = this;
l.pointData = l.mathbox.mathboxView.array({
width: 1,
channels: 3
});
l.labelData = l.mathbox.mathboxView.format({
font: "KaTeX_Main",
style: "normal"
});
l.mo = l.mathbox.mathboxView.label({
points: l.pointData,
zIndex: 4,
text: l.labelData
});
return l;
};
MathboxLabel.prototype.redraw = function () {
var l = _super.prototype.redraw.call(this);
l.labelData.set("data", [l.text]);
return l;
};
return MathboxLabel;
}(KG.MathboxPoint));
KG.MathboxLabel = MathboxLabel;
})(KG || (KG = {}));
/// <reference path="../../node_modules/@types/katex/index.d.ts"/>
/// <reference path="../../node_modules/@types/d3/index.d.ts"/>
/// <reference path="../../node_modules/@types/mathjs/index.d.ts"/>
/// <reference path="../../node_modules/@types/js-yaml/index.d.ts"/>
/// <reference path="lib/underscore.ts"/>
/// <reference path="KGAuthor/kgAuthor.ts"/>
/// <reference path="model/model.ts"/>
/// <reference path="model/param.ts" />
/// <reference path="model/restriction.ts" />
/// <reference path="model/updateListener.ts" />
/// <reference path="math/mathFunction.ts" />
/// <reference path="math/univariateFunction.ts" />
/// <reference path="math/parametricFunction.ts" />
/// <reference path="math/multivariateFunction.ts" />
/// <reference path="controller/listeners/listener.ts" />
/// <reference path="controller/listeners/dragListener.ts" />
/// <reference path="controller/listeners/clickListener.ts" />
/// <reference path="controller/interactionHandler.ts" />
/// <reference path="view/view.ts"/>
/// <reference path="view/scale.ts" />
/// <reference path="view/viewObjects/viewObject.ts" />
/// <reference path="view/viewObjects/marker.ts" />
/// <reference path="view/viewObjects/segment.ts" />
/// <reference path="view/viewObjects/curve.ts" />
/// <reference path="view/viewObjects/axis.ts" />
/// <reference path="view/viewObjects/point.ts" />
/// <reference path="view/viewObjects/circle.ts" />
/// <reference path="view/viewObjects/rectangle.ts" />
/// <reference path="view/viewObjects/area.ts" />
/// <reference path="view/viewObjects/ggbObject.ts" />
/// <reference path="view/viewObjects/contour.ts" />
/// <reference path="view/divObjects/divObject.ts" />
/// <reference path="view/divObjects/positionedDiv.ts" />
/// <reference path="view/divObjects/div.ts" />
/// <reference path="view/divObjects/paramControl.ts"/>
/// <reference path="view/divObjects/slider.ts"/>
/// <reference path="view/divObjects/checkbox.ts"/>
/// <reference path="view/divObjects/radio.ts"/>
/// <reference path="view/divObjects/controls.ts"/>
/// <reference path="view/divObjects/gameMatrix.ts"/>
/// <reference path="view/divObjects/ggbApplet.ts"/>
/// <reference path="view/divObjects/mathbox.ts"/>
/// <reference path="view/divObjects/sidebar.ts"/>
/// <reference path="view/viewObjects/label.ts" />
/// <reference path="view/mathboxObjects/mathboxObject.ts" />
/// <reference path="view/mathboxObjects/mathboxAxis.ts" />
/// <reference path="view/mathboxObjects/mathboxPoint.ts" />
/// <reference path="view/mathboxObjects/mathboxCurve.ts" />
/// <reference path="view/mathboxObjects/mathboxSurface.ts" />
/// <reference path="view/mathboxObjects/mathboxLabel.ts" />
// this file provides the interface with the overall web page
var views = [];
// initialize the diagram from divs with class kg-container
window.addEventListener("load", function () {
var viewDivs = document.getElementsByClassName('kg-container');
var _loop_1 = function (i) {
var d = viewDivs[i], src = d.getAttribute('src');
if (d.innerHTML.indexOf('svg') > -1) {
//console.log('already loaded');
}
else {
// if there is no src attribute
if (!src) {
console.log('loading yaml');
var j = void 0;
try {
// read inner HTML of div as YAML
var y = jsyaml.safeLoad(d.innerHTML);
// convert it to JSON, un-escaping HTML <, >, and & signs
j = JSON.parse(JSON.stringify(y).replace(/&gt;/g, '>').replace(/&lt;/g, '<').replace(/&amp;/g, '&'));
}
catch (e) {
console.log('Error reading YAML: ', e.message);
}
finally {
views.push(new KG.View(d, j));
}
}
// first look to see if there's a definition in the KG.viewData object
else if (KG['viewData'].hasOwnProperty(src)) {
viewDivs[i].innerHTML = "";
views.push(new KG.View(viewDivs[i], KG['viewData'][src]));
}
else {
// then look to see if the src is available by a URL
d3.json(src + "?update=true").then(function (data) {
if (!data) {
viewDivs[i].innerHTML = "<p>oops, " + src + " doesn't seem to exist.</p>";
}
else {
viewDivs[i].innerHTML = "";
views.push(new KG.View(viewDivs[i], data));
}
});
}
d.classList.add('kg-loaded');
}
};
// for each div, fetch the JSON definition and create a View object with that div and data
for (var i = 0; i < viewDivs.length; i++) {
_loop_1(i);
}
});
// if the window changes size, update the dimensions of the containers
window.onresize = function () {
views.forEach(function (c) {
c.updateDimensions();
});
};