diff --git a/animate-demo.html b/animate-demo.html new file mode 100644 index 0000000..7b2563a --- /dev/null +++ b/animate-demo.html @@ -0,0 +1,1029 @@ + + + + + + + Animations in Reveal.js + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+

Animations with Reveal.js and SVG.js

+

+ Created by Asvin Goel +

+
+ +
+ +
+
+ + + + + + +
+ +
+ + +
+
+

Graphical solution procedure

+ + + + + +
+ +
+ +
+
+

Multiple corner point solutions

+ +
+ +
+
+ +
+

Simplex algorithm

+ + + + + + + + + +
+ +
+
+ +
+

Linear relaxation and rounding

+ + + + + + +
+ +
+
+ + +
+

Integer enumeration

+
+ +
+
+
+

Branch and bound

+
+ Solution: $(x,y) = (3.8,3)$ + Branch $x \geq 4$ + Branch $x \geq 4$ ⟶ $(x,y) = (4,2.9)$ + Branch $x \geq 4$, $y \geq 3$ + Branch $x \geq 4$, $y \geq 3$ ⟶ infeasible + Discard branch: $x \geq 4$, $y \geq 3$ + Branch $x \geq 4$, $y \leq 2$ + Branch $x \geq 4$, $y \leq 2$ ⟶ $(x,y) = (4,2)$ + $(x,y) = (4,2)$ is an integer solution + Branch $x \leq 3$ + Branch $x \leq 3$ ⟶ $(x,y) = (3,2.6)$ + Branch $x \leq 3$, $y \geq 3$ + Branch $x \leq 3$, $y \geq 3$ ⟶ infeasible + Discard branch: $x \leq 3$, $y \geq 3$ + Branch $x \leq 3$, $y \leq 2$ + Branch $x \leq 3$, $y \leq 2$ ⟶ $(x,y) = (1.8,2)$ + Branch $x \leq 3$, $y \leq 2$, $x \geq 2$ + Branch $x \leq 3$, $y \leq 2$, $x \geq 2$⟶ $(x,y) = (2,2)$ + $(x,y) = (2,2)$ is an integer solution + Branch $x \leq 3$, $y \geq 3$, $x \leq 1$ + Branch $x \leq 3$, $y \geq 3$, $x \leq 1$ ⟶ $(x,y) = (1,1.6)$ + $(x,y) = (1,1.6)$ is worse than best integer solution + All branches solved, $(x,y) = (2,2)$ is optimal +
+
+ +
+ +
+

Big-M constraint

+
$y \leq 1 + M(1-z)$ with $z=1$
+
+ +
+ +
+ +
+

Big-M constraint

+
$y \leq 1 + M(1-z)$ with $z=0$ + + and sufficiently large $M$ +
+
+ +
+
+ +
+ +

The end

+ +

Check out other plugins by clicking on    and then on "Plugins ".

+

Have a look at the source code & documentation on Github.

+ Download + Star +
+
+
+ + + + + + + diff --git a/animate/branch_and_bound.svg b/animate/branch_and_bound.svg new file mode 100644 index 0000000..5e983da --- /dev/null +++ b/animate/branch_and_bound.svg @@ -0,0 +1,222 @@ + + + + + + + + + + + + + + + + + + + + + + + + x + y + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 8.2 + + + + + + + + + + + + 7.6 + + + + + + + + + + + + + + + + 4.0 + + + + + + + + + 7.4 + + + + + 6.2 + + + + + + + + + + + + 6.0 + + + + + + + + + 5.4 + + + + + + + diff --git a/animate/heart.svg b/animate/heart.svg new file mode 100644 index 0000000..99d44f4 --- /dev/null +++ b/animate/heart.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/animate/integer_program.svg b/animate/integer_program.svg new file mode 100644 index 0000000..3267b68 --- /dev/null +++ b/animate/integer_program.svg @@ -0,0 +1,149 @@ + + + + + + + + + + + + + + + + + + + + + + + + x + y + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/animate/linear_program.svg b/animate/linear_program.svg new file mode 100644 index 0000000..f964382 --- /dev/null +++ b/animate/linear_program.svg @@ -0,0 +1,40 @@ + + + + + + + + + + x + y + + + + y ≥ 0 + + + + + x ≥ 0 + + + + + x ≤ 4 + + + + + y ≤ 6 + + + + + 3x+2y ≤ 18 + + + + + diff --git a/anything-demo.html b/anything-demo.html index e108c33..25da850 100644 --- a/anything-demo.html +++ b/anything-demo.html @@ -14,24 +14,21 @@ - - - - - - - - - - + + + + + + + + + + + + + + + @@ -367,7 +364,7 @@

World tour

The end

-

Check out other plugins by clicking on    and then on "Plugins ".

+

Check out other plugins by clicking on    and then on "Plugins ".

Have a look at the source code & documentation on Github.

@@ -392,7 +389,7 @@

The end

markers: true, hideMissingTitles: true, custom: [ - { title: 'Plugins', icon: '', src: 'toc.html' }, + { title: 'Plugins', icon: '', src: 'toc.html' }, { title: 'About', icon: '', src: 'about.html' } ] }, @@ -524,29 +521,11 @@

The end

}) }, {className: "anything", initialize: (function(container, options){ if (options && options.initialize) { options.initialize(container)} }) } ], - theme: Reveal.getQueryHash().theme, // available themes are in /css/theme - transition: Reveal.getQueryHash().transition || 'default', // none/fade/slide/convex/concave/zoom - - // Optional libraries used to extend on reveal.js - dependencies: [ - { src: '../reveal.js/lib/js/classList.js', condition: function() { return !document.body.classList; } }, - { src: '../reveal.js/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, - { src: '../reveal.js/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, - { src: '../reveal.js/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }, - { src: 'anything/d3/d3.v3.min.js' }, - { src: 'anything/d3.patch.js' }, - { src: 'anything/d3/queue.v1.min.js' }, - { src: 'anything/d3/topojson.v1.min.js' }, -// { src: 'anything/function-plot/site/js/vendor/d3.js' }, - { src: 'anything/function-plot/site/js/function-plot.js' }, - { src: '../reveal.js-plugins/chart/Chart.min.js' }, - { src: '../reveal.js-plugins/anything/anything.js' }, - { src: '../reveal.js-plugins/menu/menu.js' }, - ], + plugins: [ RevealMarkdown, RevealMenu, RevealHighlight, RevealAnything ], }); -Fork me on GitHub + diff --git a/anything/Chart.min.js b/anything/Chart.min.js new file mode 100644 index 0000000..7c16b0d --- /dev/null +++ b/anything/Chart.min.js @@ -0,0 +1,7 @@ +/*! + * Chart.js v2.9.3 + * https://www.chartjs.org + * (c) 2019 Chart.js Contributors + * Released under the MIT License + */ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(function(){try{return require("moment")}catch(t){}}()):"function"==typeof define&&define.amd?define(["require"],(function(t){return e(function(){try{return t("moment")}catch(t){}}())})):(t=t||self).Chart=e(t.moment)}(this,(function(t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var e={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},n=function(t,e){return t(e={exports:{}},e.exports),e.exports}((function(t){var n={};for(var i in e)e.hasOwnProperty(i)&&(n[e[i]]=i);var a=t.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var r in a)if(a.hasOwnProperty(r)){if(!("channels"in a[r]))throw new Error("missing channels property: "+r);if(!("labels"in a[r]))throw new Error("missing channel labels property: "+r);if(a[r].labels.length!==a[r].channels)throw new Error("channel and label counts mismatch: "+r);var o=a[r].channels,s=a[r].labels;delete a[r].channels,delete a[r].labels,Object.defineProperty(a[r],"channels",{value:o}),Object.defineProperty(a[r],"labels",{value:s})}a.rgb.hsl=function(t){var e,n,i=t[0]/255,a=t[1]/255,r=t[2]/255,o=Math.min(i,a,r),s=Math.max(i,a,r),l=s-o;return s===o?e=0:i===s?e=(a-r)/l:a===s?e=2+(r-i)/l:r===s&&(e=4+(i-a)/l),(e=Math.min(60*e,360))<0&&(e+=360),n=(o+s)/2,[e,100*(s===o?0:n<=.5?l/(s+o):l/(2-s-o)),100*n]},a.rgb.hsv=function(t){var e,n,i,a,r,o=t[0]/255,s=t[1]/255,l=t[2]/255,u=Math.max(o,s,l),d=u-Math.min(o,s,l),h=function(t){return(u-t)/6/d+.5};return 0===d?a=r=0:(r=d/u,e=h(o),n=h(s),i=h(l),o===u?a=i-n:s===u?a=1/3+e-i:l===u&&(a=2/3+n-e),a<0?a+=1:a>1&&(a-=1)),[360*a,100*r,100*u]},a.rgb.hwb=function(t){var e=t[0],n=t[1],i=t[2];return[a.rgb.hsl(t)[0],100*(1/255*Math.min(e,Math.min(n,i))),100*(i=1-1/255*Math.max(e,Math.max(n,i)))]},a.rgb.cmyk=function(t){var e,n=t[0]/255,i=t[1]/255,a=t[2]/255;return[100*((1-n-(e=Math.min(1-n,1-i,1-a)))/(1-e)||0),100*((1-i-e)/(1-e)||0),100*((1-a-e)/(1-e)||0),100*e]},a.rgb.keyword=function(t){var i=n[t];if(i)return i;var a,r,o,s=1/0;for(var l in e)if(e.hasOwnProperty(l)){var u=e[l],d=(r=t,o=u,Math.pow(r[0]-o[0],2)+Math.pow(r[1]-o[1],2)+Math.pow(r[2]-o[2],2));d.04045?Math.pow((e+.055)/1.055,2.4):e/12.92)+.3576*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.1805*(i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92)),100*(.2126*e+.7152*n+.0722*i),100*(.0193*e+.1192*n+.9505*i)]},a.rgb.lab=function(t){var e=a.rgb.xyz(t),n=e[0],i=e[1],r=e[2];return i/=100,r/=108.883,n=(n/=95.047)>.008856?Math.pow(n,1/3):7.787*n+16/116,[116*(i=i>.008856?Math.pow(i,1/3):7.787*i+16/116)-16,500*(n-i),200*(i-(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116))]},a.hsl.rgb=function(t){var e,n,i,a,r,o=t[0]/360,s=t[1]/100,l=t[2]/100;if(0===s)return[r=255*l,r,r];e=2*l-(n=l<.5?l*(1+s):l+s-l*s),a=[0,0,0];for(var u=0;u<3;u++)(i=o+1/3*-(u-1))<0&&i++,i>1&&i--,r=6*i<1?e+6*(n-e)*i:2*i<1?n:3*i<2?e+(n-e)*(2/3-i)*6:e,a[u]=255*r;return a},a.hsl.hsv=function(t){var e=t[0],n=t[1]/100,i=t[2]/100,a=n,r=Math.max(i,.01);return n*=(i*=2)<=1?i:2-i,a*=r<=1?r:2-r,[e,100*(0===i?2*a/(r+a):2*n/(i+n)),100*((i+n)/2)]},a.hsv.rgb=function(t){var e=t[0]/60,n=t[1]/100,i=t[2]/100,a=Math.floor(e)%6,r=e-Math.floor(e),o=255*i*(1-n),s=255*i*(1-n*r),l=255*i*(1-n*(1-r));switch(i*=255,a){case 0:return[i,l,o];case 1:return[s,i,o];case 2:return[o,i,l];case 3:return[o,s,i];case 4:return[l,o,i];case 5:return[i,o,s]}},a.hsv.hsl=function(t){var e,n,i,a=t[0],r=t[1]/100,o=t[2]/100,s=Math.max(o,.01);return i=(2-r)*o,n=r*s,[a,100*(n=(n/=(e=(2-r)*s)<=1?e:2-e)||0),100*(i/=2)]},a.hwb.rgb=function(t){var e,n,i,a,r,o,s,l=t[0]/360,u=t[1]/100,d=t[2]/100,h=u+d;switch(h>1&&(u/=h,d/=h),i=6*l-(e=Math.floor(6*l)),0!=(1&e)&&(i=1-i),a=u+i*((n=1-d)-u),e){default:case 6:case 0:r=n,o=a,s=u;break;case 1:r=a,o=n,s=u;break;case 2:r=u,o=n,s=a;break;case 3:r=u,o=a,s=n;break;case 4:r=a,o=u,s=n;break;case 5:r=n,o=u,s=a}return[255*r,255*o,255*s]},a.cmyk.rgb=function(t){var e=t[0]/100,n=t[1]/100,i=t[2]/100,a=t[3]/100;return[255*(1-Math.min(1,e*(1-a)+a)),255*(1-Math.min(1,n*(1-a)+a)),255*(1-Math.min(1,i*(1-a)+a))]},a.xyz.rgb=function(t){var e,n,i,a=t[0]/100,r=t[1]/100,o=t[2]/100;return n=-.9689*a+1.8758*r+.0415*o,i=.0557*a+-.204*r+1.057*o,e=(e=3.2406*a+-1.5372*r+-.4986*o)>.0031308?1.055*Math.pow(e,1/2.4)-.055:12.92*e,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:12.92*i,[255*(e=Math.min(Math.max(0,e),1)),255*(n=Math.min(Math.max(0,n),1)),255*(i=Math.min(Math.max(0,i),1))]},a.xyz.lab=function(t){var e=t[0],n=t[1],i=t[2];return n/=100,i/=108.883,e=(e/=95.047)>.008856?Math.pow(e,1/3):7.787*e+16/116,[116*(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116)-16,500*(e-n),200*(n-(i=i>.008856?Math.pow(i,1/3):7.787*i+16/116))]},a.lab.xyz=function(t){var e,n,i,a=t[0];e=t[1]/500+(n=(a+16)/116),i=n-t[2]/200;var r=Math.pow(n,3),o=Math.pow(e,3),s=Math.pow(i,3);return n=r>.008856?r:(n-16/116)/7.787,e=o>.008856?o:(e-16/116)/7.787,i=s>.008856?s:(i-16/116)/7.787,[e*=95.047,n*=100,i*=108.883]},a.lab.lch=function(t){var e,n=t[0],i=t[1],a=t[2];return(e=360*Math.atan2(a,i)/2/Math.PI)<0&&(e+=360),[n,Math.sqrt(i*i+a*a),e]},a.lch.lab=function(t){var e,n=t[0],i=t[1];return e=t[2]/360*2*Math.PI,[n,i*Math.cos(e),i*Math.sin(e)]},a.rgb.ansi16=function(t){var e=t[0],n=t[1],i=t[2],r=1 in arguments?arguments[1]:a.rgb.hsv(t)[2];if(0===(r=Math.round(r/50)))return 30;var o=30+(Math.round(i/255)<<2|Math.round(n/255)<<1|Math.round(e/255));return 2===r&&(o+=60),o},a.hsv.ansi16=function(t){return a.rgb.ansi16(a.hsv.rgb(t),t[2])},a.rgb.ansi256=function(t){var e=t[0],n=t[1],i=t[2];return e===n&&n===i?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(n/255*5)+Math.round(i/255*5)},a.ansi16.rgb=function(t){var e=t%10;if(0===e||7===e)return t>50&&(e+=3.5),[e=e/10.5*255,e,e];var n=.5*(1+~~(t>50));return[(1&e)*n*255,(e>>1&1)*n*255,(e>>2&1)*n*255]},a.ansi256.rgb=function(t){if(t>=232){var e=10*(t-232)+8;return[e,e,e]}var n;return t-=16,[Math.floor(t/36)/5*255,Math.floor((n=t%36)/6)/5*255,n%6/5*255]},a.rgb.hex=function(t){var e=(((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2]))).toString(16).toUpperCase();return"000000".substring(e.length)+e},a.hex.rgb=function(t){var e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];var n=e[0];3===e[0].length&&(n=n.split("").map((function(t){return t+t})).join(""));var i=parseInt(n,16);return[i>>16&255,i>>8&255,255&i]},a.rgb.hcg=function(t){var e,n=t[0]/255,i=t[1]/255,a=t[2]/255,r=Math.max(Math.max(n,i),a),o=Math.min(Math.min(n,i),a),s=r-o;return e=s<=0?0:r===n?(i-a)/s%6:r===i?2+(a-n)/s:4+(n-i)/s+4,e/=6,[360*(e%=1),100*s,100*(s<1?o/(1-s):0)]},a.hsl.hcg=function(t){var e=t[1]/100,n=t[2]/100,i=1,a=0;return(i=n<.5?2*e*n:2*e*(1-n))<1&&(a=(n-.5*i)/(1-i)),[t[0],100*i,100*a]},a.hsv.hcg=function(t){var e=t[1]/100,n=t[2]/100,i=e*n,a=0;return i<1&&(a=(n-i)/(1-i)),[t[0],100*i,100*a]},a.hcg.rgb=function(t){var e=t[0]/360,n=t[1]/100,i=t[2]/100;if(0===n)return[255*i,255*i,255*i];var a,r=[0,0,0],o=e%1*6,s=o%1,l=1-s;switch(Math.floor(o)){case 0:r[0]=1,r[1]=s,r[2]=0;break;case 1:r[0]=l,r[1]=1,r[2]=0;break;case 2:r[0]=0,r[1]=1,r[2]=s;break;case 3:r[0]=0,r[1]=l,r[2]=1;break;case 4:r[0]=s,r[1]=0,r[2]=1;break;default:r[0]=1,r[1]=0,r[2]=l}return a=(1-n)*i,[255*(n*r[0]+a),255*(n*r[1]+a),255*(n*r[2]+a)]},a.hcg.hsv=function(t){var e=t[1]/100,n=e+t[2]/100*(1-e),i=0;return n>0&&(i=e/n),[t[0],100*i,100*n]},a.hcg.hsl=function(t){var e=t[1]/100,n=t[2]/100*(1-e)+.5*e,i=0;return n>0&&n<.5?i=e/(2*n):n>=.5&&n<1&&(i=e/(2*(1-n))),[t[0],100*i,100*n]},a.hcg.hwb=function(t){var e=t[1]/100,n=e+t[2]/100*(1-e);return[t[0],100*(n-e),100*(1-n)]},a.hwb.hcg=function(t){var e=t[1]/100,n=1-t[2]/100,i=n-e,a=0;return i<1&&(a=(n-i)/(1-i)),[t[0],100*i,100*a]},a.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},a.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},a.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},a.gray.hsl=a.gray.hsv=function(t){return[0,0,t[0]]},a.gray.hwb=function(t){return[0,100,t[0]]},a.gray.cmyk=function(t){return[0,0,0,t[0]]},a.gray.lab=function(t){return[t[0],0,0]},a.gray.hex=function(t){var e=255&Math.round(t[0]/100*255),n=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(n.length)+n},a.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}}));n.rgb,n.hsl,n.hsv,n.hwb,n.cmyk,n.xyz,n.lab,n.lch,n.hex,n.keyword,n.ansi16,n.ansi256,n.hcg,n.apple,n.gray;function i(t){var e=function(){for(var t={},e=Object.keys(n),i=e.length,a=0;a1&&(e=Array.prototype.slice.call(arguments));var n=t(e);if("object"==typeof n)for(var i=n.length,a=0;a1&&(e=Array.prototype.slice.call(arguments)),t(e))};return"conversion"in t&&(e.conversion=t.conversion),e}(i)}))}));var s=o,l={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},u={getRgba:d,getHsla:h,getRgb:function(t){var e=d(t);return e&&e.slice(0,3)},getHsl:function(t){var e=h(t);return e&&e.slice(0,3)},getHwb:c,getAlpha:function(t){var e=d(t);if(e)return e[3];if(e=h(t))return e[3];if(e=c(t))return e[3]},hexString:function(t,e){e=void 0!==e&&3===t.length?e:t[3];return"#"+v(t[0])+v(t[1])+v(t[2])+(e>=0&&e<1?v(Math.round(255*e)):"")},rgbString:function(t,e){if(e<1||t[3]&&t[3]<1)return f(t,e);return"rgb("+t[0]+", "+t[1]+", "+t[2]+")"},rgbaString:f,percentString:function(t,e){if(e<1||t[3]&&t[3]<1)return g(t,e);var n=Math.round(t[0]/255*100),i=Math.round(t[1]/255*100),a=Math.round(t[2]/255*100);return"rgb("+n+"%, "+i+"%, "+a+"%)"},percentaString:g,hslString:function(t,e){if(e<1||t[3]&&t[3]<1)return p(t,e);return"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)"},hslaString:p,hwbString:function(t,e){void 0===e&&(e=void 0!==t[3]?t[3]:1);return"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+(void 0!==e&&1!==e?", "+e:"")+")"},keyword:function(t){return b[t.slice(0,3)]}};function d(t){if(t){var e=[0,0,0],n=1,i=t.match(/^#([a-fA-F0-9]{3,4})$/i),a="";if(i){a=(i=i[1])[3];for(var r=0;rn?(e+.05)/(n+.05):(n+.05)/(e+.05)},level:function(t){var e=this.contrast(t);return e>=7.1?"AAA":e>=4.5?"AA":""},dark:function(){var t=this.values.rgb;return(299*t[0]+587*t[1]+114*t[2])/1e3<128},light:function(){return!this.dark()},negate:function(){for(var t=[],e=0;e<3;e++)t[e]=255-this.values.rgb[e];return this.setValues("rgb",t),this},lighten:function(t){var e=this.values.hsl;return e[2]+=e[2]*t,this.setValues("hsl",e),this},darken:function(t){var e=this.values.hsl;return e[2]-=e[2]*t,this.setValues("hsl",e),this},saturate:function(t){var e=this.values.hsl;return e[1]+=e[1]*t,this.setValues("hsl",e),this},desaturate:function(t){var e=this.values.hsl;return e[1]-=e[1]*t,this.setValues("hsl",e),this},whiten:function(t){var e=this.values.hwb;return e[1]+=e[1]*t,this.setValues("hwb",e),this},blacken:function(t){var e=this.values.hwb;return e[2]+=e[2]*t,this.setValues("hwb",e),this},greyscale:function(){var t=this.values.rgb,e=.3*t[0]+.59*t[1]+.11*t[2];return this.setValues("rgb",[e,e,e]),this},clearer:function(t){var e=this.values.alpha;return this.setValues("alpha",e-e*t),this},opaquer:function(t){var e=this.values.alpha;return this.setValues("alpha",e+e*t),this},rotate:function(t){var e=this.values.hsl,n=(e[0]+t)%360;return e[0]=n<0?360+n:n,this.setValues("hsl",e),this},mix:function(t,e){var n=t,i=void 0===e?.5:e,a=2*i-1,r=this.alpha()-n.alpha(),o=((a*r==-1?a:(a+r)/(1+a*r))+1)/2,s=1-o;return this.rgb(o*this.red()+s*n.red(),o*this.green()+s*n.green(),o*this.blue()+s*n.blue()).alpha(this.alpha()*i+n.alpha()*(1-i))},toJSON:function(){return this.rgb()},clone:function(){var t,e,n=new y,i=this.values,a=n.values;for(var r in i)i.hasOwnProperty(r)&&(t=i[r],"[object Array]"===(e={}.toString.call(t))?a[r]=t.slice(0):"[object Number]"===e?a[r]=t:console.error("unexpected color value:",t));return n}},y.prototype.spaces={rgb:["red","green","blue"],hsl:["hue","saturation","lightness"],hsv:["hue","saturation","value"],hwb:["hue","whiteness","blackness"],cmyk:["cyan","magenta","yellow","black"]},y.prototype.maxes={rgb:[255,255,255],hsl:[360,100,100],hsv:[360,100,100],hwb:[360,100,100],cmyk:[100,100,100,100]},y.prototype.getValues=function(t){for(var e=this.values,n={},i=0;i=0;a--)e.call(n,t[a],a);else for(a=0;a=1?t:-(Math.sqrt(1-t*t)-1)},easeOutCirc:function(t){return Math.sqrt(1-(t-=1)*t)},easeInOutCirc:function(t){return(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},easeInElastic:function(t){var e=1.70158,n=0,i=1;return 0===t?0:1===t?1:(n||(n=.3),i<1?(i=1,e=n/4):e=n/(2*Math.PI)*Math.asin(1/i),-i*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n))},easeOutElastic:function(t){var e=1.70158,n=0,i=1;return 0===t?0:1===t?1:(n||(n=.3),i<1?(i=1,e=n/4):e=n/(2*Math.PI)*Math.asin(1/i),i*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/n)+1)},easeInOutElastic:function(t){var e=1.70158,n=0,i=1;return 0===t?0:2==(t/=.5)?1:(n||(n=.45),i<1?(i=1,e=n/4):e=n/(2*Math.PI)*Math.asin(1/i),t<1?i*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)*-.5:i*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)*.5+1)},easeInBack:function(t){var e=1.70158;return t*t*((e+1)*t-e)},easeOutBack:function(t){var e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack:function(t){var e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:function(t){return 1-S.easeOutBounce(1-t)},easeOutBounce:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},easeInOutBounce:function(t){return t<.5?.5*S.easeInBounce(2*t):.5*S.easeOutBounce(2*t-1)+.5}},C={effects:S};M.easingEffects=S;var P=Math.PI,A=P/180,D=2*P,T=P/2,I=P/4,F=2*P/3,L={clear:function(t){t.ctx.clearRect(0,0,t.width,t.height)},roundedRect:function(t,e,n,i,a,r){if(r){var o=Math.min(r,a/2,i/2),s=e+o,l=n+o,u=e+i-o,d=n+a-o;t.moveTo(e,l),se.left-1e-6&&t.xe.top-1e-6&&t.y0&&this.requestAnimationFrame()},advance:function(){for(var t,e,n,i,a=this.animations,r=0;r=n?(V.callback(t.onAnimationComplete,[t],e),e.animating=!1,a.splice(r,1)):++r}},J=V.options.resolve,Q=["push","pop","shift","splice","unshift"];function tt(t,e){var n=t._chartjs;if(n){var i=n.listeners,a=i.indexOf(e);-1!==a&&i.splice(a,1),i.length>0||(Q.forEach((function(e){delete t[e]})),delete t._chartjs)}}var et=function(t,e){this.initialize(t,e)};V.extend(et.prototype,{datasetElementType:null,dataElementType:null,_datasetElementOptions:["backgroundColor","borderCapStyle","borderColor","borderDash","borderDashOffset","borderJoinStyle","borderWidth"],_dataElementOptions:["backgroundColor","borderColor","borderWidth","pointStyle"],initialize:function(t,e){var n=this;n.chart=t,n.index=e,n.linkScales(),n.addElements(),n._type=n.getMeta().type},updateIndex:function(t){this.index=t},linkScales:function(){var t=this.getMeta(),e=this.chart,n=e.scales,i=this.getDataset(),a=e.options.scales;null!==t.xAxisID&&t.xAxisID in n&&!i.xAxisID||(t.xAxisID=i.xAxisID||a.xAxes[0].id),null!==t.yAxisID&&t.yAxisID in n&&!i.yAxisID||(t.yAxisID=i.yAxisID||a.yAxes[0].id)},getDataset:function(){return this.chart.data.datasets[this.index]},getMeta:function(){return this.chart.getDatasetMeta(this.index)},getScaleForId:function(t){return this.chart.scales[t]},_getValueScaleId:function(){return this.getMeta().yAxisID},_getIndexScaleId:function(){return this.getMeta().xAxisID},_getValueScale:function(){return this.getScaleForId(this._getValueScaleId())},_getIndexScale:function(){return this.getScaleForId(this._getIndexScaleId())},reset:function(){this._update(!0)},destroy:function(){this._data&&tt(this._data,this)},createMetaDataset:function(){var t=this.datasetElementType;return t&&new t({_chart:this.chart,_datasetIndex:this.index})},createMetaData:function(t){var e=this.dataElementType;return e&&new e({_chart:this.chart,_datasetIndex:this.index,_index:t})},addElements:function(){var t,e,n=this.getMeta(),i=this.getDataset().data||[],a=n.data;for(t=0,e=i.length;tn&&this.insertElements(n,i-n)},insertElements:function(t,e){for(var n=0;na?(r=a/e.innerRadius,t.arc(o,s,e.innerRadius-a,i+r,n-r,!0)):t.arc(o,s,a,i+Math.PI/2,n-Math.PI/2),t.closePath(),t.clip()}function rt(t,e,n){var i="inner"===e.borderAlign;i?(t.lineWidth=2*e.borderWidth,t.lineJoin="round"):(t.lineWidth=e.borderWidth,t.lineJoin="bevel"),n.fullCircles&&function(t,e,n,i){var a,r=n.endAngle;for(i&&(n.endAngle=n.startAngle+it,at(t,n),n.endAngle=r,n.endAngle===n.startAngle&&n.fullCircles&&(n.endAngle+=it,n.fullCircles--)),t.beginPath(),t.arc(n.x,n.y,n.innerRadius,n.startAngle+it,n.startAngle,!0),a=0;as;)a-=it;for(;a=o&&a<=s,u=r>=n.innerRadius&&r<=n.outerRadius;return l&&u}return!1},getCenterPoint:function(){var t=this._view,e=(t.startAngle+t.endAngle)/2,n=(t.innerRadius+t.outerRadius)/2;return{x:t.x+Math.cos(e)*n,y:t.y+Math.sin(e)*n}},getArea:function(){var t=this._view;return Math.PI*((t.endAngle-t.startAngle)/(2*Math.PI))*(Math.pow(t.outerRadius,2)-Math.pow(t.innerRadius,2))},tooltipPosition:function(){var t=this._view,e=t.startAngle+(t.endAngle-t.startAngle)/2,n=(t.outerRadius-t.innerRadius)/2+t.innerRadius;return{x:t.x+Math.cos(e)*n,y:t.y+Math.sin(e)*n}},draw:function(){var t,e=this._chart.ctx,n=this._view,i="inner"===n.borderAlign?.33:0,a={x:n.x,y:n.y,innerRadius:n.innerRadius,outerRadius:Math.max(n.outerRadius-i,0),pixelMargin:i,startAngle:n.startAngle,endAngle:n.endAngle,fullCircles:Math.floor(n.circumference/it)};if(e.save(),e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,a.fullCircles){for(a.endAngle=a.startAngle+it,e.beginPath(),e.arc(a.x,a.y,a.outerRadius,a.startAngle,a.endAngle),e.arc(a.x,a.y,a.innerRadius,a.endAngle,a.startAngle,!0),e.closePath(),t=0;tt.x&&(e=vt(e,"left","right")):t.basen?n:i,r:l.right||a<0?0:a>e?e:a,b:l.bottom||r<0?0:r>n?n:r,l:l.left||o<0?0:o>e?e:o}}function xt(t,e,n){var i=null===e,a=null===n,r=!(!t||i&&a)&&mt(t);return r&&(i||e>=r.left&&e<=r.right)&&(a||n>=r.top&&n<=r.bottom)}z._set("global",{elements:{rectangle:{backgroundColor:gt,borderColor:gt,borderSkipped:"bottom",borderWidth:0}}});var yt=X.extend({_type:"rectangle",draw:function(){var t=this._chart.ctx,e=this._view,n=function(t){var e=mt(t),n=e.right-e.left,i=e.bottom-e.top,a=bt(t,n/2,i/2);return{outer:{x:e.left,y:e.top,w:n,h:i},inner:{x:e.left+a.l,y:e.top+a.t,w:n-a.l-a.r,h:i-a.t-a.b}}}(e),i=n.outer,a=n.inner;t.fillStyle=e.backgroundColor,t.fillRect(i.x,i.y,i.w,i.h),i.w===a.w&&i.h===a.h||(t.save(),t.beginPath(),t.rect(i.x,i.y,i.w,i.h),t.clip(),t.fillStyle=e.borderColor,t.rect(a.x,a.y,a.w,a.h),t.fill("evenodd"),t.restore())},height:function(){var t=this._view;return t.base-t.y},inRange:function(t,e){return xt(this._view,t,e)},inLabelRange:function(t,e){var n=this._view;return pt(n)?xt(n,t,null):xt(n,null,e)},inXRange:function(t){return xt(this._view,t,null)},inYRange:function(t){return xt(this._view,null,t)},getCenterPoint:function(){var t,e,n=this._view;return pt(n)?(t=n.x,e=(n.y+n.base)/2):(t=(n.x+n.base)/2,e=n.y),{x:t,y:e}},getArea:function(){var t=this._view;return pt(t)?t.width*Math.abs(t.y-t.base):t.height*Math.abs(t.x-t.base)},tooltipPosition:function(){var t=this._view;return{x:t.x,y:t.y}}}),_t={},kt=ot,wt=ut,Mt=ft,St=yt;_t.Arc=kt,_t.Line=wt,_t.Point=Mt,_t.Rectangle=St;var Ct=V._deprecated,Pt=V.valueOrDefault;function At(t,e,n){var i,a,r=n.barThickness,o=e.stackCount,s=e.pixels[t],l=V.isNullOrUndef(r)?function(t,e){var n,i,a,r,o=t._length;for(a=1,r=e.length;a0?Math.min(o,Math.abs(i-n)):o,n=i;return o}(e.scale,e.pixels):-1;return V.isNullOrUndef(r)?(i=l*n.categoryPercentage,a=n.barPercentage):(i=r*o,a=1),{chunk:i/o,ratio:a,start:s-i/2}}z._set("bar",{hover:{mode:"label"},scales:{xAxes:[{type:"category",offset:!0,gridLines:{offsetGridLines:!0}}],yAxes:[{type:"linear"}]}}),z._set("global",{datasets:{bar:{categoryPercentage:.8,barPercentage:.9}}});var Dt=nt.extend({dataElementType:_t.Rectangle,_dataElementOptions:["backgroundColor","borderColor","borderSkipped","borderWidth","barPercentage","barThickness","categoryPercentage","maxBarThickness","minBarLength"],initialize:function(){var t,e,n=this;nt.prototype.initialize.apply(n,arguments),(t=n.getMeta()).stack=n.getDataset().stack,t.bar=!0,e=n._getIndexScale().options,Ct("bar chart",e.barPercentage,"scales.[x/y]Axes.barPercentage","dataset.barPercentage"),Ct("bar chart",e.barThickness,"scales.[x/y]Axes.barThickness","dataset.barThickness"),Ct("bar chart",e.categoryPercentage,"scales.[x/y]Axes.categoryPercentage","dataset.categoryPercentage"),Ct("bar chart",n._getValueScale().options.minBarLength,"scales.[x/y]Axes.minBarLength","dataset.minBarLength"),Ct("bar chart",e.maxBarThickness,"scales.[x/y]Axes.maxBarThickness","dataset.maxBarThickness")},update:function(t){var e,n,i=this.getMeta().data;for(this._ruler=this.getRuler(),e=0,n=i.length;e=0&&p.min>=0?p.min:p.max,y=void 0===p.start?p.end:p.max>=0&&p.min>=0?p.max-p.min:p.min-p.max,_=g.length;if(v||void 0===v&&void 0!==b)for(i=0;i<_&&(a=g[i]).index!==t;++i)a.stack===b&&(r=void 0===(u=h._parseValue(f[a.index].data[e])).start?u.end:u.min>=0&&u.max>=0?u.max:u.min,(p.min<0&&r<0||p.max>=0&&r>0)&&(x+=r));return o=h.getPixelForValue(x),l=(s=h.getPixelForValue(x+y))-o,void 0!==m&&Math.abs(l)=0&&!c||y<0&&c?o-m:o+m),{size:l,base:o,head:s,center:s+l/2}},calculateBarIndexPixels:function(t,e,n,i){var a="flex"===i.barThickness?function(t,e,n){var i,a=e.pixels,r=a[t],o=t>0?a[t-1]:null,s=t=Ot?-Rt:b<-Ot?Rt:0)+m,y=Math.cos(b),_=Math.sin(b),k=Math.cos(x),w=Math.sin(x),M=b<=0&&x>=0||x>=Rt,S=b<=zt&&x>=zt||x>=Rt+zt,C=b<=-zt&&x>=-zt||x>=Ot+zt,P=b===-Ot||x>=Ot?-1:Math.min(y,y*p,k,k*p),A=C?-1:Math.min(_,_*p,w,w*p),D=M?1:Math.max(y,y*p,k,k*p),T=S?1:Math.max(_,_*p,w,w*p);u=(D-P)/2,d=(T-A)/2,h=-(D+P)/2,c=-(T+A)/2}for(i=0,a=g.length;i0&&!isNaN(t)?Rt*(Math.abs(t)/e):0},getMaxBorderWidth:function(t){var e,n,i,a,r,o,s,l,u=0,d=this.chart;if(!t)for(e=0,n=d.data.datasets.length;e(u=s>u?s:u)?l:u);return u},setHoverStyle:function(t){var e=t._model,n=t._options,i=V.getHoverColor;t.$previousStyle={backgroundColor:e.backgroundColor,borderColor:e.borderColor,borderWidth:e.borderWidth},e.backgroundColor=Lt(n.hoverBackgroundColor,i(n.backgroundColor)),e.borderColor=Lt(n.hoverBorderColor,i(n.borderColor)),e.borderWidth=Lt(n.hoverBorderWidth,n.borderWidth)},_getRingWeightOffset:function(t){for(var e=0,n=0;n0&&Vt(l[t-1]._model,s)&&(n.controlPointPreviousX=u(n.controlPointPreviousX,s.left,s.right),n.controlPointPreviousY=u(n.controlPointPreviousY,s.top,s.bottom)),t0&&(r=t.getDatasetMeta(r[0]._datasetIndex).data),r},"x-axis":function(t,e){return ie(t,e,{intersect:!1})},point:function(t,e){return te(t,Jt(e,t))},nearest:function(t,e,n){var i=Jt(e,t);n.axis=n.axis||"xy";var a=ne(n.axis);return ee(t,i,n.intersect,a)},x:function(t,e,n){var i=Jt(e,t),a=[],r=!1;return Qt(t,(function(t){t.inXRange(i.x)&&a.push(t),t.inRange(i.x,i.y)&&(r=!0)})),n.intersect&&!r&&(a=[]),a},y:function(t,e,n){var i=Jt(e,t),a=[],r=!1;return Qt(t,(function(t){t.inYRange(i.y)&&a.push(t),t.inRange(i.x,i.y)&&(r=!0)})),n.intersect&&!r&&(a=[]),a}}},re=V.extend;function oe(t,e){return V.where(t,(function(t){return t.pos===e}))}function se(t,e){return t.sort((function(t,n){var i=e?n:t,a=e?t:n;return i.weight===a.weight?i.index-a.index:i.weight-a.weight}))}function le(t,e,n,i){return Math.max(t[n],e[n])+Math.max(t[i],e[i])}function ue(t,e,n){var i,a,r=n.box,o=t.maxPadding;if(n.size&&(t[n.pos]-=n.size),n.size=n.horizontal?r.height:r.width,t[n.pos]+=n.size,r.getPadding){var s=r.getPadding();o.top=Math.max(o.top,s.top),o.left=Math.max(o.left,s.left),o.bottom=Math.max(o.bottom,s.bottom),o.right=Math.max(o.right,s.right)}if(i=e.outerWidth-le(o,t,"left","right"),a=e.outerHeight-le(o,t,"top","bottom"),i!==t.w||a!==t.h)return t.w=i,t.h=a,n.horizontal?i!==t.w:a!==t.h}function de(t,e){var n=e.maxPadding;function i(t){var i={left:0,top:0,right:0,bottom:0};return t.forEach((function(t){i[t]=Math.max(e[t],n[t])})),i}return i(t?["left","right"]:["top","bottom"])}function he(t,e,n){var i,a,r,o,s,l,u=[];for(i=0,a=t.length;idiv{position:absolute;width:1000000px;height:1000000px;left:0;top:0}.chartjs-size-monitor-shrink>div{position:absolute;width:200%;height:200%;left:0;top:0}"}))&&fe.default||fe,me="$chartjs",ve="chartjs-size-monitor",be="chartjs-render-monitor",xe="chartjs-render-animation",ye=["animationstart","webkitAnimationStart"],_e={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"};function ke(t,e){var n=V.getStyle(t,e),i=n&&n.match(/^(\d+)(\.\d+)?px$/);return i?Number(i[1]):void 0}var we=!!function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("e",null,e)}catch(t){}return t}()&&{passive:!0};function Me(t,e,n){t.addEventListener(e,n,we)}function Se(t,e,n){t.removeEventListener(e,n,we)}function Ce(t,e,n,i,a){return{type:t,chart:e,native:a||null,x:void 0!==n?n:null,y:void 0!==i?i:null}}function Pe(t){var e=document.createElement("div");return e.className=t||"",e}function Ae(t,e,n){var i,a,r,o,s=t[me]||(t[me]={}),l=s.resizer=function(t){var e=Pe(ve),n=Pe(ve+"-expand"),i=Pe(ve+"-shrink");n.appendChild(Pe()),i.appendChild(Pe()),e.appendChild(n),e.appendChild(i),e._reset=function(){n.scrollLeft=1e6,n.scrollTop=1e6,i.scrollLeft=1e6,i.scrollTop=1e6};var a=function(){e._reset(),t()};return Me(n,"scroll",a.bind(n,"expand")),Me(i,"scroll",a.bind(i,"shrink")),e}((i=function(){if(s.resizer){var i=n.options.maintainAspectRatio&&t.parentNode,a=i?i.clientWidth:0;e(Ce("resize",n)),i&&i.clientWidth0){var r=t[0];r.label?n=r.label:r.xLabel?n=r.xLabel:a>0&&r.index-1?t.split("\n"):t}function We(t){var e=z.global;return{xPadding:t.xPadding,yPadding:t.yPadding,xAlign:t.xAlign,yAlign:t.yAlign,rtl:t.rtl,textDirection:t.textDirection,bodyFontColor:t.bodyFontColor,_bodyFontFamily:Re(t.bodyFontFamily,e.defaultFontFamily),_bodyFontStyle:Re(t.bodyFontStyle,e.defaultFontStyle),_bodyAlign:t.bodyAlign,bodyFontSize:Re(t.bodyFontSize,e.defaultFontSize),bodySpacing:t.bodySpacing,titleFontColor:t.titleFontColor,_titleFontFamily:Re(t.titleFontFamily,e.defaultFontFamily),_titleFontStyle:Re(t.titleFontStyle,e.defaultFontStyle),titleFontSize:Re(t.titleFontSize,e.defaultFontSize),_titleAlign:t.titleAlign,titleSpacing:t.titleSpacing,titleMarginBottom:t.titleMarginBottom,footerFontColor:t.footerFontColor,_footerFontFamily:Re(t.footerFontFamily,e.defaultFontFamily),_footerFontStyle:Re(t.footerFontStyle,e.defaultFontStyle),footerFontSize:Re(t.footerFontSize,e.defaultFontSize),_footerAlign:t.footerAlign,footerSpacing:t.footerSpacing,footerMarginTop:t.footerMarginTop,caretSize:t.caretSize,cornerRadius:t.cornerRadius,backgroundColor:t.backgroundColor,opacity:0,legendColorBackground:t.multiKeyBackground,displayColors:t.displayColors,borderColor:t.borderColor,borderWidth:t.borderWidth}}function Ve(t,e){return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-t.xPadding:t.x+t.xPadding}function He(t){return Be([],Ee(t))}var je=X.extend({initialize:function(){this._model=We(this._options),this._lastActive=[]},getTitle:function(){var t=this,e=t._options,n=e.callbacks,i=n.beforeTitle.apply(t,arguments),a=n.title.apply(t,arguments),r=n.afterTitle.apply(t,arguments),o=[];return o=Be(o,Ee(i)),o=Be(o,Ee(a)),o=Be(o,Ee(r))},getBeforeBody:function(){return He(this._options.callbacks.beforeBody.apply(this,arguments))},getBody:function(t,e){var n=this,i=n._options.callbacks,a=[];return V.each(t,(function(t){var r={before:[],lines:[],after:[]};Be(r.before,Ee(i.beforeLabel.call(n,t,e))),Be(r.lines,i.label.call(n,t,e)),Be(r.after,Ee(i.afterLabel.call(n,t,e))),a.push(r)})),a},getAfterBody:function(){return He(this._options.callbacks.afterBody.apply(this,arguments))},getFooter:function(){var t=this,e=t._options.callbacks,n=e.beforeFooter.apply(t,arguments),i=e.footer.apply(t,arguments),a=e.afterFooter.apply(t,arguments),r=[];return r=Be(r,Ee(n)),r=Be(r,Ee(i)),r=Be(r,Ee(a))},update:function(t){var e,n,i,a,r,o,s,l,u,d,h=this,c=h._options,f=h._model,g=h._model=We(c),p=h._active,m=h._data,v={xAlign:f.xAlign,yAlign:f.yAlign},b={x:f.x,y:f.y},x={width:f.width,height:f.height},y={x:f.caretX,y:f.caretY};if(p.length){g.opacity=1;var _=[],k=[];y=Ne[c.position].call(h,p,h._eventPosition);var w=[];for(e=0,n=p.length;ei.width&&(a=i.width-e.width),a<0&&(a=0)),"top"===d?r+=h:r-="bottom"===d?e.height+h:e.height/2,"center"===d?"left"===u?a+=h:"right"===u&&(a-=h):"left"===u?a-=c:"right"===u&&(a+=c),{x:a,y:r}}(g,x,v=function(t,e){var n,i,a,r,o,s=t._model,l=t._chart,u=t._chart.chartArea,d="center",h="center";s.yl.height-e.height&&(h="bottom");var c=(u.left+u.right)/2,f=(u.top+u.bottom)/2;"center"===h?(n=function(t){return t<=c},i=function(t){return t>c}):(n=function(t){return t<=e.width/2},i=function(t){return t>=l.width-e.width/2}),a=function(t){return t+e.width+s.caretSize+s.caretPadding>l.width},r=function(t){return t-e.width-s.caretSize-s.caretPadding<0},o=function(t){return t<=f?"top":"bottom"},n(s.x)?(d="left",a(s.x)&&(d="center",h=o(s.y))):i(s.x)&&(d="right",r(s.x)&&(d="center",h=o(s.y)));var g=t._options;return{xAlign:g.xAlign?g.xAlign:d,yAlign:g.yAlign?g.yAlign:h}}(this,x),h._chart)}else g.opacity=0;return g.xAlign=v.xAlign,g.yAlign=v.yAlign,g.x=b.x,g.y=b.y,g.width=x.width,g.height=x.height,g.caretX=y.x,g.caretY=y.y,h._model=g,t&&c.custom&&c.custom.call(h,g),h},drawCaret:function(t,e){var n=this._chart.ctx,i=this._view,a=this.getCaretPosition(t,e,i);n.lineTo(a.x1,a.y1),n.lineTo(a.x2,a.y2),n.lineTo(a.x3,a.y3)},getCaretPosition:function(t,e,n){var i,a,r,o,s,l,u=n.caretSize,d=n.cornerRadius,h=n.xAlign,c=n.yAlign,f=t.x,g=t.y,p=e.width,m=e.height;if("center"===c)s=g+m/2,"left"===h?(a=(i=f)-u,r=i,o=s+u,l=s-u):(a=(i=f+p)+u,r=i,o=s-u,l=s+u);else if("left"===h?(i=(a=f+d+u)-u,r=a+u):"right"===h?(i=(a=f+p-d-u)-u,r=a+u):(i=(a=n.caretX)-u,r=a+u),"top"===c)s=(o=g)-u,l=o;else{s=(o=g+m)+u,l=o;var v=r;r=i,i=v}return{x1:i,x2:a,x3:r,y1:o,y2:s,y3:l}},drawTitle:function(t,e,n){var i,a,r,o=e.title,s=o.length;if(s){var l=ze(e.rtl,e.x,e.width);for(t.x=Ve(e,e._titleAlign),n.textAlign=l.textAlign(e._titleAlign),n.textBaseline="middle",i=e.titleFontSize,a=e.titleSpacing,n.fillStyle=e.titleFontColor,n.font=V.fontString(i,e._titleFontStyle,e._titleFontFamily),r=0;r0&&n.stroke()},draw:function(){var t=this._chart.ctx,e=this._view;if(0!==e.opacity){var n={width:e.width,height:e.height},i={x:e.x,y:e.y},a=Math.abs(e.opacity<.001)?0:e.opacity,r=e.title.length||e.beforeBody.length||e.body.length||e.afterBody.length||e.footer.length;this._options.enabled&&r&&(t.save(),t.globalAlpha=a,this.drawBackground(i,e,t,n),i.y+=e.yPadding,V.rtl.overrideTextDirection(t,e.textDirection),this.drawTitle(i,e,t),this.drawBody(i,e,t),this.drawFooter(i,e,t),V.rtl.restoreTextDirection(t,e.textDirection),t.restore())}},handleEvent:function(t){var e,n=this,i=n._options;return n._lastActive=n._lastActive||[],"mouseout"===t.type?n._active=[]:(n._active=n._chart.getElementsAtEventForMode(t,i.mode,i),i.reverse&&n._active.reverse()),(e=!V.arrayEquals(n._active,n._lastActive))&&(n._lastActive=n._active,(i.enabled||i.custom)&&(n._eventPosition={x:t.x,y:t.y},n.update(!0),n.pivot())),e}}),qe=Ne,Ue=je;Ue.positioners=qe;var Ye=V.valueOrDefault;function Ge(){return V.merge({},[].slice.call(arguments),{merger:function(t,e,n,i){if("xAxes"===t||"yAxes"===t){var a,r,o,s=n[t].length;for(e[t]||(e[t]=[]),a=0;a=e[t].length&&e[t].push({}),!e[t][a].type||o.type&&o.type!==e[t][a].type?V.merge(e[t][a],[Oe.getScaleDefaults(r),o]):V.merge(e[t][a],o)}else V._merger(t,e,n,i)}})}function Xe(){return V.merge({},[].slice.call(arguments),{merger:function(t,e,n,i){var a=e[t]||{},r=n[t];"scales"===t?e[t]=Ge(a,r):"scale"===t?e[t]=V.merge(a,[Oe.getScaleDefaults(r.type),r]):V._merger(t,e,n,i)}})}function Ke(t){var e=t.options;V.each(t.scales,(function(e){ge.removeBox(t,e)})),e=Xe(z.global,z[t.config.type],e),t.options=t.config.options=e,t.ensureScalesHaveIDs(),t.buildOrUpdateScales(),t.tooltip._options=e.tooltips,t.tooltip.initialize()}function Ze(t,e,n){var i,a=function(t){return t.id===i};do{i=e+n++}while(V.findIndex(t,a)>=0);return i}function $e(t){return"top"===t||"bottom"===t}function Je(t,e){return function(n,i){return n[t]===i[t]?n[e]-i[e]:n[t]-i[t]}}z._set("global",{elements:{},events:["mousemove","mouseout","click","touchstart","touchmove"],hover:{onHover:null,mode:"nearest",intersect:!0,animationDuration:400},onClick:null,maintainAspectRatio:!0,responsive:!0,responsiveAnimationDuration:0});var Qe=function(t,e){return this.construct(t,e),this};V.extend(Qe.prototype,{construct:function(t,e){var n=this;e=function(t){var e=(t=t||{}).data=t.data||{};return e.datasets=e.datasets||[],e.labels=e.labels||[],t.options=Xe(z.global,z[t.type],t.options||{}),t}(e);var i=Fe.acquireContext(t,e),a=i&&i.canvas,r=a&&a.height,o=a&&a.width;n.id=V.uid(),n.ctx=i,n.canvas=a,n.config=e,n.width=o,n.height=r,n.aspectRatio=r?o/r:null,n.options=e.options,n._bufferedRender=!1,n._layers=[],n.chart=n,n.controller=n,Qe.instances[n.id]=n,Object.defineProperty(n,"data",{get:function(){return n.config.data},set:function(t){n.config.data=t}}),i&&a?(n.initialize(),n.update()):console.error("Failed to create chart: can't acquire context from the given item")},initialize:function(){var t=this;return Le.notify(t,"beforeInit"),V.retinaScale(t,t.options.devicePixelRatio),t.bindEvents(),t.options.responsive&&t.resize(!0),t.initToolTip(),Le.notify(t,"afterInit"),t},clear:function(){return V.canvas.clear(this),this},stop:function(){return $.cancelAnimation(this),this},resize:function(t){var e=this,n=e.options,i=e.canvas,a=n.maintainAspectRatio&&e.aspectRatio||null,r=Math.max(0,Math.floor(V.getMaximumWidth(i))),o=Math.max(0,Math.floor(a?r/a:V.getMaximumHeight(i)));if((e.width!==r||e.height!==o)&&(i.width=e.width=r,i.height=e.height=o,i.style.width=r+"px",i.style.height=o+"px",V.retinaScale(e,n.devicePixelRatio),!t)){var s={width:r,height:o};Le.notify(e,"resize",[s]),n.onResize&&n.onResize(e,s),e.stop(),e.update({duration:n.responsiveAnimationDuration})}},ensureScalesHaveIDs:function(){var t=this.options,e=t.scales||{},n=t.scale;V.each(e.xAxes,(function(t,n){t.id||(t.id=Ze(e.xAxes,"x-axis-",n))})),V.each(e.yAxes,(function(t,n){t.id||(t.id=Ze(e.yAxes,"y-axis-",n))})),n&&(n.id=n.id||"scale")},buildOrUpdateScales:function(){var t=this,e=t.options,n=t.scales||{},i=[],a=Object.keys(n).reduce((function(t,e){return t[e]=!1,t}),{});e.scales&&(i=i.concat((e.scales.xAxes||[]).map((function(t){return{options:t,dtype:"category",dposition:"bottom"}})),(e.scales.yAxes||[]).map((function(t){return{options:t,dtype:"linear",dposition:"left"}})))),e.scale&&i.push({options:e.scale,dtype:"radialLinear",isDefault:!0,dposition:"chartArea"}),V.each(i,(function(e){var i=e.options,r=i.id,o=Ye(i.type,e.dtype);$e(i.position)!==$e(e.dposition)&&(i.position=e.dposition),a[r]=!0;var s=null;if(r in n&&n[r].type===o)(s=n[r]).options=i,s.ctx=t.ctx,s.chart=t;else{var l=Oe.getScaleConstructor(o);if(!l)return;s=new l({id:r,type:o,options:i,ctx:t.ctx,chart:t}),n[s.id]=s}s.mergeTicksOptions(),e.isDefault&&(t.scale=s)})),V.each(a,(function(t,e){t||delete n[e]})),t.scales=n,Oe.addScalesToLayout(this)},buildOrUpdateControllers:function(){var t,e,n=this,i=[],a=n.data.datasets;for(t=0,e=a.length;t=0;--n)this.drawDataset(e[n],t);Le.notify(this,"afterDatasetsDraw",[t])}},drawDataset:function(t,e){var n={meta:t,index:t.index,easingValue:e};!1!==Le.notify(this,"beforeDatasetDraw",[n])&&(t.controller.draw(e),Le.notify(this,"afterDatasetDraw",[n]))},_drawTooltip:function(t){var e=this.tooltip,n={tooltip:e,easingValue:t};!1!==Le.notify(this,"beforeTooltipDraw",[n])&&(e.draw(),Le.notify(this,"afterTooltipDraw",[n]))},getElementAtEvent:function(t){return ae.modes.single(this,t)},getElementsAtEvent:function(t){return ae.modes.label(this,t,{intersect:!0})},getElementsAtXAxis:function(t){return ae.modes["x-axis"](this,t,{intersect:!0})},getElementsAtEventForMode:function(t,e,n){var i=ae.modes[e];return"function"==typeof i?i(this,t,n):[]},getDatasetAtEvent:function(t){return ae.modes.dataset(this,t,{intersect:!0})},getDatasetMeta:function(t){var e=this.data.datasets[t];e._meta||(e._meta={});var n=e._meta[this.id];return n||(n=e._meta[this.id]={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e.order||0,index:t}),n},getVisibleDatasetCount:function(){for(var t=0,e=0,n=this.data.datasets.length;e3?n[2]-n[1]:n[1]-n[0];Math.abs(i)>1&&t!==Math.floor(t)&&(i=t-Math.floor(t));var a=V.log10(Math.abs(i)),r="";if(0!==t)if(Math.max(Math.abs(n[0]),Math.abs(n[n.length-1]))<1e-4){var o=V.log10(Math.abs(t)),s=Math.floor(o)-Math.floor(a);s=Math.max(Math.min(s,20),0),r=t.toExponential(s)}else{var l=-1*Math.floor(a);l=Math.max(Math.min(l,20),0),r=t.toFixed(l)}else r="0";return r},logarithmic:function(t,e,n){var i=t/Math.pow(10,Math.floor(V.log10(t)));return 0===t?"0":1===i||2===i||5===i||0===e||e===n.length-1?t.toExponential():""}}},on=V.isArray,sn=V.isNullOrUndef,ln=V.valueOrDefault,un=V.valueAtIndexOrDefault;function dn(t,e,n){var i,a=t.getTicks().length,r=Math.min(e,a-1),o=t.getPixelForTick(r),s=t._startPixel,l=t._endPixel;if(!(n&&(i=1===a?Math.max(o-s,l-o):0===e?(t.getPixelForTick(1)-o)/2:(o-t.getPixelForTick(r-1))/2,(o+=rl+1e-6)))return o}function hn(t,e,n,i){var a,r,o,s,l,u,d,h,c,f,g,p,m,v=n.length,b=[],x=[],y=[];for(a=0;ae){for(n=0;n=c||d<=1||!s.isHorizontal()?s.labelRotation=h:(e=(t=s._getLabelSizes()).widest.width,n=t.highest.height-t.highest.offset,i=Math.min(s.maxWidth,s.chart.width-e),e+6>(a=l.offset?s.maxWidth/d:i/(d-1))&&(a=i/(d-(l.offset?.5:1)),r=s.maxHeight-cn(l.gridLines)-u.padding-fn(l.scaleLabel),o=Math.sqrt(e*e+n*n),f=V.toDegrees(Math.min(Math.asin(Math.min((t.highest.height+6)/a,1)),Math.asin(Math.min(r/o,1))-Math.asin(n/o))),f=Math.max(h,Math.min(c,f))),s.labelRotation=f)},afterCalculateTickRotation:function(){V.callback(this.options.afterCalculateTickRotation,[this])},beforeFit:function(){V.callback(this.options.beforeFit,[this])},fit:function(){var t=this,e=t.minSize={width:0,height:0},n=t.chart,i=t.options,a=i.ticks,r=i.scaleLabel,o=i.gridLines,s=t._isVisible(),l="bottom"===i.position,u=t.isHorizontal();if(u?e.width=t.maxWidth:s&&(e.width=cn(o)+fn(r)),u?s&&(e.height=cn(o)+fn(r)):e.height=t.maxHeight,a.display&&s){var d=pn(a),h=t._getLabelSizes(),c=h.first,f=h.last,g=h.widest,p=h.highest,m=.4*d.minor.lineHeight,v=a.padding;if(u){var b=0!==t.labelRotation,x=V.toRadians(t.labelRotation),y=Math.cos(x),_=Math.sin(x),k=_*g.width+y*(p.height-(b?p.offset:0))+(b?0:m);e.height=Math.min(t.maxHeight,e.height+k+v);var w,M,S=t.getPixelForTick(0)-t.left,C=t.right-t.getPixelForTick(t.getTicks().length-1);b?(w=l?y*c.width+_*c.offset:_*(c.height-c.offset),M=l?_*(f.height-f.offset):y*f.width+_*f.offset):(w=c.width/2,M=f.width/2),t.paddingLeft=Math.max((w-S)*t.width/(t.width-S),0)+3,t.paddingRight=Math.max((M-C)*t.width/(t.width-C),0)+3}else{var P=a.mirror?0:g.width+v+m;e.width=Math.min(t.maxWidth,e.width+P),t.paddingTop=c.height/2,t.paddingBottom=f.height/2}}t.handleMargins(),u?(t.width=t._length=n.width-t.margins.left-t.margins.right,t.height=e.height):(t.width=e.width,t.height=t._length=n.height-t.margins.top-t.margins.bottom)},handleMargins:function(){var t=this;t.margins&&(t.margins.left=Math.max(t.paddingLeft,t.margins.left),t.margins.top=Math.max(t.paddingTop,t.margins.top),t.margins.right=Math.max(t.paddingRight,t.margins.right),t.margins.bottom=Math.max(t.paddingBottom,t.margins.bottom))},afterFit:function(){V.callback(this.options.afterFit,[this])},isHorizontal:function(){var t=this.options.position;return"top"===t||"bottom"===t},isFullWidth:function(){return this.options.fullWidth},getRightValue:function(t){if(sn(t))return NaN;if(("number"==typeof t||t instanceof Number)&&!isFinite(t))return NaN;if(t)if(this.isHorizontal()){if(void 0!==t.x)return this.getRightValue(t.x)}else if(void 0!==t.y)return this.getRightValue(t.y);return t},_convertTicksToLabels:function(t){var e,n,i,a=this;for(a.ticks=t.map((function(t){return t.value})),a.beforeTickToLabelConversion(),e=a.convertTicksToLabels(t)||a.ticks,a.afterTickToLabelConversion(),n=0,i=t.length;nn-1?null:this.getPixelForDecimal(t*i+(e?i/2:0))},getPixelForDecimal:function(t){return this._reversePixels&&(t=1-t),this._startPixel+t*this._length},getDecimalForPixel:function(t){var e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e},getBasePixel:function(){return this.getPixelForValue(this.getBaseValue())},getBaseValue:function(){var t=this.min,e=this.max;return this.beginAtZero?0:t<0&&e<0?e:t>0&&e>0?t:0},_autoSkip:function(t){var e,n,i,a,r=this.options.ticks,o=this._length,s=r.maxTicksLimit||o/this._tickSize()+1,l=r.major.enabled?function(t){var e,n,i=[];for(e=0,n=t.length;es)return function(t,e,n){var i,a,r=0,o=e[0];for(n=Math.ceil(n),i=0;iu)return r;return Math.max(u,1)}(l,t,0,s),u>0){for(e=0,n=u-1;e1?(h-d)/(u-1):null,vn(t,i,V.isNullOrUndef(a)?0:d-a,d),vn(t,i,h,V.isNullOrUndef(a)?t.length:h+a),mn(t)}return vn(t,i),mn(t)},_tickSize:function(){var t=this.options.ticks,e=V.toRadians(this.labelRotation),n=Math.abs(Math.cos(e)),i=Math.abs(Math.sin(e)),a=this._getLabelSizes(),r=t.autoSkipPadding||0,o=a?a.widest.width+r:0,s=a?a.highest.height+r:0;return this.isHorizontal()?s*n>o*i?o/n:s/i:s*i=0&&(o=t),void 0!==r&&(t=n.indexOf(r))>=0&&(s=t),e.minIndex=o,e.maxIndex=s,e.min=n[o],e.max=n[s]},buildTicks:function(){var t=this._getLabels(),e=this.minIndex,n=this.maxIndex;this.ticks=0===e&&n===t.length-1?t:t.slice(e,n+1)},getLabelForIndex:function(t,e){var n=this.chart;return n.getDatasetMeta(e).controller._getValueScaleId()===this.id?this.getRightValue(n.data.datasets[e].data[t]):this._getLabels()[t]},_configure:function(){var t=this,e=t.options.offset,n=t.ticks;xn.prototype._configure.call(t),t.isHorizontal()||(t._reversePixels=!t._reversePixels),n&&(t._startValue=t.minIndex-(e?.5:0),t._valueRange=Math.max(n.length-(e?0:1),1))},getPixelForValue:function(t,e,n){var i,a,r,o=this;return yn(e)||yn(n)||(t=o.chart.data.datasets[n].data[e]),yn(t)||(i=o.isHorizontal()?t.x:t.y),(void 0!==i||void 0!==t&&isNaN(e))&&(a=o._getLabels(),t=V.valueOrDefault(i,t),e=-1!==(r=a.indexOf(t))?r:e,isNaN(e)&&(e=t)),o.getPixelForDecimal((e-o._startValue)/o._valueRange)},getPixelForTick:function(t){var e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t],t+this.minIndex)},getValueForPixel:function(t){var e=Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange);return Math.min(Math.max(e,0),this.ticks.length-1)},getBasePixel:function(){return this.bottom}}),kn={position:"bottom"};_n._defaults=kn;var wn=V.noop,Mn=V.isNullOrUndef;var Sn=xn.extend({getRightValue:function(t){return"string"==typeof t?+t:xn.prototype.getRightValue.call(this,t)},handleTickRangeOptions:function(){var t=this,e=t.options.ticks;if(e.beginAtZero){var n=V.sign(t.min),i=V.sign(t.max);n<0&&i<0?t.max=0:n>0&&i>0&&(t.min=0)}var a=void 0!==e.min||void 0!==e.suggestedMin,r=void 0!==e.max||void 0!==e.suggestedMax;void 0!==e.min?t.min=e.min:void 0!==e.suggestedMin&&(null===t.min?t.min=e.suggestedMin:t.min=Math.min(t.min,e.suggestedMin)),void 0!==e.max?t.max=e.max:void 0!==e.suggestedMax&&(null===t.max?t.max=e.suggestedMax:t.max=Math.max(t.max,e.suggestedMax)),a!==r&&t.min>=t.max&&(a?t.max=t.min+1:t.min=t.max-1),t.min===t.max&&(t.max++,e.beginAtZero||t.min--)},getTickLimit:function(){var t,e=this.options.ticks,n=e.stepSize,i=e.maxTicksLimit;return n?t=Math.ceil(this.max/n)-Math.floor(this.min/n)+1:(t=this._computeTickLimit(),i=i||11),i&&(t=Math.min(i,t)),t},_computeTickLimit:function(){return Number.POSITIVE_INFINITY},handleDirectionalChanges:wn,buildTicks:function(){var t=this,e=t.options.ticks,n=t.getTickLimit(),i={maxTicks:n=Math.max(2,n),min:e.min,max:e.max,precision:e.precision,stepSize:V.valueOrDefault(e.fixedStepSize,e.stepSize)},a=t.ticks=function(t,e){var n,i,a,r,o=[],s=t.stepSize,l=s||1,u=t.maxTicks-1,d=t.min,h=t.max,c=t.precision,f=e.min,g=e.max,p=V.niceNum((g-f)/u/l)*l;if(p<1e-14&&Mn(d)&&Mn(h))return[f,g];(r=Math.ceil(g/p)-Math.floor(f/p))>u&&(p=V.niceNum(r*p/u/l)*l),s||Mn(c)?n=Math.pow(10,V._decimalPlaces(p)):(n=Math.pow(10,c),p=Math.ceil(p*n)/n),i=Math.floor(f/p)*p,a=Math.ceil(g/p)*p,s&&(!Mn(d)&&V.almostWhole(d/p,p/1e3)&&(i=d),!Mn(h)&&V.almostWhole(h/p,p/1e3)&&(a=h)),r=(a-i)/p,r=V.almostEquals(r,Math.round(r),p/1e3)?Math.round(r):Math.ceil(r),i=Math.round(i*n)/n,a=Math.round(a*n)/n,o.push(Mn(d)?i:d);for(var m=1;me.length-1?null:this.getPixelForValue(e[t])}}),Tn=Cn;Dn._defaults=Tn;var In=V.valueOrDefault,Fn=V.math.log10;var Ln={position:"left",ticks:{callback:rn.formatters.logarithmic}};function On(t,e){return V.isFinite(t)&&t>=0?t:e}var Rn=xn.extend({determineDataLimits:function(){var t,e,n,i,a,r,o=this,s=o.options,l=o.chart,u=l.data.datasets,d=o.isHorizontal();function h(t){return d?t.xAxisID===o.id:t.yAxisID===o.id}o.min=Number.POSITIVE_INFINITY,o.max=Number.NEGATIVE_INFINITY,o.minNotZero=Number.POSITIVE_INFINITY;var c=s.stacked;if(void 0===c)for(t=0;t0){var e=V.min(t),n=V.max(t);o.min=Math.min(o.min,e),o.max=Math.max(o.max,n)}}))}else for(t=0;t0?t.minNotZero=t.min:t.max<1?t.minNotZero=Math.pow(10,Math.floor(Fn(t.max))):t.minNotZero=1)},buildTicks:function(){var t=this,e=t.options.ticks,n=!t.isHorizontal(),i={min:On(e.min),max:On(e.max)},a=t.ticks=function(t,e){var n,i,a=[],r=In(t.min,Math.pow(10,Math.floor(Fn(e.min)))),o=Math.floor(Fn(e.max)),s=Math.ceil(e.max/Math.pow(10,o));0===r?(n=Math.floor(Fn(e.minNotZero)),i=Math.floor(e.minNotZero/Math.pow(10,n)),a.push(r),r=i*Math.pow(10,n)):(n=Math.floor(Fn(r)),i=Math.floor(r/Math.pow(10,n)));var l=n<0?Math.pow(10,Math.abs(n)):1;do{a.push(r),10===++i&&(i=1,l=++n>=0?1:l),r=Math.round(i*Math.pow(10,n)*l)/l}while(ne.length-1?null:this.getPixelForValue(e[t])},_getFirstTickValue:function(t){var e=Math.floor(Fn(t));return Math.floor(t/Math.pow(10,e))*Math.pow(10,e)},_configure:function(){var t=this,e=t.min,n=0;xn.prototype._configure.call(t),0===e&&(e=t._getFirstTickValue(t.minNotZero),n=In(t.options.ticks.fontSize,z.global.defaultFontSize)/t._length),t._startValue=Fn(e),t._valueOffset=n,t._valueRange=(Fn(t.max)-Fn(e))/(1-n)},getPixelForValue:function(t){var e=this,n=0;return(t=+e.getRightValue(t))>e.min&&t>0&&(n=(Fn(t)-e._startValue)/e._valueRange+e._valueOffset),e.getPixelForDecimal(n)},getValueForPixel:function(t){var e=this,n=e.getDecimalForPixel(t);return 0===n&&0===e.min?0:Math.pow(10,e._startValue+(n-e._valueOffset)*e._valueRange)}}),zn=Ln;Rn._defaults=zn;var Nn=V.valueOrDefault,Bn=V.valueAtIndexOrDefault,En=V.options.resolve,Wn={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,color:"rgba(0,0,0,0.1)",lineWidth:1,borderDash:[],borderDashOffset:0},gridLines:{circular:!1},ticks:{showLabelBackdrop:!0,backdropColor:"rgba(255,255,255,0.75)",backdropPaddingY:2,backdropPaddingX:2,callback:rn.formatters.linear},pointLabels:{display:!0,fontSize:10,callback:function(t){return t}}};function Vn(t){var e=t.ticks;return e.display&&t.display?Nn(e.fontSize,z.global.defaultFontSize)+2*e.backdropPaddingY:0}function Hn(t,e,n,i,a){return t===i||t===a?{start:e-n/2,end:e+n/2}:ta?{start:e-n,end:e}:{start:e,end:e+n}}function jn(t){return 0===t||180===t?"center":t<180?"left":"right"}function qn(t,e,n,i){var a,r,o=n.y+i/2;if(V.isArray(e))for(a=0,r=e.length;a270||t<90)&&(n.y-=e.h)}function Yn(t){return V.isNumber(t)?t:0}var Gn=Sn.extend({setDimensions:function(){var t=this;t.width=t.maxWidth,t.height=t.maxHeight,t.paddingTop=Vn(t.options)/2,t.xCenter=Math.floor(t.width/2),t.yCenter=Math.floor((t.height-t.paddingTop)/2),t.drawingArea=Math.min(t.height-t.paddingTop,t.width)/2},determineDataLimits:function(){var t=this,e=t.chart,n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;V.each(e.data.datasets,(function(a,r){if(e.isDatasetVisible(r)){var o=e.getDatasetMeta(r);V.each(a.data,(function(e,a){var r=+t.getRightValue(e);isNaN(r)||o.data[a].hidden||(n=Math.min(r,n),i=Math.max(r,i))}))}})),t.min=n===Number.POSITIVE_INFINITY?0:n,t.max=i===Number.NEGATIVE_INFINITY?0:i,t.handleTickRangeOptions()},_computeTickLimit:function(){return Math.ceil(this.drawingArea/Vn(this.options))},convertTicksToLabels:function(){var t=this;Sn.prototype.convertTicksToLabels.call(t),t.pointLabels=t.chart.data.labels.map((function(){var e=V.callback(t.options.pointLabels.callback,arguments,t);return e||0===e?e:""}))},getLabelForIndex:function(t,e){return+this.getRightValue(this.chart.data.datasets[e].data[t])},fit:function(){var t=this.options;t.display&&t.pointLabels.display?function(t){var e,n,i,a=V.options._parseFont(t.options.pointLabels),r={l:0,r:t.width,t:0,b:t.height-t.paddingTop},o={};t.ctx.font=a.string,t._pointLabelSizes=[];var s,l,u,d=t.chart.data.labels.length;for(e=0;er.r&&(r.r=f.end,o.r=h),g.startr.b&&(r.b=g.end,o.b=h)}t.setReductions(t.drawingArea,r,o)}(this):this.setCenterPoint(0,0,0,0)},setReductions:function(t,e,n){var i=this,a=e.l/Math.sin(n.l),r=Math.max(e.r-i.width,0)/Math.sin(n.r),o=-e.t/Math.cos(n.t),s=-Math.max(e.b-(i.height-i.paddingTop),0)/Math.cos(n.b);a=Yn(a),r=Yn(r),o=Yn(o),s=Yn(s),i.drawingArea=Math.min(Math.floor(t-(a+r)/2),Math.floor(t-(o+s)/2)),i.setCenterPoint(a,r,o,s)},setCenterPoint:function(t,e,n,i){var a=this,r=a.width-e-a.drawingArea,o=t+a.drawingArea,s=n+a.drawingArea,l=a.height-a.paddingTop-i-a.drawingArea;a.xCenter=Math.floor((o+r)/2+a.left),a.yCenter=Math.floor((s+l)/2+a.top+a.paddingTop)},getIndexAngle:function(t){var e=this.chart,n=(t*(360/e.data.labels.length)+((e.options||{}).startAngle||0))%360;return(n<0?n+360:n)*Math.PI*2/360},getDistanceFromCenterForValue:function(t){var e=this;if(V.isNullOrUndef(t))return NaN;var n=e.drawingArea/(e.max-e.min);return e.options.ticks.reverse?(e.max-t)*n:(t-e.min)*n},getPointPosition:function(t,e){var n=this.getIndexAngle(t)-Math.PI/2;return{x:Math.cos(n)*e+this.xCenter,y:Math.sin(n)*e+this.yCenter}},getPointPositionForValue:function(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))},getBasePosition:function(t){var e=this.min,n=this.max;return this.getPointPositionForValue(t||0,this.beginAtZero?0:e<0&&n<0?n:e>0&&n>0?e:0)},_drawGrid:function(){var t,e,n,i=this,a=i.ctx,r=i.options,o=r.gridLines,s=r.angleLines,l=Nn(s.lineWidth,o.lineWidth),u=Nn(s.color,o.color);if(r.pointLabels.display&&function(t){var e=t.ctx,n=t.options,i=n.pointLabels,a=Vn(n),r=t.getDistanceFromCenterForValue(n.ticks.reverse?t.min:t.max),o=V.options._parseFont(i);e.save(),e.font=o.string,e.textBaseline="middle";for(var s=t.chart.data.labels.length-1;s>=0;s--){var l=0===s?a/2:0,u=t.getPointPosition(s,r+l+5),d=Bn(i.fontColor,s,z.global.defaultFontColor);e.fillStyle=d;var h=t.getIndexAngle(s),c=V.toDegrees(h);e.textAlign=jn(c),Un(c,t._pointLabelSizes[s],u),qn(e,t.pointLabels[s],u,o.lineHeight)}e.restore()}(i),o.display&&V.each(i.ticks,(function(t,n){0!==n&&(e=i.getDistanceFromCenterForValue(i.ticksAsNumbers[n]),function(t,e,n,i){var a,r=t.ctx,o=e.circular,s=t.chart.data.labels.length,l=Bn(e.color,i-1),u=Bn(e.lineWidth,i-1);if((o||s)&&l&&u){if(r.save(),r.strokeStyle=l,r.lineWidth=u,r.setLineDash&&(r.setLineDash(e.borderDash||[]),r.lineDashOffset=e.borderDashOffset||0),r.beginPath(),o)r.arc(t.xCenter,t.yCenter,n,0,2*Math.PI);else{a=t.getPointPosition(0,n),r.moveTo(a.x,a.y);for(var d=1;d=0;t--)e=i.getDistanceFromCenterForValue(r.ticks.reverse?i.min:i.max),n=i.getPointPosition(t,e),a.beginPath(),a.moveTo(i.xCenter,i.yCenter),a.lineTo(n.x,n.y),a.stroke();a.restore()}},_drawLabels:function(){var t=this,e=t.ctx,n=t.options.ticks;if(n.display){var i,a,r=t.getIndexAngle(0),o=V.options._parseFont(n),s=Nn(n.fontColor,z.global.defaultFontColor);e.save(),e.font=o.string,e.translate(t.xCenter,t.yCenter),e.rotate(r),e.textAlign="center",e.textBaseline="middle",V.each(t.ticks,(function(r,l){(0!==l||n.reverse)&&(i=t.getDistanceFromCenterForValue(t.ticksAsNumbers[l]),n.showLabelBackdrop&&(a=e.measureText(r).width,e.fillStyle=n.backdropColor,e.fillRect(-a/2-n.backdropPaddingX,-i-o.size/2-n.backdropPaddingY,a+2*n.backdropPaddingX,o.size+2*n.backdropPaddingY)),e.fillStyle=s,e.fillText(r,0,-i))})),e.restore()}},_drawTitle:V.noop}),Xn=Wn;Gn._defaults=Xn;var Kn=V._deprecated,Zn=V.options.resolve,$n=V.valueOrDefault,Jn=Number.MIN_SAFE_INTEGER||-9007199254740991,Qn=Number.MAX_SAFE_INTEGER||9007199254740991,ti={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},ei=Object.keys(ti);function ni(t,e){return t-e}function ii(t){return V.valueOrDefault(t.time.min,t.ticks.min)}function ai(t){return V.valueOrDefault(t.time.max,t.ticks.max)}function ri(t,e,n,i){var a=function(t,e,n){for(var i,a,r,o=0,s=t.length-1;o>=0&&o<=s;){if(a=t[(i=o+s>>1)-1]||null,r=t[i],!a)return{lo:null,hi:r};if(r[e]n))return{lo:a,hi:r};s=i-1}}return{lo:r,hi:null}}(t,e,n),r=a.lo?a.hi?a.lo:t[t.length-2]:t[0],o=a.lo?a.hi?a.hi:t[t.length-1]:t[1],s=o[e]-r[e],l=s?(n-r[e])/s:0,u=(o[i]-r[i])*l;return r[i]+u}function oi(t,e){var n=t._adapter,i=t.options.time,a=i.parser,r=a||i.format,o=e;return"function"==typeof a&&(o=a(o)),V.isFinite(o)||(o="string"==typeof r?n.parse(o,r):n.parse(o)),null!==o?+o:(a||"function"!=typeof r||(o=r(e),V.isFinite(o)||(o=n.parse(o))),o)}function si(t,e){if(V.isNullOrUndef(e))return null;var n=t.options.time,i=oi(t,t.getRightValue(e));return null===i?i:(n.round&&(i=+t._adapter.startOf(i,n.round)),i)}function li(t,e,n,i){var a,r,o,s=ei.length;for(a=ei.indexOf(t);a=0&&(e[r].major=!0);return e}(t,r,o,n):r}var di=xn.extend({initialize:function(){this.mergeTicksOptions(),xn.prototype.initialize.call(this)},update:function(){var t=this,e=t.options,n=e.time||(e.time={}),i=t._adapter=new an._date(e.adapters.date);return Kn("time scale",n.format,"time.format","time.parser"),Kn("time scale",n.min,"time.min","ticks.min"),Kn("time scale",n.max,"time.max","ticks.max"),V.mergeIf(n.displayFormats,i.formats()),xn.prototype.update.apply(t,arguments)},getRightValue:function(t){return t&&void 0!==t.t&&(t=t.t),xn.prototype.getRightValue.call(this,t)},determineDataLimits:function(){var t,e,n,i,a,r,o,s=this,l=s.chart,u=s._adapter,d=s.options,h=d.time.unit||"day",c=Qn,f=Jn,g=[],p=[],m=[],v=s._getLabels();for(t=0,n=v.length;t1?function(t){var e,n,i,a={},r=[];for(e=0,n=t.length;e1e5*u)throw e+" and "+n+" are too far apart with stepSize of "+u+" "+l;for(a=h;a=a&&n<=r&&d.push(n);return i.min=a,i.max=r,i._unit=l.unit||(s.autoSkip?li(l.minUnit,i.min,i.max,h):function(t,e,n,i,a){var r,o;for(r=ei.length-1;r>=ei.indexOf(n);r--)if(o=ei[r],ti[o].common&&t._adapter.diff(a,i,o)>=e-1)return o;return ei[n?ei.indexOf(n):0]}(i,d.length,l.minUnit,i.min,i.max)),i._majorUnit=s.major.enabled&&"year"!==i._unit?function(t){for(var e=ei.indexOf(t)+1,n=ei.length;ee&&s=0&&t0?s:1}}),hi={position:"bottom",distribution:"linear",bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,displayFormat:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{autoSkip:!1,source:"auto",major:{enabled:!1}}};di._defaults=hi;var ci={category:_n,linear:Dn,logarithmic:Rn,radialLinear:Gn,time:di},fi={datetime:"MMM D, YYYY, h:mm:ss a",millisecond:"h:mm:ss.SSS a",second:"h:mm:ss a",minute:"h:mm a",hour:"hA",day:"MMM D",week:"ll",month:"MMM YYYY",quarter:"[Q]Q - YYYY",year:"YYYY"};an._date.override("function"==typeof t?{_id:"moment",formats:function(){return fi},parse:function(e,n){return"string"==typeof e&&"string"==typeof n?e=t(e,n):e instanceof t||(e=t(e)),e.isValid()?e.valueOf():null},format:function(e,n){return t(e).format(n)},add:function(e,n,i){return t(e).add(n,i).valueOf()},diff:function(e,n,i){return t(e).diff(t(n),i)},startOf:function(e,n,i){return e=t(e),"isoWeek"===n?e.isoWeekday(i).valueOf():e.startOf(n).valueOf()},endOf:function(e,n){return t(e).endOf(n).valueOf()},_create:function(e){return t(e)}}:{}),z._set("global",{plugins:{filler:{propagate:!0}}});var gi={dataset:function(t){var e=t.fill,n=t.chart,i=n.getDatasetMeta(e),a=i&&n.isDatasetVisible(e)&&i.dataset._children||[],r=a.length||0;return r?function(t,e){return e=n)&&i;switch(r){case"bottom":return"start";case"top":return"end";case"zero":return"origin";case"origin":case"start":case"end":return r;default:return!1}}function mi(t){return(t.el._scale||{}).getPointPositionForValue?function(t){var e,n,i,a,r,o=t.el._scale,s=o.options,l=o.chart.data.labels.length,u=t.fill,d=[];if(!l)return null;for(e=s.ticks.reverse?o.max:o.min,n=s.ticks.reverse?o.min:o.max,i=o.getPointPositionForValue(0,e),a=0;a0;--r)V.canvas.lineTo(t,n[r],n[r-1],!0);else for(o=n[0].cx,s=n[0].cy,l=Math.sqrt(Math.pow(n[0].x-o,2)+Math.pow(n[0].y-s,2)),r=a-1;r>0;--r)t.arc(o,s,l,n[r].angle,n[r-1].angle,!0)}}function _i(t,e,n,i,a,r){var o,s,l,u,d,h,c,f,g=e.length,p=i.spanGaps,m=[],v=[],b=0,x=0;for(t.beginPath(),o=0,s=g;o=0;--n)(e=l[n].$filler)&&e.visible&&(a=(i=e.el)._view,r=i._children||[],o=e.mapper,s=a.backgroundColor||z.global.defaultColor,o&&s&&r.length&&(V.canvas.clipArea(u,t.chartArea),_i(u,r,o,a,s,i._loop),V.canvas.unclipArea(u)))}},wi=V.rtl.getRtlAdapter,Mi=V.noop,Si=V.valueOrDefault;function Ci(t,e){return t.usePointStyle&&t.boxWidth>e?e:t.boxWidth}z._set("global",{legend:{display:!0,position:"top",align:"center",fullWidth:!0,reverse:!1,weight:1e3,onClick:function(t,e){var n=e.datasetIndex,i=this.chart,a=i.getDatasetMeta(n);a.hidden=null===a.hidden?!i.data.datasets[n].hidden:null,i.update()},onHover:null,onLeave:null,labels:{boxWidth:40,padding:10,generateLabels:function(t){var e=t.data.datasets,n=t.options.legend||{},i=n.labels&&n.labels.usePointStyle;return t._getSortedDatasetMetas().map((function(n){var a=n.controller.getStyle(i?0:void 0);return{text:e[n.index].label,fillStyle:a.backgroundColor,hidden:!t.isDatasetVisible(n.index),lineCap:a.borderCapStyle,lineDash:a.borderDash,lineDashOffset:a.borderDashOffset,lineJoin:a.borderJoinStyle,lineWidth:a.borderWidth,strokeStyle:a.borderColor,pointStyle:a.pointStyle,rotation:a.rotation,datasetIndex:n.index}}),this)}}},legendCallback:function(t){var e,n,i,a=document.createElement("ul"),r=t.data.datasets;for(a.setAttribute("class",t.id+"-legend"),e=0,n=r.length;el.width)&&(h+=o+n.padding,d[d.length-(e>0?0:1)]=0),s[e]={left:0,top:0,width:i,height:o},d[d.length-1]+=i+n.padding})),l.height+=h}else{var c=n.padding,f=t.columnWidths=[],g=t.columnHeights=[],p=n.padding,m=0,v=0;V.each(t.legendItems,(function(t,e){var i=Ci(n,o)+o/2+a.measureText(t.text).width;e>0&&v+o+2*c>l.height&&(p+=m+n.padding,f.push(m),g.push(v),m=0,v=0),m=Math.max(m,i),v+=o+c,s[e]={left:0,top:0,width:i,height:o}})),p+=m,f.push(m),g.push(v),l.width+=p}t.width=l.width,t.height=l.height}else t.width=l.width=t.height=l.height=0},afterFit:Mi,isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},draw:function(){var t=this,e=t.options,n=e.labels,i=z.global,a=i.defaultColor,r=i.elements.line,o=t.height,s=t.columnHeights,l=t.width,u=t.lineWidths;if(e.display){var d,h=wi(e.rtl,t.left,t.minSize.width),c=t.ctx,f=Si(n.fontColor,i.defaultFontColor),g=V.options._parseFont(n),p=g.size;c.textAlign=h.textAlign("left"),c.textBaseline="middle",c.lineWidth=.5,c.strokeStyle=f,c.fillStyle=f,c.font=g.string;var m=Ci(n,p),v=t.legendHitBoxes,b=function(t,i){switch(e.align){case"start":return n.padding;case"end":return t-i;default:return(t-i+n.padding)/2}},x=t.isHorizontal();d=x?{x:t.left+b(l,u[0]),y:t.top+n.padding,line:0}:{x:t.left+n.padding,y:t.top+b(o,s[0]),line:0},V.rtl.overrideTextDirection(t.ctx,e.textDirection);var y=p+n.padding;V.each(t.legendItems,(function(e,i){var f=c.measureText(e.text).width,g=m+p/2+f,_=d.x,k=d.y;h.setWidth(t.minSize.width),x?i>0&&_+g+n.padding>t.left+t.minSize.width&&(k=d.y+=y,d.line++,_=d.x=t.left+b(l,u[d.line])):i>0&&k+y>t.top+t.minSize.height&&(_=d.x=_+t.columnWidths[d.line]+n.padding,d.line++,k=d.y=t.top+b(o,s[d.line]));var w=h.x(_);!function(t,e,i){if(!(isNaN(m)||m<=0)){c.save();var o=Si(i.lineWidth,r.borderWidth);if(c.fillStyle=Si(i.fillStyle,a),c.lineCap=Si(i.lineCap,r.borderCapStyle),c.lineDashOffset=Si(i.lineDashOffset,r.borderDashOffset),c.lineJoin=Si(i.lineJoin,r.borderJoinStyle),c.lineWidth=o,c.strokeStyle=Si(i.strokeStyle,a),c.setLineDash&&c.setLineDash(Si(i.lineDash,r.borderDash)),n&&n.usePointStyle){var s=m*Math.SQRT2/2,l=h.xPlus(t,m/2),u=e+p/2;V.canvas.drawPoint(c,i.pointStyle,s,l,u,i.rotation)}else c.fillRect(h.leftForLtr(t,m),e,m,p),0!==o&&c.strokeRect(h.leftForLtr(t,m),e,m,p);c.restore()}}(w,k,e),v[i].left=h.leftForLtr(w,v[i].width),v[i].top=k,function(t,e,n,i){var a=p/2,r=h.xPlus(t,m+a),o=e+a;c.fillText(n.text,r,o),n.hidden&&(c.beginPath(),c.lineWidth=2,c.moveTo(r,o),c.lineTo(h.xPlus(r,i),o),c.stroke())}(w,k,e,f),x?d.x+=g+n.padding:d.y+=y})),V.rtl.restoreTextDirection(t.ctx,e.textDirection)}},_getLegendItemAt:function(t,e){var n,i,a,r=this;if(t>=r.left&&t<=r.right&&e>=r.top&&e<=r.bottom)for(a=r.legendHitBoxes,n=0;n=(i=a[n]).left&&t<=i.left+i.width&&e>=i.top&&e<=i.top+i.height)return r.legendItems[n];return null},handleEvent:function(t){var e,n=this,i=n.options,a="mouseup"===t.type?"click":t.type;if("mousemove"===a){if(!i.onHover&&!i.onLeave)return}else{if("click"!==a)return;if(!i.onClick)return}e=n._getLegendItemAt(t.x,t.y),"click"===a?e&&i.onClick&&i.onClick.call(n,t.native,e):(i.onLeave&&e!==n._hoveredItem&&(n._hoveredItem&&i.onLeave.call(n,t.native,n._hoveredItem),n._hoveredItem=e),i.onHover&&e&&i.onHover.call(n,t.native,e))}});function Ai(t,e){var n=new Pi({ctx:t.ctx,options:e,chart:t});ge.configure(t,n,e),ge.addBox(t,n),t.legend=n}var Di={id:"legend",_element:Pi,beforeInit:function(t){var e=t.options.legend;e&&Ai(t,e)},beforeUpdate:function(t){var e=t.options.legend,n=t.legend;e?(V.mergeIf(e,z.global.legend),n?(ge.configure(t,n,e),n.options=e):Ai(t,e)):n&&(ge.removeBox(t,n),delete t.legend)},afterEvent:function(t,e){var n=t.legend;n&&n.handleEvent(e)}},Ti=V.noop;z._set("global",{title:{display:!1,fontStyle:"bold",fullWidth:!0,padding:10,position:"top",text:"",weight:2e3}});var Ii=X.extend({initialize:function(t){V.extend(this,t),this.legendHitBoxes=[]},beforeUpdate:Ti,update:function(t,e,n){var i=this;return i.beforeUpdate(),i.maxWidth=t,i.maxHeight=e,i.margins=n,i.beforeSetDimensions(),i.setDimensions(),i.afterSetDimensions(),i.beforeBuildLabels(),i.buildLabels(),i.afterBuildLabels(),i.beforeFit(),i.fit(),i.afterFit(),i.afterUpdate(),i.minSize},afterUpdate:Ti,beforeSetDimensions:Ti,setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0,t.minSize={width:0,height:0}},afterSetDimensions:Ti,beforeBuildLabels:Ti,buildLabels:Ti,afterBuildLabels:Ti,beforeFit:Ti,fit:function(){var t,e=this,n=e.options,i=e.minSize={},a=e.isHorizontal();n.display?(t=(V.isArray(n.text)?n.text.length:1)*V.options._parseFont(n).lineHeight+2*n.padding,e.width=i.width=a?e.maxWidth:t,e.height=i.height=a?t:e.maxHeight):e.width=i.width=e.height=i.height=0},afterFit:Ti,isHorizontal:function(){var t=this.options.position;return"top"===t||"bottom"===t},draw:function(){var t=this,e=t.ctx,n=t.options;if(n.display){var i,a,r,o=V.options._parseFont(n),s=o.lineHeight,l=s/2+n.padding,u=0,d=t.top,h=t.left,c=t.bottom,f=t.right;e.fillStyle=V.valueOrDefault(n.fontColor,z.global.defaultFontColor),e.font=o.string,t.isHorizontal()?(a=h+(f-h)/2,r=d+l,i=f-h):(a="left"===n.position?h+l:f-l,r=d+(c-d)/2,i=c-d,u=Math.PI*("left"===n.position?-.5:.5)),e.save(),e.translate(a,r),e.rotate(u),e.textAlign="center",e.textBaseline="middle";var g=n.text;if(V.isArray(g))for(var p=0,m=0;m=0;i--){var a=t[i];if(e(a))return a}},V.isNumber=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},V.almostEquals=function(t,e,n){return Math.abs(t-e)=t},V.max=function(t){return t.reduce((function(t,e){return isNaN(e)?t:Math.max(t,e)}),Number.NEGATIVE_INFINITY)},V.min=function(t){return t.reduce((function(t,e){return isNaN(e)?t:Math.min(t,e)}),Number.POSITIVE_INFINITY)},V.sign=Math.sign?function(t){return Math.sign(t)}:function(t){return 0===(t=+t)||isNaN(t)?t:t>0?1:-1},V.toRadians=function(t){return t*(Math.PI/180)},V.toDegrees=function(t){return t*(180/Math.PI)},V._decimalPlaces=function(t){if(V.isFinite(t)){for(var e=1,n=0;Math.round(t*e)/e!==t;)e*=10,n++;return n}},V.getAngleFromPoint=function(t,e){var n=e.x-t.x,i=e.y-t.y,a=Math.sqrt(n*n+i*i),r=Math.atan2(i,n);return r<-.5*Math.PI&&(r+=2*Math.PI),{angle:r,distance:a}},V.distanceBetweenPoints=function(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))},V.aliasPixel=function(t){return t%2==0?0:.5},V._alignPixel=function(t,e,n){var i=t.currentDevicePixelRatio,a=n/2;return Math.round((e-a)*i)/i+a},V.splineCurve=function(t,e,n,i){var a=t.skip?e:t,r=e,o=n.skip?e:n,s=Math.sqrt(Math.pow(r.x-a.x,2)+Math.pow(r.y-a.y,2)),l=Math.sqrt(Math.pow(o.x-r.x,2)+Math.pow(o.y-r.y,2)),u=s/(s+l),d=l/(s+l),h=i*(u=isNaN(u)?0:u),c=i*(d=isNaN(d)?0:d);return{previous:{x:r.x-h*(o.x-a.x),y:r.y-h*(o.y-a.y)},next:{x:r.x+c*(o.x-a.x),y:r.y+c*(o.y-a.y)}}},V.EPSILON=Number.EPSILON||1e-14,V.splineCurveMonotone=function(t){var e,n,i,a,r,o,s,l,u,d=(t||[]).map((function(t){return{model:t._model,deltaK:0,mK:0}})),h=d.length;for(e=0;e0?d[e-1]:null,(a=e0?d[e-1]:null,a=e=t.length-1?t[0]:t[e+1]:e>=t.length-1?t[t.length-1]:t[e+1]},V.previousItem=function(t,e,n){return n?e<=0?t[t.length-1]:t[e-1]:e<=0?t[0]:t[e-1]},V.niceNum=function(t,e){var n=Math.floor(V.log10(t)),i=t/Math.pow(10,n);return(e?i<1.5?1:i<3?2:i<7?5:10:i<=1?1:i<=2?2:i<=5?5:10)*Math.pow(10,n)},V.requestAnimFrame="undefined"==typeof window?function(t){t()}:window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)},V.getRelativePosition=function(t,e){var n,i,a=t.originalEvent||t,r=t.target||t.srcElement,o=r.getBoundingClientRect(),s=a.touches;s&&s.length>0?(n=s[0].clientX,i=s[0].clientY):(n=a.clientX,i=a.clientY);var l=parseFloat(V.getStyle(r,"padding-left")),u=parseFloat(V.getStyle(r,"padding-top")),d=parseFloat(V.getStyle(r,"padding-right")),h=parseFloat(V.getStyle(r,"padding-bottom")),c=o.right-o.left-l-d,f=o.bottom-o.top-u-h;return{x:n=Math.round((n-o.left-l)/c*r.width/e.currentDevicePixelRatio),y:i=Math.round((i-o.top-u)/f*r.height/e.currentDevicePixelRatio)}},V.getConstraintWidth=function(t){return n(t,"max-width","clientWidth")},V.getConstraintHeight=function(t){return n(t,"max-height","clientHeight")},V._calculatePadding=function(t,e,n){return(e=V.getStyle(t,e)).indexOf("%")>-1?n*parseInt(e,10)/100:parseInt(e,10)},V._getParentNode=function(t){var e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e},V.getMaximumWidth=function(t){var e=V._getParentNode(t);if(!e)return t.clientWidth;var n=e.clientWidth,i=n-V._calculatePadding(e,"padding-left",n)-V._calculatePadding(e,"padding-right",n),a=V.getConstraintWidth(t);return isNaN(a)?i:Math.min(i,a)},V.getMaximumHeight=function(t){var e=V._getParentNode(t);if(!e)return t.clientHeight;var n=e.clientHeight,i=n-V._calculatePadding(e,"padding-top",n)-V._calculatePadding(e,"padding-bottom",n),a=V.getConstraintHeight(t);return isNaN(a)?i:Math.min(i,a)},V.getStyle=function(t,e){return t.currentStyle?t.currentStyle[e]:document.defaultView.getComputedStyle(t,null).getPropertyValue(e)},V.retinaScale=function(t,e){var n=t.currentDevicePixelRatio=e||"undefined"!=typeof window&&window.devicePixelRatio||1;if(1!==n){var i=t.canvas,a=t.height,r=t.width;i.height=a*n,i.width=r*n,t.ctx.scale(n,n),i.style.height||i.style.width||(i.style.height=a+"px",i.style.width=r+"px")}},V.fontString=function(t,e,n){return e+" "+t+"px "+n},V.longestText=function(t,e,n,i){var a=(i=i||{}).data=i.data||{},r=i.garbageCollect=i.garbageCollect||[];i.font!==e&&(a=i.data={},r=i.garbageCollect=[],i.font=e),t.font=e;var o,s,l,u,d,h=0,c=n.length;for(o=0;on.length){for(o=0;oi&&(i=r),i},V.numberOfLabelLines=function(t){var e=1;return V.each(t,(function(t){V.isArray(t)&&t.length>e&&(e=t.length)})),e},V.color=k?function(t){return t instanceof CanvasGradient&&(t=z.global.defaultColor),k(t)}:function(t){return console.error("Color.js not found!"),t},V.getHoverColor=function(t){return t instanceof CanvasPattern||t instanceof CanvasGradient?t:V.color(t).saturate(.5).darken(.1).rgbString()}}(),tn._adapters=an,tn.Animation=Z,tn.animationService=$,tn.controllers=$t,tn.DatasetController=nt,tn.defaults=z,tn.Element=X,tn.elements=_t,tn.Interaction=ae,tn.layouts=ge,tn.platform=Fe,tn.plugins=Le,tn.Scale=xn,tn.scaleService=Oe,tn.Ticks=rn,tn.Tooltip=Ue,tn.helpers.each(ci,(function(t,e){tn.scaleService.registerScaleType(e,t,t._defaults)})),Li)Li.hasOwnProperty(Ni)&&tn.plugins.register(Li[Ni]);tn.platform.initialize();var Bi=tn;return"undefined"!=typeof window&&(window.Chart=tn),tn.Chart=tn,tn.Legend=Li.legend._element,tn.Title=Li.title._element,tn.pluginService=tn.plugins,tn.PluginBase=tn.Element.extend({}),tn.canvasHelpers=tn.helpers.canvas,tn.layoutService=tn.layouts,tn.LinearScaleBase=Sn,tn.helpers.each(["Bar","Bubble","Doughnut","Line","PolarArea","Radar","Scatter"],(function(t){tn[t]=function(e,n){return new tn(e,tn.helpers.merge(n||{},{type:t.charAt(0).toLowerCase()+t.slice(1)}))}})),Bi})); diff --git a/anything/function-plot.js b/anything/function-plot.js new file mode 100644 index 0000000..1b1d956 --- /dev/null +++ b/anything/function-plot.js @@ -0,0 +1 @@ +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.functionPlot=f()}})(function(){var define,module,exports;return function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;igHi){var t=gLo;gLo=gHi;gHi=t}var hi=Math.min(vHi,gHi);var lo=Math.max(vLo,gLo);if(lo>hi){return[-minWidthHeight,0]}return[lo,hi]}var line=function(points,closed){var path="";var range=yScale.range();var minY=Math.min.apply(Math,range);var maxY=Math.max.apply(Math,range);for(var i=0,length=points.length;i path.line").data(evaluatedData);minWidthHeight=Math.max(evaluatedData[0].scaledDx,1);innerSelection.enter().append("path").attr("class","line line-"+index).attr("fill","none");innerSelection.attr("stroke-width",minWidthHeight).attr("stroke",utils.color(d,index)).attr("opacity",closed?.5:1).attr("d",function(d){return line(d,closed)}).attr(d.attr);innerSelection.exit().remove()})}return plotLine}},{"../evaluate":3,"../utils":22}],7:[function(require,module,exports){"use strict";var d3=window.d3;var evaluate=require("../evaluate");var utils=require("../utils");var clamp=require("clamp");module.exports=function(chart){var xScale=chart.meta.xScale;var yScale=chart.meta.yScale;function plotLine(selection){selection.each(function(d){var el=plotLine.el=d3.select(this);var index=d.index;var evaluatedData=evaluate(chart,d);var color=utils.color(d,index);var innerSelection=el.selectAll(":scope > path.line").data(evaluatedData);var yRange=yScale.range();var yMax=yRange[0];var yMin=yRange[1];var diff=yMax-yMin;yMax+=diff*1e6;yMin-=diff*1e6;if(d.skipBoundsCheck){yMax=Infinity;yMin=-Infinity}function y(d){return clamp(yScale(d[1]),yMin,yMax)}var line=d3.svg.line().interpolate("linear").x(function(d){return xScale(d[0])}).y(y);var area=d3.svg.area().x(function(d){return xScale(d[0])}).y0(yScale(0)).y1(y);innerSelection.enter().append("path").attr("class","line line-"+index).attr("stroke-width",1).attr("stroke-linecap","round");innerSelection.each(function(){var path=d3.select(this);var pathD;if(d.closed){path.attr("fill",color);path.attr("fill-opacity",.3);pathD=area}else{path.attr("fill","none");pathD=line}path.attr("stroke",color).attr("marker-end",function(){return d.fnType==="vector"?"url(#"+chart.markerId+")":null}).attr("d",pathD)}).attr(d.attr);innerSelection.exit().remove()})}return plotLine}},{"../evaluate":3,"../utils":22,clamp:29}],8:[function(require,module,exports){"use strict";var d3=window.d3;var evaluate=require("../evaluate");var utils=require("../utils");module.exports=function(chart){var xScale=chart.meta.xScale;var yScale=chart.meta.yScale;function scatter(selection){selection.each(function(d){var i,j;var index=d.index;var color=utils.color(d,index);var evaluatedData=evaluate(chart,d);var joined=[];for(i=0;i circle").data(joined);innerSelection.enter().append("circle");innerSelection.attr("fill",d3.hsl(color.toString()).brighter(1.5)).attr("stroke",color).attr("opacity",.7).attr("r",1).attr("cx",function(d){return xScale(d[0])}).attr("cy",function(d){return yScale(d[1])}).attr(d.attr);innerSelection.exit().remove()})}return scatter}},{"../evaluate":3,"../utils":22}],9:[function(require,module,exports){"use strict";var d3=window.d3;module.exports=function(options){var annotations;var xScale=options.owner.meta.xScale;var yScale=options.owner.meta.yScale;var line=d3.svg.line().x(function(d){return d[0]}).y(function(d){return d[1]});annotations=function(parentSelection){parentSelection.each(function(){var current=d3.select(this);var selection=current.selectAll("g.annotations").data(function(d){return d.annotations||[]});selection.enter().append("g").attr("class","annotations");var yRange=yScale.range();var xRange=xScale.range();var path=selection.selectAll("path").data(function(d){if(d.hasOwnProperty("x")){return[[[0,yRange[0]],[0,yRange[1]]]]}else{return[[[xRange[0],0],[xRange[1],0]]]}});path.enter().append("path").attr("stroke","#eee").attr("d",line);path.exit().remove();var text=selection.selectAll("text").data(function(d){return[{text:d.text||"",hasX:d.hasOwnProperty("x")}]});text.enter().append("text").attr("y",function(d){return d.hasX?3:0}).attr("x",function(d){return d.hasX?0:3}).attr("dy",function(d){return d.hasX?5:-5}).attr("text-anchor",function(d){return d.hasX?"end":""}).attr("transform",function(d){return d.hasX?"rotate(-90)":""}).text(function(d){return d.text});text.exit().remove();selection.attr("transform",function(d){if(d.hasOwnProperty("x")){return"translate("+xScale(d.x)+", 0)"}else{return"translate(0, "+yScale(d.y)+")"}});selection.exit().remove()})};return annotations}},{}],10:[function(require,module,exports){"use strict";var d3=window.d3;var builtInEvaluator=require("./eval").builtIn;var polyline=require("../graph-types/polyline");var datumDefaults=require("../datum-defaults");module.exports=function(chart){var derivativeDatum=datumDefaults({isHelper:true,skipTip:true,skipBoundsCheck:true,nSamples:2,graphType:"polyline"});var derivative;function computeLine(d){if(!d.derivative){return[]}var x0=typeof d.derivative.x0==="number"?d.derivative.x0:Infinity;derivativeDatum.index=d.index;derivativeDatum.scope={m:builtInEvaluator(d.derivative,"fn",{x:x0}),x0:x0,y0:builtInEvaluator(d,"fn",{x:x0})};derivativeDatum.fn="m * (x - x0) + y0";return[derivativeDatum]}function checkAutoUpdate(d){var self=this;if(!d.derivative){return}if(d.derivative.updateOnMouseMove&&!d.derivative.$$mouseListener){d.derivative.$$mouseListener=function(x0){if(d.derivative){d.derivative.x0=x0}derivative(self)};chart.on("tip:update",d.derivative.$$mouseListener)}}derivative=function(selection){selection.each(function(d){var el=d3.select(this);var data=computeLine.call(selection,d);checkAutoUpdate.call(selection,d);var innerSelection=el.selectAll("g.derivative").data(data);innerSelection.enter().append("g").attr("class","derivative");innerSelection.call(polyline(chart));innerSelection.selectAll("path").attr("opacity",.5);innerSelection.exit().remove()})};return derivative}},{"../datum-defaults":2,"../graph-types/polyline":7,"./eval":11}],11:[function(require,module,exports){"use strict";var samplers={interval:require("interval-arithmetic-eval"),builtIn:require("built-in-math-eval")};var extend=require("extend");window.math&&(samplers.builtIn=window.math.compile);function generateEvaluator(samplerName){function doCompile(expression){if(typeof expression==="string"){var compile=samplers[samplerName];return compile(expression)}else if(typeof expression==="function"){return{eval:expression}}else{throw Error("expression must be a string or a function")}}function compileIfPossible(meta,property){var expression=meta[property];var hiddenProperty=samplerName+"_Expression_"+property;var hiddenCompiled=samplerName+"_Compiled_"+property;if(expression!==meta[hiddenProperty]){meta[hiddenProperty]=expression;meta[hiddenCompiled]=doCompile(expression)}}function getCompiledExpression(meta,property){return meta[samplerName+"_Compiled_"+property]}function evaluate(meta,property,variables){compileIfPossible(meta,property);return getCompiledExpression(meta,property).eval(extend({},meta.scope||{},variables))}return evaluate}module.exports.builtIn=generateEvaluator("builtIn");module.exports.interval=generateEvaluator("interval")},{"built-in-math-eval":26,extend:31,"interval-arithmetic-eval":34}],12:[function(require,module,exports){"use strict";var d3=window.d3;var derivative=require("./derivative");var secant=require("./secant");module.exports=function(chart){function helper(selection){selection.each(function(){var el=d3.select(this);el.call(derivative(chart));el.call(secant(chart))})}return helper}},{"./derivative":10,"./secant":13}],13:[function(require,module,exports){"use strict";var d3=window.d3;var extend=require("extend");var builtInEvaluator=require("./eval").builtIn;var datumDefaults=require("../datum-defaults");var polyline=require("../graph-types/polyline");module.exports=function(chart){var secantDefaults=datumDefaults({isHelper:true,skipTip:true,skipBoundsCheck:true,nSamples:2,graphType:"polyline"});var secant;function computeSlope(scope){scope.m=(scope.y1-scope.y0)/(scope.x1-scope.x0)}function updateLine(d,secant){if(!secant.hasOwnProperty("x0")){throw Error("secant must have the property `x0` defined")}secant.scope=secant.scope||{};var x0=secant.x0;var x1=typeof secant.x1==="number"?secant.x1:Infinity;extend(secant.scope,{x0:x0,x1:x1,y0:builtInEvaluator(d,"fn",{x:x0}),y1:builtInEvaluator(d,"fn",{x:x1})});computeSlope(secant.scope)}function setFn(d,secant){updateLine(d,secant);secant.fn="m * (x - x0) + y0"}function setMouseListener(d,secantObject){var self=this;if(secantObject.updateOnMouseMove&&!secantObject.$$mouseListener){secantObject.$$mouseListener=function(x1){secantObject.x1=x1;updateLine(d,secantObject);secant(self)};chart.on("tip:update",secantObject.$$mouseListener)}}function computeLines(d){var self=this;var data=[];d.secants=d.secants||[];for(var i=0;i=xDomain[1]){throw Error("the pair defining the x-domain is inverted")}if(yDomain[0]>=yDomain[1]){throw Error("the pair defining the y-domain is inverted")}xScale=this.meta.xScale=d3.scale[options.xAxis.type]().domain(xDomain).range(options.xAxis.invert?[width,0]:[0,width]);yScale=this.meta.yScale=d3.scale[options.yAxis.type]().domain(yDomain).range(options.yAxis.invert?[0,height]:[height,0]);this.meta.xAxis=d3.svg.axis().scale(xScale).tickSize(options.grid?-height:0).tickFormat(format(xScale)).orient("bottom");this.meta.yAxis=d3.svg.axis().scale(yScale).tickSize(options.grid?-width:0).tickFormat(format(yScale)).orient("left")};Chart.prototype.internalVars=function(){this.meta={};margin=this.meta.margin={left:30,right:30,top:20,bottom:20};if(options.title){this.meta.margin.top=40}zoomBehavior=this.meta.zoomBehavior=d3.behavior.zoom();width=this.meta.width=(options.width||globals.DEFAULT_WIDTH)-margin.left-margin.right;height=this.meta.height=(options.height||globals.DEFAULT_HEIGHT)-margin.top-margin.bottom;this.initializeAxes()};Chart.prototype.drawGraphWrapper=function(){var root=this.root=d3.select(options.target).selectAll("svg").data([options]);this.root.enter=root.enter().append("svg").attr("class","function-plot").attr("font-size",this.getFontSize());root.attr("width",width+margin.left+margin.right).attr("height",height+margin.top+margin.bottom);this.buildTitle();this.buildLegend();this.buildCanvas();this.buildClip();this.buildAxis();this.buildAxisLabel();this.draw();var tip=this.tip=mousetip(extend(options.tip,{owner:this}));this.canvas.call(tip);this.buildZoomHelper();this.setUpPlugins()};Chart.prototype.buildTitle=function(){var selection=this.root.selectAll("text.title").data(function(d){return[d.title].filter(Boolean)});selection.enter().append("text").attr("class","title").attr("y",margin.top/2).attr("x",margin.left+width/2).attr("font-size",25).attr("text-anchor","middle").attr("alignment-baseline","middle").text(options.title);selection.exit().remove()};Chart.prototype.buildLegend=function(){this.root.enter.append("text").attr("class","top-right-legend").attr("text-anchor","end");this.root.select(".top-right-legend").attr("y",margin.top/2).attr("x",width+margin.left)};Chart.prototype.buildCanvas=function(){var self=this;this.meta.zoomBehavior.x(xScale).y(yScale).on("zoom",function onZoom(){self.emit("all:zoom",d3.event.translate,d3.event.scale)});var canvas=this.canvas=this.root.selectAll(".canvas").data(function(d){return[d]});this.canvas.enter=canvas.enter().append("g").attr("class","canvas")};Chart.prototype.buildClip=function(){var id=this.id;var defs=this.canvas.enter.append("defs");defs.append("clipPath").attr("id","function-plot-clip-"+id).append("rect").attr("class","clip static-clip");this.canvas.selectAll(".clip").attr("width",width).attr("height",height);this.markerId=this.id+"-marker";defs.append("clipPath").append("marker").attr("id",this.markerId).attr("viewBox","0 -5 10 10").attr("refX",10).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("svg:path").attr("d","M0,-5L10,0L0,5L0,0").attr("stroke-width","0px").attr("fill-opacity",1).attr("fill","#777")};Chart.prototype.buildAxis=function(){var canvasEnter=this.canvas.enter;canvasEnter.append("g").attr("class","x axis");canvasEnter.append("g").attr("class","y axis");this.canvas.select(".x.axis").attr("transform","translate(0,"+height+")").call(this.meta.xAxis);this.canvas.select(".y.axis").call(this.meta.yAxis)};Chart.prototype.buildAxisLabel=function(){var xLabel,yLabel;var canvas=this.canvas;xLabel=canvas.selectAll("text.x.axis-label").data(function(d){return[d.xAxis.label].filter(Boolean)});xLabel.enter().append("text").attr("class","x axis-label").attr("text-anchor","end");xLabel.attr("x",width).attr("y",height-6).text(function(d){return d});xLabel.exit().remove();yLabel=canvas.selectAll("text.y.axis-label").data(function(d){return[d.yAxis.label].filter(Boolean)});yLabel.enter().append("text").attr("class","y axis-label").attr("y",6).attr("dy",".75em").attr("text-anchor","end").attr("transform","rotate(-90)");yLabel.text(function(d){return d});yLabel.exit().remove()};Chart.prototype.buildContent=function(){var self=this;var canvas=this.canvas;canvas.attr("transform","translate("+margin.left+","+margin.top+")").call(zoomBehavior).each(function(){var el=d3.select(this);var listeners=["mousedown","touchstart","onwheel"in document?"wheel":"ononmousewheel"in document?"mousewheel":"MozMousePixelScroll"].map(function(d){return d+".zoom"});if(!el._zoomListenersCache){listeners.forEach(function(l){el["_"+l]=el.on(l)});el._zoomListenersCache=true}function setState(state){listeners.forEach(function(l){state?el.on(l,el["_"+l]):el.on(l,null)})}setState(!options.disableZoom)});var content=this.content=canvas.selectAll(":scope > g.content").data(function(d){return[d]});content.enter().append("g").attr("clip-path","url(#function-plot-clip-"+this.id+")").attr("class","content");if(options.xAxis.type==="linear"){var yOrigin=content.selectAll(":scope > path.y.origin").data([[[0,yScale.domain()[0]],[0,yScale.domain()[1]]]]);yOrigin.enter().append("path").attr("class","y origin").attr("stroke","black").attr("opacity",.2);yOrigin.attr("d",line)}if(options.yAxis.type==="linear"){var xOrigin=content.selectAll(":scope > path.x.origin").data([[[xScale.domain()[0],0],[xScale.domain()[1],0]]]);xOrigin.enter().append("path").attr("class","x origin").attr("stroke","black").attr("opacity",.2);xOrigin.attr("d",line)}content.call(annotations({owner:self}));var graphs=content.selectAll(":scope > g.graph").data(function(d){return d.data.map(datumDefaults)});graphs.enter().append("g").attr("class","graph");graphs.each(function(d,index){d.index=index;d3.select(this).call(graphTypes[d.graphType](self));d3.select(this).call(helpers(self))})};Chart.prototype.buildZoomHelper=function(){var self=this;this.draggable=this.canvas.enter.append("rect").attr("class","zoom-and-drag").style("fill","none").style("pointer-events","all");this.canvas.select(".zoom-and-drag").attr("width",width).attr("height",height).on("mouseover",function(){self.emit("all:mouseover")}).on("mouseout",function(){self.emit("all:mouseout")}).on("mousemove",function(){self.emit("all:mousemove")})};Chart.prototype.setUpPlugins=function(){var plugins=options.plugins||[];var self=this;plugins.forEach(function(plugin){plugin(self)})};Chart.prototype.addLink=function(){for(var i=0;i",toggle:false},options);var brush=d3.svg.brush();var kd=keydown(options.key);var visible=false;var cachedInstance;function wrapper(datum){return function(x){var functionPlot=window.functionPlot;return functionPlot.eval.builtIn(datum,"fn",{x:x})}}function setBrushState(visible){var brushEl=cachedInstance.canvas.selectAll(".definite-integral");brushEl.style("display",visible?null:"none")}function inner(instance){cachedInstance=instance;var oldDisableZoom;brush.x(instance.meta.xScale).on("brushstart",function(){if(!d3.event.sourceEvent)return;oldDisableZoom=!!instance.options.disableZoom;instance.options.disableZoom=true;instance.emit("draw")}).on("brushend",function(){if(!d3.event.sourceEvent)return;instance.options.disableZoom=oldDisableZoom;if(!brush.empty()){var a=brush.extent()[0];var b=brush.extent()[1];instance.options.data.forEach(function(datum,i){var value=integrateSimpson(wrapper(datum),a,b,options.tol,options.maxdepth);instance.emit("definite-integral",datum,i,value,a,b)})}instance.draw()});var brushEl=instance.canvas.append("g").attr("class","brush definite-integral");brushEl.call(brush).call(brush.event);instance.canvas.selectAll(".brush .extent").attr("stroke","#fff").attr("fill-opacity",.125).attr("shape-rendering","crispEdges");brushEl.selectAll("rect").attr("height",instance.meta.height);instance.canvas.on("mousemove.definiteIntegral",function(){if(!options.toggle){inner.visible(pressed(options.key))}});kd.on("pressed",function(){inner.visible(options.toggle?!inner.visible():true)});inner.visible(false)}inner.visible=function(_){if(!arguments.length){return visible}visible=_;setBrushState(_);return inner};return inner}},{extend:31,"integrate-adaptive-simpson":33,"key-pressed":52,keydown:53}],16:[function(require,module,exports){module.exports={zoomBox:require("./zoom-box"),definiteIntegral:require("./definite-integral")}},{"./definite-integral":15,"./zoom-box":17}],17:[function(require,module,exports){var d3=window.d3;var extend=require("extend");var pressed=require("key-pressed");var keydown=require("keydown");module.exports=function(options){options=extend({key:"",toggle:false},options);var brush=d3.svg.brush();var kd=keydown(options.key);var cachedInstance;var visible=false;function setBrushState(visible){var brushEl=cachedInstance.canvas.selectAll(".zoom-box");brushEl.style("display",visible?null:"none")}function inner(instance){cachedInstance=instance;var oldDisableZoom;brush.x(instance.meta.xScale).y(instance.meta.yScale).on("brushstart",function(){if(!d3.event.sourceEvent)return;oldDisableZoom=!!instance.options.disableZoom;instance.options.disableZoom=true;instance.draw()}).on("brushend",function(){if(!d3.event.sourceEvent)return;instance.options.disableZoom=oldDisableZoom;if(!brush.empty()){var lo=brush.extent()[0];var hi=brush.extent()[1];var x=[lo[0],hi[0]];var y=[lo[1],hi[1]];instance.programmaticZoom(x,y)}d3.select(this).transition().duration(1).call(brush.clear()).call(brush.event)});var brushEl=instance.canvas.append("g").attr("class","brush zoom-box");brushEl.call(brush).call(brush.event);instance.canvas.selectAll(".brush .extent").attr("stroke","#fff").attr("fill-opacity",.125).attr("shape-rendering","crispEdges");instance.canvas.on("mousemove.zoombox",function(){if(!options.toggle){inner.visible(pressed(options.key))}});kd.on("pressed",function(){inner.visible(options.toggle?!inner.visible():true)});inner.visible(false)}inner.visible=function(_){if(!arguments.length){return visible}visible=_;setBrushState(_);return inner};return inner}},{extend:31,"key-pressed":52,keydown:53}],18:[function(require,module,exports){(function(doc,proto){try{doc.querySelector(":scope body")}catch(err){["querySelector","querySelectorAll"].forEach(function(method){var native=proto[method];proto[method]=function(selectors){if(/(^|,)\s*:scope/.test(selectors)){var id=this.id;this.id="ID_"+Date.now();selectors=selectors.replace(/((^|,)\s*):scope/g,"$1#"+this.id);var result=doc[method](selectors);this.id=id;return result}else{return native.call(this,selectors)}}})}})(window.document,Element.prototype)},{}],19:[function(require,module,exports){"use strict";var clamp=require("clamp");var linspace=require("linspace");var utils=require("../utils");var evaluate=require("../helpers/eval").builtIn;function checkAsymptote(d0,d1,meta,sign,level){if(!level){return{asymptote:true,d0:d0,d1:d1}}var i;var n=10;var x0=d0[0];var x1=d1[0];var samples=linspace(x0,x1,n);var oldY,oldX;for(i=0;i1/zoomScale){var check=checkAsymptote(data[i-1],data[i],meta,newSign,3);if(check.asymptote){st.push(updateY(check.d0));sets.push(st);st=[updateY(check.d1)]}}oldSign=newSign;st.push(data[i]);++i}if(st.length){sets.push(st)}return sets}function linear(chart,meta,range,n){var allX=utils.space(chart,range,n);var yDomain=chart.meta.yScale.domain();var yDomainMargin=yDomain[1]-yDomain[0];var yMin=yDomain[0]-yDomainMargin*1e5;var yMax=yDomain[1]+yDomainMargin*1e5;var data=[];var i;for(i=0;inext[1].hi){prev[1].hi=Math.max(yMax,prev[1].hi);next[1].lo=Math.min(yMin,next[1].lo)}if(prev[1].hirange[0]-globals.TIP_X_EPS&&x00){return 1}return 0},color:function(data,index){return data.color||globals.COLORS[index]}}},{"./globals":4,linspace:54,log10:56,logspace:57}],23:[function(require,module,exports){"use strict";exports.byteLength=byteLength;exports.toByteArray=toByteArray;exports.fromByteArray=fromByteArray;var lookup=[];var revLookup=[];var Arr=typeof Uint8Array!=="undefined"?Uint8Array:Array;var code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i=0,len=code.length;i0){throw new Error("Invalid string. Length must be a multiple of 4")}var validLen=b64.indexOf("=");if(validLen===-1)validLen=len;var placeHoldersLen=validLen===len?0:4-validLen%4;return[validLen,placeHoldersLen]}function byteLength(b64){var lens=getLens(b64);var validLen=lens[0];var placeHoldersLen=lens[1];return(validLen+placeHoldersLen)*3/4-placeHoldersLen}function _byteLength(b64,validLen,placeHoldersLen){return(validLen+placeHoldersLen)*3/4-placeHoldersLen}function toByteArray(b64){var tmp;var lens=getLens(b64);var validLen=lens[0];var placeHoldersLen=lens[1];var arr=new Arr(_byteLength(b64,validLen,placeHoldersLen));var curByte=0;var len=placeHoldersLen>0?validLen-4:validLen;for(var i=0;i>16&255;arr[curByte++]=tmp>>8&255;arr[curByte++]=tmp&255}if(placeHoldersLen===2){tmp=revLookup[b64.charCodeAt(i)]<<2|revLookup[b64.charCodeAt(i+1)]>>4;arr[curByte++]=tmp&255}if(placeHoldersLen===1){tmp=revLookup[b64.charCodeAt(i)]<<10|revLookup[b64.charCodeAt(i+1)]<<4|revLookup[b64.charCodeAt(i+2)]>>2;arr[curByte++]=tmp>>8&255;arr[curByte++]=tmp&255}return arr}function tripletToBase64(num){return lookup[num>>18&63]+lookup[num>>12&63]+lookup[num>>6&63]+lookup[num&63]}function encodeChunk(uint8,start,end){var tmp;var output=[];for(var i=start;ilen2?len2:i+maxChunkLength))}if(extraBytes===1){tmp=uint8[len-1];parts.push(lookup[tmp>>2]+lookup[tmp<<4&63]+"==")}else if(extraBytes===2){tmp=(uint8[len-2]<<8)+uint8[len-1];parts.push(lookup[tmp>>10]+lookup[tmp>>4&63]+lookup[tmp<<2&63]+"=")}return parts.join("")}},{}],24:[function(require,module,exports){var objectCreate=Object.create||objectCreatePolyfill;var objectKeys=Object.keys||objectKeysPolyfill;var bind=Function.prototype.bind||functionBindPolyfill;function EventEmitter(){if(!this._events||!Object.prototype.hasOwnProperty.call(this,"_events")){this._events=objectCreate(null);this._eventsCount=0}this._maxListeners=this._maxListeners||undefined}module.exports=EventEmitter;EventEmitter.EventEmitter=EventEmitter;EventEmitter.prototype._events=undefined;EventEmitter.prototype._maxListeners=undefined;var defaultMaxListeners=10;var hasDefineProperty;try{var o={};if(Object.defineProperty)Object.defineProperty(o,"x",{value:0});hasDefineProperty=o.x===0}catch(err){hasDefineProperty=false}if(hasDefineProperty){Object.defineProperty(EventEmitter,"defaultMaxListeners",{enumerable:true,get:function(){return defaultMaxListeners},set:function(arg){if(typeof arg!=="number"||arg<0||arg!==arg)throw new TypeError('"defaultMaxListeners" must be a positive number');defaultMaxListeners=arg}})}else{EventEmitter.defaultMaxListeners=defaultMaxListeners}EventEmitter.prototype.setMaxListeners=function setMaxListeners(n){if(typeof n!=="number"||n<0||isNaN(n))throw new TypeError('"n" argument must be a positive number');this._maxListeners=n;return this};function $getMaxListeners(that){if(that._maxListeners===undefined)return EventEmitter.defaultMaxListeners;return that._maxListeners}EventEmitter.prototype.getMaxListeners=function getMaxListeners(){return $getMaxListeners(this)};function emitNone(handler,isFn,self){if(isFn)handler.call(self);else{var len=handler.length;var listeners=arrayClone(handler,len);for(var i=0;i1)er=arguments[1];if(er instanceof Error){throw er}else{var err=new Error('Unhandled "error" event. ('+er+")");err.context=er;throw err}return false}handler=events[type];if(!handler)return false;var isFn=typeof handler==="function";len=arguments.length;switch(len){case 1:emitNone(handler,isFn,this);break;case 2:emitOne(handler,isFn,this,arguments[1]);break;case 3:emitTwo(handler,isFn,this,arguments[1],arguments[2]);break;case 4:emitThree(handler,isFn,this,arguments[1],arguments[2],arguments[3]);break;default:args=new Array(len-1);for(i=1;i0&&existing.length>m){existing.warned=true;var w=new Error("Possible EventEmitter memory leak detected. "+existing.length+' "'+String(type)+'" listeners '+"added. Use emitter.setMaxListeners() to "+"increase limit.");w.name="MaxListenersExceededWarning";w.emitter=target;w.type=type;w.count=existing.length;if(typeof console==="object"&&console.warn){console.warn("%s: %s",w.name,w.message)}}}}return target}EventEmitter.prototype.addListener=function addListener(type,listener){return _addListener(this,type,listener,false)};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.prependListener=function prependListener(type,listener){return _addListener(this,type,listener,true)};function onceWrapper(){if(!this.fired){this.target.removeListener(this.type,this.wrapFn);this.fired=true;switch(arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:var args=new Array(arguments.length);for(var i=0;i=0;i--){if(list[i]===listener||list[i].listener===listener){originalListener=list[i].listener;position=i;break}}if(position<0)return this;if(position===0)list.shift();else spliceOne(list,position);if(list.length===1)events[type]=list[0];if(events.removeListener)this.emit("removeListener",type,originalListener||listener)}return this};EventEmitter.prototype.removeAllListeners=function removeAllListeners(type){var listeners,events,i;events=this._events;if(!events)return this;if(!events.removeListener){if(arguments.length===0){this._events=objectCreate(null);this._eventsCount=0}else if(events[type]){if(--this._eventsCount===0)this._events=objectCreate(null);else delete events[type]}return this}if(arguments.length===0){var keys=objectKeys(events);var key;for(i=0;i=0;i--){this.removeListener(type,listeners[i])}}return this};function _listeners(target,type,unwrap){var events=target._events;if(!events)return[];var evlistener=events[type];if(!evlistener)return[];if(typeof evlistener==="function")return unwrap?[evlistener.listener||evlistener]:[evlistener];return unwrap?unwrapListeners(evlistener):arrayClone(evlistener,evlistener.length)}EventEmitter.prototype.listeners=function listeners(type){return _listeners(this,type,true)};EventEmitter.prototype.rawListeners=function rawListeners(type){return _listeners(this,type,false)};EventEmitter.listenerCount=function(emitter,type){if(typeof emitter.listenerCount==="function"){return emitter.listenerCount(type)}else{return listenerCount.call(emitter,type)}};EventEmitter.prototype.listenerCount=listenerCount;function listenerCount(type){var events=this._events;if(events){var evlistener=events[type];if(typeof evlistener==="function"){return 1}else if(evlistener){return evlistener.length}}return 0}EventEmitter.prototype.eventNames=function eventNames(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};function spliceOne(list,index){for(var i=index,k=i+1,n=list.length;kK_MAX_LENGTH){throw new RangeError('The value "'+length+'" is invalid for option "size"')}var buf=new Uint8Array(length);buf.__proto__=Buffer.prototype;return buf}function Buffer(arg,encodingOrOffset,length){if(typeof arg==="number"){if(typeof encodingOrOffset==="string"){throw new TypeError('The "string" argument must be of type string. Received type number')}return allocUnsafe(arg)}return from(arg,encodingOrOffset,length)}if(typeof Symbol!=="undefined"&&Symbol.species!=null&&Buffer[Symbol.species]===Buffer){Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:true,enumerable:false,writable:false})}Buffer.poolSize=8192;function from(value,encodingOrOffset,length){if(typeof value==="string"){return fromString(value,encodingOrOffset)}if(ArrayBuffer.isView(value)){return fromArrayLike(value)}if(value==null){throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, "+"or Array-like Object. Received type "+typeof value)}if(isInstance(value,ArrayBuffer)||value&&isInstance(value.buffer,ArrayBuffer)){return fromArrayBuffer(value,encodingOrOffset,length)}if(typeof value==="number"){throw new TypeError('The "value" argument must not be of type number. Received type number')}var valueOf=value.valueOf&&value.valueOf();if(valueOf!=null&&valueOf!==value){return Buffer.from(valueOf,encodingOrOffset,length)}var b=fromObject(value);if(b)return b;if(typeof Symbol!=="undefined"&&Symbol.toPrimitive!=null&&typeof value[Symbol.toPrimitive]==="function"){return Buffer.from(value[Symbol.toPrimitive]("string"),encodingOrOffset,length)}throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, "+"or Array-like Object. Received type "+typeof value)}Buffer.from=function(value,encodingOrOffset,length){return from(value,encodingOrOffset,length)};Buffer.prototype.__proto__=Uint8Array.prototype;Buffer.__proto__=Uint8Array;function assertSize(size){if(typeof size!=="number"){throw new TypeError('"size" argument must be of type number')}else if(size<0){throw new RangeError('The value "'+size+'" is invalid for option "size"')}}function alloc(size,fill,encoding){assertSize(size);if(size<=0){return createBuffer(size)}if(fill!==undefined){return typeof encoding==="string"?createBuffer(size).fill(fill,encoding):createBuffer(size).fill(fill)}return createBuffer(size)}Buffer.alloc=function(size,fill,encoding){return alloc(size,fill,encoding)};function allocUnsafe(size){assertSize(size);return createBuffer(size<0?0:checked(size)|0)}Buffer.allocUnsafe=function(size){return allocUnsafe(size)};Buffer.allocUnsafeSlow=function(size){return allocUnsafe(size)};function fromString(string,encoding){if(typeof encoding!=="string"||encoding===""){encoding="utf8"}if(!Buffer.isEncoding(encoding)){throw new TypeError("Unknown encoding: "+encoding)}var length=byteLength(string,encoding)|0;var buf=createBuffer(length);var actual=buf.write(string,encoding);if(actual!==length){buf=buf.slice(0,actual)}return buf}function fromArrayLike(array){var length=array.length<0?0:checked(array.length)|0;var buf=createBuffer(length);for(var i=0;i=K_MAX_LENGTH){throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+K_MAX_LENGTH.toString(16)+" bytes")}return length|0}function SlowBuffer(length){if(+length!=length){length=0}return Buffer.alloc(+length)}Buffer.isBuffer=function isBuffer(b){return b!=null&&b._isBuffer===true&&b!==Buffer.prototype};Buffer.compare=function compare(a,b){if(isInstance(a,Uint8Array))a=Buffer.from(a,a.offset,a.byteLength);if(isInstance(b,Uint8Array))b=Buffer.from(b,b.offset,b.byteLength);if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b)){throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array')}if(a===b)return 0;var x=a.length;var y=b.length;for(var i=0,len=Math.min(x,y);i2&&arguments[2]===true;if(!mustMatch&&len===0)return 0;var loweredCase=false;for(;;){switch(encoding){case"ascii":case"latin1":case"binary":return len;case"utf8":case"utf-8":return utf8ToBytes(string).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return len*2;case"hex":return len>>>1;case"base64":return base64ToBytes(string).length;default:if(loweredCase){return mustMatch?-1:utf8ToBytes(string).length}encoding=(""+encoding).toLowerCase();loweredCase=true}}}Buffer.byteLength=byteLength;function slowToString(encoding,start,end){var loweredCase=false;if(start===undefined||start<0){start=0}if(start>this.length){return""}if(end===undefined||end>this.length){end=this.length}if(end<=0){return""}end>>>=0;start>>>=0;if(end<=start){return""}if(!encoding)encoding="utf8";while(true){switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"latin1":case"binary":return latin1Slice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase();loweredCase=true}}}Buffer.prototype._isBuffer=true;function swap(b,n,m){var i=b[n];b[n]=b[m];b[m]=i}Buffer.prototype.swap16=function swap16(){var len=this.length;if(len%2!==0){throw new RangeError("Buffer size must be a multiple of 16-bits")}for(var i=0;imax)str+=" ... ";return""};Buffer.prototype.compare=function compare(target,start,end,thisStart,thisEnd){if(isInstance(target,Uint8Array)){target=Buffer.from(target,target.offset,target.byteLength)}if(!Buffer.isBuffer(target)){throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. '+"Received type "+typeof target)}if(start===undefined){start=0}if(end===undefined){end=target?target.length:0}if(thisStart===undefined){thisStart=0}if(thisEnd===undefined){thisEnd=this.length}if(start<0||end>target.length||thisStart<0||thisEnd>this.length){throw new RangeError("out of range index")}if(thisStart>=thisEnd&&start>=end){return 0}if(thisStart>=thisEnd){return-1}if(start>=end){return 1}start>>>=0;end>>>=0;thisStart>>>=0;thisEnd>>>=0;if(this===target)return 0;var x=thisEnd-thisStart;var y=end-start;var len=Math.min(x,y);var thisCopy=this.slice(thisStart,thisEnd);var targetCopy=target.slice(start,end);for(var i=0;i2147483647){byteOffset=2147483647}else if(byteOffset<-2147483648){byteOffset=-2147483648}byteOffset=+byteOffset;if(numberIsNaN(byteOffset)){byteOffset=dir?0:buffer.length-1}if(byteOffset<0)byteOffset=buffer.length+byteOffset;if(byteOffset>=buffer.length){if(dir)return-1;else byteOffset=buffer.length-1}else if(byteOffset<0){if(dir)byteOffset=0;else return-1}if(typeof val==="string"){val=Buffer.from(val,encoding)}if(Buffer.isBuffer(val)){if(val.length===0){return-1}return arrayIndexOf(buffer,val,byteOffset,encoding,dir)}else if(typeof val==="number"){val=val&255;if(typeof Uint8Array.prototype.indexOf==="function"){if(dir){return Uint8Array.prototype.indexOf.call(buffer,val,byteOffset)}else{return Uint8Array.prototype.lastIndexOf.call(buffer,val,byteOffset)}}return arrayIndexOf(buffer,[val],byteOffset,encoding,dir)}throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(arr,val,byteOffset,encoding,dir){var indexSize=1;var arrLength=arr.length;var valLength=val.length;if(encoding!==undefined){encoding=String(encoding).toLowerCase();if(encoding==="ucs2"||encoding==="ucs-2"||encoding==="utf16le"||encoding==="utf-16le"){if(arr.length<2||val.length<2){return-1}indexSize=2;arrLength/=2;valLength/=2;byteOffset/=2}}function read(buf,i){if(indexSize===1){return buf[i]}else{return buf.readUInt16BE(i*indexSize)}}var i;if(dir){var foundIndex=-1;for(i=byteOffset;iarrLength)byteOffset=arrLength-valLength;for(i=byteOffset;i>=0;i--){var found=true;for(var j=0;jremaining){length=remaining}}var strLen=string.length;if(length>strLen/2){length=strLen/2}for(var i=0;i>>0;if(isFinite(length)){length=length>>>0;if(encoding===undefined)encoding="utf8"}else{encoding=length;length=undefined}}else{throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported")}var remaining=this.length-offset;if(length===undefined||length>remaining)length=remaining;if(string.length>0&&(length<0||offset<0)||offset>this.length){throw new RangeError("Attempt to write outside buffer bounds")}if(!encoding)encoding="utf8";var loweredCase=false;for(;;){switch(encoding){case"hex":return hexWrite(this,string,offset,length);case"utf8":case"utf-8":return utf8Write(this,string,offset,length);case"ascii":return asciiWrite(this,string,offset,length);case"latin1":case"binary":return latin1Write(this,string,offset,length);case"base64":return base64Write(this,string,offset,length);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,string,offset,length);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(""+encoding).toLowerCase();loweredCase=true}}};Buffer.prototype.toJSON=function toJSON(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function base64Slice(buf,start,end){if(start===0&&end===buf.length){return base64.fromByteArray(buf)}else{return base64.fromByteArray(buf.slice(start,end))}}function utf8Slice(buf,start,end){end=Math.min(buf.length,end);var res=[];var i=start;while(i239?4:firstByte>223?3:firstByte>191?2:1;if(i+bytesPerSequence<=end){var secondByte,thirdByte,fourthByte,tempCodePoint;switch(bytesPerSequence){case 1:if(firstByte<128){codePoint=firstByte}break;case 2:secondByte=buf[i+1];if((secondByte&192)===128){tempCodePoint=(firstByte&31)<<6|secondByte&63;if(tempCodePoint>127){codePoint=tempCodePoint}}break;case 3:secondByte=buf[i+1];thirdByte=buf[i+2];if((secondByte&192)===128&&(thirdByte&192)===128){tempCodePoint=(firstByte&15)<<12|(secondByte&63)<<6|thirdByte&63;if(tempCodePoint>2047&&(tempCodePoint<55296||tempCodePoint>57343)){codePoint=tempCodePoint}}break;case 4:secondByte=buf[i+1];thirdByte=buf[i+2];fourthByte=buf[i+3];if((secondByte&192)===128&&(thirdByte&192)===128&&(fourthByte&192)===128){tempCodePoint=(firstByte&15)<<18|(secondByte&63)<<12|(thirdByte&63)<<6|fourthByte&63;if(tempCodePoint>65535&&tempCodePoint<1114112){codePoint=tempCodePoint}}}}if(codePoint===null){codePoint=65533;bytesPerSequence=1}else if(codePoint>65535){codePoint-=65536;res.push(codePoint>>>10&1023|55296);codePoint=56320|codePoint&1023}res.push(codePoint);i+=bytesPerSequence}return decodeCodePointsArray(res)}var MAX_ARGUMENTS_LENGTH=4096;function decodeCodePointsArray(codePoints){var len=codePoints.length;if(len<=MAX_ARGUMENTS_LENGTH){return String.fromCharCode.apply(String,codePoints)}var res="";var i=0;while(ilen)end=len;var out="";for(var i=start;ilen){start=len}if(end<0){end+=len;if(end<0)end=0}else if(end>len){end=len}if(endlength)throw new RangeError("Trying to access beyond buffer length")}Buffer.prototype.readUIntLE=function readUIntLE(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i>>0;byteLength=byteLength>>>0;if(!noAssert){checkOffset(offset,byteLength,this.length)}var val=this[offset+--byteLength];var mul=1;while(byteLength>0&&(mul*=256)){val+=this[offset+--byteLength]*mul}return val};Buffer.prototype.readUInt8=function readUInt8(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,1,this.length);return this[offset]};Buffer.prototype.readUInt16LE=function readUInt16LE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,2,this.length);return this[offset]|this[offset+1]<<8};Buffer.prototype.readUInt16BE=function readUInt16BE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,2,this.length);return this[offset]<<8|this[offset+1]};Buffer.prototype.readUInt32LE=function readUInt32LE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+this[offset+3]*16777216};Buffer.prototype.readUInt32BE=function readUInt32BE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return this[offset]*16777216+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])};Buffer.prototype.readIntLE=function readIntLE(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readIntBE=function readIntBE(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var i=byteLength;var mul=1;var val=this[offset+--i];while(i>0&&(mul*=256)){val+=this[offset+--i]*mul}mul*=128;if(val>=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readInt8=function readInt8(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,1,this.length);if(!(this[offset]&128))return this[offset];return(255-this[offset]+1)*-1};Buffer.prototype.readInt16LE=function readInt16LE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt16BE=function readInt16BE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt32LE=function readInt32LE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24};Buffer.prototype.readInt32BE=function readInt32BE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]};Buffer.prototype.readFloatLE=function readFloatLE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,true,23,4)};Buffer.prototype.readFloatBE=function readFloatBE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,false,23,4)};Buffer.prototype.readDoubleLE=function readDoubleLE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,true,52,8)};Buffer.prototype.readDoubleBE=function readDoubleBE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,false,52,8)};function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError('"buffer" argument must be a Buffer instance');if(value>max||valuebuf.length)throw new RangeError("Index out of range")}Buffer.prototype.writeUIntLE=function writeUIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert){var maxBytes=Math.pow(2,8*byteLength)-1;checkInt(this,value,offset,byteLength,maxBytes,0)}var mul=1;var i=0;this[offset]=value&255;while(++i>>0;byteLength=byteLength>>>0;if(!noAssert){var maxBytes=Math.pow(2,8*byteLength)-1;checkInt(this,value,offset,byteLength,maxBytes,0)}var i=byteLength-1;var mul=1;this[offset+i]=value&255;while(--i>=0&&(mul*=256)){this[offset+i]=value/mul&255}return offset+byteLength};Buffer.prototype.writeUInt8=function writeUInt8(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,1,255,0);this[offset]=value&255;return offset+1};Buffer.prototype.writeUInt16LE=function writeUInt16LE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,65535,0);this[offset]=value&255;this[offset+1]=value>>>8;return offset+2};Buffer.prototype.writeUInt16BE=function writeUInt16BE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,65535,0);this[offset]=value>>>8;this[offset+1]=value&255;return offset+2};Buffer.prototype.writeUInt32LE=function writeUInt32LE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);this[offset+3]=value>>>24;this[offset+2]=value>>>16;this[offset+1]=value>>>8;this[offset]=value&255;return offset+4};Buffer.prototype.writeUInt32BE=function writeUInt32BE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&255;return offset+4};Buffer.prototype.writeIntLE=function writeIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=0;var mul=1;var sub=0;this[offset]=value&255;while(++i>0)-sub&255}return offset+byteLength};Buffer.prototype.writeIntBE=function writeIntBE(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=byteLength-1;var mul=1;var sub=0;this[offset+i]=value&255;while(--i>=0&&(mul*=256)){if(value<0&&sub===0&&this[offset+i+1]!==0){sub=1}this[offset+i]=(value/mul>>0)-sub&255}return offset+byteLength};Buffer.prototype.writeInt8=function writeInt8(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,1,127,-128);if(value<0)value=255+value+1;this[offset]=value&255;return offset+1};Buffer.prototype.writeInt16LE=function writeInt16LE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);this[offset]=value&255;this[offset+1]=value>>>8;return offset+2};Buffer.prototype.writeInt16BE=function writeInt16BE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);this[offset]=value>>>8;this[offset+1]=value&255;return offset+2};Buffer.prototype.writeInt32LE=function writeInt32LE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);this[offset]=value&255;this[offset+1]=value>>>8;this[offset+2]=value>>>16;this[offset+3]=value>>>24;return offset+4};Buffer.prototype.writeInt32BE=function writeInt32BE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(value<0)value=4294967295+value+1;this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&255;return offset+4};function checkIEEE754(buf,value,offset,ext,max,min){if(offset+ext>buf.length)throw new RangeError("Index out of range");if(offset<0)throw new RangeError("Index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){value=+value;offset=offset>>>0;if(!noAssert){checkIEEE754(buf,value,offset,4,34028234663852886e22,-34028234663852886e22)}ieee754.write(buf,value,offset,littleEndian,23,4);return offset+4}Buffer.prototype.writeFloatLE=function writeFloatLE(value,offset,noAssert){return writeFloat(this,value,offset,true,noAssert)};Buffer.prototype.writeFloatBE=function writeFloatBE(value,offset,noAssert){return writeFloat(this,value,offset,false,noAssert)};function writeDouble(buf,value,offset,littleEndian,noAssert){value=+value;offset=offset>>>0;if(!noAssert){checkIEEE754(buf,value,offset,8,17976931348623157e292,-17976931348623157e292)}ieee754.write(buf,value,offset,littleEndian,52,8);return offset+8}Buffer.prototype.writeDoubleLE=function writeDoubleLE(value,offset,noAssert){return writeDouble(this,value,offset,true,noAssert)};Buffer.prototype.writeDoubleBE=function writeDoubleBE(value,offset,noAssert){return writeDouble(this,value,offset,false,noAssert)};Buffer.prototype.copy=function copy(target,targetStart,start,end){if(!Buffer.isBuffer(target))throw new TypeError("argument should be a Buffer");if(!start)start=0;if(!end&&end!==0)end=this.length;if(targetStart>=target.length)targetStart=target.length;if(!targetStart)targetStart=0;if(end>0&&end=this.length)throw new RangeError("Index out of range");if(end<0)throw new RangeError("sourceEnd out of bounds");if(end>this.length)end=this.length;if(target.length-targetStart=0;--i){target[i+targetStart]=this[i+start]}}else{Uint8Array.prototype.set.call(target,this.subarray(start,end),targetStart)}return len};Buffer.prototype.fill=function fill(val,start,end,encoding){if(typeof val==="string"){if(typeof start==="string"){encoding=start;start=0;end=this.length}else if(typeof end==="string"){encoding=end;end=this.length}if(encoding!==undefined&&typeof encoding!=="string"){throw new TypeError("encoding must be a string")}if(typeof encoding==="string"&&!Buffer.isEncoding(encoding)){throw new TypeError("Unknown encoding: "+encoding)}if(val.length===1){var code=val.charCodeAt(0);if(encoding==="utf8"&&code<128||encoding==="latin1"){val=code}}}else if(typeof val==="number"){val=val&255}if(start<0||this.length>>0;end=end===undefined?this.length:end>>>0;if(!val)val=0;var i;if(typeof val==="number"){for(i=start;i55295&&codePoint<57344){if(!leadSurrogate){if(codePoint>56319){if((units-=3)>-1)bytes.push(239,191,189);continue}else if(i+1===length){if((units-=3)>-1)bytes.push(239,191,189);continue}leadSurrogate=codePoint;continue}if(codePoint<56320){if((units-=3)>-1)bytes.push(239,191,189);leadSurrogate=codePoint;continue}codePoint=(leadSurrogate-55296<<10|codePoint-56320)+65536}else if(leadSurrogate){if((units-=3)>-1)bytes.push(239,191,189)}leadSurrogate=null;if(codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,codePoint&63|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,codePoint&63|128)}else if(codePoint<1114112){if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,codePoint&63|128)}else{throw new Error("Invalid code point")}}return bytes}function asciiToBytes(str){var byteArray=[];for(var i=0;i>8;lo=c%256;byteArray.push(lo);byteArray.push(hi)}return byteArray}function base64ToBytes(str){return base64.toByteArray(base64clean(str))}function blitBuffer(src,dst,offset,length){for(var i=0;i=dst.length||i>=src.length)break;dst[i+offset]=src[i]}return i}function isInstance(obj,type){return obj instanceof type||obj!=null&&obj.constructor!=null&&obj.constructor.name!=null&&obj.constructor.name===type.name}function numberIsNaN(obj){return obj!==obj}},{"base64-js":23,ieee754:32}],26:[function(require,module,exports){"use strict";module.exports=require("./lib/eval")},{"./lib/eval":28}],27:[function(require,module,exports){"use strict";module.exports=function(){var math=Object.create(Math);math.factory=function(a){if(typeof a!=="number"){throw new TypeError("built-in math factory only accepts numbers")}return Number(a)};math.add=function(a,b){return a+b};math.sub=function(a,b){return a-b};math.mul=function(a,b){return a*b};math.div=function(a,b){return a/b};math.mod=function(a,b){return a%b};math.factorial=function(a){var res=1;for(var i=2;i<=a;i+=1){res*=i}return res};math.nthRoot=function(a,root){var inv=root<0;if(inv){root=-root}if(root===0){throw new Error("Root must be non-zero")}if(a<0&&Math.abs(root)%2!==1){throw new Error("Root must be odd when a is negative.")}if(a===0){return 0}if(!isFinite(a)){return inv?0:a}var x=Math.pow(Math.abs(a),1/root);x=a<0?-x:x;return inv?1/x:x};math.logicalOR=function(a,b){return a||b};math.logicalXOR=function(a,b){return a!=b};math.logicalAND=function(a,b){return a&&b};math.bitwiseOR=function(a,b){return a|b};math.bitwiseXOR=function(a,b){return a^b};math.bitwiseAND=function(a,b){return a&b};math.lessThan=function(a,b){return ab};math.greaterEqualThan=function(a,b){return a>=b};math.equal=function(a,b){return a==b};math.strictlyEqual=function(a,b){return a===b};math.notEqual=function(a,b){return a!=b};math.strictlyNotEqual=function(a,b){return a!==b};math.shiftRight=function(a,b){return a>>b};math.shiftLeft=function(a,b){return a<>>b};math.negative=function(a){return-a};math.positive=function(a){return a};return math}},{}],28:[function(require,module,exports){"use strict";var CodeGenerator=require("math-codegen");var math=require("./adapter")();function processScope(scope){Object.keys(scope).forEach(function(k){var value=scope[k];scope[k]=math.factory(value)})}module.exports=function(expression){return(new CodeGenerator).setDefs({$$processScope:processScope}).parse(expression).compile(math)};module.exports.math=math},{"./adapter":27,"math-codegen":58}],29:[function(require,module,exports){module.exports=clamp;function clamp(value,min,max){return minmax?max:value:valuemin?min:value}},{}],30:[function(require,module,exports){(function(Buffer){var hasTypedArrays=false;if(typeof Float64Array!=="undefined"){var DOUBLE_VIEW=new Float64Array(1),UINT_VIEW=new Uint32Array(DOUBLE_VIEW.buffer);DOUBLE_VIEW[0]=1;hasTypedArrays=true;if(UINT_VIEW[1]===1072693248){module.exports=function doubleBitsLE(n){DOUBLE_VIEW[0]=n;return[UINT_VIEW[0],UINT_VIEW[1]]};function toDoubleLE(lo,hi){UINT_VIEW[0]=lo;UINT_VIEW[1]=hi;return DOUBLE_VIEW[0]}module.exports.pack=toDoubleLE;function lowUintLE(n){DOUBLE_VIEW[0]=n;return UINT_VIEW[0]}module.exports.lo=lowUintLE;function highUintLE(n){DOUBLE_VIEW[0]=n;return UINT_VIEW[1]}module.exports.hi=highUintLE}else if(UINT_VIEW[0]===1072693248){module.exports=function doubleBitsBE(n){DOUBLE_VIEW[0]=n;return[UINT_VIEW[1],UINT_VIEW[0]]};function toDoubleBE(lo,hi){UINT_VIEW[1]=lo;UINT_VIEW[0]=hi;return DOUBLE_VIEW[0]}module.exports.pack=toDoubleBE;function lowUintBE(n){DOUBLE_VIEW[0]=n;return UINT_VIEW[1]}module.exports.lo=lowUintBE;function highUintBE(n){DOUBLE_VIEW[0]=n;return UINT_VIEW[0]}module.exports.hi=highUintBE}else{hasTypedArrays=false}}if(!hasTypedArrays){var buffer=new Buffer(8);module.exports=function doubleBits(n){buffer.writeDoubleLE(n,0,true);return[buffer.readUInt32LE(0,true),buffer.readUInt32LE(4,true)]};function toDouble(lo,hi){buffer.writeUInt32LE(lo,0,true);buffer.writeUInt32LE(hi,4,true);return buffer.readDoubleLE(0,true)}module.exports.pack=toDouble;function lowUint(n){buffer.writeDoubleLE(n,0,true);return buffer.readUInt32LE(0,true)}module.exports.lo=lowUint;function highUint(n){buffer.writeDoubleLE(n,0,true);return buffer.readUInt32LE(4,true)}module.exports.hi=highUint}module.exports.sign=function(n){return module.exports.hi(n)>>>31};module.exports.exponent=function(n){var b=module.exports.hi(n);return(b<<1>>>21)-1023};module.exports.fraction=function(n){var lo=module.exports.lo(n);var hi=module.exports.hi(n);var b=hi&(1<<20)-1;if(hi&2146435072){b+=1<<20}return[lo,b]};module.exports.denormalized=function(n){var hi=module.exports.hi(n);return!(hi&2146435072)}}).call(this,require("buffer").Buffer)},{buffer:25}],31:[function(require,module,exports){"use strict";var hasOwn=Object.prototype.hasOwnProperty;var toStr=Object.prototype.toString;var defineProperty=Object.defineProperty;var gOPD=Object.getOwnPropertyDescriptor;var isArray=function isArray(arr){if(typeof Array.isArray==="function"){return Array.isArray(arr)}return toStr.call(arr)==="[object Array]"};var isPlainObject=function isPlainObject(obj){if(!obj||toStr.call(obj)!=="[object Object]"){return false}var hasOwnConstructor=hasOwn.call(obj,"constructor");var hasIsPrototypeOf=obj.constructor&&obj.constructor.prototype&&hasOwn.call(obj.constructor.prototype,"isPrototypeOf");if(obj.constructor&&!hasOwnConstructor&&!hasIsPrototypeOf){return false}var key;for(key in obj){}return typeof key==="undefined"||hasOwn.call(obj,key)};var setProperty=function setProperty(target,options){if(defineProperty&&options.name==="__proto__"){defineProperty(target,options.name,{enumerable:true,configurable:true,value:options.newValue,writable:true})}else{target[options.name]=options.newValue}};var getProperty=function getProperty(obj,name){if(name==="__proto__"){if(!hasOwn.call(obj,name)){return void 0}else if(gOPD){return gOPD(obj,name).value}}return obj[name]};module.exports=function extend(){var options,name,src,copy,copyIsArray,clone;var target=arguments[0];var i=1;var length=arguments.length;var deep=false;if(typeof target==="boolean"){deep=target;target=arguments[1]||{};i=2}if(target==null||typeof target!=="object"&&typeof target!=="function"){target={}}for(;i>1;var nBits=-7;var i=isLE?nBytes-1:0;var d=isLE?-1:1;var s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8){}m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8){}if(e===0){e=1-eBias}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity}else{m=m+Math.pow(2,mLen);e=e-eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c;var eLen=nBytes*8-mLen-1;var eMax=(1<>1;var rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0;var i=isLE?0:nBytes-1;var d=isLE?1:-1;var s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2}if(e+eBias>=1){value+=rt/c}else{value+=rt*Math.pow(2,1-eBias)}if(value*c>=2){e++;c/=2}if(e+eBias>=eMax){m=0;e=eMax}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0}}for(;mLen>=8;buffer[offset+i]=m&255,i+=d,m/=256,mLen-=8){}e=e<0;buffer[offset+i]=e&255,i+=d,e/=256,eLen-=8){}buffer[offset+i-d]|=s*128}},{}],33:[function(require,module,exports){"use strict";module.exports=integrate;function adsimp(f,a,b,fa,fm,fb,V0,tol,maxdepth,depth,state){if(state.nanEncountered){return NaN}var h,f1,f2,sl,sr,s2,m,V1,V2,err;h=b-a;f1=f(a+h*.25);f2=f(b-h*.25);if(isNaN(f1)){state.nanEncountered=true;return}if(isNaN(f2)){state.nanEncountered=true;return}sl=h*(fa+4*f1+fm)/12;sr=h*(fm+4*f2+fb)/12;s2=sl+sr;err=(s2-V0)/15;if(depth>maxdepth){state.maxDepthCount++;return s2+err}else if(Math.abs(err)0&&console&&console.warn){console.warn("integrate-adaptive-simpson: Warning: maximum recursion depth ("+maxdepth+") reached "+state.maxDepthCount+" times")}if(state.nanEncountered&&console&&console.warn){console.warn("integrate-adaptive-simpson: Warning: NaN encountered. Halting early.")}return result}},{}],34:[function(require,module,exports){"use strict";module.exports=require("./lib/eval")},{"./lib/eval":36}],35:[function(require,module,exports){"use strict";module.exports=function(ns){ns.mod=ns.fmod;ns.lessThan=ns.lt;ns.lessEqualThan=ns.leq;ns.greaterThan=ns.gt;ns.greaterEqualThan=ns.geq;ns.strictlyEqual=ns.equal;ns.strictlyNotEqual=ns.notEqual;ns.logicalAND=function(a,b){return a&&b};ns.logicalXOR=function(a,b){return a^b};ns.logicalOR=function(a,b){return a||b}}},{}],36:[function(require,module,exports){"use strict";var CodeGenerator=require("math-codegen");var Interval=require("interval-arithmetic");require("./adapter")(Interval);function processScope(scope){Object.keys(scope).forEach(function(k){var value=scope[k];if(typeof value==="number"||Array.isArray(value)){scope[k]=Interval.factory(value)}else if(typeof value==="object"&&"lo"in value&&"hi"in value){scope[k]=Interval.factory(value.lo,value.hi)}})}module.exports=function(expression){return(new CodeGenerator).setDefs({$$processScope:processScope}).parse(expression).compile(Interval)};module.exports.policies=require("./policies")(Interval);module.exports.Interval=Interval},{"./adapter":35,"./policies":37,"interval-arithmetic":38,"math-codegen":58}],37:[function(require,module,exports){"use strict";module.exports=function(Interval){return{disableRounding:function(){Interval.rmath.disable()},enableRounding:function(){Interval.rmath.enable()}}}},{}],38:[function(require,module,exports){"use strict";var extend=require("xtend/mutable");require("./lib/polyfill");module.exports=require("./lib/interval");module.exports.rmath=require("./lib/round-math");module.exports.round=require("./lib/round-math");extend(module.exports,require("./lib/constants"),require("./lib/operations/relational"),require("./lib/operations/arithmetic"),require("./lib/operations/algebra"),require("./lib/operations/trigonometric"),require("./lib/operations/misc"),require("./lib/operations/utils"))},{"./lib/constants":39,"./lib/interval":40,"./lib/operations/algebra":41,"./lib/operations/arithmetic":42,"./lib/operations/misc":44,"./lib/operations/relational":45,"./lib/operations/trigonometric":46,"./lib/operations/utils":47,"./lib/polyfill":48,"./lib/round-math":49,"xtend/mutable":90}],39:[function(require,module,exports){"use strict";var Interval=require("./interval");var mutate=require("xtend/mutable");var piLow=(3373259426+273688/(1<<21))/(1<<30);var piHigh=(3373259426+273689/(1<<21))/(1<<30);var constants={};mutate(constants,{PI_LOW:piLow,PI_HIGH:piHigh,PI_HALF_LOW:piLow/2,PI_HALF_HIGH:piHigh/2,PI_TWICE_LOW:piLow*2,PI_TWICE_HIGH:piHigh*2});function getter(property,fn){Object.defineProperty(constants,property,{get:function(){return fn()},enumerable:true})}getter("PI",function(){return Interval(piLow,piHigh)});getter("PI_HALF",function(){return Interval(constants.PI_HALF_LOW,constants.PI_HALF_HIGH)});getter("PI_TWICE",function(){return Interval(constants.PI_TWICE_LOW,constants.PI_TWICE_HIGH)});getter("ZERO",function(){return Interval(0)});getter("ONE",function(){return Interval(1)});getter("WHOLE",function(){return Interval().setWhole()});getter("EMPTY",function(){return Interval().setEmpty()});module.exports=constants},{"./interval":40,"xtend/mutable":90}],40:[function(require,module,exports){"use strict";var utils=require("./operations/utils");var round=require("./round-math");module.exports=Interval;function Interval(lo,hi){if(!(this instanceof Interval)){return new Interval(lo,hi)}if(typeof lo!=="undefined"&&typeof hi!=="undefined"){if(utils.isInterval(lo)){if(!utils.isSingleton(lo)){throw new TypeError("Interval: interval `lo` must be a singleton")}lo=lo.lo}if(utils.isInterval(hi)){if(!utils.isSingleton(hi)){throw TypeError("Interval: interval `hi` must be a singleton")}hi=hi.hi}}else if(typeof lo!=="undefined"){if(Array.isArray(lo)){return Interval(lo[0],lo[1])}return Interval(lo,lo)}else{lo=hi=0}this.lo=undefined;this.hi=undefined;this.assign(lo,hi)}Interval.factory=Interval;Interval.prototype.singleton=function(v){return this.set(v,v)};Interval.prototype.bounded=function(lo,hi){return this.set(round.prev(lo),round.next(hi))};Interval.prototype.boundedSingleton=function(v){return this.bounded(v,v)};Interval.prototype.set=function(lo,hi){this.lo=lo;this.hi=hi;return this};Interval.prototype.assign=function(lo,hi){if(typeof lo!=="number"||typeof hi!=="number"){throw TypeError("Interval#assign: arguments must be numbers")}if(isNaN(lo)||isNaN(hi)||lo>hi){return this.setEmpty()}return this.set(lo,hi)};Interval.prototype.setEmpty=function(){return this.set(Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY)};Interval.prototype.setWhole=function(){return this.set(Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY)};Interval.prototype.open=function(lo,hi){return this.assign(round.safeNext(lo),round.safePrev(hi))};Interval.prototype.halfOpenLeft=function(lo,hi){return this.assign(round.safeNext(lo),hi)};Interval.prototype.halfOpenRight=function(lo,hi){return this.assign(lo,round.safePrev(hi))};Interval.prototype.toArray=function(){return[this.lo,this.hi]};Interval.prototype.clone=function(){return Interval().set(this.lo,this.hi)}},{"./operations/utils":47,"./round-math":49}],41:[function(require,module,exports){"use strict";var isSafeInteger=require("is-safe-integer");var Interval=require("../interval");var rmath=require("../round-math");var utils=require("./utils");var arithmetic=require("./arithmetic");var constants=require("../constants");var algebra={};algebra.fmod=function(x,y){if(utils.isEmpty(x)||utils.isEmpty(y)){return constants.EMPTY}var yb=x.lo<0?y.lo:y.hi;var n=x.lo/yb;if(n<0)n=Math.ceil(n);else n=Math.floor(n);return arithmetic.sub(x,arithmetic.mul(y,Interval(n)))};algebra.multiplicativeInverse=function(x){if(utils.isEmpty(x)){return constants.EMPTY}if(utils.zeroIn(x)){if(x.lo!==0){if(x.hi!==0){return constants.WHOLE}else{return Interval(Number.NEGATIVE_INFINITY,rmath.divHi(1,x.lo))}}else{if(x.hi!==0){return Interval(rmath.divLo(1,x.hi),Number.POSITIVE_INFINITY)}else{return constants.EMPTY}}}else{return Interval(rmath.divLo(1,x.hi),rmath.divHi(1,x.lo))}};algebra.pow=function(x,power){if(utils.isEmpty(x)){return constants.EMPTY}if(typeof power==="object"){if(!utils.isSingleton(power)){return constants.EMPTY}power=power.lo}if(power===0){if(x.lo===0&&x.hi===0){return constants.EMPTY}else{return constants.ONE}}else if(power<0){return algebra.pow(algebra.multiplicativeInverse(x),-power)}if(isSafeInteger(power)){if(x.hi<0){var yl=rmath.powLo(-x.hi,power);var yh=rmath.powHi(-x.lo,power);if(power&1){return Interval(-yh,-yl)}else{return Interval(yl,yh)}}else if(x.lo<0){if(power&1){return Interval(-rmath.powLo(-x.lo,power),rmath.powHi(x.hi,power))}else{return Interval(0,rmath.powHi(Math.max(-x.lo,x.hi),power))}}else{return Interval(rmath.powLo(x.lo,power),rmath.powHi(x.hi,power))}}else{console.warn("power is not an integer, you should use nth-root instead, returning an empty interval");return constants.EMPTY}};algebra.sqrt=function(x){return algebra.nthRoot(x,2)};algebra.nthRoot=function(x,n){if(utils.isEmpty(x)||n<0){return constants.EMPTY}if(typeof n==="object"){if(!utils.isSingleton(n)){return constants.EMPTY}n=n.lo}var power=1/n;if(x.hi<0){if(isSafeInteger(n)&(n&1)){var yl=rmath.powHi(-x.lo,power);var yh=rmath.powLo(-x.hi,power);return Interval(-yl,-yh)}return Interval.EMPTY}else if(x.lo<0){var yp=rmath.powHi(x.hi,power);if(isSafeInteger(n)&(n&1)){var yn=-rmath.powHi(-x.lo,power);return Interval(yn,yp)}return Interval(0,yp)}else{return Interval(rmath.powLo(x.lo,power),rmath.powHi(x.hi,power))}};module.exports=algebra},{"../constants":39,"../interval":40,"../round-math":49,"./arithmetic":42,"./utils":47,"is-safe-integer":51}],42:[function(require,module,exports){"use strict";var Interval=require("../interval");var rmath=require("../round-math");var utils=require("./utils");var constants=require("../constants");var division=require("./division");var arithmetic={};arithmetic.add=function(x,y){return Interval(rmath.addLo(x.lo,y.lo),rmath.addHi(x.hi,y.hi))};arithmetic.subtract=function(x,y){return Interval(rmath.subLo(x.lo,y.hi),rmath.subHi(x.hi,y.lo))};arithmetic.sub=arithmetic.subtract;arithmetic.multiply=function(x,y){if(utils.isEmpty(x)||utils.isEmpty(y)){return constants.EMPTY}var xl=x.lo;var xh=x.hi;var yl=y.lo;var yh=y.hi;var out=Interval();if(xl<0){if(xh>0){if(yl<0){if(yh>0){out.lo=Math.min(rmath.mulLo(xl,yh),rmath.mulLo(xh,yl));out.hi=Math.max(rmath.mulHi(xl,yl),rmath.mulHi(xh,yh))}else{out.lo=rmath.mulLo(xh,yl);out.hi=rmath.mulHi(xl,yl)}}else{if(yh>0){out.lo=rmath.mulLo(xl,yh);out.hi=rmath.mulHi(xh,yh)}else{out.lo=0;out.hi=0}}}else{if(yl<0){if(yh>0){out.lo=rmath.mulLo(xl,yh);out.hi=rmath.mulHi(xl,yl)}else{out.lo=rmath.mulLo(xh,yh);out.hi=rmath.mulHi(xl,yl)}}else{if(yh>0){out.lo=rmath.mulLo(xl,yh);out.hi=rmath.mulHi(xh,yl)}else{out.lo=0;out.hi=0}}}}else{if(xh>0){if(yl<0){if(yh>0){out.lo=rmath.mulLo(xh,yl);out.hi=rmath.mulHi(xh,yh)}else{out.lo=rmath.mulLo(xh,yl);out.hi=rmath.mulHi(xl,yh)}}else{if(yh>0){out.lo=rmath.mulLo(xl,yl);out.hi=rmath.mulHi(xh,yh)}else{out.lo=0;out.hi=0}}}else{out.lo=0;out.hi=0}}return out};arithmetic.mul=arithmetic.multiply;arithmetic.divide=function(x,y){if(utils.isEmpty(x)||utils.isEmpty(y)){return constants.EMPTY}if(utils.zeroIn(y)){if(y.lo!==0){if(y.hi!==0){return division.zero(x)}else{return division.negative(x,y.lo)}}else{if(y.hi!==0){return division.positive(x,y.hi)}else{return constants.EMPTY}}}else{return division.nonZero(x,y)}};arithmetic.div=arithmetic.divide;arithmetic.positive=function(x){return Interval(x.lo,x.hi)};arithmetic.negative=function(x){return Interval(-x.hi,-x.lo)};module.exports=arithmetic},{"../constants":39,"../interval":40,"../round-math":49,"./division":43,"./utils":47}],43:[function(require,module,exports){"use strict";var Interval=require("../interval");var rmath=require("../round-math");var utils=require("./utils");var constants=require("../constants");var division={nonZero:function(x,y){var xl=x.lo;var xh=x.hi;var yl=y.lo;var yh=y.hi;var out=Interval();if(xh<0){if(yh<0){out.lo=rmath.divLo(xh,yl);out.hi=rmath.divHi(xl,yh)}else{out.lo=rmath.divLo(xl,yl);out.hi=rmath.divHi(xh,yh)}}else if(xl<0){if(yh<0){out.lo=rmath.divLo(xh,yh);out.hi=rmath.divHi(xl,yh)}else{out.lo=rmath.divLo(xl,yl);out.hi=rmath.divHi(xh,yl)}}else{if(yh<0){out.lo=rmath.divLo(xh,yh);out.hi=rmath.divHi(xl,yl)}else{out.lo=rmath.divLo(xl,yh);out.hi=rmath.divHi(xh,yl)}}return out},positive:function(x,v){if(x.lo===0&&x.hi===0){return x}if(utils.zeroIn(x)){return constants.WHOLE}if(x.hi<0){return Interval(Number.NEGATIVE_INFINITY,rmath.divHi(x.hi,v))}else{return Interval(rmath.divLo(x.lo,v),Number.POSITIVE_INFINITY)}},negative:function(x,v){if(x.lo===0&&x.hi===0){return x}if(utils.zeroIn(x)){return constants.WHOLE}if(x.hi<0){return Interval(rmath.divLo(x.hi,v),Number.POSITIVE_INFINITY)}else{return Interval(Number.NEGATIVE_INFINITY,rmath.divHi(x.lo,v))}},zero:function(x){if(x.lo===0&&x.hi===0){return x}return constants.WHOLE}};module.exports=division},{"../constants":39,"../interval":40,"../round-math":49,"./utils":47}],44:[function(require,module,exports){"use strict";var constants=require("../constants");var Interval=require("../interval");var rmath=require("../round-math");var utils=require("./utils");var arithmetic=require("./arithmetic");var misc={};misc.exp=function(x){if(utils.isEmpty(x)){return constants.EMPTY}return Interval(rmath.expLo(x.lo),rmath.expHi(x.hi))};misc.log=function(x){if(utils.isEmpty(x)){return constants.EMPTY}var l=x.lo<=0?Number.NEGATIVE_INFINITY:rmath.logLo(x.lo);return Interval(l,rmath.logHi(x.hi))};misc.ln=misc.log;misc.LOG_EXP_10=misc.log(Interval(10,10));misc.log10=function(x){if(utils.isEmpty(x)){return constants.EMPTY}return arithmetic.div(misc.log(x),misc.LOG_EXP_10)};misc.LOG_EXP_2=misc.log(Interval(2,2));misc.log2=function(x){if(utils.isEmpty(x)){return constants.EMPTY}return arithmetic.div(misc.log(x),misc.LOG_EXP_2)};misc.hull=function(x,y){var badX=utils.isEmpty(x);var badY=utils.isEmpty(y);if(badX&&badY){return constants.EMPTY}else if(badX){return y.clone()}else if(badY){return x.clone()}else{return Interval(Math.min(x.lo,y.lo),Math.max(x.hi,y.hi))}};misc.intersection=function(x,y){if(utils.isEmpty(x)||utils.isEmpty(y)){return constants.EMPTY}var lo=Math.max(x.lo,y.lo);var hi=Math.min(x.hi,y.hi);if(lo<=hi){return Interval(lo,hi)}return constants.EMPTY};misc.union=function(x,y){if(!utils.intervalsOverlap(x,y)){throw Error("Interval#union: intervals do not overlap")}return Interval(Math.min(x.lo,y.lo),Math.max(x.hi,y.hi))};misc.difference=function(x,y){if(utils.isEmpty(x)||utils.isWhole(y)){return constants.EMPTY}if(utils.intervalsOverlap(x,y)){if(x.lo=x.hi&&y.lo===-Infinity){return constants.EMPTY}if(y.lo<=x.lo){return Interval().halfOpenLeft(y.hi,x.hi)}return Interval().halfOpenRight(x.lo,y.lo)}return Interval.clone(x)};misc.width=function(x){if(utils.isEmpty(x)){return 0}return rmath.subHi(x.hi,x.lo)};misc.wid=misc.width;misc.abs=function(x){if(utils.isEmpty(x)){return constants.EMPTY}if(x.lo>=0){return Interval.clone(x)}if(x.hi<=0){return arithmetic.negative(x)}return Interval(0,Math.max(-x.lo,x.hi))};misc.max=function(x,y){var badX=utils.isEmpty(x);var badY=utils.isEmpty(y);if(badX&&badY){return constants.EMPTY}else if(badX){return y.clone()}else if(badY){return x.clone()}else{return Interval(Math.max(x.lo,y.lo),Math.max(x.hi,y.hi))}};misc.min=function(x,y){var badX=utils.isEmpty(x);var badY=utils.isEmpty(y);if(badX&&badY){return constants.EMPTY}else if(badX){return y.clone()}else if(badY){return x.clone()}else{return Interval(Math.min(x.lo,y.lo),Math.min(x.hi,y.hi))}};misc.clone=function(x){return Interval().set(x.lo,x.hi)};module.exports=misc},{"../constants":39,"../interval":40,"../round-math":49,"./arithmetic":42,"./utils":47}],45:[function(require,module,exports){"use strict";var utils=require("./utils");var relational={};relational.equal=function(x,y){if(utils.isEmpty(x)){return utils.isEmpty(y)}return!utils.isEmpty(y)&&x.lo===y.lo&&x.hi===y.hi};var EPS=1e-7;function assert(a,message){if(!a){throw new Error(message||"assertion failed")}}function assertEps(a,b){if(!isFinite(a)){return assert(a===b,"[Infinity] expected "+a+" to be "+b)}assert(Math.abs(a-b)y.hi};relational.lessThan=function(x,y){if(utils.isEmpty(x)||utils.isEmpty(y)){return false}return x.hiy.hi};relational.gt=relational.greaterThan;relational.lessEqualThan=function(x,y){if(utils.isEmpty(x)||utils.isEmpty(y)){return false}return x.hi<=y.lo};relational.leq=relational.lessEqualThan;relational.greaterEqualThan=function(x,y){if(utils.isEmpty(x)||utils.isEmpty(y)){return false}return x.lo>=y.hi};relational.geq=relational.greaterEqualThan;module.exports=relational},{"./utils":47}],46:[function(require,module,exports){"use strict";var constants=require("../constants");var Interval=require("../interval");var rmath=require("../round-math");var utils=require("./utils");var misc=require("./misc");var algebra=require("./algebra");var arithmetic=require("./arithmetic");var trigonometric={};function onlyInfinity(x){return!isFinite(x.lo)&&x.lo===x.hi}function handleNegative(interval){if(interval.lo<0){if(interval.lo===-Infinity){interval.lo=0;interval.hi=Infinity}else{var n=Math.ceil(-interval.lo/constants.PI_TWICE_LOW);interval.lo+=constants.PI_TWICE_LOW*n;interval.hi+=constants.PI_TWICE_LOW*n}}return interval}trigonometric.cos=function(x){var rlo,rhi;if(utils.isEmpty(x)||onlyInfinity(x)){return constants.EMPTY}var cache=Interval();cache.set(x.lo,x.hi);handleNegative(cache);var pi2=constants.PI_TWICE;var t=algebra.fmod(cache,pi2);if(misc.width(t)>=pi2.lo){return Interval(-1,1)}if(t.lo>=constants.PI_HIGH){var cos=trigonometric.cos(arithmetic.sub(t,constants.PI));return arithmetic.negative(cos)}var lo=t.lo;var hi=t.hi;rlo=rmath.cosLo(hi);rhi=rmath.cosHi(lo);if(hi<=constants.PI_LOW){return Interval(rlo,rhi)}else if(hi<=pi2.lo){return Interval(-1,Math.max(rlo,rhi))}else{return Interval(-1,1)}};trigonometric.sin=function(x){if(utils.isEmpty(x)||onlyInfinity(x)){return constants.EMPTY}return trigonometric.cos(arithmetic.sub(x,constants.PI_HALF))};trigonometric.tan=function(x){if(utils.isEmpty(x)||onlyInfinity(x)){return constants.EMPTY}var cache=Interval();cache.set(x.lo,x.hi);handleNegative(cache);var pi=constants.PI;var t=algebra.fmod(cache,pi);if(t.lo>=constants.PI_HALF_LOW){t=arithmetic.sub(t,pi)}if(t.lo<=-constants.PI_HALF_LOW||t.hi>=constants.PI_HALF_LOW){return constants.WHOLE}return Interval(rmath.tanLo(t.lo),rmath.tanHi(t.hi))};trigonometric.asin=function(x){if(utils.isEmpty(x)||x.hi<-1||x.lo>1){return constants.EMPTY}var lo=x.lo<=-1?-constants.PI_HALF_HIGH:rmath.asinLo(x.lo);var hi=x.hi>=1?constants.PI_HALF_HIGH:rmath.asinHi(x.hi);return Interval(lo,hi)};trigonometric.acos=function(x){if(utils.isEmpty(x)||x.hi<-1||x.lo>1){return constants.EMPTY}var lo=x.hi>=1?0:rmath.acosLo(x.hi);var hi=x.lo<=-1?constants.PI_HIGH:rmath.acosHi(x.lo);return Interval(lo,hi)};trigonometric.atan=function(x){if(utils.isEmpty(x)){return constants.EMPTY}return Interval(rmath.atanLo(x.lo),rmath.atanHi(x.hi))};trigonometric.sinh=function(x){if(utils.isEmpty(x)){return constants.EMPTY}return Interval(rmath.sinhLo(x.lo),rmath.sinhHi(x.hi))};trigonometric.cosh=function(x){if(utils.isEmpty(x)){return constants.EMPTY}if(x.hi<0){return Interval(rmath.coshLo(x.hi),rmath.coshHi(x.lo))}else if(x.lo>=0){return Interval(rmath.coshLo(x.lo),rmath.coshHi(x.hi))}else{return Interval(1,rmath.coshHi(-x.lo>x.hi?x.lo:x.hi))}};trigonometric.tanh=function(x){if(utils.isEmpty(x)){return constants.EMPTY}return Interval(rmath.tanhLo(x.lo),rmath.tanhHi(x.hi))};module.exports=trigonometric},{"../constants":39,"../interval":40,"../round-math":49,"./algebra":41,"./arithmetic":42,"./misc":44,"./utils":47}],47:[function(require,module,exports){"use strict";var utils={};utils.isInterval=function(x){return typeof x==="object"&&typeof x.lo==="number"&&typeof x.hi==="number"};utils.isEmpty=function(x){return x.lo>x.hi};utils.isWhole=function(x){return x.lo===-Infinity&&x.hi===Infinity};utils.isSingleton=function(x){return x.lo===x.hi};utils.zeroIn=function(x){return utils.hasValue(x,0)};utils.hasValue=function(a,value){if(utils.isEmpty(a)){return false}return a.lo<=value&&value<=a.hi};utils.hasInterval=function(x,y){if(utils.isEmpty(x)){return true}return!utils.isEmpty(y)&&y.lo<=x.lo&&x.hi<=y.hi};utils.intervalsOverlap=function(x,y){if(utils.isEmpty(x)||utils.isEmpty(y)){return false}return x.lo<=y.lo&&y.lo<=x.hi||y.lo<=x.lo&&x.lo<=y.hi};module.exports=utils},{}],48:[function(require,module,exports){"use strict";Math.sinh=Math.sinh||function(x){var y=Math.exp(x);return(y-1/y)/2};Math.cosh=Math.cosh||function(x){var y=Math.exp(x);return(y+1/y)/2};Math.tanh=Math.tanh||function(x){if(x===Number.POSITIVE_INFINITY){return 1}else if(x===Number.NEGATIVE_INFINITY){return-1}else{var y=Math.exp(2*x);return(y-1)/(y+1)}}},{}],49:[function(require,module,exports){"use strict";var nextafter=require("nextafter");function identity(v){return v}function prev(v){if(v===Infinity){return v}return nextafter(v,-Infinity)}function next(v){if(v===-Infinity){return v}return nextafter(v,Infinity)}var round={safePrev:prev,safeNext:next,prev:prev,next:next};round.addLo=function(x,y){return this.prev(x+y)};round.addHi=function(x,y){return this.next(x+y)};round.subLo=function(x,y){return this.prev(x-y)};round.subHi=function(x,y){return this.next(x-y)};round.mulLo=function(x,y){return this.prev(x*y)};round.mulHi=function(x,y){return this.next(x*y)};round.divLo=function(x,y){return this.prev(x/y)};round.divHi=function(x,y){return this.next(x/y)};function toInteger(x){return x<0?Math.ceil(x):Math.floor(x)}round.intLo=function(x){return toInteger(this.prev(x))};round.intHi=function(x){return toInteger(this.next(x))};round.logLo=function(x){return this.prev(Math.log(x))};round.logHi=function(x){return this.next(Math.log(x))};round.expLo=function(x){return this.prev(Math.exp(x))};round.expHi=function(x){return this.next(Math.exp(x))};round.sinLo=function(x){return this.prev(Math.sin(x))};round.sinHi=function(x){return this.next(Math.sin(x))};round.cosLo=function(x){return this.prev(Math.cos(x))};round.cosHi=function(x){return this.next(Math.cos(x))};round.tanLo=function(x){return this.prev(Math.tan(x))};round.tanHi=function(x){return this.next(Math.tan(x))};round.asinLo=function(x){return this.prev(Math.asin(x))};round.asinHi=function(x){return this.next(Math.asin(x))};round.acosLo=function(x){return this.prev(Math.acos(x))};round.acosHi=function(x){return this.next(Math.acos(x))};round.atanLo=function(x){return this.prev(Math.atan(x))};round.atanHi=function(x){return this.next(Math.atan(x))};round.sinhLo=function(x){return this.prev(Math.sinh(x))};round.sinhHi=function(x){return this.next(Math.sinh(x))};round.coshLo=function(x){return this.prev(Math.cosh(x))};round.coshHi=function(x){return this.next(Math.cosh(x))};round.tanhLo=function(x){return this.prev(Math.tanh(x))};round.tanhHi=function(x){return this.next(Math.tanh(x))};round.powLo=function(x,power){if(power%1!==0){return this.prev(Math.pow(x,power))}var y=power&1?x:1;power>>=1;while(power>0){x=round.mulLo(x,x);if(power&1){y=round.mulLo(x,y)}power>>=1}return y};round.powHi=function(x,power){if(power%1!==0){return this.next(Math.pow(x,power))}var y=power&1?x:1;power>>=1;while(power>0){x=round.mulHi(x,x);if(power&1){y=round.mulHi(x,y)}power>>=1}return y};round.sqrtLo=function(x){return this.prev(Math.sqrt(x))};round.sqrtHi=function(x){return this.next(Math.sqrt(x))};round.disable=function(){this.next=this.prev=identity};round.enable=function(){this.next=next;this.prev=prev};module.exports=round},{nextafter:87}],50:[function(require,module,exports){"use strict";module.exports=function isObject(x){return typeof x==="object"&&x!==null}},{}],51:[function(require,module,exports){"use strict";var MAX_SAFE_INTEGER=require("max-safe-integer");module.exports=Number.isSafeInteger||function(val){return typeof val==="number"&&val===val&&val!==Infinity&&val!==-Infinity&&parseInt(val,10)===val&&Math.abs(val)<=MAX_SAFE_INTEGER}},{"max-safe-integer":71}],52:[function(require,module,exports){(function(process){var keys=require("vkey");var list=Object.keys(keys);var down={};reset();module.exports=pressed;if(process.browser){window.addEventListener("keydown",keydown,false);window.addEventListener("keyup",keyup,false);window.addEventListener("blur",reset,false)}function pressed(key){return key?down[key]:down}function reset(){list.forEach(function(code){down[keys[code]]=false})}function keyup(e){down[keys[e.keyCode]]=false}function keydown(e){down[keys[e.keyCode]]=true}}).call(this,require("_process"))},{_process:88,vkey:89}],53:[function(require,module,exports){var Emitter=require("events").EventEmitter;var vkey=require("vkey");module.exports=function(keys,el){if(typeof keys==="string")keys=[keys];if(!el)el=window;var emitter=new Emitter;emitter.pressed={};el.addEventListener("blur",clearPressed);el.addEventListener("focus",clearPressed);el.addEventListener("keydown",function(ev){var key=vkey[ev.keyCode];emitter.pressed[key]=true;var allPressed=true;keys.forEach(function(k){if(!emitter.pressed[k])allPressed=false});if(allPressed){emitter.emit("pressed",emitter.pressed);clearPressed()}});el.addEventListener("keyup",function(ev){delete emitter.pressed[vkey[ev.keyCode]]});function clearPressed(){emitter.pressed={}}return emitter}},{events:24,vkey:89}],54:[function(require,module,exports){var range=require("lodash.range");module.exports=function linspace(a,b,n){var every=(b-a)/(n-1),ranged=range(a,b,every);return ranged.length==n?ranged:ranged.concat(b)}},{"lodash.range":55}],55:[function(require,module,exports){var INFINITY=1/0,MAX_SAFE_INTEGER=9007199254740991,MAX_INTEGER=17976931348623157e292,NAN=0/0;var funcTag="[object Function]",genTag="[object GeneratorFunction]",symbolTag="[object Symbol]";var reTrim=/^\s+|\s+$/g;var reIsBadHex=/^[-+]0x[0-9a-f]+$/i;var reIsBinary=/^0b[01]+$/i;var reIsOctal=/^0o[0-7]+$/i;var reIsUint=/^(?:0|[1-9]\d*)$/;var freeParseInt=parseInt;function baseProperty(key){return function(object){return object==null?undefined:object[key]}}var objectProto=Object.prototype;var objectToString=objectProto.toString;var nativeCeil=Math.ceil,nativeMax=Math.max;function baseRange(start,end,step,fromRight){var index=-1,length=nativeMax(nativeCeil((end-start)/(step||1)),0),result=Array(length);while(length--){result[fromRight?length:++index]=start;start+=step}return result}function createRange(fromRight){return function(start,end,step){if(step&&typeof step!="number"&&isIterateeCall(start,end,step)){end=step=undefined}start=toFinite(start);if(end===undefined){end=start;start=0}else{end=toFinite(end)}step=step===undefined?start-1&&value%1==0&&value-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isObject(value){var type=typeof value;return!!value&&(type=="object"||type=="function")}function isObjectLike(value){return!!value&&typeof value=="object"}function isSymbol(value){return typeof value=="symbol"||isObjectLike(value)&&objectToString.call(value)==symbolTag}function toFinite(value){if(!value){return value===0?value:0}value=toNumber(value);if(value===INFINITY||value===-INFINITY){var sign=value<0?-1:1;return sign*MAX_INTEGER}return value===value?value:0}function toNumber(value){if(typeof value=="number"){return value}if(isSymbol(value)){return NAN}if(isObject(value)){var other=isFunction(value.valueOf)?value.valueOf():value;value=isObject(other)?other+"":other}if(typeof value!="string"){return value===0?value:+value}value=value.replace(reTrim,"");var isBinary=reIsBinary.test(value);return isBinary||reIsOctal.test(value)?freeParseInt(value.slice(2),isBinary?2:8):reIsBadHex.test(value)?NAN:+value}var range=createRange();module.exports=range},{}],56:[function(require,module,exports){"use strict";module.exports=Math.log10||function(x){return Math.log(x)*Math.LOG10E}},{}],57:[function(require,module,exports){var linspace=require("linspace");module.exports=function logspace(a,b,n){return linspace(a,b,n).map(function(x){return Math.pow(10,x)})}},{linspace:54}],58:[function(require,module,exports){"use strict";module.exports=require("./lib/CodeGenerator")},{"./lib/CodeGenerator":59}],59:[function(require,module,exports){"use strict";var Parser=require("mr-parser").Parser;var Interpreter=require("./Interpreter");var extend=require("extend");function CodeGenerator(options,defs){this.statements=[];this.defs=defs||{};this.interpreter=new Interpreter(this,options)}CodeGenerator.prototype.setDefs=function(defs){this.defs=extend(this.defs,defs);return this};CodeGenerator.prototype.compile=function(namespace){if(!namespace||!(typeof namespace==="object"||typeof namespace==="function")){throw TypeError("namespace must be an object")}if(typeof namespace.factory!=="function"){throw TypeError("namespace.factory must be a function")}this.defs.ns=namespace;this.defs.$$mathCodegen={getProperty:function(symbol,scope,ns){if(symbol in scope){return scope[symbol]}if(symbol in ns){return ns[symbol]}throw SyntaxError('symbol "'+symbol+'" is undefined')},functionProxy:function(fn,name){if(typeof fn!=="function"){throw SyntaxError('symbol "'+name+'" must be a function')}return fn}};this.defs.$$processScope=this.defs.$$processScope||function(){};var defsCode=Object.keys(this.defs).map(function(name){return"var "+name+' = defs["'+name+'"]'});if(!this.statements.length){throw Error("there are no statements saved in this generator, make sure you parse an expression before compiling it")}this.statements[this.statements.length-1]="return "+this.statements[this.statements.length-1];var code=this.statements.join(";");var factoryCode=defsCode.join("\n")+"\n"+["return {"," eval: function (scope) {"," scope = scope || {}"," $$processScope(scope)"," "+code," },"," code: '"+code+"'","}"].join("\n");var factory=new Function("defs",factoryCode);return factory(this.defs)};CodeGenerator.prototype.parse=function(code){var self=this;var program=(new Parser).parse(code);this.statements=program.blocks.map(function(statement){return self.interpreter.next(statement)});return this};module.exports=CodeGenerator},{"./Interpreter":60,extend:31,"mr-parser":72}],60:[function(require,module,exports){"use strict";var extend=require("extend");var types={ArrayNode:require("./node/ArrayNode"),AssignmentNode:require("./node/AssignmentNode"),ConditionalNode:require("./node/ConditionalNode"),ConstantNode:require("./node/ConstantNode"),FunctionNode:require("./node/FunctionNode"),OperatorNode:require("./node/OperatorNode"),SymbolNode:require("./node/SymbolNode"),UnaryNode:require("./node/UnaryNode")};var Interpreter=function(owner,options){this.owner=owner;this.options=extend({factory:"ns.factory",raw:false,rawArrayExpressionElements:true,rawCallExpressionElements:false},options)};extend(Interpreter.prototype,types);Interpreter.prototype.next=function(node){if(!(node.type in this)){throw new TypeError("the node type "+node.type+" is not implemented")}return this[node.type](node)};Interpreter.prototype.rawify=function(test,fn){var oldRaw=this.options.raw;if(test){this.options.raw=true}fn();if(test){this.options.raw=oldRaw}};module.exports=Interpreter},{"./node/ArrayNode":63,"./node/AssignmentNode":64,"./node/ConditionalNode":65,"./node/ConstantNode":66,"./node/FunctionNode":67,"./node/OperatorNode":68,"./node/SymbolNode":69,"./node/UnaryNode":70,extend:31}],61:[function(require,module,exports){"use strict";module.exports={"+":"add","-":"sub","*":"mul","/":"div","^":"pow","%":"mod","!":"factorial","|":"bitwiseOR","^|":"bitwiseXOR","&":"bitwiseAND","||":"logicalOR",xor:"logicalXOR","&&":"logicalAND","<":"lessThan",">":"greaterThan","<=":"lessEqualThan",">=":"greaterEqualThan","===":"strictlyEqual","==":"equal","!==":"strictlyNotEqual","!=":"notEqual",">>":"shiftRight","<<":"shiftLeft",">>>":"unsignedRightShift"}},{}],62:[function(require,module,exports){"use strict";module.exports={"+":"positive","-":"negative","~":"oneComplement"}},{}],63:[function(require,module,exports){"use strict";module.exports=function(node){var self=this;var arr=[];this.rawify(this.options.rawArrayExpressionElements,function(){arr=node.nodes.map(function(el){return self.next(el)})});var arrString="["+arr.join(",")+"]";if(this.options.raw){return arrString}return this.options.factory+"("+arrString+")"}},{}],64:[function(require,module,exports){"use strict";module.exports=function(node){return'scope["'+node.name+'"] = '+this.next(node.expr)}},{}],65:[function(require,module,exports){"use strict";module.exports=function(node){var condition="!!("+this.next(node.condition)+")";var trueExpr=this.next(node.trueExpr);var falseExpr=this.next(node.falseExpr);return"("+condition+" ? ("+trueExpr+") : ("+falseExpr+") )"}},{}],66:[function(require,module,exports){"use strict";module.exports=function(node){if(this.options.raw){return node.value}return this.options.factory+"("+node.value+")"}},{}],67:[function(require,module,exports){"use strict";var SymbolNode=require("mr-parser").nodeTypes.SymbolNode;var functionProxy=function(node){return"$$mathCodegen.functionProxy("+this.next(new SymbolNode(node.name))+', "'+node.name+'")'};module.exports=function(node){var self=this;var method=functionProxy.call(this,node);var args=[];this.rawify(this.options.rawCallExpressionElements,function(){args=node.args.map(function(arg){return self.next(arg)})});return method+"("+args.join(", ")+")"};module.exports.functionProxy=functionProxy},{"mr-parser":72}],68:[function(require,module,exports){"use strict";var Operators=require("../misc/Operators");module.exports=function(node){if(this.options.raw){return["("+this.next(node.args[0]),node.op,this.next(node.args[1])+")"].join(" ")}var namedOperator=Operators[node.op];if(!namedOperator){throw TypeError("unidentified operator")}return this.FunctionNode({name:namedOperator,args:node.args})}},{"../misc/Operators":61}],69:[function(require,module,exports){"use strict";module.exports=function(node){var id=node.name;return'$$mathCodegen.getProperty("'+id+'", scope, ns)'}},{}],70:[function(require,module,exports){"use strict";var UnaryOperators=require("../misc/UnaryOperators");module.exports=function(node){if(this.options.raw){return node.op+this.next(node.argument)}if(!(node.op in UnaryOperators)){throw new SyntaxError(node.op+" not implemented")}var namedOperator=UnaryOperators[node.op];return this.FunctionNode({name:namedOperator,args:[node.argument]})}},{"../misc/UnaryOperators":62}],71:[function(require,module,exports){"use strict";module.exports=9007199254740991},{}],72:[function(require,module,exports){"use strict";module.exports.Lexer=require("./lib/Lexer");module.exports.Parser=require("./lib/Parser");module.exports.nodeTypes=require("./lib/node/")},{"./lib/Lexer":73,"./lib/Parser":74,"./lib/node/":85}],73:[function(require,module,exports){var tokenType=require("./token-type");var ESCAPES={n:"\n",f:"\f",r:"\r",t:"\t",v:"\v","'":"'",'"':'"'};var DELIMITERS={",":true,"(":true,")":true,"[":true,"]":true,";":true,"~":true,"!":true,"+":true,"-":true,"*":true,"/":true,"%":true,"^":true,"**":true,"|":true,"&":true,"^|":true,"=":true,":":true,"?":true,"||":true,"&&":true,xor:true,"==":true,"!=":true,"===":true,"!==":true,"<":true,">":true,">=":true,"<=":true,">>>":true,"<<":true,">>":true};function isDigit(c){return c>="0"&&c<="9"}function isIdentifier(c){return c>="a"&&c<="z"||c>="A"&&c<="Z"||c==="$"||c==="_"}function isWhitespace(c){return c===" "||c==="\r"||c==="\t"||c==="\n"||c==="\v"||c===" "}function isDelimiter(str){return DELIMITERS[str]}function isQuote(c){return c==="'"||c==='"'}function Lexer(){}Lexer.prototype.throwError=function(message,index){index=typeof index==="undefined"?this.index:index;var error=new Error(message+" at index "+index);error.index=index;error.description=message;throw error};Lexer.prototype.lex=function(text){this.text=text;this.index=0;this.tokens=[];while(this.index=this.text.length){return}return this.text.charAt(this.index+nth)};Lexer.prototype.consume=function(){var current=this.peek();this.index+=1;return current};Lexer.prototype.readNumber=function(){var number="";if(this.peek()==="."){number+=this.consume();if(!isDigit(this.peek())){this.throwError("number expected")}}else{while(isDigit(this.peek())){number+=this.consume()}if(this.peek()==="."){number+=this.consume()}}while(isDigit(this.peek())){number+=this.consume()}if(this.peek()==="e"||this.peek()==="E"){number+=this.consume();if(!(isDigit(this.peek())||this.peek()==="+"||this.peek()==="-")){this.throwError()}if(this.peek()==="+"||this.peek()==="-"){number+=this.consume()}if(!isDigit(this.peek())){this.throwError("number expected")}while(isDigit(this.peek())){number+=this.consume()}}return number};Lexer.prototype.readIdentifier=function(){var text="";while(isIdentifier(this.peek())||isDigit(this.peek())){text+=this.consume()}return text};Lexer.prototype.readString=function(){var quote=this.consume();var string="";var escape;while(true){var c=this.consume();if(!c){this.throwError("string is not closed")}if(escape){if(c==="u"){var hex=this.text.substring(this.index+1,this.index+5);if(!hex.match(/[\da-f]{4}/i)){this.throwError("invalid unicode escape")}this.index+=4;string+=String.fromCharCode(parseInt(hex,16))}else{var replacement=ESCAPES[c];if(replacement){string+=replacement}else{string+=c}}escape=false}else if(c===quote){break}else if(c==="\\"){escape=true}else{string+=c}}return string};module.exports=Lexer},{"./token-type":86}],74:[function(require,module,exports){var tokenType=require("./token-type");var Lexer=require("./Lexer");var ConstantNode=require("./node/ConstantNode");var OperatorNode=require("./node/OperatorNode");var UnaryNode=require("./node/UnaryNode");var SymbolNode=require("./node/SymbolNode");var FunctionNode=require("./node/FunctionNode");var ArrayNode=require("./node/ArrayNode");var ConditionalNode=require("./node/ConditionalNode");var AssignmentNode=require("./node/AssignmentNode");var BlockNode=require("./node/BlockNode");function Parser(){this.lexer=new Lexer;this.tokens=null}Parser.prototype.current=function(){return this.tokens[0]};Parser.prototype.next=function(){return this.tokens[1]};Parser.prototype.peek=function(){if(this.tokens.length){var first=this.tokens[0];for(var i=0;i=","<=",">","<")){var op=this.consume();var right=this.shift();return new OperatorNode(op.value,[left,right])}return left};Parser.prototype.shift=function(){var left=this.additive();if(this.peek(">>","<<",">>>")){var op=this.consume();var right=this.shift();return new OperatorNode(op.value,[left,right])}return left};Parser.prototype.additive=function(){var left=this.multiplicative();while(this.peek("+","-")){var op=this.consume();left=new OperatorNode(op.value,[left,this.multiplicative()])}return left};Parser.prototype.multiplicative=function(){var op,right;var left=this.unary();while(this.peek("*","/","%")){op=this.consume();left=new OperatorNode(op.value,[left,this.unary()])}if(this.current().type===tokenType.SYMBOL||this.peek("(")||!(left.type instanceof ConstantNode)&&this.current().type===tokenType.NUMBER){right=this.multiplicative();return new OperatorNode("*",[left,right])}return left};Parser.prototype.unary=function(){if(this.peek("-","+","~")){var op=this.consume();var right=this.unary();return new UnaryNode(op.value,right)}return this.pow()};Parser.prototype.pow=function(){var left=this.factorial();if(this.peek("^","**")){var op=this.consume();var right=this.unary();return new OperatorNode(op.value,[left,right])}return left};Parser.prototype.factorial=function(){var left=this.symbol();if(this.peek("!")){var op=this.consume();return new OperatorNode(op.value,[left])}return left};Parser.prototype.symbol=function(){var current=this.current();if(current.type===tokenType.SYMBOL){var symbol=this.consume();var node=this.functionCall(symbol);return node}return this.string()};Parser.prototype.functionCall=function(symbolToken){var name=symbolToken.value;if(this.peek("(")){this.consume();var params=[];while(!this.peek(")")&&!this.isEOF()){params.push(this.assignment());if(this.peek(",")){this.consume()}}this.expect(")");return new FunctionNode(name,params)}return new SymbolNode(name)};Parser.prototype.string=function(){if(this.current().type===tokenType.STRING){return new ConstantNode(this.consume().value,"string")}return this.array()};Parser.prototype.array=function(){if(this.peek("[")){this.consume();var params=[];while(!this.peek("]")&&!this.isEOF()){params.push(this.assignment());if(this.peek(",")){this.consume()}}this.expect("]");return new ArrayNode(params)}return this.number()};Parser.prototype.number=function(){var token=this.current();if(token.type===tokenType.NUMBER){return new ConstantNode(this.consume().value,"number")}return this.parentheses()};Parser.prototype.parentheses=function(){var token=this.current();if(token.value==="("){this.consume();var left=this.assignment();this.expect(")");return left}return this.end()};Parser.prototype.end=function(){var token=this.current();if(token.type!==tokenType.EOF){throw Error("unexpected end of expression")}};module.exports=Parser},{"./Lexer":73,"./node/ArrayNode":75,"./node/AssignmentNode":76,"./node/BlockNode":77,"./node/ConditionalNode":78,"./node/ConstantNode":79,"./node/FunctionNode":80,"./node/OperatorNode":82,"./node/SymbolNode":83,"./node/UnaryNode":84,"./token-type":86}],75:[function(require,module,exports){var Node=require("./Node");function ArrayNode(nodes){this.nodes=nodes}ArrayNode.prototype=Object.create(Node.prototype);ArrayNode.prototype.type="ArrayNode";module.exports=ArrayNode},{"./Node":81}],76:[function(require,module,exports){var Node=require("./Node");function AssignmentNode(name,expr){this.name=name;this.expr=expr}AssignmentNode.prototype=Object.create(Node.prototype);AssignmentNode.prototype.type="AssignmentNode";module.exports=AssignmentNode},{"./Node":81}],77:[function(require,module,exports){var Node=require("./Node");function BlockNode(blocks){this.blocks=blocks}BlockNode.prototype=Object.create(Node.prototype);BlockNode.prototype.type="BlockNode";module.exports=BlockNode},{"./Node":81}],78:[function(require,module,exports){var Node=require("./Node");function ConditionalNode(predicate,truthy,falsy){this.condition=predicate;this.trueExpr=truthy;this.falseExpr=falsy}ConditionalNode.prototype=Object.create(Node.prototype);ConditionalNode.prototype.type="ConditionalNode";module.exports=ConditionalNode},{"./Node":81}],79:[function(require,module,exports){var Node=require("./Node");var SUPPORTED_TYPES={number:true,string:true,boolean:true,undefined:true,null:true};function ConstantNode(value,type){if(!SUPPORTED_TYPES[type]){throw Error("unsupported type '"+type+"'")}this.value=value;this.valueType=type}ConstantNode.prototype=Object.create(Node.prototype);ConstantNode.prototype.type="ConstantNode";module.exports=ConstantNode},{"./Node":81}],80:[function(require,module,exports){var Node=require("./Node");function FunctionNode(name,args){this.name=name;this.args=args}FunctionNode.prototype=Object.create(Node.prototype);FunctionNode.prototype.type="FunctionNode";module.exports=FunctionNode},{"./Node":81}],81:[function(require,module,exports){function Node(){}Node.prototype.type="Node";module.exports=Node},{}],82:[function(require,module,exports){var Node=require("./Node");function OperatorNode(op,args){this.op=op;this.args=args||[]}OperatorNode.prototype=Object.create(Node.prototype);OperatorNode.prototype.type="OperatorNode";module.exports=OperatorNode},{"./Node":81}],83:[function(require,module,exports){var Node=require("./Node");function SymbolNode(name){this.name=name}SymbolNode.prototype=Object.create(Node.prototype);SymbolNode.prototype.type="SymbolNode";module.exports=SymbolNode},{"./Node":81}],84:[function(require,module,exports){var Node=require("./Node");function UnaryNode(op,argument){this.op=op;this.argument=argument}UnaryNode.prototype=Object.create(Node.prototype);UnaryNode.prototype.type="UnaryNode";module.exports=UnaryNode},{"./Node":81}],85:[function(require,module,exports){module.exports={ArrayNode:require("./ArrayNode"),AssignmentNode:require("./AssignmentNode"),BlockNode:require("./BlockNode"),ConditionalNode:require("./ConditionalNode"),ConstantNode:require("./ConstantNode"),FunctionNode:require("./FunctionNode"),Node:require("./Node"),OperatorNode:require("./OperatorNode"),SymbolNode:require("./SymbolNode"),UnaryNode:require("./UnaryNode")}},{"./ArrayNode":75,"./AssignmentNode":76,"./BlockNode":77,"./ConditionalNode":78,"./ConstantNode":79,"./FunctionNode":80,"./Node":81,"./OperatorNode":82,"./SymbolNode":83,"./UnaryNode":84}],86:[function(require,module,exports){module.exports={EOF:0,DELIMITER:1,NUMBER:2,STRING:3,SYMBOL:4}},{}],87:[function(require,module,exports){"use strict";var doubleBits=require("double-bits");var SMALLEST_DENORM=Math.pow(2,-1074);var UINT_MAX=-1>>>0;module.exports=nextafter;function nextafter(x,y){if(isNaN(x)||isNaN(y)){return NaN}if(x===y){return x}if(x===0){if(y<0){return-SMALLEST_DENORM}else{return SMALLEST_DENORM}}var hi=doubleBits.hi(x);var lo=doubleBits.lo(x);if(y>x===x>0){if(lo===UINT_MAX){hi+=1;lo=0}else{lo+=1}}else{if(lo===0){lo=UINT_MAX;hi-=1}else{lo-=1}}return doubleBits.pack(lo,hi)}},{"double-bits":30}],88:[function(require,module,exports){var process=module.exports={};var cachedSetTimeout;var cachedClearTimeout;function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function"){cachedSetTimeout=setTimeout}else{cachedSetTimeout=defaultSetTimout}}catch(e){cachedSetTimeout=defaultSetTimout}try{if(typeof clearTimeout==="function"){cachedClearTimeout=clearTimeout}else{cachedClearTimeout=defaultClearTimeout}}catch(e){cachedClearTimeout=defaultClearTimeout}})();function runTimeout(fun){if(cachedSetTimeout===setTimeout){return setTimeout(fun,0)}if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout){cachedSetTimeout=setTimeout;return setTimeout(fun,0)}try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout){return clearTimeout(marker)}if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout){cachedClearTimeout=clearTimeout;return clearTimeout(marker)}try{return cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}var queue=[];var draining=false;var currentQueue;var queueIndex=-1;function cleanUpNextTick(){if(!draining||!currentQueue){return}draining=false;if(currentQueue.length){queue=currentQueue.concat(queue)}else{queueIndex=-1}if(queue.length){drainQueue()}}function drainQueue(){if(draining){return}var timeout=runTimeout(cleanUpNextTick);draining=true;var len=queue.length;while(len){currentQueue=queue;queue=[];while(++queueIndex1){for(var i=1;i":"",1:"",2:"",3:"",4:"",5:"",6:"",8:"",9:"",12:"",13:"",16:"",17:"",18:"",19:"",20:"",21:"",23:"",24:"",25:"",27:"",28:"",29:"",30:"",31:"",27:"",32:"",33:"",34:"",35:"",36:"",37:"",38:"",39:"",40:"",41:"",42:"",43:"",44:"",45:"",46:"",47:"",91:"",92:"",93:isOSX?"":"",95:"",106:"",107:"",108:"",109:"",110:"",111:"",144:"",145:"",160:"",161:"",162:"",163:"",164:"",165:"",166:"",167:"",168:"",169:"",170:"",171:"",172:"",173:isOSX&&maybeFirefox?"-":"",174:"",175:"",176:"",177:"",178:"",179:"",180:"",181:"",182:"",183:"",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",223:"",224:"",226:"",229:"",231:isOpera?"`":"",246:"",247:"",248:"",249:"",250:"",251:"",252:"",253:"",254:""};for(i=58;i<65;++i){output[i]=String.fromCharCode(i)}for(i=48;i<58;++i){output[i]=i-48+""}for(i=65;i<91;++i){output[i]=String.fromCharCode(i)}for(i=96;i<106;++i){output[i]=""}for(i=112;i<136;++i){output[i]="F"+(i-111)}},{}],91:[function(require,module,exports){module.exports=extend;var hasOwnProperty=Object.prototype.hasOwnProperty;function extend(target){for(var i=1;i hi) { - // no overlap - return [-minWidthHeight, 0] - } - return [lo, hi] - } - - var line = function (points, closed) { - var path = '' - var minY = yScale.range()[1] - var maxY = yScale.range()[0] - for (var i = 0, length = points.length; i < length; i += 1) { - if (points[i]) { - var x = points[i][0] - var y = points[i][1] - var yLo = y.lo - var yHi = y.hi - // if options.closed is set to true then one of the bounds must be zero - if (closed) { - yLo = Math.min(yLo, 0) - yHi = Math.max(yHi, 0) - } - // points.scaledDX is added because of the stroke-width - var moveX = xScale(x.lo) + points.scaledDx / 2 - var viewportY = clampRange( - minY, maxY, - isFinite(yHi) ? yScale(yHi) : -Infinity, - isFinite(yLo) ? yScale(yLo) : Infinity - ) - var vLo = viewportY[0] - var vHi = viewportY[1] - path += ' M ' + moveX + ' ' + vLo - path += ' v ' + Math.max(vHi - vLo, minWidthHeight) - } - } - return path - } - - function plotLine (selection) { - selection.each(function (d) { - var el = plotLine.el = d3.select(this) - var index = d.index - var closed = d.closed - var evaluatedData = evaluate(chart, d) - var innerSelection = el.selectAll(':scope > path.line') - .data(evaluatedData) - - // the min height/width of the rects drawn by the path generator - minWidthHeight = Math.max(evaluatedData[0].scaledDx, 1) - - innerSelection.enter() - .append('path') - .attr('class', 'line line-' + index) - .attr('fill', 'none') - - // enter + update - innerSelection - .attr('stroke-width', minWidthHeight) - .attr('stroke', utils.color(d, index)) - .attr('opacity', closed ? 0.5 : 1) - .attr('d', function (d) { - return line(d, closed) - }) - - innerSelection.exit().remove() - }) - } - - return plotLine -} diff --git a/anything/function-plot/lib/graph-types/polyline.js b/anything/function-plot/lib/graph-types/polyline.js deleted file mode 100644 index 834e016..0000000 --- a/anything/function-plot/lib/graph-types/polyline.js +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Created by mauricio on 3/29/15. - */ -'use strict' -var d3 = window.d3 -var evaluate = require('../evaluate') -var utils = require('../utils') - -module.exports = function (chart) { - var xScale = chart.meta.xScale - var yScale = chart.meta.yScale - var line = d3.svg.line() - .interpolate('linear') - .x(function (d) { return xScale(d[0]) }) - .y(function (d) { return yScale(d[1]) }) - var area = d3.svg.area() - .x(function (d) { return xScale(d[0]) }) - .y0(yScale(0)) - .y1(function (d) { return yScale(d[1]) }) - - function plotLine (selection) { - - selection.each(function (d) { - var el = plotLine.el = d3.select(this) - var index = d.index - var evaluatedData = evaluate(chart, d) - var color = utils.color(d, index) - var innerSelection = el.selectAll(':scope > path.line') - .data(evaluatedData) - - innerSelection.enter() - .append('path') - .attr('class', 'line line-' + index) - .attr('stroke-width', 1) - .attr('stroke-linecap', 'round') - - // enter + update - innerSelection - .each(function () { - var path = d3.select(this) - var pathD - if (d.closed) { - path.attr('fill', color) - path.attr('fill-opacity', 0.3) - pathD = area - } else { - path.attr('fill', 'none') - pathD = line - } - path - .attr('stroke', color) - .attr('marker-end', function () { - // special marker for vectors - return d.fnType === 'vector' - ? 'url(#' + chart.markerId + ')' - : null - }) - .attr('d', pathD) - }) - - innerSelection.exit().remove() - }) - } - - return plotLine -} diff --git a/anything/function-plot/lib/graph-types/scatter.js b/anything/function-plot/lib/graph-types/scatter.js deleted file mode 100644 index ff0fba7..0000000 --- a/anything/function-plot/lib/graph-types/scatter.js +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Created by mauricio on 3/29/15. - */ -'use strict' -var d3 = window.d3 -var evaluate = require('../evaluate') -var utils = require('../utils') - -module.exports = function (chart) { - var xScale = chart.meta.xScale - var yScale = chart.meta.yScale - - function scatter (selection) { - selection.each(function (d) { - var i, j - var index = d.index - var color = utils.color(d, index) - var evaluatedData = evaluate(chart, d) - - // scatter doesn't need groups, therefore each group is - // flattened into a single array - var joined = [] - for (i = 0; i < evaluatedData.length; i += 1) { - for (j = 0; j < evaluatedData[i].length; j += 1) { - joined.push(evaluatedData[i][j]) - } - } - - var innerSelection = d3.select(this).selectAll(':scope > circle') - .data(joined) - - innerSelection.enter() - .append('circle') - - innerSelection - .attr('fill', d3.hsl(color.toString()).brighter(1.5)) - .attr('stroke', color) - .attr('opacity', 0.7) - .attr('r', 1) - .attr('cx', function (d) { return xScale(d[0]) }) - .attr('cy', function (d) { return yScale(d[1]) }) - - innerSelection.exit().remove() - }) - } - - return scatter -} diff --git a/anything/function-plot/lib/helpers/annotations.js b/anything/function-plot/lib/helpers/annotations.js deleted file mode 100644 index f802602..0000000 --- a/anything/function-plot/lib/helpers/annotations.js +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Created by mauricio on 3/29/15. - */ -'use strict' -var d3 = window.d3 - -module.exports = function (options) { - var annotations - var xScale = options.owner.meta.xScale - var yScale = options.owner.meta.yScale - - var line = d3.svg.line() - .x(function (d) { return d[0] }) - .y(function (d) { return d[1] }) - - annotations = function (parentSelection) { - parentSelection.each(function () { - // join - var current = d3.select(this) - var selection = current.selectAll('g.annotations') - .data(function (d) { return d.annotations || [] }) - - // enter - selection.enter() - .append('g') - .attr('class', 'annotations') - - // enter + update - // - path - var yRange = yScale.range() - var xRange = xScale.range() - var path = selection.selectAll('path') - .data(function (d) { - if (d.hasOwnProperty('x')) { - return [ [[0, yRange[0]], [0, yRange[1]]] ] - } else { - return [ [[xRange[0], 0], [xRange[1], 0]] ] - } - }) - path.enter() - .append('path') - .attr('stroke', '#eee') - .attr('d', line) - path.exit().remove() - - // enter + update - // - text - var text = selection.selectAll('text') - .data(function (d) { - return [{ - text: d.text || '', - hasX: d.hasOwnProperty('x') - }] - }) - text.enter() - .append('text') - .attr('y', function (d) { - return d.hasX ? 3 : 0 - }) - .attr('x', function (d) { - return d.hasX ? 0 : 3 - }) - .attr('dy', function (d) { - return d.hasX ? 5 : -5 - }) - .attr('text-anchor', function (d) { - return d.hasX ? 'end' : '' - }) - .attr('transform', function (d) { - return d.hasX ? 'rotate(-90)' : '' - }) - .text(function (d) { return d.text }) - text.exit().remove() - - // enter + update - // move group - selection - .attr('transform', function (d) { - if (d.hasOwnProperty('x')) { - return 'translate(' + xScale(d.x) + ', 0)' - } else { - return 'translate(0, ' + yScale(d.y) + ')' - } - }) - - // exit - selection.exit() - .remove() - }) - } - - return annotations -} diff --git a/anything/function-plot/lib/helpers/derivative.js b/anything/function-plot/lib/helpers/derivative.js deleted file mode 100644 index 005431c..0000000 --- a/anything/function-plot/lib/helpers/derivative.js +++ /dev/null @@ -1,78 +0,0 @@ -/** - * Created by mauricio on 3/29/15. - */ -'use strict' -var d3 = window.d3 -var builtInEvaluator = require('./eval').builtIn -var polyline = require('../graph-types/polyline') -var datumDefaults = require('../datum-defaults') - -module.exports = function (chart) { - var derivativeDatum = datumDefaults({ - skipTip: true, - nSamples: 2, - graphType: 'polyline' - }) - var derivative - - function computeLine (d) { - if (!d.derivative) { - return [] - } - var x0 = typeof d.derivative.x0 === 'number' ? d.derivative.x0 : Infinity - derivativeDatum.index = d.index - derivativeDatum.scope = { - m: builtInEvaluator(d.derivative, 'fn', {x: x0}), - x0: x0, - y0: builtInEvaluator(d, 'fn', {x: x0}) - } - derivativeDatum.fn = 'm * (x - x0) + y0' - return [derivativeDatum] - } - - function checkAutoUpdate (d) { - var self = this - if (!d.derivative) { - return - } - if (d.derivative.updateOnMouseMove && !d.derivative.$$mouseListener) { - d.derivative.$$mouseListener = function (x0) { - // update initial value to be the position of the mouse - // scope's x0 will be updated on the next call to `derivative(self)` - d.derivative.x0 = x0 - // trigger update (selection = self) - derivative(self) - } - // if d.derivative is destroyed and recreated, the tip:update event - // will be fired on the new d.derivative :) - chart.on('tip:update', d.derivative.$$mouseListener) - } - } - - derivative = function (selection) { - selection.each(function (d) { - var el = d3.select(this) - var data = computeLine.call(selection, d) - checkAutoUpdate.call(selection, d) - var innerSelection = el.selectAll('g.derivative') - .data(data) - - innerSelection.enter() - .append('g') - .attr('class', 'derivative') - - // enter + update - innerSelection - .call(polyline(chart)) - - // update - // change the opacity of the line - innerSelection.selectAll('path') - .attr('opacity', 0.5) - - innerSelection.exit().remove() - }) - } - - return derivative -} diff --git a/anything/function-plot/lib/helpers/eval.js b/anything/function-plot/lib/helpers/eval.js deleted file mode 100644 index 7b64c49..0000000 --- a/anything/function-plot/lib/helpers/eval.js +++ /dev/null @@ -1,97 +0,0 @@ -'use strict' -var samplers = { - interval: require('interval-arithmetic-eval'), - builtIn: require('built-in-math-eval') -} -var extend = require('extend') - -window.math && (samplers.builtIn = window.math.compile) - -function generateEvaluator (samplerName) { - function doCompile (expression) { - // compiles does the following - // - // when expression === string - // - // gen = new require('math-codegen') - // return gen.parse(expression).compile(Interval|BultInMath) - // - // which is an object with the form - // - // { - // eval: function (scope) { - // // math-codegen magic - // } - // } - // - // when expression === function - // - // { - // eval: expression - // } - // - // othewise throw an error - if (typeof expression === 'string') { - var compile = samplers[samplerName] - return compile(expression) - } else if (typeof expression === 'function') { - return { eval: expression } - } else { - throw Error('expression must be a string or a function') - } - } - - function compileIfPossible (meta, property) { - // compile the function using interval arithmetic, cache the result - // so that multiple calls with the same argument don't trigger the - // kinda expensive compilation process - var expression = meta[property] - var hiddenProperty = samplerName + '_Expression_' + property - var hiddenCompiled = samplerName + '_Compiled_' + property - if (expression !== meta[hiddenProperty]) { - meta[hiddenProperty] = expression - meta[hiddenCompiled] = doCompile(expression) - } - } - - function getCompiledExpression (meta, property) { - return meta[samplerName + '_Compiled_' + property] - } - - /** - * Evaluates meta[property] with `variables` - * - * - Compiles meta[property] if it wasn't compiled already (also with cache - * check) - * - Evaluates the resulting function with the merge of meta.scope and - * `variables` - * - * @param {Object} meta - * @param {String} property - * @param {Object} variables - * @returns {Number|Array} The builtIn evaluator returns a number, the - * interval evaluator an array - */ - function evaluate (meta, property, variables) { - // e.g. - // - // meta: { - // fn: 'x + 3', - // scope: { y: 3 } - // } - // property: 'fn' - // variables: { x: 3 } - // - compileIfPossible(meta, property) - - return getCompiledExpression(meta, property).eval( - extend({}, meta.scope || {}, variables) - ) - } - - return evaluate -} - -module.exports.builtIn = generateEvaluator('builtIn') -module.exports.interval = generateEvaluator('interval') - diff --git a/anything/function-plot/lib/helpers/index.js b/anything/function-plot/lib/helpers/index.js deleted file mode 100644 index 5f4985a..0000000 --- a/anything/function-plot/lib/helpers/index.js +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Created by mauricio on 4/8/15. - */ -'use strict' -var d3 = window.d3 -var derivative = require('./derivative') -var secant = require('./secant') - -module.exports = function (chart) { - function helper (selection) { - selection.each(function () { - var el = d3.select(this) - el.call(derivative(chart)) - el.call(secant(chart)) - }) - } - - return helper -} diff --git a/anything/function-plot/lib/helpers/secant.js b/anything/function-plot/lib/helpers/secant.js deleted file mode 100644 index 686c887..0000000 --- a/anything/function-plot/lib/helpers/secant.js +++ /dev/null @@ -1,101 +0,0 @@ -/** - * Created by mauricio on 3/29/15. - */ -'use strict' -var d3 = window.d3 - -var extend = require('extend') -var builtInEvaluator = require('./eval').builtIn -var datumDefaults = require('../datum-defaults') -var polyline = require('../graph-types/polyline') - -module.exports = function (chart) { - var secantDefaults = datumDefaults({ - isHelper: true, - skipTip: true, - nSamples: 2, - graphType: 'polyline' - }) - var secant - - function computeSlope (scope) { - scope.m = (scope.y1 - scope.y0) / (scope.x1 - scope.x0) - } - - function updateLine (d, secant) { - if (!secant.hasOwnProperty('x0')) { - throw Error('secant must have the property `x0` defined') - } - secant.scope = secant.scope || {} - - var x0 = secant.x0 - var x1 = typeof secant.x1 === 'number' ? secant.x1 : Infinity - extend(secant.scope, { - x0: x0, - x1: x1, - y0: builtInEvaluator(d, 'fn', {x: x0}), - y1: builtInEvaluator(d, 'fn', {x: x1}) - }) - computeSlope(secant.scope) - } - - function setFn (d, secant) { - updateLine(d, secant) - secant.fn = 'm * (x - x0) + y0' - } - - function setMouseListener (d, secantObject) { - var self = this - if (secantObject.updateOnMouseMove && !secantObject.$$mouseListener) { - secantObject.$$mouseListener = function (x1) { - secantObject.x1 = x1 - updateLine(d, secantObject) - secant(self) - } - chart.on('tip:update', secantObject.$$mouseListener) - } - } - - function computeLines (d) { - var self = this - var data = [] - d.secants = d.secants || [] - for (var i = 0; i < d.secants.length; i += 1) { - var secant = d.secants[i] = extend({}, secantDefaults, d.secants[i]) - // necessary to make the secant have the same color as d - secant.index = d.index - if (!secant.fn) { - setFn.call(self, d, secant) - setMouseListener.call(self, d, secant) - } - data.push(secant) - } - return data - } - - secant = function (selection) { - selection.each(function (d) { - var el = d3.select(this) - var data = computeLines.call(selection, d) - var innerSelection = el.selectAll('g.secant') - .data(data) - - innerSelection.enter() - .append('g') - .attr('class', 'secant') - - // enter + update - innerSelection - .call(polyline(chart)) - - // change the opacity of the secants - innerSelection.selectAll('path') - .attr('opacity', 0.5) - - // exit - innerSelection.exit().remove() - }) - } - - return secant -} diff --git a/anything/function-plot/lib/index.js b/anything/function-plot/lib/index.js deleted file mode 100644 index 06afae1..0000000 --- a/anything/function-plot/lib/index.js +++ /dev/null @@ -1,615 +0,0 @@ -/* - * function-plot - * - * Copyright (c) 2015 Mauricio Poppe - * Licensed under the MIT license. - */ -'use strict' -require('./polyfills') - -var d3 = window.d3 - -var events = require('events') -var extend = require('extend') - -var mousetip = require('./tip') -var helpers = require('./helpers/') -var annotations = require('./helpers/annotations') -var datumDefaults = require('./datum-defaults') - -var globals -var graphTypes -var cache = [] - -module.exports = function (options) { - options = options || {} - options.data = options.data || [] - - // globals - var width, height - var margin - var zoomBehavior - var xScale, yScale - var line = d3.svg.line() - .x(function (d) { return xScale(d[0]) }) - .y(function (d) { return yScale(d[1]) }) - - function Chart () { - var n = Math.random() - var letter = String.fromCharCode(Math.floor(n * 26) + 97) - this.id = options.id = letter + n.toString(16).substr(2) - this.linkedGraphs = [this] - this.options = options - cache[this.id] = this - this.setUpEventListeners() - } - - Chart.prototype = Object.create(events.prototype) - - /** - * Rebuilds the entire graph from scratch recomputing - * - * - the inner width/height - * - scales/axes - * - * After this is done it does a complete redraw of all the datums, - * if only the datums need to be redrawn call `instance.draw()` instead - * - * @returns {Chart} - */ - Chart.prototype.build = function () { - this.internalVars() - this.drawGraphWrapper() - return this - } - - Chart.prototype.initializeAxes = function () { - var integerFormat = d3.format('s') - var format = function (scale) { - return function (d) { - var decimalFormat = scale.tickFormat(10) - var isInteger = d === +d && d === (d | 0) - // integers: d3.format('s'), see https://github.com/mbostock/d3/wiki/Formatting - // decimals: default d3.scale.linear() formatting see - // https://github.com/mbostock/d3/blob/master/src/svg/axis.js#L29 - return isInteger ? integerFormat(d) : decimalFormat(d) - } - } - - function computeYScale (xScale) { - // assumes that xScale is a linear scale - var xDiff = xScale[1] - xScale[0] - return height * xDiff / width - } - - options.xAxis = options.xAxis || {} - options.xAxis.type = options.xAxis.type || 'linear' - - options.yAxis = options.yAxis || {} - options.yAxis.type = options.yAxis.type || 'linear' - - var xDomain = this.meta.xDomain = (function (axis) { - if (axis.domain) { - return axis.domain - } - if (axis.type === 'linear') { - var xLimit = 12 - return [-xLimit / 2, xLimit / 2] - } else if (axis.type === 'log') { - return [1, 10] - } - throw Error('axis type ' + axis.type + ' unsupported') - })(options.xAxis) - - var yDomain = this.meta.yDomain = (function (axis) { - if (axis.domain) { - return axis.domain - } - var yLimit = computeYScale(xDomain) - if (axis.type === 'linear') { - return [-yLimit / 2, yLimit / 2] - } else if (axis.type === 'log') { - return [1, 10] - } - throw Error('axis type ' + axis.type + ' unsupported') - })(options.yAxis) - - if (xDomain[0] >= xDomain[1]) { - throw Error('the pair defining the x-domain is inverted') - } - if (yDomain[0] >= yDomain[1]) { - throw Error('the pair defining the y-domain is inverted') - } - - xScale = this.meta.xScale = d3.scale[options.xAxis.type]() - .domain(xDomain) - .range([0, width]) - yScale = this.meta.yScale = d3.scale[options.yAxis.type]() - .domain(yDomain) - .range([height, 0]) - this.meta.xAxis = d3.svg.axis() - .scale(xScale) - .tickSize(options.grid ? -height : 0) - .tickFormat(format(xScale)) - .orient('bottom') - this.meta.yAxis = d3.svg.axis() - .scale(yScale) - .tickSize(options.grid ? -width : 0) - .tickFormat(format(yScale)) - .orient('left') - } - - Chart.prototype.internalVars = function () { - // measurements and other derived data - this.meta = {} - - margin = this.meta.margin = {left: 30, right: 30, top: 20, bottom: 20} - // if there's a title make the top margin bigger - if (options.title) { - this.meta.margin.top = 40 - } - - zoomBehavior = this.meta.zoomBehavior = d3.behavior.zoom() - - // inner width/height - width = this.meta.width = (options.width || globals.DEFAULT_WIDTH) - - margin.left - margin.right - height = this.meta.height = (options.height || globals.DEFAULT_HEIGHT) - - margin.top - margin.bottom - - this.initializeAxes() - } - - Chart.prototype.drawGraphWrapper = function () { - var root = this.root = d3.select(options.target).selectAll('svg') - .data([options]) - - // enter - this.root.enter = root.enter() - .append('svg') - .attr('class', 'function-plot') - .attr('font-size', this.getFontSize()) - - // merge - root - .attr('width', width + margin.left + margin.right) - .attr('height', height + margin.top + margin.bottom) - - this.buildTitle() - this.buildLegend() - this.buildCanvas() - this.buildClip() - this.buildAxis() - this.buildAxisLabel() - - // draw each datum after the wrapper was set up - this.draw() - - // helper to detect the closest fn to the cursor's current abscissa - var tip = this.tip = mousetip(extend(options.tip, { owner: this })) - this.canvas - .call(tip) - - this.buildZoomHelper() - this.setUpPlugins() - } - - Chart.prototype.buildTitle = function () { - // join - var selection = this.root.selectAll('text.title') - .data(function (d) { - return [d.title].filter(Boolean) - }) - - // enter - selection.enter() - .append('text') - .attr('class', 'title') - .attr('y', margin.top / 2) - .attr('x', margin.left + width / 2) - .attr('font-size', 25) - .attr('text-anchor', 'middle') - .attr('alignment-baseline', 'middle') - .text(options.title) - - // exit - selection.exit().remove() - } - - Chart.prototype.buildLegend = function () { - // enter - this.root.enter - .append('text') - .attr('class', 'top-right-legend') - .attr('text-anchor', 'end') - - // update + enter - this.root.select('.top-right-legend') - .attr('y', margin.top / 2) - .attr('x', width + margin.left) - } - - Chart.prototype.buildCanvas = function () { - var self = this - - this.meta.zoomBehavior - .x(xScale) - .y(yScale) - .on('zoom', function onZoom () { - self.emit('all:zoom', d3.event.translate, d3.event.scale) - }) - - // enter - var canvas = this.canvas = this.root - .selectAll('.canvas') - .data(function (d) { return [d] }) - - this.canvas.enter = canvas.enter() - .append('g') - .attr('class', 'canvas') - - // enter + update - } - - Chart.prototype.buildClip = function () { - // (so that the functions don't overflow on zoom or drag) - var id = this.id - var defs = this.canvas.enter.append('defs') - defs.append('clipPath') - .attr('id', 'function-plot-clip-' + id) - .append('rect') - .attr('class', 'clip static-clip') - - // enter + update - this.canvas.selectAll('.clip') - .attr('width', width) - .attr('height', height) - - // marker clip (for vectors) - this.markerId = this.id + '-marker' - defs.append('clipPath') - .append('marker') - .attr('id', this.markerId) - .attr('viewBox', '0 -5 10 10') - .attr('refX', 10) - .attr('markerWidth', 5) - .attr('markerHeight', 5) - .attr('orient', 'auto') - .append('svg:path') - .attr('d', 'M0,-5L10,0L0,5L0,0') - .attr('stroke-width', '0px') - .attr('fill-opacity', 1) - .attr('fill', '#777') - } - - Chart.prototype.buildAxis = function () { - // axis creation - var canvasEnter = this.canvas.enter - canvasEnter.append('g') - .attr('class', 'x axis') - canvasEnter.append('g') - .attr('class', 'y axis') - - // update - this.canvas.select('.x.axis') - .attr('transform', 'translate(0,' + height + ')') - .call(this.meta.xAxis) - this.canvas.select('.y.axis') - .call(this.meta.yAxis) - - } - - Chart.prototype.buildAxisLabel = function () { - // axis labeling - var xLabel, yLabel - var canvas = this.canvas - - xLabel = canvas.selectAll('text.x.axis-label') - .data(function (d) { - return [d.xAxis.label].filter(Boolean) - }) - xLabel.enter() - .append('text') - .attr('class', 'x axis-label') - .attr('text-anchor', 'end') - xLabel - .attr('x', width) - .attr('y', height - 6) - .text(function (d) { return d }) - xLabel.exit().remove() - - yLabel = canvas.selectAll('text.y.axis-label') - .data(function (d) { - return [d.yAxis.label].filter(Boolean) - }) - yLabel.enter() - .append('text') - .attr('class', 'y axis-label') - .attr('y', 6) - .attr('dy', '.75em') - .attr('text-anchor', 'end') - .attr('transform', 'rotate(-90)') - yLabel - .text(function (d) { return d }) - yLabel.exit().remove() - } - - /** - * @private - * - * Draws each of the datums stored in data.options, to do a full - * redraw call `instance.draw()` - */ - Chart.prototype.buildContent = function () { - var self = this - var canvas = this.canvas - - canvas - .attr('transform', 'translate(' + margin.left + ',' + margin.top + ')') - .call(zoomBehavior) - .each(function () { - var el = d3.select(this) - // make a copy of all the listeners available to be removed/added later - var listeners = ['mousedown', 'mousewheel', 'mouseover', 'DOMMouseScroll', 'dblclick', 'wheel', 'MozMousePixelScroll'] - listeners = listeners.map(function (l) { return l + '.zoom' }) - if (!el._hasZoomListeners) { - listeners.forEach(function (l) { - el['_' + l] = el.on(l) - }) - } - function setState (state) { - listeners.forEach(function (l) { - state ? el.on(l, el['_' + l]) : el.on(l, null) - }) - } - setState(!options.disableZoom) - }) - - var content = this.content = canvas.selectAll(':scope > g.content') - .data(function (d) { return [d] }) - - // g tag clipped to hold the data - content.enter() - .append('g') - .attr('clip-path', 'url(#function-plot-clip-' + this.id + ')') - .attr('class', 'content') - - // helper line, x = 0 - if (options.xAxis.type === 'linear') { - var yOrigin = content.selectAll(':scope > path.y.origin') - .data([ [[0, yScale.domain()[0]], [0, yScale.domain()[1]]] ]) - yOrigin.enter() - .append('path') - .attr('class', 'y origin') - .attr('stroke', 'black') - .attr('opacity', 0.2) - yOrigin.attr('d', line) - } - - // helper line y = 0 - if (options.yAxis.type === 'linear') { - var xOrigin = content.selectAll(':scope > path.x.origin') - .data([ [[xScale.domain()[0], 0], [xScale.domain()[1], 0]] ]) - xOrigin.enter() - .append('path') - .attr('class', 'x origin') - .attr('stroke', 'black') - .attr('opacity', 0.2) - xOrigin.attr('d', line) - } - - // annotations - content - .call(annotations({ owner: self })) - - // content construction - // - join options.data to elements - // - for each datum determine the sampler to use - var graphs = content.selectAll(':scope > g.graph') - .data(function (d) { - return d.data.map(datumDefaults) - }) - - // enter - graphs - .enter() - .append('g') - .attr('class', 'graph') - - // enter + update - graphs - .each(function (d, index) { - // additional options needed in the graph-types/helpers - d.index = index - - d3.select(this) - .call(graphTypes[d.graphType](self)) - d3.select(this) - .call(helpers(self)) - }) - } - - Chart.prototype.buildZoomHelper = function () { - // dummy rect (detects the zoom + drag) - var self = this - - // enter - this.canvas.enter - .append('rect') - .attr('class', 'zoom-and-drag') - .style('fill', 'none') - .style('pointer-events', 'all') - - // update - this.canvas.select('.zoom-and-drag') - .attr('width', width) - .attr('height', height) - .on('mouseover', function () { - self.emit('all:mouseover') - }) - .on('mouseout', function () { - self.emit('all:mouseout') - }) - .on('mousemove', function () { - self.emit('all:mousemove') - }) - } - - Chart.prototype.setUpPlugins = function () { - var plugins = options.plugins || [] - var self = this - plugins.forEach(function (plugin) { - plugin(self) - }) - } - - Chart.prototype.addLink = function () { - for (var i = 0; i < arguments.length; i += 1) { - this.linkedGraphs.push(arguments[i]) - } - } - - Chart.prototype.updateAxes = function () { - var instance = this - var canvas = instance.canvas - canvas.select('.x.axis').call(instance.meta.xAxis) - canvas.select('.y.axis').call(instance.meta.yAxis) - - // updates the style of the axes - canvas.selectAll('.axis path, .axis line') - .attr('fill', 'none') - .attr('stroke', 'black') - .attr('shape-rendering', 'crispedges') - .attr('opacity', 0.1) - } - - Chart.prototype.syncOptions = function () { - // update the original options yDomain and xDomain - this.options.xAxis.domain = this.meta.xScale.domain() - this.options.yAxis.domain = this.meta.yScale.domain() - } - - Chart.prototype.programmaticZoom = function (xDomain, yDomain) { - var instance = this - d3.transition() - .duration(750) - .tween('zoom', function () { - var ix = d3.interpolate(xScale.domain(), xDomain) - var iy = d3.interpolate(yScale.domain(), yDomain) - return function (t) { - zoomBehavior - .x(xScale.domain(ix(t))) - .y(yScale.domain(iy(t))) - instance.draw() - } - }) - .each('end', function () { - instance.emit('programmatic-zoom') - }) - } - - Chart.prototype.getFontSize = function () { - return Math.max(Math.max(width, height) / 50, 8) - } - - Chart.prototype.draw = function () { - var instance = this - instance.emit('before:draw') - instance.syncOptions() - instance.updateAxes() - instance.buildContent() - instance.emit('after:draw') - } - - Chart.prototype.setUpEventListeners = function () { - var instance = this - - var events = { - mousemove: function (x, y) { - instance.tip.move(x, y) - }, - - mouseover: function () { - instance.tip.show() - }, - - mouseout: function () { - instance.tip.hide() - }, - - zoom: function (translate, scale) { - zoomBehavior - .translate(translate) - .scale(scale) - }, - - 'tip:update': function (x, y, index) { - var meta = instance.root.datum().data[index] - var title = meta.title || '' - var format = meta.renderer || function (x, y) { - return x.toFixed(3) + ', ' + y.toFixed(3) - } - - var text = [] - title && text.push(title) - text.push(format(x, y)) - - instance.root.select('.top-right-legend') - .attr('fill', globals.COLORS[index]) - .text(text.join(' ')) - } - - } - - var all = { - mousemove: function () { - var mouse = d3.mouse(instance.root.select('rect.zoom-and-drag').node()) - var x = xScale.invert(mouse[0]) - var y = yScale.invert(mouse[1]) - instance.linkedGraphs.forEach(function (graph) { - graph.emit('mousemove', x, y) - }) - }, - - zoom: function (translate, scale) { - instance.linkedGraphs.forEach(function (graph, i) { - graph.emit('zoom', translate, scale) - graph.draw() - }) - - // emit the position of the mouse to all the registered graphs - instance.emit('all:mousemove') - } - - } - - Object.keys(events).forEach(function (e) { - instance.on(e, events[e]) - // create an event for each event existing on `events` in the form 'all:' event - // e.g. all:mouseover all:mouseout - // the objective is that all the linked graphs receive the same event as the current graph - !all[e] && instance.on('all:' + e, function () { - var args = Array.prototype.slice.call(arguments) - instance.linkedGraphs.forEach(function (graph) { - var localArgs = args.slice() - localArgs.unshift(e) - graph.emit.apply(graph, localArgs) - }) - }) - }) - - Object.keys(all).forEach(function (e) { - instance.on('all:' + e, all[e]) - }) - } - - var instance = cache[options.id] - if (!instance) { - instance = new Chart() - } - return instance.build() -} -globals = module.exports.globals = require('./globals') -graphTypes = module.exports.graphTypes = require('./graph-types/') -module.exports.plugins = require('./plugins/') -module.exports.eval = require('./helpers/eval') diff --git a/anything/function-plot/lib/plugins/definite-integral.js b/anything/function-plot/lib/plugins/definite-integral.js deleted file mode 100644 index 7cceeea..0000000 --- a/anything/function-plot/lib/plugins/definite-integral.js +++ /dev/null @@ -1,100 +0,0 @@ -var d3 = window.d3 -var extend = require('extend') -var pressed = require('key-pressed') -var keydown = require('keydown') -var integrateSimpson = require('integrate-adaptive-simpson') -module.exports = function (options) { - options = extend({ - key: '', - // true to make the brush mask visible/hidden on keydown - // by default the mask will be visible only when the `key` - // combination is pressed - toggle: false - }, options) - - var brush = d3.svg.brush() - var kd = keydown(options.key) - var visible = false - var cachedInstance - - // the integrator module requires a function with a single parameter x - function wrapper (datum) { - return function (x) { - var functionPlot = window.functionPlot - return functionPlot.eval.builtIn(datum, 'fn', {x: x}) - } - } - - function setBrushState (visible) { - var brushEl = cachedInstance.canvas.selectAll('.definite-integral') - brushEl.style('display', visible ? null : 'none') - } - - function inner (instance) { - cachedInstance = instance - // update the brush scale with the instance scale - var oldDisableZoom - brush - .x(instance.meta.xScale) - .on('brushstart', function () { - if (!d3.event.sourceEvent) return - oldDisableZoom = !!instance.options.disableZoom - instance.options.disableZoom = true - // replot the samples with the option disableZoom set to true - instance.emit('draw') - }) - .on('brushend', function () { - if (!d3.event.sourceEvent) return - instance.options.disableZoom = oldDisableZoom - - if (!brush.empty()) { - var a = brush.extent()[0] - var b = brush.extent()[1] - // iterate the data finding the value of the definite integral - // with bounds `a` and `b` - instance.options.data.forEach(function (datum, i) { - var value = integrateSimpson(wrapper(datum), a, b, options.tol, options.maxdepth) - instance.emit('definite-integral', datum, i, value, a, b) - }) - } - // replot the samples with the option disableZoom set to whatever it was before - instance.draw() - }) - var brushEl = instance.canvas.append('g').attr('class', 'brush definite-integral') - brushEl - .call(brush) - .call(brush.event) - - instance.canvas.selectAll('.brush .extent') - .attr('stroke', '#fff') - .attr('fill-opacity', 0.125) - .attr('shape-rendering', 'crispEdges') - - brushEl.selectAll('rect') - .attr('height', instance.meta.height) - - instance.canvas - .on('mousemove.definiteIntegral', function () { - // options.toggle sets the mask visibility when all the required - // are pressed once and it's not disabled on keyup - if (!options.toggle) { - inner.visible(pressed(options.key)) - } - }) - kd.on('pressed', function () { - inner.visible(options.toggle ? !inner.visible() : true) - }) - inner.visible(false) - } - - inner.visible = function (_) { - if (!arguments.length) { - return visible - } - visible = _ - setBrushState(_) - return inner - } - - return inner -} diff --git a/anything/function-plot/lib/plugins/index.js b/anything/function-plot/lib/plugins/index.js deleted file mode 100644 index 1c386cc..0000000 --- a/anything/function-plot/lib/plugins/index.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - zoomBox: require('./zoom-box'), - definiteIntegral: require('./definite-integral') -} diff --git a/anything/function-plot/lib/plugins/zoom-box.js b/anything/function-plot/lib/plugins/zoom-box.js deleted file mode 100644 index 6a044c4..0000000 --- a/anything/function-plot/lib/plugins/zoom-box.js +++ /dev/null @@ -1,89 +0,0 @@ -var d3 = window.d3 -var extend = require('extend') -var pressed = require('key-pressed') -var keydown = require('keydown') -module.exports = function (options) { - options = extend({ - key: '', - // true to make the brush mask visible/hidden on keydown - // by default the mask will be visible only when the `key` - // combination is pressed - toggle: false - }, options) - - var brush = d3.svg.brush() - var kd = keydown(options.key) - var cachedInstance - var visible = false - - function setBrushState (visible) { - var brushEl = cachedInstance.canvas.selectAll('.zoom-box') - brushEl.style('display', visible ? null : 'none') - } - - function inner (instance) { - cachedInstance = instance - // update the brush scale with the instance scale - var oldDisableZoom - brush - .x(instance.meta.xScale) - .y(instance.meta.yScale) - .on('brushstart', function () { - if (!d3.event.sourceEvent) return - oldDisableZoom = !!instance.options.disableZoom - instance.options.disableZoom = true - // redrawing the canvas with the option disableZoom set to true - instance.draw() - }) - .on('brushend', function () { - if (!d3.event.sourceEvent) return - instance.options.disableZoom = oldDisableZoom - - if (!brush.empty()) { - var lo = brush.extent()[0] - var hi = brush.extent()[1] - var x = [lo[0], hi[0]] - var y = [lo[1], hi[1]] - instance.programmaticZoom(x, y) - } - d3.select(this) - .transition() - .duration(1) - .call(brush.clear()) - .call(brush.event) - }) - var brushEl = instance.canvas.append('g').attr('class', 'brush zoom-box') - brushEl - .call(brush) - .call(brush.event) - - instance.canvas.selectAll('.brush .extent') - .attr('stroke', '#fff') - .attr('fill-opacity', 0.125) - .attr('shape-rendering', 'crispEdges') - - instance.canvas - .on('mousemove.zoombox', function () { - // options.toggle sets the mask visibility when all the required - // are pressed once and it's not disabled on keyup - if (!options.toggle) { - inner.visible(pressed(options.key)) - } - }) - kd.on('pressed', function () { - inner.visible(options.toggle ? !inner.visible() : true) - }) - inner.visible(false) - } - - inner.visible = function (_) { - if (!arguments.length) { - return visible - } - visible = _ - setBrushState(_) - return inner - } - - return inner -} diff --git a/anything/function-plot/lib/polyfills.js b/anything/function-plot/lib/polyfills.js deleted file mode 100644 index 62f96b4..0000000 --- a/anything/function-plot/lib/polyfills.js +++ /dev/null @@ -1,29 +0,0 @@ -// issue: https://github.com/maurizzzio/function-plot/issues/6 -// solution: the line type is selecting the derivative line when the content is re-drawn, then when the -// derivative was redrawn an already selected line (by the line type) was used thus making a single line -// disappear from the graph, to avoid the selection of the derivative line the selector needs to -// work only for immediate children which is done with `:scope >` -// src: http://stackoverflow.com/questions/6481612/queryselector-search-immediate-children -/*eslint-disable */ -;(function (doc, proto) { - try { // check if browser supports :scope natively - doc.querySelector(':scope body') - } catch (err) { // polyfill native methods if it doesn't - ['querySelector', 'querySelectorAll'].forEach(function (method) { - var native = proto[method] - proto[method] = function (selectors) { - if (/(^|,)\s*:scope/.test(selectors)) { // only if selectors contains :scope - var id = this.id // remember current element id - this.id = 'ID_' + Date.now() // assign new unique id - selectors = selectors.replace(/((^|,)\s*):scope/g, '$1#' + this.id); // replace :scope with #ID - var result = doc[method](selectors) - this.id = id // restore previous id - return result - } else { - return native.call(this, selectors) // use native code for other selectors - } - } - }) - } -})(window.document, Element.prototype) -/*eslint-enable */ diff --git a/anything/function-plot/lib/samplers/builtIn.js b/anything/function-plot/lib/samplers/builtIn.js deleted file mode 100644 index 00ac912..0000000 --- a/anything/function-plot/lib/samplers/builtIn.js +++ /dev/null @@ -1,180 +0,0 @@ -'use strict' -var clamp = require('clamp') -var linspace = require('linspace') - -var utils = require('../utils') -var evaluate = require('../helpers/eval').builtIn - -function checkAsymptote (d0, d1, meta, sign, level) { - if (!level) { - return { - asymptote: true, - d0: d0, - d1: d1 - } - } - var i - var n = 10 - var x0 = d0[0] - var x1 = d1[0] - var samples = linspace(x0, x1, n) - var oldY, oldX - for (i = 0; i < n; i += 1) { - var x = samples[i] - var y = evaluate(meta, 'fn', {x: x}) - - if (i) { - var deltaY = y - oldY - var newSign = utils.sgn(deltaY) - if (newSign === sign) { - return checkAsymptote([oldX, oldY], [x, y], meta, sign, level - 1) - } - } - oldY = y - oldX = x - } - return { - asymptote: false, - d0: d0, - d1: d1 - } -} - -/** - * Splits the evaluated data into arrays, each array is separated by any asymptote found - * through the process of detecting slope/sign brusque changes - * @param chart - * @param data - * @returns {Array[]} - */ -function split (chart, meta, data) { - var i, oldSign - var deltaX - var st = [] - var sets = [] - var domain = chart.meta.yScale.domain() - var zoomScale = chart.meta.zoomBehavior.scale() - var yMin = domain[0] - var yMax = domain[1] - - if (data[0]) { - st.push(data[0]) - deltaX = data[1][0] - data[0][0] - oldSign = utils.sgn(data[1][1] - data[0][1]) - } - - function updateY (d) { - d[1] = Math.min(d[1], yMax) - d[1] = Math.max(d[1], yMin) - return d - } - - i = 1 - while (i < data.length) { - var y0 = data[i - 1][1] - var y1 = data[i][1] - var deltaY = y1 - y0 - var newSign = utils.sgn(deltaY) - // make a new set if: - if (// utils.sgn(y1) * utils.sgn(y0) < 0 && // there's a change in the evaluated values sign - // there's a change in the slope sign - oldSign !== newSign && - // the slope is bigger to some value (according to the current zoom scale) - Math.abs(deltaY / deltaX) > 1 / zoomScale) { - // retest this section again and determine if it's an asymptote - var check = checkAsymptote(data[i - 1], data[i], meta, newSign, 3) - if (check.asymptote) { - st.push(updateY(check.d0)) - sets.push(st) - st = [updateY(check.d1)] - } - } - oldSign = newSign - st.push(data[i]) - ++i - } - - if (st.length) { - sets.push(st) - } - - return sets -} - -function linear (chart, meta, range, n) { - var allX = utils.space(chart, range, n) - var yDomain = chart.meta.yScale.domain() - var yDomainMargin = (yDomain[1] - yDomain[0]) - var yMin = yDomain[0] - yDomainMargin * 1e5 - var yMax = yDomain[1] + yDomainMargin * 1e5 - var data = [] - var i - for (i = 0; i < allX.length; i += 1) { - var x = allX[i] - var y = evaluate(meta, 'fn', {x: x}) - if (utils.isValidNumber(x) && utils.isValidNumber(y)) { - data.push([x, clamp(y, yMin, yMax)]) - } - } - data = split(chart, meta, data) - return data -} - -function parametric (chart, meta, range, nSamples) { - // range is mapped to canvas coordinates from the input - // for parametric plots the range will tell the start/end points of the `t` param - var parametricRange = meta.range || [0, 2 * Math.PI] - var tCoords = utils.space(chart, parametricRange, nSamples) - var samples = [] - for (var i = 0; i < tCoords.length; i += 1) { - var t = tCoords[i] - var x = evaluate(meta, 'x', {t: t}) - var y = evaluate(meta, 'y', {t: t}) - samples.push([x, y]) - } - return [samples] -} - -function polar (chart, meta, range, nSamples) { - // range is mapped to canvas coordinates from the input - // for polar plots the range will tell the start/end points of the `theta` param - var polarRange = meta.range || [-Math.PI, Math.PI] - var thetaSamples = utils.space(chart, polarRange, nSamples) - var samples = [] - for (var i = 0; i < thetaSamples.length; i += 1) { - var theta = thetaSamples[i] - var r = evaluate(meta, 'r', {theta: theta}) - var x = r * Math.cos(theta) - var y = r * Math.sin(theta) - samples.push([x, y]) - } - return [samples] -} - -function points (chart, meta, range, nSamples) { - return [meta.points] -} - -function vector (chart, meta, range, nSamples) { - meta.offset = meta.offset || [0, 0] - return [[ - meta.offset, - [meta.vector[0] + meta.offset[0], meta.vector[1] + meta.offset[1]] - ]] -} - -var sampler = function (chart, d, range, nSamples) { - var fnTypes = { - parametric: parametric, - polar: polar, - points: points, - vector: vector, - linear: linear - } - if (!(d.fnType in fnTypes)) { - throw Error(d.fnType + ' is not supported in the `builtIn` sampler') - } - return fnTypes[d.fnType].apply(null, arguments) -} - -module.exports = sampler diff --git a/anything/function-plot/lib/samplers/index.js b/anything/function-plot/lib/samplers/index.js deleted file mode 100644 index 0b222a9..0000000 --- a/anything/function-plot/lib/samplers/index.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - builtIn: require('./builtIn'), - interval: require('./interval') -} diff --git a/anything/function-plot/lib/samplers/interval.js b/anything/function-plot/lib/samplers/interval.js deleted file mode 100644 index 08e0e43..0000000 --- a/anything/function-plot/lib/samplers/interval.js +++ /dev/null @@ -1,124 +0,0 @@ -/** - * Created by mauricio on 5/14/15. - */ -'use strict' -var intervalArithmeticEval = require('interval-arithmetic-eval') -var Interval = intervalArithmeticEval.Interval - -var evaluate = require('../helpers/eval').interval -var utils = require('../utils') - -// disable the use of typed arrays in interval-arithmetic to improve the performance -intervalArithmeticEval.policies.disableRounding() - -function interval1d (chart, meta, range, nSamples) { - var xCoords = utils.space(chart, range, nSamples) - var xScale = chart.meta.xScale - var yScale = chart.meta.yScale - var yMin = yScale.domain()[0] - var yMax = yScale.domain()[1] - var samples = [] - var i - for (i = 0; i < xCoords.length - 1; i += 1) { - var x = {lo: xCoords[i], hi: xCoords[i + 1]} - var y = evaluate(meta, 'fn', {x: x}) - if (!Interval.isEmpty(y) && !Interval.isWhole(y)) { - samples.push([x, y]) - } - if (Interval.isWhole(y)) { - // means that the next and prev intervals need to be fixed - samples.push(null) - } - } - - // asymptote determination - for (i = 1; i < samples.length - 1; i += 1) { - if (!samples[i]) { - var prev = samples[i - 1] - var next = samples[i + 1] - if (prev && next && !Interval.intervalsOverlap(prev[1], next[1])) { - // case: - // - // | - // - // | - // - // p n - if (prev[1].lo > next[1].hi) { - prev[1].hi = Math.max(yMax, prev[1].hi) - next[1].lo = Math.min(yMin, next[1].lo) - } - // case: - // - // | - // - // | - // - // p n - if (prev[1].hi < next[1].lo) { - prev[1].lo = Math.min(yMin, prev[1].lo) - next[1].hi = Math.max(yMax, next[1].hi) - } - } - } - } - - samples.scaledDx = xScale(xCoords[1]) - xScale(xCoords[0]) - return [samples] -} - -var rectEps -function smallRect (x, y) { - return Interval.width(x) < rectEps -} - -function quadTree (x, y, meta) { - var sample = evaluate(meta, 'fn', { - x: x, - y: y - }) - var fulfills = Interval.zeroIn(sample) - if (!fulfills) { return this } - if (smallRect(x, y)) { - this.push([x, y]) - return this - } - var midX = x.lo + (x.hi - x.lo) / 2 - var midY = y.lo + (y.hi - y.lo) / 2 - var east = {lo: midX, hi: x.hi} - var west = {lo: x.lo, hi: midX} - var north = {lo: midY, hi: y.hi} - var south = {lo: y.lo, hi: midY} - - quadTree.call(this, east, north, meta) - quadTree.call(this, east, south, meta) - quadTree.call(this, west, north, meta) - quadTree.call(this, west, south, meta) -} - -function interval2d (chart, meta) { - var xScale = chart.meta.xScale - var xDomain = chart.meta.xScale.domain() - var yDomain = chart.meta.yScale.domain() - var x = {lo: xDomain[0], hi: xDomain[1]} - var y = {lo: yDomain[0], hi: yDomain[1]} - var samples = [] - // 1 px - rectEps = xScale.invert(1) - xScale.invert(0) - quadTree.call(samples, x, y, meta) - samples.scaledDx = 1 - return [samples] -} - -var sampler = function (chart, d, range, nSamples) { - var fnTypes = { - implicit: interval2d, - linear: interval1d - } - if (!(fnTypes.hasOwnProperty(d.fnType))) { - throw Error(d.fnType + ' is not supported in the `interval` sampler') - } - return fnTypes[d.fnType].apply(null, arguments) -} - -module.exports = sampler diff --git a/anything/function-plot/lib/tip.js b/anything/function-plot/lib/tip.js deleted file mode 100644 index 2d68056..0000000 --- a/anything/function-plot/lib/tip.js +++ /dev/null @@ -1,151 +0,0 @@ -/** - * Created by mauricio on 3/29/15. - */ -'use strict' -var d3 = window.d3 -var extend = require('extend') -var utils = require('./utils') -var clamp = require('clamp') -var globals = require('./globals') -var builtInEvaluator = require('./helpers/eval').builtIn - -module.exports = function (config) { - config = extend({ - xLine: false, - yLine: false, - renderer: function (x, y) { - return '(' + x.toFixed(3) + ', ' + y.toFixed(3) + ')' - }, - owner: null - }, config) - - var MARGIN = 20 - - var line = d3.svg.line() - .x(function (d) { return d[0] }) - .y(function (d) { return d[1] }) - - function lineGenerator (el, data) { - return el.append('path') - .datum(data) - .attr('stroke', 'grey') - .attr('stroke-dasharray', '5,5') - .attr('opacity', 0.5) - .attr('d', line) - } - - function tip (selection) { - var innerSelection = selection.selectAll('g.tip') - .data(function (d) { return [d] }) - - // enter - innerSelection - .enter().append('g') - .attr('class', 'tip') - .attr('clip-path', 'url(#function-plot-clip-' + config.owner.id + ')') - - // enter + update = enter inner tip - tip.el = innerSelection.selectAll('g.inner-tip') - .data(function (d) { - // debugger - return [d] - }) - - tip.el.enter() - .append('g') - .attr('class', 'inner-tip') - .style('display', 'none') - .each(function () { - var el = d3.select(this) - lineGenerator(el, [[0, -config.owner.meta.height - MARGIN], [0, config.owner.meta.height + MARGIN]]) - .attr('class', 'tip-x-line') - .style('display', 'none') - lineGenerator(el, [[-config.owner.meta.width - MARGIN, 0], [config.owner.meta.width + MARGIN, 0]]) - .attr('class', 'tip-y-line') - .style('display', 'none') - el.append('circle').attr('r', 3) - el.append('text').attr('transform', 'translate(5,-5)') - }) - - // enter + update - selection.selectAll('.tip-x-line').style('display', config.xLine ? null : 'none') - selection.selectAll('.tip-y-line').style('display', config.yLine ? null : 'none') - } - - tip.move = function (x0, y0) { - var i - var minDist = Infinity - var closestIndex = -1 - var x, y - - var el = tip.el - var inf = 1e8 - var meta = config.owner.meta - var data = el.data()[0].data - var xScale = meta.xScale - var yScale = meta.yScale - var width = meta.width - var height = meta.height - - for (i = 0; i < data.length; i += 1) { - // skipTip=true skips the evaluation in the datum - // implicit equations cannot be evaluated with a single point - // parametric equations cannot be evaluated with a single point - // polar equations cannot be evaluated with a single point - if (data[i].skipTip || data[i].fnType !== 'linear') { - continue - } - - var range = data[i].range || [-inf, inf] - if (x0 > range[0] - globals.TIP_X_EPS && x0 < range[1] + globals.TIP_X_EPS) { - try { - var candidateY = builtInEvaluator(data[i], 'fn', {x: x0}) - } catch (e) { } - if (utils.isValidNumber(candidateY)) { - var tDist = Math.abs(candidateY - y0) - if (tDist < minDist) { - minDist = tDist - closestIndex = i - } - } - } - } - - if (closestIndex !== -1) { - x = x0 - if (data[closestIndex].range) { - x = Math.max(x, data[closestIndex].range[0]) - x = Math.min(x, data[closestIndex].range[1]) - } - y = builtInEvaluator(data[closestIndex], 'fn', {x: x}) - - tip.show() - config.owner.emit('tip:update', x, y, closestIndex) - var clampX = clamp(x, xScale.invert(-MARGIN), xScale.invert(width + MARGIN)) - var clampY = clamp(y, yScale.invert(height + MARGIN), yScale.invert(-MARGIN)) - var color = utils.color(data[closestIndex], closestIndex) - el.attr('transform', 'translate(' + xScale(clampX) + ',' + yScale(clampY) + ')') - el.select('circle') - .attr('fill', color) - el.select('text') - .attr('fill', color) - .text(config.renderer(x, y)) - } else { - tip.hide() - } - } - - tip.show = function () { - this.el.style('display', null) - } - - tip.hide = function () { - this.el.style('display', 'none') - } - // generations of getters/setters - Object.keys(config).forEach(function (option) { - utils.getterSetter.call(tip, config, option) - }) - - return tip -} diff --git a/anything/function-plot/lib/utils.js b/anything/function-plot/lib/utils.js deleted file mode 100644 index df9a9bd..0000000 --- a/anything/function-plot/lib/utils.js +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Created by mauricio on 3/29/15. - */ -'use strict' -var linspace = require('linspace') -var logspace = require('logspace') -var log10 = require('log10') - -var globals = require('./globals') - -module.exports = { - isValidNumber: function (v) { - return typeof v === 'number' && !isNaN(v) - }, - - space: function (chart, range, n) { - var lo = range[0] - var hi = range[1] - if (chart.options.xAxis.type === 'log') { - return logspace(log10(lo), log10(hi), n) - } - // default is linear - return linspace(lo, hi, n) - }, - - getterSetter: function (config, option) { - var me = this - this[option] = function (value) { - if (!arguments.length) { - return config[option] - } - config[option] = value - return me - } - }, - - sgn: function (v) { - if (v < 0) { return -1 } - if (v > 0) { return 1 } - return 0 - }, - - color: function (data, index) { - return data.color || globals.COLORS[index] - } -} diff --git a/anything/function-plot/package.json b/anything/function-plot/package.json deleted file mode 100644 index b5275f7..0000000 --- a/anything/function-plot/package.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "name": "function-plot", - "version": "1.16.2", - "description": "A simple 2d function plotter powered by d3", - "bugs": "https://github.com/maurizzzio/function-plot/issues", - "license": "MIT", - "main": "lib/index.js", - "homepage": "http://maurizzzio.github.io/function-plot/", - "author": "Mauricio Poppe ", - "files": [ - "/*", - "!/site/" - ], - "repository": { - "type": "git", - "url": "https://github.com/maurizzzio/function-plot" - }, - "keywords": [ - "function-plot", - "function", - "plotter", - "visualization", - "derivative", - "2d" - ], - "dependencies": { - "built-in-math-eval": "^0.3.0", - "clamp": "^1.0.1", - "extend": "^3.0.0", - "integrate-adaptive-simpson": "^1.0.3", - "interval-arithmetic-eval": "^0.4.3", - "is-object": "^1.0.1", - "key-pressed": "0.0.1", - "keydown": "0.0.3", - "linspace": "0.0.1-1", - "log10": "^1.0.0", - "logspace": "0.0.0" - }, - "devDependencies": { - "beefy": "^2.1.3", - "coveralls": "^2.11.2", - "dox": "^0.7.1", - "eslint": "^0.17.1", - "gh-pages-deploy": "^0.3.0", - "istanbul": "^0.3.8", - "jade": "^1.9.2", - "lodash": "^3.6.0", - "mocha": "^2.2.1", - "mocha-lcov-reporter": "^0.0.2", - "nodemon": "^1.3.7", - "standard": "^4.5.4", - "uglify-js": "~2.4.12" - }, - "scripts": { - "istanbul": "istanbul cover _mocha --report lcovonly 2> /dev/null -- -R spec test/", - "lint": "standard", - "test": "echo 'no tests!'", - "test:watch": "nodemon --watch lib --watch test --watch index.js --exec 'npm test'", - "start": "beefy index.js:js/function-plot.js 5555 --cwd site/ -- --standalone functionPlot", - "fetch": "curl -o site/partials/brcdn-module.html -L https://www.brcdn.org/?module=function-plot&version=latest", - "html": "node site.js", - "pre_publish": "npm run lint", - "browserify": "browserify index.js -o site/js/function-plot.js --standalone functionPlot", - "minify": "cat site/js/function-plot.js | uglifyjs -o site/js/function-plot.js", - "build": "npm run browserify && npm run minify", - "dist": "npm run lint && npm run build && cp site/js/function-plot.js dist/", - "deploy": "gh-pages-deploy" - }, - "gh-pages-deploy": { - "prep": [ - "html" - ], - "staticpath": "site" - }, - "standard": { - "ignore": [ - "sandbox/", - "site/", - "dist/" - ] - } -} diff --git a/anything/function-plot/site.js b/anything/function-plot/site.js deleted file mode 100644 index a1bab0b..0000000 --- a/anything/function-plot/site.js +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Created by mauricio on 4/9/15. - */ -'use strict' -var fs = require('fs') -var dox = require('dox') -var _ = require('lodash') -var jade = require('jade') -var version = require('./package.json').version - -var file = fs.readFileSync('./site/js/site.js', { encoding: 'utf-8' }) -var comments = dox.parseComments(file) - -var parsed = comments.map(function (c) { - var ids = c.code.match(/target:\s*'(.*)'/g) - if (ids) { - ids = ids - .map(function (str) { - return /#[0-9a-zA-Z\-]*/.exec(str)[0].substr(1) - }) - } - - var comment = c.description.full - var experimental - if (_.find(c.tags, {type: 'experimental'})) { - experimental = true - } - var additionalDOM = _.find(c.tags, {type: 'additionalDOM'}) - if (additionalDOM) { - additionalDOM = additionalDOM.string - } - comment = comment.replace(//g, ' ') - return { - comment: comment, - experimental: experimental, - code: c.code, - additionalDOM: additionalDOM, - ids: ids - } -}).filter(function (entry) { - return entry.ids -}) - -var output = fs.createWriteStream('./site/partials/examples.html') -output.write(jade.compileFile('./site/jade/examples.jade')({comments: parsed})) -output.end() - -var wzrd = fs.createWriteStream('./site/partials/wzrd.html') -wzrd.write(jade.compileFile('./site/jade/wzrd.jade')({version: version})) -wzrd.end() diff --git a/anything/function-plot/site/.gitattributes b/anything/function-plot/site/.gitattributes deleted file mode 100644 index 176a458..0000000 --- a/anything/function-plot/site/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -* text=auto diff --git a/anything/function-plot/site/.htaccess b/anything/function-plot/site/.htaccess deleted file mode 100644 index c066aab..0000000 --- a/anything/function-plot/site/.htaccess +++ /dev/null @@ -1,998 +0,0 @@ -# Apache Server Configs v2.13.0 | MIT License -# https://github.com/h5bp/server-configs-apache - -# (!) Using `.htaccess` files slows down Apache, therefore, if you have -# access to the main server configuration file (which is usually called -# `httpd.conf`), you should add this logic there. -# -# https://httpd.apache.org/docs/current/howto/htaccess.html. - -# ###################################################################### -# # CROSS-ORIGIN # -# ###################################################################### - -# ---------------------------------------------------------------------- -# | Cross-origin requests | -# ---------------------------------------------------------------------- - -# Allow cross-origin requests. -# -# https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS -# http://enable-cors.org/ -# http://www.w3.org/TR/cors/ - -# -# Header set Access-Control-Allow-Origin "*" -# - -# ---------------------------------------------------------------------- -# | Cross-origin images | -# ---------------------------------------------------------------------- - -# Send the CORS header for images when browsers request it. -# -# https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image -# https://blog.chromium.org/2011/07/using-cross-domain-images-in-webgl-and.html - - - - - SetEnvIf Origin ":" IS_CORS - Header set Access-Control-Allow-Origin "*" env=IS_CORS - - - - -# ---------------------------------------------------------------------- -# | Cross-origin web fonts | -# ---------------------------------------------------------------------- - -# Allow cross-origin access to web fonts. - - - - Header set Access-Control-Allow-Origin "*" - - - -# ---------------------------------------------------------------------- -# | Cross-origin resource timing | -# ---------------------------------------------------------------------- - -# Allow cross-origin access to the timing information for all resources. -# -# If a resource isn't served with a `Timing-Allow-Origin` header that -# would allow its timing information to be shared with the document, -# some of the attributes of the `PerformanceResourceTiming` object will -# be set to zero. -# -# http://www.w3.org/TR/resource-timing/ -# http://www.stevesouders.com/blog/2014/08/21/resource-timing-practical-tips/ - -# -# Header set Timing-Allow-Origin: "*" -# - - -# ###################################################################### -# # ERRORS # -# ###################################################################### - -# ---------------------------------------------------------------------- -# | Custom error messages/pages | -# ---------------------------------------------------------------------- - -# Customize what Apache returns to the client in case of an error. -# https://httpd.apache.org/docs/current/mod/core.html#errordocument - -ErrorDocument 404 /404.html - -# ---------------------------------------------------------------------- -# | Error prevention | -# ---------------------------------------------------------------------- - -# Disable the pattern matching based on filenames. -# -# This setting prevents Apache from returning a 404 error as the result -# of a rewrite when the directory with the same name does not exist. -# -# https://httpd.apache.org/docs/current/content-negotiation.html#multiviews - -Options -MultiViews - - -# ###################################################################### -# # INTERNET EXPLORER # -# ###################################################################### - -# ---------------------------------------------------------------------- -# | Document modes | -# ---------------------------------------------------------------------- - -# Force Internet Explorer 8/9/10 to render pages in the highest mode -# available in the various cases when it may not. -# -# https://hsivonen.fi/doctype/#ie8 -# -# (!) Starting with Internet Explorer 11, document modes are deprecated. -# If your business still relies on older web apps and services that were -# designed for older versions of Internet Explorer, you might want to -# consider enabling `Enterprise Mode` throughout your company. -# -# https://msdn.microsoft.com/en-us/library/ie/bg182625.aspx#docmode -# http://blogs.msdn.com/b/ie/archive/2014/04/02/stay-up-to-date-with-enterprise-mode-for-internet-explorer-11.aspx - - - - Header set X-UA-Compatible "IE=edge" - - # `mod_headers` cannot match based on the content-type, however, - # the `X-UA-Compatible` response header should be send only for - # HTML documents and not for the other resources. - - - Header unset X-UA-Compatible - - - - -# ---------------------------------------------------------------------- -# | Iframes cookies | -# ---------------------------------------------------------------------- - -# Allow cookies to be set from iframes in Internet Explorer. -# -# https://msdn.microsoft.com/en-us/library/ms537343.aspx -# http://www.w3.org/TR/2000/CR-P3P-20001215/ - -# -# Header set P3P "policyref=\"/w3c/p3p.xml\", CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"" -# - - -# ###################################################################### -# # MEDIA TYPES AND CHARACTER ENCODINGS # -# ###################################################################### - -# ---------------------------------------------------------------------- -# | Media types | -# ---------------------------------------------------------------------- - -# Serve resources with the proper media types (f.k.a. MIME types). -# -# https://www.iana.org/assignments/media-types/media-types.xhtml -# https://httpd.apache.org/docs/current/mod/mod_mime.html#addtype - - - - # Data interchange - - AddType application/atom+xml atom - AddType application/json json map topojson - AddType application/ld+json jsonld - AddType application/rss+xml rss - AddType application/vnd.geo+json geojson - AddType application/xml rdf xml - - - # JavaScript - - # Normalize to standard type. - # https://tools.ietf.org/html/rfc4329#section-7.2 - - AddType application/javascript js - - - # Manifest files - - # If you are providing a web application manifest file (see - # the specification: https://w3c.github.io/manifest/), it is - # recommended that you serve it with the `application/manifest+json` - # media type. - # - # Because the web application manifest file doesn't have its - # own unique file extension, you can set its media type either - # by matching: - # - # 1) the exact location of the file (this can be done using a - # directive such as ``, but it will NOT work in - # the `.htaccess` file, so you will have to do it in the main - # server configuration file or inside of a `` - # container) - # - # e.g.: - # - # - # AddType application/manifest+json json - # - # - # 2) the filename (this can be problematic as you will need to - # ensure that you don't have any other file with the same name - # as the one you gave to your web application manifest file) - # - # e.g.: - # - # - # AddType application/manifest+json json - # - - AddType application/x-web-app-manifest+json webapp - AddType text/cache-manifest appcache - - - # Media files - - AddType audio/mp4 f4a f4b m4a - AddType audio/ogg oga ogg opus - AddType image/bmp bmp - AddType image/svg+xml svg svgz - AddType image/webp webp - AddType video/mp4 f4v f4p m4v mp4 - AddType video/ogg ogv - AddType video/webm webm - AddType video/x-flv flv - - # Serving `.ico` image files with a different media type - # prevents Internet Explorer from displaying then as images: - # https://github.com/h5bp/html5-boilerplate/commit/37b5fec090d00f38de64b591bcddcb205aadf8ee - - AddType image/x-icon cur ico - - - # Web fonts - - AddType application/font-woff woff - AddType application/font-woff2 woff2 - AddType application/vnd.ms-fontobject eot - - # Browsers usually ignore the font media types and simply sniff - # the bytes to figure out the font type. - # https://mimesniff.spec.whatwg.org/#matching-a-font-type-pattern - # - # However, Blink and WebKit based browsers will show a warning - # in the console if the following font types are served with any - # other media types. - - AddType application/x-font-ttf ttc ttf - AddType font/opentype otf - - - # Other - - AddType application/octet-stream safariextz - AddType application/x-bb-appworld bbaw - AddType application/x-chrome-extension crx - AddType application/x-opera-extension oex - AddType application/x-xpinstall xpi - AddType text/vcard vcard vcf - AddType text/vnd.rim.location.xloc xloc - AddType text/vtt vtt - AddType text/x-component htc - - - -# ---------------------------------------------------------------------- -# | Character encodings | -# ---------------------------------------------------------------------- - -# Serve all resources labeled as `text/html` or `text/plain` -# with the media type `charset` parameter set to `UTF-8`. -# -# https://httpd.apache.org/docs/current/mod/core.html#adddefaultcharset - -AddDefaultCharset utf-8 - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Serve the following file types with the media type `charset` -# parameter set to `UTF-8`. -# -# https://httpd.apache.org/docs/current/mod/mod_mime.html#addcharset - - - AddCharset utf-8 .atom \ - .bbaw \ - .css \ - .geojson \ - .js \ - .json \ - .jsonld \ - .rdf \ - .rss \ - .topojson \ - .vtt \ - .webapp \ - .xloc \ - .xml - - - -# ###################################################################### -# # REWRITES # -# ###################################################################### - -# ---------------------------------------------------------------------- -# | Rewrite engine | -# ---------------------------------------------------------------------- - -# (1) Turn on the rewrite engine (this is necessary in order for -# the `RewriteRule` directives to work). -# -# https://httpd.apache.org/docs/current/mod/mod_rewrite.html#RewriteEngine -# -# (2) Enable the `FollowSymLinks` option if it isn't already. -# -# https://httpd.apache.org/docs/current/mod/core.html#options -# -# (3) If your web host doesn't allow the `FollowSymlinks` option, -# you need to comment it out or remove it, and then uncomment -# the `Options +SymLinksIfOwnerMatch` line (4), but be aware -# of the performance impact. -# -# https://httpd.apache.org/docs/current/misc/perf-tuning.html#symlinks -# -# (4) Some cloud hosting services will require you set `RewriteBase`. -# -# https://www.rackspace.com/knowledge_center/frequently-asked-question/why-is-modrewrite-not-working-on-my-site -# https://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritebase -# -# (5) Depending on how your server is set up, you may also need to -# use the `RewriteOptions` directive to enable some options for -# the rewrite engine. -# -# https://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriteoptions -# -# (6) Set %{ENV:PROTO} variable, to allow rewrites to redirect with the -# appropriate schema automatically (http or https). - - - - # (1) - RewriteEngine On - - # (2) - Options +FollowSymlinks - - # (3) - # Options +SymLinksIfOwnerMatch - - # (4) - # RewriteBase / - - # (5) - # RewriteOptions - - # (6) - RewriteCond %{HTTPS} =on - RewriteRule ^ - [env=proto:https] - RewriteCond %{HTTPS} !=on - RewriteRule ^ - [env=proto:http] - - - -# ---------------------------------------------------------------------- -# | Forcing `https://` | -# ---------------------------------------------------------------------- - -# Redirect from the `http://` to the `https://` version of the URL. -# https://wiki.apache.org/httpd/RewriteHTTPToHTTPS - -# -# RewriteEngine On -# RewriteCond %{HTTPS} !=on -# RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] -# - -# ---------------------------------------------------------------------- -# | Suppressing / Forcing the `www.` at the beginning of URLs | -# ---------------------------------------------------------------------- - -# The same content should never be available under two different -# URLs, especially not with and without `www.` at the beginning. -# This can cause SEO problems (duplicate content), and therefore, -# you should choose one of the alternatives and redirect the other -# one. -# -# By default `Option 1` (no `www.`) is activated. -# http://no-www.org/faq.php?q=class_b -# -# If you would prefer to use `Option 2`, just comment out all the -# lines from `Option 1` and uncomment the ones from `Option 2`. -# -# (!) NEVER USE BOTH RULES AT THE SAME TIME! - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Option 1: rewrite www.example.com → example.com - - - RewriteEngine On - RewriteCond %{HTTPS} !=on - RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] - RewriteRule ^ %{ENV:PROTO}://%1%{REQUEST_URI} [R=301,L] - - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Option 2: rewrite example.com → www.example.com -# -# Be aware that the following might not be a good idea if you use "real" -# subdomains for certain parts of your website. - -# -# RewriteEngine On -# RewriteCond %{HTTPS} !=on -# RewriteCond %{HTTP_HOST} !^www\. [NC] -# RewriteCond %{SERVER_ADDR} !=127.0.0.1 -# RewriteCond %{SERVER_ADDR} !=::1 -# RewriteRule ^ %{ENV:PROTO}://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] -# - - -# ###################################################################### -# # SECURITY # -# ###################################################################### - -# ---------------------------------------------------------------------- -# | Clickjacking | -# ---------------------------------------------------------------------- - -# Protect website against clickjacking. -# -# The example below sends the `X-Frame-Options` response header with -# the value `DENY`, informing browsers not to display the content of -# the web page in any frame. -# -# This might not be the best setting for everyone. You should read -# about the other two possible values the `X-Frame-Options` header -# field can have: `SAMEORIGIN` and `ALLOW-FROM`. -# https://tools.ietf.org/html/rfc7034#section-2.1. -# -# Keep in mind that while you could send the `X-Frame-Options` header -# for all of your website’s pages, this has the potential downside that -# it forbids even non-malicious framing of your content (e.g.: when -# users visit your website using a Google Image Search results page). -# -# Nonetheless, you should ensure that you send the `X-Frame-Options` -# header for all pages that allow a user to make a state changing -# operation (e.g: pages that contain one-click purchase links, checkout -# or bank-transfer confirmation pages, pages that make permanent -# configuration changes, etc.). -# -# Sending the `X-Frame-Options` header can also protect your website -# against more than just clickjacking attacks: -# https://cure53.de/xfo-clickjacking.pdf. -# -# https://tools.ietf.org/html/rfc7034 -# http://blogs.msdn.com/b/ieinternals/archive/2010/03/30/combating-clickjacking-with-x-frame-options.aspx -# https://www.owasp.org/index.php/Clickjacking - -# - -# Header set X-Frame-Options "DENY" - -# # `mod_headers` cannot match based on the content-type, however, -# # the `X-Frame-Options` response header should be send only for -# # HTML documents and not for the other resources. - -# -# Header unset X-Frame-Options -# - -# - -# ---------------------------------------------------------------------- -# | Content Security Policy (CSP) | -# ---------------------------------------------------------------------- - -# Mitigate the risk of cross-site scripting and other content-injection -# attacks. -# -# This can be done by setting a `Content Security Policy` which -# whitelists trusted sources of content for your website. -# -# The example header below allows ONLY scripts that are loaded from -# the current website's origin (no inline scripts, no CDN, etc). -# That almost certainly won't work as-is for your website! -# -# To make things easier, you can use an online CSP header generator -# such as: http://cspisawesome.com/. -# -# http://content-security-policy.com/ -# http://www.html5rocks.com/en/tutorials/security/content-security-policy/ -# http://www.w3.org/TR/CSP11/). - -# - -# Header set Content-Security-Policy "script-src 'self'; object-src 'self'" - -# # `mod_headers` cannot match based on the content-type, however, -# # the `Content-Security-Policy` response header should be send -# # only for HTML documents and not for the other resources. - -# -# Header unset Content-Security-Policy -# - -# - -# ---------------------------------------------------------------------- -# | File access | -# ---------------------------------------------------------------------- - -# Block access to directories without a default document. -# -# You should leave the following uncommented, as you shouldn't allow -# anyone to surf through every directory on your server (which may -# includes rather private places such as the CMS's directories). - - - Options -Indexes - - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Block access to all hidden files and directories with the exception of -# the visible content from within the `/.well-known/` hidden directory. -# -# These types of files usually contain user preferences or the preserved -# state of an utility, and can include rather private places like, for -# example, the `.git` or `.svn` directories. -# -# The `/.well-known/` directory represents the standard (RFC 5785) path -# prefix for "well-known locations" (e.g.: `/.well-known/manifest.json`, -# `/.well-known/keybase.txt`), and therefore, access to its visible -# content should not be blocked. -# -# https://www.mnot.net/blog/2010/04/07/well-known -# https://tools.ietf.org/html/rfc5785 - - - RewriteEngine On - RewriteCond %{REQUEST_URI} "!(^|/)\.well-known/([^./]+./?)+$" [NC] - RewriteCond %{SCRIPT_FILENAME} -d [OR] - RewriteCond %{SCRIPT_FILENAME} -f - RewriteRule "(^|/)\." - [F] - - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Block access to files that can expose sensitive information. -# -# By default, block access to backup and source files that may be -# left by some text editors and can pose a security risk when anyone -# has access to them. -# -# http://feross.org/cmsploit/ -# -# (!) Update the `` regular expression from below to -# include any files that might end up on your production server and -# can expose sensitive information about your website. These files may -# include: configuration files, files that contain metadata about the -# project (e.g.: project dependencies), build scripts, etc.. - - - - # Apache < 2.3 - - Order allow,deny - Deny from all - Satisfy All - - - # Apache ≥ 2.3 - - Require all denied - - - - -# ---------------------------------------------------------------------- -# | HTTP Strict Transport Security (HSTS) | -# ---------------------------------------------------------------------- - -# Force client-side SSL redirection. -# -# If a user types `example.com` in their browser, even if the server -# redirects them to the secure version of the website, that still leaves -# a window of opportunity (the initial HTTP connection) for an attacker -# to downgrade or redirect the request. -# -# The following header ensures that browser will ONLY connect to your -# server via HTTPS, regardless of what the users type in the browser's -# address bar. -# -# (!) Remove the `includeSubDomains` optional directive if the website's -# subdomains are not using HTTPS. -# -# http://www.html5rocks.com/en/tutorials/security/transport-layer-security/ -# https://tools.ietf.org/html/draft-ietf-websec-strict-transport-sec-14#section-6.1 -# http://blogs.msdn.com/b/ieinternals/archive/2014/08/18/hsts-strict-transport-security-attacks-mitigations-deployment-https.aspx - -# -# Header always set Strict-Transport-Security "max-age=16070400; includeSubDomains" -# - -# ---------------------------------------------------------------------- -# | Reducing MIME type security risks | -# ---------------------------------------------------------------------- - -# Prevent some browsers from MIME-sniffing the response. -# -# This reduces exposure to drive-by download attacks and cross-origin -# data leaks, and should be left uncommented, especially if the server -# is serving user-uploaded content or content that could potentially be -# treated as executable by the browser. -# -# http://www.slideshare.net/hasegawayosuke/owasp-hasegawa -# http://blogs.msdn.com/b/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-protection.aspx -# https://msdn.microsoft.com/en-us/library/ie/gg622941.aspx -# https://mimesniff.spec.whatwg.org/ - - - Header set X-Content-Type-Options "nosniff" - - -# ---------------------------------------------------------------------- -# | Reflected Cross-Site Scripting (XSS) attacks | -# ---------------------------------------------------------------------- - -# (1) Try to re-enable the cross-site scripting (XSS) filter built -# into most web browsers. -# -# The filter is usually enabled by default, but in some cases it -# may be disabled by the user. However, in Internet Explorer for -# example, it can be re-enabled just by sending the -# `X-XSS-Protection` header with the value of `1`. -# -# (2) Prevent web browsers from rendering the web page if a potential -# reflected (a.k.a non-persistent) XSS attack is detected by the -# filter. -# -# By default, if the filter is enabled and browsers detect a -# reflected XSS attack, they will attempt to block the attack -# by making the smallest possible modifications to the returned -# web page. -# -# Unfortunately, in some browsers (e.g.: Internet Explorer), -# this default behavior may allow the XSS filter to be exploited, -# thereby, it's better to inform browsers to prevent the rendering -# of the page altogether, instead of attempting to modify it. -# -# https://hackademix.net/2009/11/21/ies-xss-filter-creates-xss-vulnerabilities -# -# (!) Do not rely on the XSS filter to prevent XSS attacks! Ensure that -# you are taking all possible measures to prevent XSS attacks, the -# most obvious being: validating and sanitizing your website's inputs. -# -# http://blogs.msdn.com/b/ie/archive/2008/07/02/ie8-security-part-iv-the-xss-filter.aspx -# http://blogs.msdn.com/b/ieinternals/archive/2011/01/31/controlling-the-internet-explorer-xss-filter-with-the-x-xss-protection-http-header.aspx -# https://www.owasp.org/index.php/Cross-site_Scripting_%28XSS%29 - -# - -# # (1) (2) -# Header set X-XSS-Protection "1; mode=block" - -# # `mod_headers` cannot match based on the content-type, however, -# # the `X-XSS-Protection` response header should be send only for -# # HTML documents and not for the other resources. - -# -# Header unset X-XSS-Protection -# - -# - -# ---------------------------------------------------------------------- -# | Server-side technology information | -# ---------------------------------------------------------------------- - -# Remove the `X-Powered-By` response header that: -# -# * is set by some frameworks and server-side languages -# (e.g.: ASP.NET, PHP), and its value contains information -# about them (e.g.: their name, version number) -# -# * doesn't provide any value as far as users are concern, -# and in some cases, the information provided by it can -# be used by attackers -# -# (!) If you can, you should disable the `X-Powered-By` header from the -# language / framework level (e.g.: for PHP, you can do that by setting -# `expose_php = off` in `php.ini`) -# -# https://php.net/manual/en/ini.core.php#ini.expose-php - - - Header unset X-Powered-By - - -# ---------------------------------------------------------------------- -# | Server software information | -# ---------------------------------------------------------------------- - -# Prevent Apache from adding a trailing footer line containing -# information about the server to the server-generated documents -# (e.g.: error messages, directory listings, etc.) -# -# https://httpd.apache.org/docs/current/mod/core.html#serversignature - -ServerSignature Off - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Prevent Apache from sending in the `Server` response header its -# exact version number, the description of the generic OS-type or -# information about its compiled-in modules. -# -# (!) The `ServerTokens` directive will only work in the main server -# configuration file, so don't try to enable it in the `.htaccess` file! -# -# https://httpd.apache.org/docs/current/mod/core.html#servertokens - -#ServerTokens Prod - - -# ###################################################################### -# # WEB PERFORMANCE # -# ###################################################################### - -# ---------------------------------------------------------------------- -# | Compression | -# ---------------------------------------------------------------------- - - - - # Force compression for mangled `Accept-Encoding` request headers - # https://developer.yahoo.com/blogs/ydn/pushing-beyond-gzipping-25601.html - - - - SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding - RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Compress all output labeled with one of the following media types. - # - # (!) For Apache versions below version 2.3.7 you don't need to - # enable `mod_filter` and can remove the `` - # and `` lines as `AddOutputFilterByType` is still in - # the core directives. - # - # https://httpd.apache.org/docs/current/mod/mod_filter.html#addoutputfilterbytype - - - AddOutputFilterByType DEFLATE "application/atom+xml" \ - "application/javascript" \ - "application/json" \ - "application/ld+json" \ - "application/manifest+json" \ - "application/rdf+xml" \ - "application/rss+xml" \ - "application/schema+json" \ - "application/vnd.geo+json" \ - "application/vnd.ms-fontobject" \ - "application/x-font-ttf" \ - "application/x-javascript" \ - "application/x-web-app-manifest+json" \ - "application/xhtml+xml" \ - "application/xml" \ - "font/eot" \ - "font/opentype" \ - "image/bmp" \ - "image/svg+xml" \ - "image/vnd.microsoft.icon" \ - "image/x-icon" \ - "text/cache-manifest" \ - "text/css" \ - "text/html" \ - "text/javascript" \ - "text/plain" \ - "text/vcard" \ - "text/vnd.rim.location.xloc" \ - "text/vtt" \ - "text/x-component" \ - "text/x-cross-domain-policy" \ - "text/xml" - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Map the following filename extensions to the specified - # encoding type in order to make Apache serve the file types - # with the appropriate `Content-Encoding` response header - # (do note that this will NOT make Apache compress them!). - # - # If these files types would be served without an appropriate - # `Content-Enable` response header, client applications (e.g.: - # browsers) wouldn't know that they first need to uncompress - # the response, and thus, wouldn't be able to understand the - # content. - # - # https://httpd.apache.org/docs/current/mod/mod_mime.html#addencoding - - - AddEncoding gzip svgz - - - - -# ---------------------------------------------------------------------- -# | Content transformation | -# ---------------------------------------------------------------------- - -# Prevent intermediate caches or proxies (e.g.: such as the ones -# used by mobile network providers) from modifying the website's -# content. -# -# https://tools.ietf.org/html/rfc2616#section-14.9.5 -# -# (!) If you are using `mod_pagespeed`, please note that setting -# the `Cache-Control: no-transform` response header will prevent -# `PageSpeed` from rewriting `HTML` files, and, if the -# `ModPagespeedDisableRewriteOnNoTransform` directive isn't set -# to `off`, also from rewriting other resources. -# -# https://developers.google.com/speed/pagespeed/module/configuration#notransform - -# -# Header merge Cache-Control "no-transform" -# - -# ---------------------------------------------------------------------- -# | ETags | -# ---------------------------------------------------------------------- - -# Remove `ETags` as resources are sent with far-future expires headers. -# -# https://developer.yahoo.com/performance/rules.html#etags -# https://tools.ietf.org/html/rfc7232#section-2.3 - -# `FileETag None` doesn't work in all cases. - - Header unset ETag - - -FileETag None - -# ---------------------------------------------------------------------- -# | Expires headers | -# ---------------------------------------------------------------------- - -# Serve resources with far-future expires headers. -# -# (!) If you don't control versioning with filename-based -# cache busting, you should consider lowering the cache times -# to something like one week. -# -# https://httpd.apache.org/docs/current/mod/mod_expires.html - - - - ExpiresActive on - ExpiresDefault "access plus 1 month" - - # CSS - ExpiresByType text/css "access plus 1 year" - - # Data interchange - ExpiresByType application/atom+xml "access plus 1 hour" - ExpiresByType application/rdf+xml "access plus 1 hour" - ExpiresByType application/rss+xml "access plus 1 hour" - - ExpiresByType application/json "access plus 0 seconds" - ExpiresByType application/ld+json "access plus 0 seconds" - ExpiresByType application/schema+json "access plus 0 seconds" - ExpiresByType application/vnd.geo+json "access plus 0 seconds" - ExpiresByType application/xml "access plus 0 seconds" - ExpiresByType text/xml "access plus 0 seconds" - - # Favicon (cannot be renamed!) and cursor images - ExpiresByType image/vnd.microsoft.icon "access plus 1 week" - ExpiresByType image/x-icon "access plus 1 week" - - # HTML - ExpiresByType text/html "access plus 0 seconds" - - # JavaScript - ExpiresByType application/javascript "access plus 1 year" - ExpiresByType application/x-javascript "access plus 1 year" - ExpiresByType text/javascript "access plus 1 year" - - # Manifest files - ExpiresByType application/manifest+json "access plus 1 year" - - ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds" - ExpiresByType text/cache-manifest "access plus 0 seconds" - - # Media files - ExpiresByType audio/ogg "access plus 1 month" - ExpiresByType image/bmp "access plus 1 month" - ExpiresByType image/gif "access plus 1 month" - ExpiresByType image/jpeg "access plus 1 month" - ExpiresByType image/png "access plus 1 month" - ExpiresByType image/svg+xml "access plus 1 month" - ExpiresByType image/webp "access plus 1 month" - ExpiresByType video/mp4 "access plus 1 month" - ExpiresByType video/ogg "access plus 1 month" - ExpiresByType video/webm "access plus 1 month" - - # Web fonts - - # Embedded OpenType (EOT) - ExpiresByType application/vnd.ms-fontobject "access plus 1 month" - ExpiresByType font/eot "access plus 1 month" - - # OpenType - ExpiresByType font/opentype "access plus 1 month" - - # TrueType - ExpiresByType application/x-font-ttf "access plus 1 month" - - # Web Open Font Format (WOFF) 1.0 - ExpiresByType application/font-woff "access plus 1 month" - ExpiresByType application/x-font-woff "access plus 1 month" - ExpiresByType font/woff "access plus 1 month" - - # Web Open Font Format (WOFF) 2.0 - ExpiresByType application/font-woff2 "access plus 1 month" - - # Other - ExpiresByType text/x-cross-domain-policy "access plus 1 week" - - - -# ---------------------------------------------------------------------- -# | File concatenation | -# ---------------------------------------------------------------------- - -# Allow concatenation from within specific files. -# -# e.g.: -# -# If you have the following lines in a file called, for -# example, `main.combined.js`: -# -# -# -# -# Apache will replace those lines with the content of the -# specified files. - -# -# -# Options +Includes -# AddOutputFilterByType INCLUDES application/javascript \ -# application/x-javascript \ -# text/javascript -# SetOutputFilter INCLUDES -# -# -# Options +Includes -# AddOutputFilterByType INCLUDES text/css -# SetOutputFilter INCLUDES -# -# - -# ---------------------------------------------------------------------- -# | Filename-based cache busting | -# ---------------------------------------------------------------------- - -# If you're not using a build process to manage your filename version -# revving, you might want to consider enabling the following directives -# to route all requests such as `/style.12345.css` to `/style.css`. -# -# To understand why this is important and even a better solution than -# using something like `*.css?v231`, please see: -# http://www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/ - -# -# RewriteEngine On -# RewriteCond %{REQUEST_FILENAME} !-f -# RewriteRule ^(.+)\.(\d+)\.(bmp|css|cur|gif|ico|jpe?g|js|png|svgz?|webp)$ $1.$3 [L] -# diff --git a/anything/function-plot/site/.npmignore b/anything/function-plot/site/.npmignore deleted file mode 100644 index 16b2d7d..0000000 --- a/anything/function-plot/site/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -# Include your project-specific ignores in this file -# Read about how to use .gitignore: https://help.github.com/articles/ignoring-files diff --git a/anything/function-plot/site/404.html b/anything/function-plot/site/404.html deleted file mode 100644 index 8d7925a..0000000 --- a/anything/function-plot/site/404.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - - Page Not Found - - - - -

Page Not Found

-

Sorry, but the page you were trying to view does not exist.

- - - diff --git a/anything/function-plot/site/LICENSE.txt b/anything/function-plot/site/LICENSE.txt deleted file mode 100644 index 294e91d..0000000 --- a/anything/function-plot/site/LICENSE.txt +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) HTML5 Boilerplate - -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. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/anything/function-plot/site/apple-touch-icon.png b/anything/function-plot/site/apple-touch-icon.png deleted file mode 100644 index 600738f..0000000 Binary files a/anything/function-plot/site/apple-touch-icon.png and /dev/null differ diff --git a/anything/function-plot/site/browserconfig.xml b/anything/function-plot/site/browserconfig.xml deleted file mode 100644 index 219b759..0000000 --- a/anything/function-plot/site/browserconfig.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/anything/function-plot/site/crossdomain.xml b/anything/function-plot/site/crossdomain.xml deleted file mode 100644 index 818b822..0000000 --- a/anything/function-plot/site/crossdomain.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - diff --git a/anything/function-plot/site/css/main.css b/anything/function-plot/site/css/main.css deleted file mode 100644 index 53ada7c..0000000 --- a/anything/function-plot/site/css/main.css +++ /dev/null @@ -1,371 +0,0 @@ -/*! HTML5 Boilerplate v5.1.0 | MIT License | https://html5boilerplate.com/ */ - -/* - * What follows is the result of much research on cross-browser styling. - * Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal, - * Kroc Camen, and the H5BP dev community and team. - */ - -/* ========================================================================== - Base styles: opinionated defaults - ========================================================================== */ - -html { - color: #222; - font-size: 1em; - line-height: 1.4; -} - -/* - * Remove text-shadow in selection highlight: - * https://twitter.com/miketaylr/status/12228805301 - * - * These selection rule sets have to be separate. - * Customize the background color to match your design. - */ - -::-moz-selection { - background: #b3d4fc; - text-shadow: none; -} - -::selection { - background: #b3d4fc; - text-shadow: none; -} - -/* - * A better looking default horizontal rule - */ - -hr { - display: block; - height: 1px; - border: 0; - border-top: 1px solid #ccc; - margin: 1em 0; - padding: 0; -} - -/* - * Remove the gap between audio, canvas, iframes, - * images, videos and the bottom of their containers: - * https://github.com/h5bp/html5-boilerplate/issues/440 - */ - -audio, -canvas, -iframe, -img, -svg, -video { - vertical-align: middle; -} - -/* - * Remove default fieldset styles. - */ - -fieldset { - border: 0; - margin: 0; - padding: 0; -} - -/* - * Allow only vertical resizing of textareas. - */ - -textarea { - resize: vertical; -} - -/* ========================================================================== - Browser Upgrade Prompt - ========================================================================== */ - -.browserupgrade { - margin: 0.2em 0; - background: #ccc; - color: #000; - padding: 0.2em 0; -} - -/* ========================================================================== - Author's custom styles - ========================================================================== */ - -/*flat ui*/ -/*https://color.adobe.com/Flat-UI-color-theme-2469224/edit/?copy=true*/ - -/* - #2C3E50 - #E74C3C - #ECF0F1 - #3498DB - #2980B9 -*/ -h1 { - font-size: 5em; -} - -h2 { - font-size: 3em; -} - -h3 { - font-size: 2em; - color: #2980B9; -} - -a { - color: #E74C3C; -} -a:hover { - color: #FF4C3C; -} - -pre { - font-size: 11px; - background: transparent; - border: 1px solid #ECF0F1; -} - -code { - background-color: #ECF0F1; - color: #3498DB; -} - -.graph { - display: inline-block; - margin: 0 auto; -} - -#description { - font-size: 1em; - width: 650px; -} -/*#description-sample {*/ - /*width: 600px;*/ -/*}*/ - -.social-buttons > div { - margin: 20px; -} - -.header { - background: #2C3E50; - color: #ECF0F1; - padding: 50px; -} - -.content { - padding-top: 40px; - padding-bottom: 40px; -} - -.footer { - font-size: 0.8em; - padding: 40px; - background: #2C3E50; - color: #ECF0F1; -} - -.container { - padding-top: 30px; - padding-bottom: 30px; -} - -.about { - padding: 20px; -} - -.demos { - margin-top: 70px; -} - -.hljs { - background: transparent; -} -section { - font-size: 3em; - background: #ECF0F1; - padding: 10px; - color: #3498DB; -} - -input[type=range] { - display: inline; - width: 90%; -} - -.extra { - margin-top: 20px; -} - -/* ========================================================================== - Helper classes - ========================================================================== */ - -/* - * Hide visually and from screen readers: - */ - -.hidden { - display: none !important; -} - -/* - * Hide only visually, but have it available for screen readers: - * http://snook.ca/archives/html_and_css/hiding-content-for-accessibility - */ - -.visuallyhidden { - border: 0; - clip: rect(0 0 0 0); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - width: 1px; -} - -/* - * Extends the .visuallyhidden class to allow the element - * to be focusable when navigated to via the keyboard: - * https://www.drupal.org/node/897638 - */ - -.visuallyhidden.focusable:active, -.visuallyhidden.focusable:focus { - clip: auto; - height: auto; - margin: 0; - overflow: visible; - position: static; - width: auto; -} - -/* - * Hide visually and from screen readers, but maintain layout - */ - -.invisible { - visibility: hidden; -} - -/* - * Clearfix: contain floats - * - * For modern browsers - * 1. The space content is one way to avoid an Opera bug when the - * `contenteditable` attribute is included anywhere else in the document. - * Otherwise it causes space to appear at the top and bottom of elements - * that receive the `clearfix` class. - * 2. The use of `table` rather than `block` is only necessary if using - * `:before` to contain the top-margins of child elements. - */ - -.clearfix:before, -.clearfix:after { - content: " "; /* 1 */ - display: table; /* 2 */ -} - -.clearfix:after { - clear: both; -} - -/* ========================================================================== - EXAMPLE Media Queries for Responsive Design. - These examples override the primary ('mobile first') styles. - Modify as content requires. - ========================================================================== */ - -@media only screen and (min-width: 35em) { - /* Style adjustments for viewports that meet the condition */ -} - -@media print, - (-webkit-min-device-pixel-ratio: 1.25), - (min-resolution: 120dpi) { - /* Style adjustments for high resolution devices */ -} - -/* ========================================================================== - Print styles. - Inlined to avoid the additional HTTP request: - http://www.phpied.com/delay-loading-your-print-css/ - ========================================================================== */ - -@media print { - *, - *:before, - *:after { - background: transparent !important; - color: #000 !important; /* Black prints faster: - http://www.sanbeiji.com/archives/953 */ - box-shadow: none !important; - text-shadow: none !important; - } - - a, - a:visited { - text-decoration: underline; - } - - a[href]:after { - content: " (" attr(href) ")"; - } - - abbr[title]:after { - content: " (" attr(title) ")"; - } - - /* - * Don't show links that are fragment identifiers, - * or use the `javascript:` pseudo protocol - */ - - a[href^="#"]:after, - a[href^="javascript:"]:after { - content: ""; - } - - pre, - blockquote { - border: 1px solid #999; - page-break-inside: avoid; - } - - /* - * Printing Tables: - * http://css-discuss.incutio.com/wiki/Printing_Tables - */ - - thead { - display: table-header-group; - } - - tr, - img { - page-break-inside: avoid; - } - - img { - max-width: 100% !important; - } - - p, - h2, - h3 { - orphans: 3; - widows: 3; - } - - h2, - h3 { - page-break-after: avoid; - } -} diff --git a/anything/function-plot/site/css/normalize.css b/anything/function-plot/site/css/normalize.css deleted file mode 100644 index 5e5e3c8..0000000 --- a/anything/function-plot/site/css/normalize.css +++ /dev/null @@ -1,424 +0,0 @@ -/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */ - -/** - * 1. Set default font family to sans-serif. - * 2. Prevent iOS and IE text size adjust after device orientation change, - * without disabling user zoom. - */ - -html { - font-family: sans-serif; /* 1 */ - -ms-text-size-adjust: 100%; /* 2 */ - -webkit-text-size-adjust: 100%; /* 2 */ -} - -/** - * Remove default margin. - */ - -body { - margin: 0; -} - -/* HTML5 display definitions - ========================================================================== */ - -/** - * Correct `block` display not defined for any HTML5 element in IE 8/9. - * Correct `block` display not defined for `details` or `summary` in IE 10/11 - * and Firefox. - * Correct `block` display not defined for `main` in IE 11. - */ - -article, -aside, -details, -figcaption, -figure, -footer, -header, -hgroup, -main, -menu, -nav, -section, -summary { - display: block; -} - -/** - * 1. Correct `inline-block` display not defined in IE 8/9. - * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. - */ - -audio, -canvas, -progress, -video { - display: inline-block; /* 1 */ - vertical-align: baseline; /* 2 */ -} - -/** - * Prevent modern browsers from displaying `audio` without controls. - * Remove excess height in iOS 5 devices. - */ - -audio:not([controls]) { - display: none; - height: 0; -} - -/** - * Address `[hidden]` styling not present in IE 8/9/10. - * Hide the `template` element in IE 8/9/10/11, Safari, and Firefox < 22. - */ - -[hidden], -template { - display: none; -} - -/* Links - ========================================================================== */ - -/** - * Remove the gray background color from active links in IE 10. - */ - -a { - background-color: transparent; -} - -/** - * Improve readability of focused elements when they are also in an - * active/hover state. - */ - -a:active, -a:hover { - outline: 0; -} - -/* Text-level semantics - ========================================================================== */ - -/** - * Address styling not present in IE 8/9/10/11, Safari, and Chrome. - */ - -abbr[title] { - border-bottom: 1px dotted; -} - -/** - * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. - */ - -b, -strong { - font-weight: bold; -} - -/** - * Address styling not present in Safari and Chrome. - */ - -dfn { - font-style: italic; -} - -/** - * Address variable `h1` font-size and margin within `section` and `article` - * contexts in Firefox 4+, Safari, and Chrome. - */ - -h1 { - font-size: 2em; - margin: 0.67em 0; -} - -/** - * Address styling not present in IE 8/9. - */ - -mark { - background: #ff0; - color: #000; -} - -/** - * Address inconsistent and variable font size in all browsers. - */ - -small { - font-size: 80%; -} - -/** - * Prevent `sub` and `sup` affecting `line-height` in all browsers. - */ - -sub, -sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; -} - -sup { - top: -0.5em; -} - -sub { - bottom: -0.25em; -} - -/* Embedded content - ========================================================================== */ - -/** - * Remove border when inside `a` element in IE 8/9/10. - */ - -img { - border: 0; -} - -/** - * Correct overflow not hidden in IE 9/10/11. - */ - -svg:not(:root) { - overflow: hidden; -} - -/* Grouping content - ========================================================================== */ - -/** - * Address margin not present in IE 8/9 and Safari. - */ - -figure { - margin: 1em 40px; -} - -/** - * Address differences between Firefox and other browsers. - */ - -hr { - box-sizing: content-box; - height: 0; -} - -/** - * Contain overflow in all browsers. - */ - -pre { - overflow: auto; -} - -/** - * Address odd `em`-unit font size rendering in all browsers. - */ - -code, -kbd, -pre, -samp { - font-family: monospace, monospace; - font-size: 1em; -} - -/* Forms - ========================================================================== */ - -/** - * Known limitation: by default, Chrome and Safari on OS X allow very limited - * styling of `select`, unless a `border` property is set. - */ - -/** - * 1. Correct color not being inherited. - * Known issue: affects color of disabled elements. - * 2. Correct font properties not being inherited. - * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. - */ - -button, -input, -optgroup, -select, -textarea { - color: inherit; /* 1 */ - font: inherit; /* 2 */ - margin: 0; /* 3 */ -} - -/** - * Address `overflow` set to `hidden` in IE 8/9/10/11. - */ - -button { - overflow: visible; -} - -/** - * Address inconsistent `text-transform` inheritance for `button` and `select`. - * All other form control elements do not inherit `text-transform` values. - * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. - * Correct `select` style inheritance in Firefox. - */ - -button, -select { - text-transform: none; -} - -/** - * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` - * and `video` controls. - * 2. Correct inability to style clickable `input` types in iOS. - * 3. Improve usability and consistency of cursor style between image-type - * `input` and others. - */ - -button, -html input[type="button"], /* 1 */ -input[type="reset"], -input[type="submit"] { - -webkit-appearance: button; /* 2 */ - cursor: pointer; /* 3 */ -} - -/** - * Re-set default cursor for disabled elements. - */ - -button[disabled], -html input[disabled] { - cursor: default; -} - -/** - * Remove inner padding and border in Firefox 4+. - */ - -button::-moz-focus-inner, -input::-moz-focus-inner { - border: 0; - padding: 0; -} - -/** - * Address Firefox 4+ setting `line-height` on `input` using `!important` in - * the UA stylesheet. - */ - -input { - line-height: normal; -} - -/** - * It's recommended that you don't attempt to style these elements. - * Firefox's implementation doesn't respect box-sizing, padding, or width. - * - * 1. Address box sizing set to `content-box` in IE 8/9/10. - * 2. Remove excess padding in IE 8/9/10. - */ - -input[type="checkbox"], -input[type="radio"] { - box-sizing: border-box; /* 1 */ - padding: 0; /* 2 */ -} - -/** - * Fix the cursor style for Chrome's increment/decrement buttons. For certain - * `font-size` values of the `input`, it causes the cursor style of the - * decrement button to change from `default` to `text`. - */ - -input[type="number"]::-webkit-inner-spin-button, -input[type="number"]::-webkit-outer-spin-button { - height: auto; -} - -/** - * 1. Address `appearance` set to `searchfield` in Safari and Chrome. - * 2. Address `box-sizing` set to `border-box` in Safari and Chrome. - */ - -input[type="search"] { - -webkit-appearance: textfield; /* 1 */ - box-sizing: content-box; /* 2 */ -} - -/** - * Remove inner padding and search cancel button in Safari and Chrome on OS X. - * Safari (but not Chrome) clips the cancel button when the search input has - * padding (and `textfield` appearance). - */ - -input[type="search"]::-webkit-search-cancel-button, -input[type="search"]::-webkit-search-decoration { - -webkit-appearance: none; -} - -/** - * Define consistent border, margin, and padding. - */ - -fieldset { - border: 1px solid #c0c0c0; - margin: 0 2px; - padding: 0.35em 0.625em 0.75em; -} - -/** - * 1. Correct `color` not being inherited in IE 8/9/10/11. - * 2. Remove padding so people aren't caught out if they zero out fieldsets. - */ - -legend { - border: 0; /* 1 */ - padding: 0; /* 2 */ -} - -/** - * Remove default vertical scrollbar in IE 8/9/10/11. - */ - -textarea { - overflow: auto; -} - -/** - * Don't inherit the `font-weight` (applied by a rule above). - * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. - */ - -optgroup { - font-weight: bold; -} - -/* Tables - ========================================================================== */ - -/** - * Remove most spacing between table cells. - */ - -table { - border-collapse: collapse; - border-spacing: 0; -} - -td, -th { - padding: 0; -} diff --git a/anything/function-plot/site/favicon.ico b/anything/function-plot/site/favicon.ico deleted file mode 100644 index be74abd..0000000 Binary files a/anything/function-plot/site/favicon.ico and /dev/null differ diff --git a/anything/function-plot/site/humans.txt b/anything/function-plot/site/humans.txt deleted file mode 100644 index 8d2330f..0000000 --- a/anything/function-plot/site/humans.txt +++ /dev/null @@ -1,15 +0,0 @@ -# humanstxt.org/ -# The humans responsible & technology colophon - -# TEAM - - -- -- - -# THANKS - - - -# TECHNOLOGY COLOPHON - - CSS3, HTML5 - Apache Server Configs, jQuery, Modernizr, Normalize.css diff --git a/anything/function-plot/site/img/.npmignore b/anything/function-plot/site/img/.npmignore deleted file mode 100644 index e69de29..0000000 diff --git a/anything/function-plot/site/img/browserify.png b/anything/function-plot/site/img/browserify.png deleted file mode 100644 index 63f334c..0000000 Binary files a/anything/function-plot/site/img/browserify.png and /dev/null differ diff --git a/anything/function-plot/site/img/mathjs_330x100.png b/anything/function-plot/site/img/mathjs_330x100.png deleted file mode 100644 index 71750ff..0000000 Binary files a/anything/function-plot/site/img/mathjs_330x100.png and /dev/null differ diff --git a/anything/function-plot/site/img/npm.png b/anything/function-plot/site/img/npm.png deleted file mode 100644 index 4031063..0000000 Binary files a/anything/function-plot/site/img/npm.png and /dev/null differ diff --git a/anything/function-plot/site/index.html b/anything/function-plot/site/index.html deleted file mode 100644 index da5fb68..0000000 --- a/anything/function-plot/site/index.html +++ /dev/null @@ -1,179 +0,0 @@ - - - - - - Function Plot - 2d function plotter powered by d3 - - - - - - - - - - - - - - - - - - - - - - -
-
-

- - Function Plot
-

- A 2d function plotter powered by D3 - -
-
- -
-

- Function Plot is a plotting library built on top of D3.js - used to render functions with little configuration (think of it as a clone of Google's - plotting utility: $y = x ^ 2$) -

-

- The library currently supports interactive line charts and scatterplots, - whenever the graph scale is modified the function is evaluated again with - the new bounds, result: infinite graphs! -

-

- -

- -

- Function Plot unlike other plotters that use $n$-equally spaced points joined by line segments - uses interval-arithmetic to - correctly determine sections of the screen that need to be plotted with a few samples -

-

- Most naive plotters will have problems plotting functions that oscillate too rapid, - for example $f(x) = sin(e^x)$ oscillates rapidly when $x > 5$, no matter how many times the - function is evaluated we will never be able to render this function correctly -

-

- -

- -

- Function Plot will instead evaluate the function using interval math which means that when - a rectangle whose $x$ bounds are $[x_i, x_{i + 1}]$ appears on the screen it's ensured that it - contains all the possible $f(\xi)$ for $\xi \in [x_i, x_{i+1}]$, the result: pixel perfect - representation of curves -

-

- -

-
- -
-
Installation
-
- -
-

Bundled versions powered by wzrd.in - - - -

-
-

- with bower: -

-
$ bower install function-plot
-

- and include it in your webpage as -

-
<script src="bower_components/function-plot/dist/function-plot.js"></script>
-
- -
Examples
- -
-
-
- -
-
Playground
-
- - - - - - - - - - - - - - - - - - - - - - - diff --git a/anything/function-plot/site/jade/examples.jade b/anything/function-plot/site/jade/examples.jade deleted file mode 100644 index 4bc2c9f..0000000 --- a/anything/function-plot/site/jade/examples.jade +++ /dev/null @@ -1,18 +0,0 @@ -each c in comments - .example - .container - .row - .col-md-6 - .comment!= c.comment - - if (c.experimental) - .experimental - b Experimental Feature: - span it might change without any further notice - .code - pre - code.javascript!= c.code - .col-md-6.center-block.demos - each id in c.ids - span.graph(id=id) - - if (c.additionalDOM) - div!= c.additionalDOM diff --git a/anything/function-plot/site/jade/wzrd.jade b/anything/function-plot/site/jade/wzrd.jade deleted file mode 100644 index 4b522ec..0000000 --- a/anything/function-plot/site/jade/wzrd.jade +++ /dev/null @@ -1,11 +0,0 @@ -- var bundle = 'function-plot@' + version -- var link = 'https://wzrd.in/standalone/' + bundle -- var script = '' - -.wzrd-in - //p Bundled package ready for production (powered by wzrd.in) - a(href=link)= bundle - - .code - pre - code= script diff --git a/anything/function-plot/site/js/function-plot.js b/anything/function-plot/site/js/function-plot.js deleted file mode 100644 index 42d2e27..0000000 --- a/anything/function-plot/site/js/function-plot.js +++ /dev/null @@ -1,5 +0,0 @@ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.functionPlot=f()}})(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o0){throw new Error("Invalid string. Length must be a multiple of 4")}var len=b64.length;placeHolders="="===b64.charAt(len-2)?2:"="===b64.charAt(len-1)?1:0;arr=new Arr(b64.length*3/4-placeHolders);l=placeHolders>0?b64.length-4:b64.length;var L=0;function push(v){arr[L++]=v}for(i=0,j=0;i>16);push((tmp&65280)>>8);push(tmp&255)}if(placeHolders===2){tmp=decode(b64.charAt(i))<<2|decode(b64.charAt(i+1))>>4;push(tmp&255)}else if(placeHolders===1){tmp=decode(b64.charAt(i))<<10|decode(b64.charAt(i+1))<<4|decode(b64.charAt(i+2))>>2;push(tmp>>8&255);push(tmp&255)}return arr}function uint8ToBase64(uint8){var i,extraBytes=uint8.length%3,output="",temp,length;function encode(num){return lookup.charAt(num)}function tripletToBase64(num){return encode(num>>18&63)+encode(num>>12&63)+encode(num>>6&63)+encode(num&63)}for(i=0,length=uint8.length-extraBytes;i>2);output+=encode(temp<<4&63);output+="==";break;case 2:temp=(uint8[uint8.length-2]<<8)+uint8[uint8.length-1];output+=encode(temp>>10);output+=encode(temp>>4&63);output+=encode(temp<<2&63);output+="=";break}return output}exports.toByteArray=b64ToByteArray;exports.fromByteArray=uint8ToBase64})(typeof exports==="undefined"?this.base64js={}:exports)},{}],2:[function(require,module,exports){(function(global){var base64=require("base64-js");var ieee754=require("ieee754");var isArray=require("isarray");exports.Buffer=Buffer;exports.SlowBuffer=SlowBuffer;exports.INSPECT_MAX_BYTES=50;Buffer.poolSize=8192;var rootParent={};Buffer.TYPED_ARRAY_SUPPORT=global.TYPED_ARRAY_SUPPORT!==undefined?global.TYPED_ARRAY_SUPPORT:typedArraySupport();function typedArraySupport(){function Bar(){}try{var arr=new Uint8Array(1);arr.foo=function(){return 42};arr.constructor=Bar;return arr.foo()===42&&arr.constructor===Bar&&typeof arr.subarray==="function"&&arr.subarray(1,1).byteLength===0}catch(e){return false}}function kMaxLength(){return Buffer.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Buffer(arg){if(!(this instanceof Buffer)){if(arguments.length>1)return new Buffer(arg,arguments[1]);return new Buffer(arg)}this.length=0;this.parent=undefined;if(typeof arg==="number"){return fromNumber(this,arg)}if(typeof arg==="string"){return fromString(this,arg,arguments.length>1?arguments[1]:"utf8")}return fromObject(this,arg)}function fromNumber(that,length){that=allocate(that,length<0?0:checked(length)|0);if(!Buffer.TYPED_ARRAY_SUPPORT){for(var i=0;i>>1;if(fromPool)that.parent=rootParent;return that}function checked(length){if(length>=kMaxLength()){throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+kMaxLength().toString(16)+" bytes")}return length|0}function SlowBuffer(subject,encoding){if(!(this instanceof SlowBuffer))return new SlowBuffer(subject,encoding);var buf=new Buffer(subject,encoding);delete buf.parent;return buf}Buffer.isBuffer=function isBuffer(b){return!!(b!=null&&b._isBuffer)};Buffer.compare=function compare(a,b){if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b)){throw new TypeError("Arguments must be Buffers")}if(a===b)return 0;var x=a.length;var y=b.length;var i=0;var len=Math.min(x,y);while(i>>1;case"base64":return base64ToBytes(string).length;default:if(loweredCase)return utf8ToBytes(string).length;encoding=(""+encoding).toLowerCase();loweredCase=true}}}Buffer.byteLength=byteLength;Buffer.prototype.length=undefined;Buffer.prototype.parent=undefined;function slowToString(encoding,start,end){var loweredCase=false;start=start|0;end=end===undefined||end===Infinity?this.length:end|0;if(!encoding)encoding="utf8";if(start<0)start=0;if(end>this.length)end=this.length;if(end<=start)return"";while(true){switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"binary":return binarySlice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase();loweredCase=true}}}Buffer.prototype.toString=function toString(){var length=this.length|0;if(length===0)return"";if(arguments.length===0)return utf8Slice(this,0,length);return slowToString.apply(this,arguments)};Buffer.prototype.equals=function equals(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");if(this===b)return true;return Buffer.compare(this,b)===0};Buffer.prototype.inspect=function inspect(){var str="";var max=exports.INSPECT_MAX_BYTES;if(this.length>0){str=this.toString("hex",0,max).match(/.{2}/g).join(" ");if(this.length>max)str+=" ... "}return""};Buffer.prototype.compare=function compare(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");if(this===b)return 0;return Buffer.compare(this,b)};Buffer.prototype.indexOf=function indexOf(val,byteOffset){if(byteOffset>2147483647)byteOffset=2147483647;else if(byteOffset<-2147483648)byteOffset=-2147483648;byteOffset>>=0;if(this.length===0)return-1;if(byteOffset>=this.length)return-1;if(byteOffset<0)byteOffset=Math.max(this.length+byteOffset,0);if(typeof val==="string"){if(val.length===0)return-1;return String.prototype.indexOf.call(this,val,byteOffset)}if(Buffer.isBuffer(val)){return arrayIndexOf(this,val,byteOffset)}if(typeof val==="number"){if(Buffer.TYPED_ARRAY_SUPPORT&&Uint8Array.prototype.indexOf==="function"){return Uint8Array.prototype.indexOf.call(this,val,byteOffset)}return arrayIndexOf(this,[val],byteOffset)}function arrayIndexOf(arr,val,byteOffset){var foundIndex=-1;for(var i=0;byteOffset+iremaining){length=remaining}}var strLen=string.length;if(strLen%2!==0)throw new Error("Invalid hex string");if(length>strLen/2){length=strLen/2}for(var i=0;iremaining)length=remaining;if(string.length>0&&(length<0||offset<0)||offset>this.length){throw new RangeError("attempt to write outside buffer bounds")}if(!encoding)encoding="utf8";var loweredCase=false;for(;;){switch(encoding){case"hex":return hexWrite(this,string,offset,length);case"utf8":case"utf-8":return utf8Write(this,string,offset,length);case"ascii":return asciiWrite(this,string,offset,length);case"binary":return binaryWrite(this,string,offset,length);case"base64":return base64Write(this,string,offset,length);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,string,offset,length);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(""+encoding).toLowerCase();loweredCase=true}}};Buffer.prototype.toJSON=function toJSON(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function base64Slice(buf,start,end){if(start===0&&end===buf.length){return base64.fromByteArray(buf)}else{return base64.fromByteArray(buf.slice(start,end))}}function utf8Slice(buf,start,end){end=Math.min(buf.length,end);var res=[];var i=start;while(i239?4:firstByte>223?3:firstByte>191?2:1;if(i+bytesPerSequence<=end){var secondByte,thirdByte,fourthByte,tempCodePoint;switch(bytesPerSequence){case 1:if(firstByte<128){codePoint=firstByte}break;case 2:secondByte=buf[i+1];if((secondByte&192)===128){tempCodePoint=(firstByte&31)<<6|secondByte&63;if(tempCodePoint>127){codePoint=tempCodePoint}}break;case 3:secondByte=buf[i+1];thirdByte=buf[i+2];if((secondByte&192)===128&&(thirdByte&192)===128){tempCodePoint=(firstByte&15)<<12|(secondByte&63)<<6|thirdByte&63;if(tempCodePoint>2047&&(tempCodePoint<55296||tempCodePoint>57343)){codePoint=tempCodePoint}}break;case 4:secondByte=buf[i+1];thirdByte=buf[i+2];fourthByte=buf[i+3];if((secondByte&192)===128&&(thirdByte&192)===128&&(fourthByte&192)===128){tempCodePoint=(firstByte&15)<<18|(secondByte&63)<<12|(thirdByte&63)<<6|fourthByte&63;if(tempCodePoint>65535&&tempCodePoint<1114112){codePoint=tempCodePoint}}}}if(codePoint===null){codePoint=65533;bytesPerSequence=1}else if(codePoint>65535){codePoint-=65536;res.push(codePoint>>>10&1023|55296);codePoint=56320|codePoint&1023}res.push(codePoint);i+=bytesPerSequence}return decodeCodePointsArray(res)}var MAX_ARGUMENTS_LENGTH=4096;function decodeCodePointsArray(codePoints){var len=codePoints.length;if(len<=MAX_ARGUMENTS_LENGTH){return String.fromCharCode.apply(String,codePoints)}var res="";var i=0;while(ilen)end=len;var out="";for(var i=start;ilen){start=len}if(end<0){end+=len;if(end<0)end=0}else if(end>len){end=len}if(endlength)throw new RangeError("Trying to access beyond buffer length")}Buffer.prototype.readUIntLE=function readUIntLE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i0&&(mul*=256)){val+=this[offset+--byteLength]*mul}return val};Buffer.prototype.readUInt8=function readUInt8(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);return this[offset]};Buffer.prototype.readUInt16LE=function readUInt16LE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]|this[offset+1]<<8};Buffer.prototype.readUInt16BE=function readUInt16BE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]<<8|this[offset+1]};Buffer.prototype.readUInt32LE=function readUInt32LE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+this[offset+3]*16777216};Buffer.prototype.readUInt32BE=function readUInt32BE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]*16777216+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])};Buffer.prototype.readIntLE=function readIntLE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readIntBE=function readIntBE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert)checkOffset(offset,byteLength,this.length);var i=byteLength;var mul=1;var val=this[offset+--i];while(i>0&&(mul*=256)){val+=this[offset+--i]*mul}mul*=128;if(val>=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readInt8=function readInt8(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);if(!(this[offset]&128))return this[offset];return(255-this[offset]+1)*-1};Buffer.prototype.readInt16LE=function readInt16LE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt16BE=function readInt16BE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt32LE=function readInt32LE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24};Buffer.prototype.readInt32BE=function readInt32BE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]};Buffer.prototype.readFloatLE=function readFloatLE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,true,23,4)};Buffer.prototype.readFloatBE=function readFloatBE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,false,23,4)};Buffer.prototype.readDoubleLE=function readDoubleLE(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,true,52,8)};Buffer.prototype.readDoubleBE=function readDoubleBE(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,false,52,8)};function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError("buffer must be a Buffer instance");if(value>max||valuebuf.length)throw new RangeError("index out of range")}Buffer.prototype.writeUIntLE=function writeUIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;byteLength=byteLength|0;if(!noAssert)checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength),0);var mul=1;var i=0;this[offset]=value&255;while(++i=0&&(mul*=256)){this[offset+i]=value/mul&255}return offset+byteLength};Buffer.prototype.writeUInt8=function writeUInt8(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,1,255,0);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);this[offset]=value&255;return offset+1};function objectWriteUInt16(buf,value,offset,littleEndian){if(value<0)value=65535+value+1;for(var i=0,j=Math.min(buf.length-offset,2);i>>(littleEndian?i:1-i)*8}}Buffer.prototype.writeUInt16LE=function writeUInt16LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value&255;this[offset+1]=value>>>8}else{objectWriteUInt16(this,value,offset,true)}return offset+2};Buffer.prototype.writeUInt16BE=function writeUInt16BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value&255}else{objectWriteUInt16(this,value,offset,false)}return offset+2};function objectWriteUInt32(buf,value,offset,littleEndian){if(value<0)value=4294967295+value+1;for(var i=0,j=Math.min(buf.length-offset,4);i>>(littleEndian?i:3-i)*8&255}}Buffer.prototype.writeUInt32LE=function writeUInt32LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset+3]=value>>>24;this[offset+2]=value>>>16;this[offset+1]=value>>>8;this[offset]=value&255}else{objectWriteUInt32(this,value,offset,true)}return offset+4};Buffer.prototype.writeUInt32BE=function writeUInt32BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&255}else{objectWriteUInt32(this,value,offset,false)}return offset+4};Buffer.prototype.writeIntLE=function writeIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=0;var mul=1;var sub=value<0?1:0;this[offset]=value&255;while(++i>0)-sub&255}return offset+byteLength};Buffer.prototype.writeIntBE=function writeIntBE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=byteLength-1;var mul=1;var sub=value<0?1:0;this[offset+i]=value&255;while(--i>=0&&(mul*=256)){this[offset+i]=(value/mul>>0)-sub&255}return offset+byteLength};Buffer.prototype.writeInt8=function writeInt8(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,1,127,-128);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);if(value<0)value=255+value+1;this[offset]=value&255;return offset+1};Buffer.prototype.writeInt16LE=function writeInt16LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value&255;this[offset+1]=value>>>8}else{objectWriteUInt16(this,value,offset,true)}return offset+2};Buffer.prototype.writeInt16BE=function writeInt16BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value&255}else{objectWriteUInt16(this,value,offset,false)}return offset+2};Buffer.prototype.writeInt32LE=function writeInt32LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value&255;this[offset+1]=value>>>8;this[offset+2]=value>>>16;this[offset+3]=value>>>24}else{objectWriteUInt32(this,value,offset,true)}return offset+4};Buffer.prototype.writeInt32BE=function writeInt32BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(value<0)value=4294967295+value+1;if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&255}else{objectWriteUInt32(this,value,offset,false)}return offset+4};function checkIEEE754(buf,value,offset,ext,max,min){if(value>max||valuebuf.length)throw new RangeError("index out of range");if(offset<0)throw new RangeError("index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){if(!noAssert){checkIEEE754(buf,value,offset,4,3.4028234663852886e38,-3.4028234663852886e38)}ieee754.write(buf,value,offset,littleEndian,23,4);return offset+4}Buffer.prototype.writeFloatLE=function writeFloatLE(value,offset,noAssert){return writeFloat(this,value,offset,true,noAssert)};Buffer.prototype.writeFloatBE=function writeFloatBE(value,offset,noAssert){return writeFloat(this,value,offset,false,noAssert)};function writeDouble(buf,value,offset,littleEndian,noAssert){if(!noAssert){checkIEEE754(buf,value,offset,8,1.7976931348623157e308,-1.7976931348623157e308)}ieee754.write(buf,value,offset,littleEndian,52,8);return offset+8}Buffer.prototype.writeDoubleLE=function writeDoubleLE(value,offset,noAssert){return writeDouble(this,value,offset,true,noAssert)};Buffer.prototype.writeDoubleBE=function writeDoubleBE(value,offset,noAssert){return writeDouble(this,value,offset,false,noAssert)};Buffer.prototype.copy=function copy(target,targetStart,start,end){if(!start)start=0;if(!end&&end!==0)end=this.length;if(targetStart>=target.length)targetStart=target.length;if(!targetStart)targetStart=0;if(end>0&&end=this.length)throw new RangeError("sourceStart out of bounds");if(end<0)throw new RangeError("sourceEnd out of bounds");if(end>this.length)end=this.length;if(target.length-targetStart=0;i--){target[i+targetStart]=this[i+start]}}else if(len<1e3||!Buffer.TYPED_ARRAY_SUPPORT){for(i=0;i=this.length)throw new RangeError("start out of bounds");if(end<0||end>this.length)throw new RangeError("end out of bounds");var i;if(typeof value==="number"){for(i=start;i55295&&codePoint<57344){if(!leadSurrogate){if(codePoint>56319){if((units-=3)>-1)bytes.push(239,191,189);continue}else if(i+1===length){if((units-=3)>-1)bytes.push(239,191,189);continue}leadSurrogate=codePoint;continue}if(codePoint<56320){if((units-=3)>-1)bytes.push(239,191,189);leadSurrogate=codePoint;continue}codePoint=(leadSurrogate-55296<<10|codePoint-56320)+65536}else if(leadSurrogate){if((units-=3)>-1)bytes.push(239,191,189)}leadSurrogate=null;if(codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,codePoint&63|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,codePoint&63|128)}else if(codePoint<1114112){if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,codePoint&63|128)}else{throw new Error("Invalid code point")}}return bytes}function asciiToBytes(str){var byteArray=[];for(var i=0;i>8;lo=c%256;byteArray.push(lo);byteArray.push(hi)}return byteArray}function base64ToBytes(str){return base64.toByteArray(base64clean(str))}function blitBuffer(src,dst,offset,length){for(var i=0;i=dst.length||i>=src.length)break;dst[i+offset]=src[i]}return i}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"base64-js":1,ieee754:4,isarray:5}],3:[function(require,module,exports){function EventEmitter(){this._events=this._events||{};this._maxListeners=this._maxListeners||undefined}module.exports=EventEmitter;EventEmitter.EventEmitter=EventEmitter;EventEmitter.prototype._events=undefined;EventEmitter.prototype._maxListeners=undefined;EventEmitter.defaultMaxListeners=10;EventEmitter.prototype.setMaxListeners=function(n){if(!isNumber(n)||n<0||isNaN(n))throw TypeError("n must be a positive number");this._maxListeners=n;return this};EventEmitter.prototype.emit=function(type){var er,handler,len,args,i,listeners;if(!this._events)this._events={};if(type==="error"){if(!this._events.error||isObject(this._events.error)&&!this._events.error.length){er=arguments[1];if(er instanceof Error){throw er}throw TypeError('Uncaught, unspecified "error" event.')}}handler=this._events[type];if(isUndefined(handler))return false;if(isFunction(handler)){switch(arguments.length){case 1:handler.call(this);break;case 2:handler.call(this,arguments[1]);break;case 3:handler.call(this,arguments[1],arguments[2]);break;default:args=Array.prototype.slice.call(arguments,1);handler.apply(this,args)}}else if(isObject(handler)){args=Array.prototype.slice.call(arguments,1);listeners=handler.slice();len=listeners.length;for(i=0;i0&&this._events[type].length>m){this._events[type].warned=true;console.error("(node) warning: possible EventEmitter memory "+"leak detected. %d listeners added. "+"Use emitter.setMaxListeners() to increase limit.",this._events[type].length);if(typeof console.trace==="function"){console.trace()}}}return this};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.once=function(type,listener){if(!isFunction(listener))throw TypeError("listener must be a function");var fired=false;function g(){this.removeListener(type,g);if(!fired){fired=true;listener.apply(this,arguments)}}g.listener=listener;this.on(type,g);return this};EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events||!this._events[type])return this;list=this._events[type];length=list.length;position=-1;if(list===listener||isFunction(list.listener)&&list.listener===listener){delete this._events[type];if(this._events.removeListener)this.emit("removeListener",type,listener)}else if(isObject(list)){for(i=length;i-->0;){if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}}if(position<0)return this;if(list.length===1){list.length=0;delete this._events[type]}else{list.splice(position,1)}if(this._events.removeListener)this.emit("removeListener",type,listener)}return this};EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener){if(arguments.length===0)this._events={};else if(this._events[type])delete this._events[type];return this}if(arguments.length===0){for(key in this._events){if(key==="removeListener")continue;this.removeAllListeners(key)}this.removeAllListeners("removeListener");this._events={};return this}listeners=this._events[type];if(isFunction(listeners)){this.removeListener(type,listeners)}else if(listeners){while(listeners.length)this.removeListener(type,listeners[listeners.length-1])}delete this._events[type];return this};EventEmitter.prototype.listeners=function(type){var ret;if(!this._events||!this._events[type])ret=[];else if(isFunction(this._events[type]))ret=[this._events[type]];else ret=this._events[type].slice();return ret};EventEmitter.prototype.listenerCount=function(type){if(this._events){var evlistener=this._events[type];if(isFunction(evlistener))return 1;else if(evlistener)return evlistener.length}return 0};EventEmitter.listenerCount=function(emitter,type){return emitter.listenerCount(type)};function isFunction(arg){return typeof arg==="function"}function isNumber(arg){return typeof arg==="number"}function isObject(arg){return typeof arg==="object"&&arg!==null}function isUndefined(arg){return arg===void 0}},{}],4:[function(require,module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m;var eLen=nBytes*8-mLen-1;var eMax=(1<>1;var nBits=-7;var i=isLE?nBytes-1:0;var d=isLE?-1:1;var s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8){}m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8){}if(e===0){e=1-eBias}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity}else{m=m+Math.pow(2,mLen);e=e-eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c;var eLen=nBytes*8-mLen-1;var eMax=(1<>1;var rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0;var i=isLE?0:nBytes-1;var d=isLE?1:-1;var s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2}if(e+eBias>=1){value+=rt/c}else{value+=rt*Math.pow(2,1-eBias)}if(value*c>=2){e++;c/=2}if(e+eBias>=eMax){m=0;e=eMax}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0}}for(;mLen>=8;buffer[offset+i]=m&255,i+=d,m/=256,mLen-=8){}e=e<0;buffer[offset+i]=e&255,i+=d,e/=256,eLen-=8){}buffer[offset+i-d]|=s*128}},{}],5:[function(require,module,exports){module.exports=Array.isArray||function(arr){return Object.prototype.toString.call(arr)=="[object Array]"}},{}],6:[function(require,module,exports){var process=module.exports={};var queue=[];var draining=false;var currentQueue;var queueIndex=-1;function cleanUpNextTick(){draining=false;if(currentQueue.length){queue=currentQueue.concat(queue)}else{queueIndex=-1}if(queue.length){drainQueue()}}function drainQueue(){if(draining){return}var timeout=setTimeout(cleanUpNextTick);draining=true;var len=queue.length;while(len){currentQueue=queue;queue=[];while(++queueIndex1){for(var i=1;ihi){return[-minWidthHeight,0]}return[lo,hi]}var line=function(points,closed){var path="";var minY=yScale.range()[1];var maxY=yScale.range()[0];for(var i=0,length=points.length;i path.line").data(evaluatedData);minWidthHeight=Math.max(evaluatedData[0].scaledDx,1);innerSelection.enter().append("path").attr("class","line line-"+index).attr("fill","none");innerSelection.attr("stroke-width",minWidthHeight).attr("stroke",utils.color(d,index)).attr("opacity",closed?.5:1).attr("d",function(d){return line(d,closed)});innerSelection.exit().remove()})}return plotLine}},{"../evaluate":9,"../utils":28}],13:[function(require,module,exports){"use strict";var d3=window.d3;var evaluate=require("../evaluate");var utils=require("../utils");module.exports=function(chart){var xScale=chart.meta.xScale;var yScale=chart.meta.yScale;var line=d3.svg.line().interpolate("linear").x(function(d){return xScale(d[0])}).y(function(d){return yScale(d[1])});var area=d3.svg.area().x(function(d){return xScale(d[0])}).y0(yScale(0)).y1(function(d){return yScale(d[1])});function plotLine(selection){selection.each(function(d){var el=plotLine.el=d3.select(this);var index=d.index;var evaluatedData=evaluate(chart,d);var color=utils.color(d,index);var innerSelection=el.selectAll(":scope > path.line").data(evaluatedData);innerSelection.enter().append("path").attr("class","line line-"+index).attr("stroke-width",1).attr("stroke-linecap","round");innerSelection.each(function(){var path=d3.select(this);var pathD;if(d.closed){path.attr("fill",color);path.attr("fill-opacity",.3);pathD=area}else{path.attr("fill","none");pathD=line}path.attr("stroke",color).attr("marker-end",function(){return d.fnType==="vector"?"url(#"+chart.markerId+")":null}).attr("d",pathD)});innerSelection.exit().remove()})}return plotLine}},{"../evaluate":9,"../utils":28}],14:[function(require,module,exports){"use strict";var d3=window.d3;var evaluate=require("../evaluate");var utils=require("../utils");module.exports=function(chart){var xScale=chart.meta.xScale;var yScale=chart.meta.yScale;function scatter(selection){selection.each(function(d){var i,j;var index=d.index;var color=utils.color(d,index);var evaluatedData=evaluate(chart,d);var joined=[];for(i=0;i circle").data(joined);innerSelection.enter().append("circle");innerSelection.attr("fill",d3.hsl(color.toString()).brighter(1.5)).attr("stroke",color).attr("opacity",.7).attr("r",1).attr("cx",function(d){return xScale(d[0])}).attr("cy",function(d){return yScale(d[1])});innerSelection.exit().remove()})}return scatter}},{"../evaluate":9,"../utils":28}],15:[function(require,module,exports){"use strict";var d3=window.d3;module.exports=function(options){var annotations;var xScale=options.owner.meta.xScale;var yScale=options.owner.meta.yScale;var line=d3.svg.line().x(function(d){return d[0]}).y(function(d){return d[1]});annotations=function(parentSelection){parentSelection.each(function(){var current=d3.select(this);var selection=current.selectAll("g.annotations").data(function(d){return d.annotations||[]});selection.enter().append("g").attr("class","annotations");var yRange=yScale.range();var xRange=xScale.range();var path=selection.selectAll("path").data(function(d){if(d.hasOwnProperty("x")){return[[[0,yRange[0]],[0,yRange[1]]]]}else{return[[[xRange[0],0],[xRange[1],0]]]}});path.enter().append("path").attr("stroke","#eee").attr("d",line);path.exit().remove();var text=selection.selectAll("text").data(function(d){return[{text:d.text||"",hasX:d.hasOwnProperty("x")}]});text.enter().append("text").attr("y",function(d){return d.hasX?3:0}).attr("x",function(d){return d.hasX?0:3}).attr("dy",function(d){return d.hasX?5:-5}).attr("text-anchor",function(d){return d.hasX?"end":""}).attr("transform",function(d){return d.hasX?"rotate(-90)":""}).text(function(d){return d.text});text.exit().remove();selection.attr("transform",function(d){if(d.hasOwnProperty("x")){return"translate("+xScale(d.x)+", 0)"}else{return"translate(0, "+yScale(d.y)+")"}});selection.exit().remove()})};return annotations}},{}],16:[function(require,module,exports){"use strict";var d3=window.d3;var builtInEvaluator=require("./eval").builtIn;var polyline=require("../graph-types/polyline");var datumDefaults=require("../datum-defaults");module.exports=function(chart){var derivativeDatum=datumDefaults({skipTip:true,nSamples:2,graphType:"polyline"});var derivative;function computeLine(d){if(!d.derivative){return[]}var x0=typeof d.derivative.x0==="number"?d.derivative.x0:Infinity;derivativeDatum.index=d.index;derivativeDatum.scope={m:builtInEvaluator(d.derivative,"fn",{x:x0}),x0:x0,y0:builtInEvaluator(d,"fn",{x:x0})};derivativeDatum.fn="m * (x - x0) + y0";return[derivativeDatum]}function checkAutoUpdate(d){var self=this;if(!d.derivative){return}if(d.derivative.updateOnMouseMove&&!d.derivative.$$mouseListener){d.derivative.$$mouseListener=function(x0){d.derivative.x0=x0;derivative(self)};chart.on("tip:update",d.derivative.$$mouseListener)}}derivative=function(selection){selection.each(function(d){var el=d3.select(this);var data=computeLine.call(selection,d);checkAutoUpdate.call(selection,d);var innerSelection=el.selectAll("g.derivative").data(data);innerSelection.enter().append("g").attr("class","derivative");innerSelection.call(polyline(chart));innerSelection.selectAll("path").attr("opacity",.5);innerSelection.exit().remove()})};return derivative}},{"../datum-defaults":8,"../graph-types/polyline":13,"./eval":17}],17:[function(require,module,exports){"use strict";var samplers={interval:require("interval-arithmetic-eval"),builtIn:require("built-in-math-eval")};var extend=require("extend");window.math&&(samplers.builtIn=window.math.compile);function generateEvaluator(samplerName){function doCompile(expression){if(typeof expression==="string"){var compile=samplers[samplerName];return compile(expression)}else if(typeof expression==="function"){return{eval:expression}}else{throw Error("expression must be a string or a function")}}function compileIfPossible(meta,property){var expression=meta[property];var hiddenProperty=samplerName+"_Expression_"+property;var hiddenCompiled=samplerName+"_Compiled_"+property;if(expression!==meta[hiddenProperty]){meta[hiddenProperty]=expression;meta[hiddenCompiled]=doCompile(expression)}}function getCompiledExpression(meta,property){return meta[samplerName+"_Compiled_"+property]}function evaluate(meta,property,variables){compileIfPossible(meta,property);return getCompiledExpression(meta,property).eval(extend({},meta.scope||{},variables))}return evaluate}module.exports.builtIn=generateEvaluator("builtIn");module.exports.interval=generateEvaluator("interval")},{"built-in-math-eval":29,extend:34,"interval-arithmetic-eval":37}],18:[function(require,module,exports){"use strict";var d3=window.d3;var derivative=require("./derivative");var secant=require("./secant");module.exports=function(chart){function helper(selection){selection.each(function(){var el=d3.select(this);el.call(derivative(chart));el.call(secant(chart))})}return helper}},{"./derivative":16,"./secant":19}],19:[function(require,module,exports){"use strict";var d3=window.d3;var extend=require("extend");var builtInEvaluator=require("./eval").builtIn;var datumDefaults=require("../datum-defaults");var polyline=require("../graph-types/polyline");module.exports=function(chart){var secantDefaults=datumDefaults({isHelper:true,skipTip:true,nSamples:2,graphType:"polyline"});var secant;function computeSlope(scope){scope.m=(scope.y1-scope.y0)/(scope.x1-scope.x0)}function updateLine(d,secant){if(!secant.hasOwnProperty("x0")){throw Error("secant must have the property `x0` defined")}secant.scope=secant.scope||{};var x0=secant.x0;var x1=typeof secant.x1==="number"?secant.x1:Infinity;extend(secant.scope,{x0:x0,x1:x1,y0:builtInEvaluator(d,"fn",{x:x0}),y1:builtInEvaluator(d,"fn",{x:x1})});computeSlope(secant.scope)}function setFn(d,secant){updateLine(d,secant);secant.fn="m * (x - x0) + y0"}function setMouseListener(d,secantObject){var self=this;if(secantObject.updateOnMouseMove&&!secantObject.$$mouseListener){secantObject.$$mouseListener=function(x1){secantObject.x1=x1;updateLine(d,secantObject);secant(self)};chart.on("tip:update",secantObject.$$mouseListener)}}function computeLines(d){var self=this;var data=[];d.secants=d.secants||[];for(var i=0;i=xDomain[1]){throw Error("the pair defining the x-domain is inverted")}if(yDomain[0]>=yDomain[1]){throw Error("the pair defining the y-domain is inverted")}xScale=this.meta.xScale=d3.scale[options.xAxis.type]().domain(xDomain).range([0,width]);yScale=this.meta.yScale=d3.scale[options.yAxis.type]().domain(yDomain).range([height,0]);this.meta.xAxis=d3.svg.axis().scale(xScale).tickSize(options.grid?-height:0).tickFormat(format(xScale)).orient("bottom");this.meta.yAxis=d3.svg.axis().scale(yScale).tickSize(options.grid?-width:0).tickFormat(format(yScale)).orient("left")};Chart.prototype.internalVars=function(){this.meta={};margin=this.meta.margin={left:30,right:30,top:20,bottom:20};if(options.title){this.meta.margin.top=40}zoomBehavior=this.meta.zoomBehavior=d3.behavior.zoom();width=this.meta.width=(options.width||globals.DEFAULT_WIDTH)-margin.left-margin.right;height=this.meta.height=(options.height||globals.DEFAULT_HEIGHT)-margin.top-margin.bottom;this.initializeAxes()};Chart.prototype.drawGraphWrapper=function(){var root=this.root=d3.select(options.target).selectAll("svg").data([options]);this.root.enter=root.enter().append("svg").attr("class","function-plot").attr("font-size",this.getFontSize());root.attr("width",width+margin.left+margin.right).attr("height",height+margin.top+margin.bottom);this.buildTitle();this.buildLegend();this.buildCanvas();this.buildClip();this.buildAxis();this.buildAxisLabel();this.draw();var tip=this.tip=mousetip(extend(options.tip,{owner:this}));this.canvas.call(tip);this.buildZoomHelper();this.setUpPlugins()};Chart.prototype.buildTitle=function(){var selection=this.root.selectAll("text.title").data(function(d){return[d.title].filter(Boolean)});selection.enter().append("text").attr("class","title").attr("y",margin.top/2).attr("x",margin.left+width/2).attr("font-size",25).attr("text-anchor","middle").attr("alignment-baseline","middle").text(options.title);selection.exit().remove()};Chart.prototype.buildLegend=function(){this.root.enter.append("text").attr("class","top-right-legend").attr("text-anchor","end");this.root.select(".top-right-legend").attr("y",margin.top/2).attr("x",width+margin.left)};Chart.prototype.buildCanvas=function(){var self=this;this.meta.zoomBehavior.x(xScale).y(yScale).on("zoom",function onZoom(){self.emit("all:zoom",d3.event.translate,d3.event.scale)});var canvas=this.canvas=this.root.selectAll(".canvas").data(function(d){return[d]});this.canvas.enter=canvas.enter().append("g").attr("class","canvas")};Chart.prototype.buildClip=function(){var id=this.id;var defs=this.canvas.enter.append("defs");defs.append("clipPath").attr("id","function-plot-clip-"+id).append("rect").attr("class","clip static-clip");this.canvas.selectAll(".clip").attr("width",width).attr("height",height);this.markerId=this.id+"-marker";defs.append("clipPath").append("marker").attr("id",this.markerId).attr("viewBox","0 -5 10 10").attr("refX",10).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("svg:path").attr("d","M0,-5L10,0L0,5L0,0").attr("stroke-width","0px").attr("fill-opacity",1).attr("fill","#777")};Chart.prototype.buildAxis=function(){var canvasEnter=this.canvas.enter;canvasEnter.append("g").attr("class","x axis");canvasEnter.append("g").attr("class","y axis");this.canvas.select(".x.axis").attr("transform","translate(0,"+height+")").call(this.meta.xAxis);this.canvas.select(".y.axis").call(this.meta.yAxis)};Chart.prototype.buildAxisLabel=function(){var xLabel,yLabel;var canvas=this.canvas;xLabel=canvas.selectAll("text.x.axis-label").data(function(d){return[d.xAxis.label].filter(Boolean)});xLabel.enter().append("text").attr("class","x axis-label").attr("text-anchor","end");xLabel.attr("x",width).attr("y",height-6).text(function(d){return d});xLabel.exit().remove();yLabel=canvas.selectAll("text.y.axis-label").data(function(d){return[d.yAxis.label].filter(Boolean)});yLabel.enter().append("text").attr("class","y axis-label").attr("y",6).attr("dy",".75em").attr("text-anchor","end").attr("transform","rotate(-90)");yLabel.text(function(d){return d});yLabel.exit().remove()};Chart.prototype.buildContent=function(){var self=this;var canvas=this.canvas;canvas.attr("transform","translate("+margin.left+","+margin.top+")").call(zoomBehavior).each(function(){var el=d3.select(this);var listeners=["mousedown","mousewheel","mouseover","DOMMouseScroll","dblclick","wheel","MozMousePixelScroll"];listeners=listeners.map(function(l){return l+".zoom"});if(!el._hasZoomListeners){listeners.forEach(function(l){el["_"+l]=el.on(l)})}function setState(state){listeners.forEach(function(l){state?el.on(l,el["_"+l]):el.on(l,null)})}setState(!options.disableZoom)});var content=this.content=canvas.selectAll(":scope > g.content").data(function(d){return[d]});content.enter().append("g").attr("clip-path","url(#function-plot-clip-"+this.id+")").attr("class","content");if(options.xAxis.type==="linear"){var yOrigin=content.selectAll(":scope > path.y.origin").data([[[0,yScale.domain()[0]],[0,yScale.domain()[1]]]]);yOrigin.enter().append("path").attr("class","y origin").attr("stroke","black").attr("opacity",.2);yOrigin.attr("d",line)}if(options.yAxis.type==="linear"){var xOrigin=content.selectAll(":scope > path.x.origin").data([[[xScale.domain()[0],0],[xScale.domain()[1],0]]]);xOrigin.enter().append("path").attr("class","x origin").attr("stroke","black").attr("opacity",.2);xOrigin.attr("d",line)}content.call(annotations({owner:self}));var graphs=content.selectAll(":scope > g.graph").data(function(d){return d.data.map(datumDefaults)});graphs.enter().append("g").attr("class","graph");graphs.each(function(d,index){d.index=index;d3.select(this).call(graphTypes[d.graphType](self));d3.select(this).call(helpers(self))})};Chart.prototype.buildZoomHelper=function(){var self=this;this.canvas.enter.append("rect").attr("class","zoom-and-drag").style("fill","none").style("pointer-events","all");this.canvas.select(".zoom-and-drag").attr("width",width).attr("height",height).on("mouseover",function(){self.emit("all:mouseover")}).on("mouseout",function(){self.emit("all:mouseout")}).on("mousemove",function(){self.emit("all:mousemove")})};Chart.prototype.setUpPlugins=function(){var plugins=options.plugins||[];var self=this;plugins.forEach(function(plugin){plugin(self)})};Chart.prototype.addLink=function(){for(var i=0;i",toggle:false},options);var brush=d3.svg.brush();var kd=keydown(options.key);var visible=false; -var cachedInstance;function wrapper(datum){return function(x){var functionPlot=window.functionPlot;return functionPlot.eval.builtIn(datum,"fn",{x:x})}}function setBrushState(visible){var brushEl=cachedInstance.canvas.selectAll(".definite-integral");brushEl.style("display",visible?null:"none")}function inner(instance){cachedInstance=instance;var oldDisableZoom;brush.x(instance.meta.xScale).on("brushstart",function(){if(!d3.event.sourceEvent)return;oldDisableZoom=!!instance.options.disableZoom;instance.options.disableZoom=true;instance.emit("draw")}).on("brushend",function(){if(!d3.event.sourceEvent)return;instance.options.disableZoom=oldDisableZoom;if(!brush.empty()){var a=brush.extent()[0];var b=brush.extent()[1];instance.options.data.forEach(function(datum,i){var value=integrateSimpson(wrapper(datum),a,b,options.tol,options.maxdepth);instance.emit("definite-integral",datum,i,value,a,b)})}instance.draw()});var brushEl=instance.canvas.append("g").attr("class","brush definite-integral");brushEl.call(brush).call(brush.event);instance.canvas.selectAll(".brush .extent").attr("stroke","#fff").attr("fill-opacity",.125).attr("shape-rendering","crispEdges");brushEl.selectAll("rect").attr("height",instance.meta.height);instance.canvas.on("mousemove.definiteIntegral",function(){if(!options.toggle){inner.visible(pressed(options.key))}});kd.on("pressed",function(){inner.visible(options.toggle?!inner.visible():true)});inner.visible(false)}inner.visible=function(_){if(!arguments.length){return visible}visible=_;setBrushState(_);return inner};return inner}},{extend:34,"integrate-adaptive-simpson":36,"key-pressed":55,keydown:56}],22:[function(require,module,exports){module.exports={zoomBox:require("./zoom-box"),definiteIntegral:require("./definite-integral")}},{"./definite-integral":21,"./zoom-box":23}],23:[function(require,module,exports){var d3=window.d3;var extend=require("extend");var pressed=require("key-pressed");var keydown=require("keydown");module.exports=function(options){options=extend({key:"",toggle:false},options);var brush=d3.svg.brush();var kd=keydown(options.key);var cachedInstance;var visible=false;function setBrushState(visible){var brushEl=cachedInstance.canvas.selectAll(".zoom-box");brushEl.style("display",visible?null:"none")}function inner(instance){cachedInstance=instance;var oldDisableZoom;brush.x(instance.meta.xScale).y(instance.meta.yScale).on("brushstart",function(){if(!d3.event.sourceEvent)return;oldDisableZoom=!!instance.options.disableZoom;instance.options.disableZoom=true;instance.draw()}).on("brushend",function(){if(!d3.event.sourceEvent)return;instance.options.disableZoom=oldDisableZoom;if(!brush.empty()){var lo=brush.extent()[0];var hi=brush.extent()[1];var x=[lo[0],hi[0]];var y=[lo[1],hi[1]];instance.programmaticZoom(x,y)}d3.select(this).transition().duration(1).call(brush.clear()).call(brush.event)});var brushEl=instance.canvas.append("g").attr("class","brush zoom-box");brushEl.call(brush).call(brush.event);instance.canvas.selectAll(".brush .extent").attr("stroke","#fff").attr("fill-opacity",.125).attr("shape-rendering","crispEdges");instance.canvas.on("mousemove.zoombox",function(){if(!options.toggle){inner.visible(pressed(options.key))}});kd.on("pressed",function(){inner.visible(options.toggle?!inner.visible():true)});inner.visible(false)}inner.visible=function(_){if(!arguments.length){return visible}visible=_;setBrushState(_);return inner};return inner}},{extend:34,"key-pressed":55,keydown:56}],24:[function(require,module,exports){(function(doc,proto){try{doc.querySelector(":scope body")}catch(err){["querySelector","querySelectorAll"].forEach(function(method){var native=proto[method];proto[method]=function(selectors){if(/(^|,)\s*:scope/.test(selectors)){var id=this.id;this.id="ID_"+Date.now();selectors=selectors.replace(/((^|,)\s*):scope/g,"$1#"+this.id);var result=doc[method](selectors);this.id=id;return result}else{return native.call(this,selectors)}}})}})(window.document,Element.prototype)},{}],25:[function(require,module,exports){"use strict";var clamp=require("clamp");var linspace=require("linspace");var utils=require("../utils");var evaluate=require("../helpers/eval").builtIn;function checkAsymptote(d0,d1,meta,sign,level){if(!level){return{asymptote:true,d0:d0,d1:d1}}var i;var n=10;var x0=d0[0];var x1=d1[0];var samples=linspace(x0,x1,n);var oldY,oldX;for(i=0;i1/zoomScale){var check=checkAsymptote(data[i-1],data[i],meta,newSign,3);if(check.asymptote){st.push(updateY(check.d0));sets.push(st);st=[updateY(check.d1)]}}oldSign=newSign;st.push(data[i]);++i}if(st.length){sets.push(st)}return sets}function linear(chart,meta,range,n){var allX=utils.space(chart,range,n);var yDomain=chart.meta.yScale.domain();var yDomainMargin=yDomain[1]-yDomain[0];var yMin=yDomain[0]-yDomainMargin*1e5;var yMax=yDomain[1]+yDomainMargin*1e5;var data=[];var i;for(i=0;inext[1].hi){prev[1].hi=Math.max(yMax,prev[1].hi);next[1].lo=Math.min(yMin,next[1].lo)}if(prev[1].hirange[0]-globals.TIP_X_EPS&&x00){return 1}return 0},color:function(data,index){return data.color||globals.COLORS[index]}}},{"./globals":10,linspace:57,log10:58,logspace:59}],29:[function(require,module,exports){"use strict";module.exports=require("./lib/eval")},{"./lib/eval":31}],30:[function(require,module,exports){"use strict";module.exports=function(){var math=Object.create(Math);math.factory=function(a){if(typeof a!=="number"){throw new TypeError("built-in math factory only accepts numbers")}return Number(a)};math.add=function(a,b){return a+b};math.sub=function(a,b){return a-b};math.mul=function(a,b){return a*b};math.div=function(a,b){return a/b};math.mod=function(a,b){return a%b};math.factorial=function(a){var res=1;for(var i=2;i<=a;i+=1){res*=i}return res};math.nthRoot=function(a,root){var inv=root<0;if(inv){root=-root}if(root===0){throw new Error("Root must be non-zero")}if(a<0&&Math.abs(root)%2!==1){throw new Error("Root must be odd when a is negative.")}if(a===0){return 0}if(!isFinite(a)){return inv?0:a}var x=Math.pow(Math.abs(a),1/root);x=a<0?-x:x;return inv?1/x:x};math.logicalOR=function(a,b){return a||b};math.logicalXOR=function(a,b){return a!=b};math.logicalAND=function(a,b){return a&&b};math.bitwiseOR=function(a,b){return a|b};math.bitwiseXOR=function(a,b){return a^b};math.bitwiseAND=function(a,b){return a&b};math.lessThan=function(a,b){return ab};math.greaterEqualThan=function(a,b){return a>=b};math.equal=function(a,b){return a==b};math.strictlyEqual=function(a,b){return a===b};math.notEqual=function(a,b){return a!=b};math.strictlyNotEqual=function(a,b){return a!==b};math.shiftRight=function(a,b){return a>>b};math.shiftLeft=function(a,b){return a<>>b};math.negative=function(a){return-a};math.positive=function(a){return a};return math}},{}],31:[function(require,module,exports){"use strict";var CodeGenerator=require("math-codegen");var math=require("./adapter")();function processScope(scope){Object.keys(scope).forEach(function(k){var value=scope[k];scope[k]=math.factory(value)})}module.exports=function(expression){return(new CodeGenerator).setDefs({$$processScope:processScope}).parse(expression).compile(math)};module.exports.math=math},{"./adapter":30,"math-codegen":60}],32:[function(require,module,exports){module.exports=clamp;function clamp(value,min,max){return minmax?max:value:valuemin?min:value}},{}],33:[function(require,module,exports){(function(Buffer){var hasTypedArrays=false;if(typeof Float64Array!=="undefined"){var DOUBLE_VIEW=new Float64Array(1),UINT_VIEW=new Uint32Array(DOUBLE_VIEW.buffer);DOUBLE_VIEW[0]=1;hasTypedArrays=true;if(UINT_VIEW[1]===1072693248){module.exports=function doubleBitsLE(n){DOUBLE_VIEW[0]=n;return[UINT_VIEW[0],UINT_VIEW[1]]};function toDoubleLE(lo,hi){UINT_VIEW[0]=lo;UINT_VIEW[1]=hi;return DOUBLE_VIEW[0]}module.exports.pack=toDoubleLE;function lowUintLE(n){DOUBLE_VIEW[0]=n;return UINT_VIEW[0]}module.exports.lo=lowUintLE;function highUintLE(n){DOUBLE_VIEW[0]=n;return UINT_VIEW[1]}module.exports.hi=highUintLE}else if(UINT_VIEW[0]===1072693248){module.exports=function doubleBitsBE(n){DOUBLE_VIEW[0]=n;return[UINT_VIEW[1],UINT_VIEW[0]]};function toDoubleBE(lo,hi){UINT_VIEW[1]=lo;UINT_VIEW[0]=hi;return DOUBLE_VIEW[0]}module.exports.pack=toDoubleBE;function lowUintBE(n){DOUBLE_VIEW[0]=n;return UINT_VIEW[1]}module.exports.lo=lowUintBE;function highUintBE(n){DOUBLE_VIEW[0]=n;return UINT_VIEW[0]}module.exports.hi=highUintBE}else{hasTypedArrays=false}}if(!hasTypedArrays){var buffer=new Buffer(8);module.exports=function doubleBits(n){buffer.writeDoubleLE(n,0,true);return[buffer.readUInt32LE(0,true),buffer.readUInt32LE(4,true)]};function toDouble(lo,hi){buffer.writeUInt32LE(lo,0,true);buffer.writeUInt32LE(hi,4,true);return buffer.readDoubleLE(0,true)}module.exports.pack=toDouble;function lowUint(n){buffer.writeDoubleLE(n,0,true);return buffer.readUInt32LE(0,true)}module.exports.lo=lowUint;function highUint(n){buffer.writeDoubleLE(n,0,true);return buffer.readUInt32LE(4,true)}module.exports.hi=highUint}module.exports.sign=function(n){return module.exports.hi(n)>>>31};module.exports.exponent=function(n){var b=module.exports.hi(n);return(b<<1>>>21)-1023};module.exports.fraction=function(n){var lo=module.exports.lo(n);var hi=module.exports.hi(n);var b=hi&(1<<20)-1;if(hi&2146435072){b+=1<<20}return[lo,b]};module.exports.denormalized=function(n){var hi=module.exports.hi(n);return!(hi&2146435072)}}).call(this,require("buffer").Buffer)},{buffer:2}],34:[function(require,module,exports){"use strict";var hasOwn=Object.prototype.hasOwnProperty;var toStr=Object.prototype.toString;var isArray=function isArray(arr){if(typeof Array.isArray==="function"){return Array.isArray(arr)}return toStr.call(arr)==="[object Array]"};var isPlainObject=function isPlainObject(obj){if(!obj||toStr.call(obj)!=="[object Object]"){return false}var hasOwnConstructor=hasOwn.call(obj,"constructor");var hasIsPrototypeOf=obj.constructor&&obj.constructor.prototype&&hasOwn.call(obj.constructor.prototype,"isPrototypeOf");if(obj.constructor&&!hasOwnConstructor&&!hasIsPrototypeOf){return false}var key;for(key in obj){}return typeof key==="undefined"||hasOwn.call(obj,key)};module.exports=function extend(){var options,name,src,copy,copyIsArray,clone,target=arguments[0],i=1,length=arguments.length,deep=false;if(typeof target==="boolean"){deep=target;target=arguments[1]||{};i=2}else if(typeof target!=="object"&&typeof target!=="function"||target==null){target={}}for(;imaxdepth){console.log("integrate-adaptive-simpson: Warning: maximum recursion depth ("+maxdepth+") exceeded");return s2+err}else if(Math.abs(err)hi){return this.setEmpty()}return this.set(lo,hi)};Interval.prototype.setEmpty=function(){return this.set(Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY)};Interval.prototype.setWhole=function(){return this.set(Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY)};Interval.prototype.toArray=function(){return[this.lo,this.hi]};Interval.prototype.clone=function(){return Interval(this.lo,this.hi)}},{"./operations/utils":50,"./round-math":52}],44:[function(require,module,exports){"use strict";var isSafeInteger=require("is-safe-integer");var Interval=require("../interval");var rmath=require("../round-math");var utils=require("./utils");var arithmetic=require("./arithmetic");var constants=require("../constants");var algebra={};algebra.fmod=function(x,y){if(utils.isEmpty(x)||utils.isEmpty(y)){return constants.EMPTY}var yb=x.lo<0?y.lo:y.hi;var n=rmath.intLo(rmath.divLo(x.lo,yb));return arithmetic.sub(x,arithmetic.mul(y,Interval(n,n)))};algebra.multiplicativeInverse=function(x){if(utils.isEmpty(x)){return constants.EMPTY}if(utils.zeroIn(x)){if(x.lo!==0){if(x.hi!==0){return constants.WHOLE}else{return Interval(Number.NEGATIVE_INFINITY,rmath.divHi(1,x.lo))}}else{if(x.hi!==0){return Interval(rmath.divLo(1,x.hi),Number.POSITIVE_INFINITY)}else{return constants.EMPTY}}}else{return Interval(rmath.divLo(1,x.hi),rmath.divHi(1,x.lo))}};algebra.pow=function(x,power){if(utils.isEmpty(x)){return constants.EMPTY}if(typeof power==="object"){if(!utils.isSingleton(power)){return constants.EMPTY}power=power.lo}if(power===0){if(x.lo===0&&x.hi===0){return constants.EMPTY}else{return constants.ONE}}else if(power<0){return algebra.multiplicativeInverse(algebra.pow(x,-power))}if(isSafeInteger(power)){if(x.hi<0){var yl=rmath.powLo(-x.hi,power);var yh=rmath.powHi(-x.lo,power);if(power&1){return Interval(-yh,-yl)}else{return Interval(yl,yh)}}else if(x.lo<0){if(power&1){return Interval(-rmath.powLo(-x.lo,power),rmath.powHi(x.hi,power))}else{return Interval(0,rmath.powHi(Math.max(-x.lo,x.hi),power))}}else{return Interval(rmath.powLo(x.lo,power),rmath.powHi(x.hi,power))}}else{console.warn("power is not an integer, you should use nth-root instead, returning an empty interval");return constants.EMPTY}};algebra.sqrt=function(x){return algebra.nthRoot(x,2)};algebra.nthRoot=function(x,n){if(utils.isEmpty(x)||n<0){return constants.EMPTY}if(typeof n==="object"){if(!utils.isSingleton(n)){return constants.EMPTY}n=n.lo}var power=1/n;if(x.hi<0){if(isSafeInteger(n)&(n&1)){var yl=rmath.powHi(-x.lo,power);var yh=rmath.powLo(-x.hi,power);return Interval(-yl,-yh)}return Interval.EMPTY}else if(x.lo<0){var yp=rmath.powHi(x.hi,power);if(isSafeInteger(n)&(n&1)){var yn=rmath.powHi(-x.lo,power);return Interval(0,Math.max(yn,yp))}return Interval(0,yp)}else{return Interval(rmath.powLo(x.lo,power),rmath.powHi(x.hi,power))}};module.exports=algebra},{"../constants":42,"../interval":43,"../round-math":52,"./arithmetic":45,"./utils":50,"is-safe-integer":54}],45:[function(require,module,exports){"use strict";var Interval=require("../interval");var rmath=require("../round-math");var utils=require("./utils");var constants=require("../constants");var division=require("./division");var arithmetic={};arithmetic.add=function(a,b){return Interval(rmath.addLo(a.lo,b.lo),rmath.addHi(a.hi,b.hi))};arithmetic.sub=function(a,b){return Interval(rmath.subLo(a.lo,b.hi),rmath.subHi(a.hi,b.lo))};arithmetic.mul=function(a,b){if(utils.isEmpty(a)||utils.isEmpty(b)){return constants.EMPTY}var al=a.lo;var ah=a.hi;var bl=b.lo;var bh=b.hi;var out=Interval();if(al<0){if(ah>0){if(bl<0){if(bh>0){out.lo=Math.min(rmath.mulLo(al,bh),rmath.mulLo(ah,bl));out.hi=Math.max(rmath.mulHi(al,bl),rmath.mulHi(ah,bh))}else{out.lo=rmath.mulLo(ah,bl);out.hi=rmath.mulHi(al,bl)}}else{if(bh>0){out.lo=rmath.mulLo(al,bh);out.hi=rmath.mulHi(ah,bh)}else{out.lo=0;out.hi=0}}}else{if(bl<0){if(bh>0){out.lo=rmath.mulLo(al,bh);out.hi=rmath.mulHi(al,bl)}else{out.lo=rmath.mulLo(ah,bh);out.hi=rmath.mulHi(al,bl)}}else{if(bh>0){out.lo=rmath.mulLo(al,bh);out.hi=rmath.mulHi(ah,bl)}else{out.lo=0;out.hi=0}}}}else{if(ah>0){if(bl<0){if(bh>0){out.lo=rmath.mulLo(ah,bl);out.hi=rmath.mulHi(ah,bh)}else{out.lo=rmath.mulLo(ah,bl);out.hi=rmath.mulHi(al,bh)}}else{if(bh>0){out.lo=rmath.mulLo(al,bl);out.hi=rmath.mulHi(ah,bh)}else{out.lo=0;out.hi=0}}}else{out.lo=0;out.hi=0}}return out};arithmetic.div=function(a,b){if(utils.isEmpty(a)||utils.isEmpty(b)){return constants.EMPTY}if(utils.zeroIn(b)){if(b.lo!==0){if(b.hi!==0){return division.zero(a)}else{return division.negative(a,b.lo)}}else{if(b.hi!==0){return division.positive(a,b.hi)}else{return constants.EMPTY}}}else{return division.nonZero(a,b)}};arithmetic.positive=function(a){return Interval(a.lo,a.hi)};arithmetic.negative=function(a){return Interval(-a.hi,-a.lo)};module.exports=arithmetic},{"../constants":42,"../interval":43,"../round-math":52,"./division":46,"./utils":50}],46:[function(require,module,exports){"use strict";var Interval=require("../interval");var rmath=require("../round-math");var utils=require("./utils");var constants=require("../constants");var division={nonZero:function(x,y){var xl=x.lo;var xh=x.hi;var yl=y.lo;var yh=y.hi;var out=Interval();if(xh<0){if(yh<0){out.lo=rmath.divLo(xh,yl);out.hi=rmath.divHi(xl,yh)}else{out.lo=rmath.divLo(xl,yl);out.hi=rmath.divHi(xh,yh)}}else if(xl<0){if(yh<0){out.lo=rmath.divLo(xh,yh);out.hi=rmath.divHi(xl,yh)}else{out.lo=rmath.divLo(xl,yl);out.hi=rmath.divHi(xh,yl)}}else{if(yh<0){out.lo=rmath.divLo(xh,yh);out.hi=rmath.divHi(xl,yl)}else{out.lo=rmath.divLo(xl,yh);out.hi=rmath.divHi(xh,yl)}}return out},positive:function(x,v){if(x.lo===0&&x.hi===0){return x}if(utils.zeroIn(x)){return constants.WHOLE}if(x.hi<0){return Interval(Number.NEGATIVE_INFINITY,rmath.divHi(x.hi,v))}else{return Interval(rmath.divLo(x.lo,v),Number.POSITIVE_INFINITY)}},negative:function(x,v){if(x.lo===0&&x.hi===0){return x}if(utils.zeroIn(x)){return constants.WHOLE}if(x.hi<0){return Interval(rmath.divLo(x.hi,v),Number.POSITIVE_INFINITY)}else{return Interval(Number.NEGATIVE_INFINITY,rmath.divHi(x.lo,v))}},zero:function(x){if(x.lo===0&&x.hi===0){return x}return constants.WHOLE}};module.exports=division},{"../constants":42,"../interval":43,"../round-math":52,"./utils":50}],47:[function(require,module,exports){"use strict";var constants=require("../constants");var Interval=require("../interval");var rmath=require("../round-math");var utils=require("./utils");var arithmetic=require("./arithmetic");var misc={};misc.exp=function(x){if(utils.isEmpty(x)){return constants.EMPTY}return Interval(rmath.expLo(x.lo),rmath.expHi(x.hi))};misc.log=function(x){if(utils.isEmpty(x)){return constants.EMPTY}var l=x.lo<=0?Number.NEGATIVE_INFINITY:rmath.logLo(x.lo);return Interval(l,rmath.logHi(x.hi))};misc.ln=misc.log;misc.LOG_EXP_10=misc.log(Interval(10,10));misc.log10=function(x){if(utils.isEmpty(x)){return constants.EMPTY}return arithmetic.div(misc.log(x),misc.LOG_EXP_10)};misc.LOG_EXP_2=misc.log(Interval(2,2));misc.log2=function(x){if(utils.isEmpty(x)){return constants.EMPTY}return arithmetic.div(misc.log(x),misc.LOG_EXP_2)};misc.hull=function(x,y){var badX=utils.isEmpty(x);var badY=utils.isEmpty(y);if(badX){if(badY){return constants.EMPTY}else{return y.clone()}}else{if(badY){return x.clone()}else{return Interval(Math.min(x.lo,y.lo),Math.max(x.hi,y.hi))}}};misc.intersection=function(x,y){ -if(utils.isEmpty(x)||utils.isEmpty(y)){return constants.EMPTY}var lo=Math.max(x.lo,y.lo);var hi=Math.min(x.hi,y.hi);if(lo<=hi){return Interval(lo,hi)}return constants.EMPTY};misc.union=function(x,y){if(!utils.intervalsOverlap(x,y)){throw TypeError("Interval.union: intervals do not overlap")}return Interval(Math.min(x.lo,y.lo),Math.max(x.hi,y.hi))};misc.difference=function(x,y){if(utils.isEmpty(x)||utils.isEmpty(y)){return constants.EMPTY}if(utils.intervalsOverlap(x,y)){if(x.lox.hi){return Interval(x.lo,rmath.prev(y.lo))}}return Interval.clone(x)};misc.width=function(x){if(utils.isEmpty(x)){return 0}return rmath.subHi(x.hi,x.lo)};misc.abs=function(x){if(utils.isEmpty(x)){return constants.EMPTY}if(x.lo>=0){return Interval.clone(x)}if(x.hi<=0){return arithmetic.negative(x)}return Interval(0,Math.max(-x.lo,x.hi))};misc.max=function(x,y){if(utils.isEmpty(x)){return constants.EMPTY}return Interval(Math.max(x.lo,y.lo),Math.max(x.hi,y.hi))};misc.min=function(x,y){if(utils.isEmpty(x)){return constants.EMPTY}return Interval(Math.min(x.lo,y.lo),Math.min(x.hi,y.hi))};misc.clone=function(x){return Interval().set(x.lo,x.hi)};module.exports=misc},{"../constants":42,"../interval":43,"../round-math":52,"./arithmetic":45,"./utils":50}],48:[function(require,module,exports){"use strict";var utils=require("./utils");var relational={};relational.equal=function(x,y){if(utils.isEmpty(x)){return utils.isEmpty(y)}return!utils.isEmpty(y)&&x.lo===y.lo&&x.hi===y.hi};relational.almostEqual=function(x,y){var EPS=1e-7;function assert(a,message){if(!a){throw new Error(message||"assertion failed")}}function assertEps(a,b){assert(Math.abs(a-b)y.hi};relational.lt=function(x,y){if(utils.isEmpty(x)||utils.isEmpty(y)){return false}return x.hiy.hi};relational.leq=function(x,y){if(utils.isEmpty(x)||utils.isEmpty(y)){return false}return x.hi<=y.lo};relational.geq=function(x,y){if(utils.isEmpty(x)||utils.isEmpty(y)){return false}return x.lo>=y.hi};module.exports=relational},{"./utils":50}],49:[function(require,module,exports){"use strict";var constants=require("../constants");var Interval=require("../interval");var rmath=require("../round-math");var utils=require("./utils");var misc=require("./misc");var algebra=require("./algebra");var arithmetic=require("./arithmetic");var trigonometric={};trigonometric.cos=function(x){var rlo,rhi;if(utils.isEmpty(x)){return constants.EMPTY}if(x.lo<0){var mult=1e7;x.lo+=2*Math.PI*mult;x.hi+=2*Math.PI*mult}var pi2=constants.PI_TWICE;var t=algebra.fmod(x,pi2);if(misc.width(t)>=pi2.lo){return Interval(-1,1)}if(t.lo>=constants.PI_HIGH){var cos=trigonometric.cos(arithmetic.sub(t,constants.PI));return arithmetic.negative(cos)}var lo=t.lo;var hi=t.hi;rlo=rmath.cosLo(hi);rhi=rmath.cosHi(lo);if(hi<=constants.PI_LOW){return Interval(rlo,rhi)}else if(hi<=pi2.lo){return Interval(-1,Math.max(rlo,rhi))}else{return Interval(-1,1)}};trigonometric.sin=function(x){if(utils.isEmpty(x)){return constants.EMPTY}return trigonometric.cos(arithmetic.sub(x,constants.PI_HALF))};trigonometric.tan=function(x){if(utils.isEmpty(x)){return constants.EMPTY}if(x.lo<0){var mult=1e7;x.lo+=2*Math.PI*mult;x.hi+=2*Math.PI*mult}var pi=constants.PI;var t=algebra.fmod(x,pi);if(t.lo>=constants.PI_HALF_LOW){t=arithmetic.sub(t,pi)}if(t.lo<=-constants.PI_HALF_LOW||t.hi>=constants.PI_HALF_LOW){return constants.WHOLE}return Interval(rmath.tanLo(t.lo),rmath.tanHi(t.hi))};trigonometric.asin=function(x){if(utils.isEmpty(x)||x.hi<-1||x.lo>1){return constants.EMPTY}var lo=x.lo<=-1?-constants.PI_HALF_HIGH:rmath.asinLo(x.lo);var hi=x.hi>=1?constants.PI_HALF_HIGH:rmath.asinHi(x.hi);return Interval(lo,hi)};trigonometric.acos=function(x){if(utils.isEmpty(x)||x.hi<-1||x.lo>1){return constants.EMPTY}var lo=x.hi>=1?0:rmath.acosLo(x.hi);var hi=x.lo<=-1?constants.PI_HIGH:rmath.acosHi(x.lo);return Interval(lo,hi)};trigonometric.atan=function(x){if(utils.isEmpty(x)){return constants.EMPTY}return Interval(rmath.atanLo(x.lo),rmath.atanHi(x.hi))};trigonometric.sinh=function(x){if(utils.isEmpty(x)){return constants.EMPTY}return Interval(rmath.sinhLo(x.lo),rmath.sinhHi(x.hi))};trigonometric.cosh=function(x){if(utils.isEmpty(x)){return constants.EMPTY}if(x.hi<0){return Interval(rmath.coshLo(x.hi),rmath.coshHi(x.lo))}else if(x.lo>=0){return Interval(rmath.coshLo(x.lo),rmath.coshHi(x.hi))}else{return Interval(1,rmath.coshHi(-x.lo>x.hi?x.lo:x.hi))}};trigonometric.tanh=function(x){if(utils.isEmpty(x)){return constants.EMPTY}return Interval(rmath.tanhLo(x.lo),rmath.tanhHi(x.hi))};module.exports=trigonometric},{"../constants":42,"../interval":43,"../round-math":52,"./algebra":44,"./arithmetic":45,"./misc":47,"./utils":50}],50:[function(require,module,exports){"use strict";var utils={};utils.isInterval=function(x){return typeof x==="object"&&typeof x.lo==="number"&&typeof x.hi==="number"};utils.isEmpty=function(a){return a.lo>a.hi};utils.isWhole=function(a){return a.lo===-Infinity&&a.hi===Infinity};utils.isSingleton=function(x){return!utils.isEmpty(x)&&x.lo===x.hi};utils.zeroIn=function(a){return utils.hasValue(a,0)};utils.hasValue=function(a,v){if(utils.isEmpty(a)){return false}return a.lo<=v&&v<=a.hi};utils.hasInterval=function(a,b){if(utils.isEmpty(a)){return true}return!utils.isEmpty(b)&&b.lo<=a.lo&&a.hi<=b.hi};utils.intervalsOverlap=function(a,b){if(utils.isEmpty(a)||utils.isEmpty(b)){return false}return a.lo<=b.lo&&b.lo<=a.hi||b.lo<=a.lo&&a.lo<=b.hi};module.exports=utils},{}],51:[function(require,module,exports){"use strict";Math.sinh=Math.sinh||function(x){var y=Math.exp(x);return(y-1/y)/2};Math.cosh=Math.cosh||function(x){var y=Math.exp(x);return(y+1/y)/2};Math.tanh=Math.tanh||function(x){if(x===Number.POSITIVE_INFINITY){return 1}else if(x===Number.NEGATIVE_INFINITY){return-1}else{var y=Math.exp(2*x);return(y-1)/(y+1)}}},{}],52:[function(require,module,exports){"use strict";var nextafter=require("nextafter");function identity(v){return v}function prev(v){if(v===Infinity){return v}return nextafter(v,-Infinity)}function next(v){if(v===-Infinity){return v}return nextafter(v,Infinity)}var round={prev:prev,next:next};round.addLo=function(x,y){return this.prev(x+y)};round.addHi=function(x,y){return this.next(x+y)};round.subLo=function(x,y){return this.prev(x-y)};round.subHi=function(x,y){return this.next(x-y)};round.mulLo=function(x,y){return this.prev(x*y)};round.mulHi=function(x,y){return this.next(x*y)};round.divLo=function(x,y){return this.prev(x/y)};round.divHi=function(x,y){return this.next(x/y)};function toInteger(x){return x<0?Math.ceil(x):Math.floor(x)}round.intLo=function(x){return toInteger(this.prev(x))};round.intHi=function(x){return toInteger(this.next(x))};round.logLo=function(x){return this.prev(Math.log(x))};round.logHi=function(x){return this.next(Math.log(x))};round.expLo=function(x){return this.prev(Math.exp(x))};round.expHi=function(x){return this.next(Math.exp(x))};round.sinLo=function(x){return this.prev(Math.sin(x))};round.sinHi=function(x){return this.next(Math.sin(x))};round.cosLo=function(x){return this.prev(Math.cos(x))};round.cosHi=function(x){return this.next(Math.cos(x))};round.tanLo=function(x){return this.prev(Math.tan(x))};round.tanHi=function(x){return this.next(Math.tan(x))};round.asinLo=function(x){return this.prev(Math.asin(x))};round.asinHi=function(x){return this.next(Math.asin(x))};round.acosLo=function(x){return this.prev(Math.acos(x))};round.acosHi=function(x){return this.next(Math.acos(x))};round.atanLo=function(x){return this.prev(Math.atan(x))};round.atanHi=function(x){return this.next(Math.atan(x))};round.sinhLo=function(x){return this.prev(Math.sinh(x))};round.sinhHi=function(x){return this.next(Math.sinh(x))};round.coshLo=function(x){return this.prev(Math.cosh(x))};round.coshHi=function(x){return this.next(Math.cosh(x))};round.tanhLo=function(x){return this.prev(Math.tanh(x))};round.tanhHi=function(x){return this.next(Math.tanh(x))};round.powLo=function(x,power){if(power%1!==0){return this.prev(Math.pow(x,power))}var y=power&1?x:1;power>>=1;while(power>0){x=round.mulLo(x,x);if(power&1){y=round.mulLo(x,y)}power>>=1}return y};round.powHi=function(x,power){if(power%1!==0){return this.next(Math.pow(x,power))}var y=power&1?x:1;power>>=1;while(power>0){x=round.mulHi(x,x);if(power&1){y=round.mulHi(x,y)}power>>=1}return y};round.sqrtLo=function(x){return this.prev(Math.sqrt(x))};round.sqrtHi=function(x){return this.next(Math.sqrt(x))};round.disable=function(){this.next=this.prev=identity};round.enable=function(){this.next=next;this.prev=prev};module.exports=round},{nextafter:89}],53:[function(require,module,exports){"use strict";module.exports=function isObject(x){return typeof x==="object"&&x!==null}},{}],54:[function(require,module,exports){"use strict";var MAX_SAFE_INTEGER=require("max-safe-integer");module.exports=Number.isSafeInteger||function(val){return typeof val==="number"&&val===val&&val!==Infinity&&val!==-Infinity&&parseInt(val,10)===val&&Math.abs(val)<=MAX_SAFE_INTEGER}},{"max-safe-integer":73}],55:[function(require,module,exports){(function(process){var keys=require("vkey");var list=Object.keys(keys);var down={};reset();module.exports=pressed;if(process.browser){window.addEventListener("keydown",keydown,false);window.addEventListener("keyup",keyup,false);window.addEventListener("blur",reset,false)}function pressed(key){return key?down[key]:down}function reset(){list.forEach(function(code){down[keys[code]]=false})}function keyup(e){down[keys[e.keyCode]]=false}function keydown(e){down[keys[e.keyCode]]=true}}).call(this,require("_process"))},{_process:6,vkey:90}],56:[function(require,module,exports){var Emitter=require("events").EventEmitter;var vkey=require("vkey");module.exports=function(keys,el){if(typeof keys==="string")keys=[keys];if(!el)el=window;var emitter=new Emitter;emitter.pressed={};el.addEventListener("blur",clearPressed);el.addEventListener("focus",clearPressed);el.addEventListener("keydown",function(ev){var key=vkey[ev.keyCode];emitter.pressed[key]=true;var allPressed=true;keys.forEach(function(k){if(!emitter.pressed[k])allPressed=false});if(allPressed){emitter.emit("pressed",emitter.pressed);clearPressed()}});el.addEventListener("keyup",function(ev){delete emitter.pressed[vkey[ev.keyCode]]});function clearPressed(){emitter.pressed={}}return emitter}},{events:3,vkey:90}],57:[function(require,module,exports){var integers=require("integers");module.exports=function linspace(a,b,n){var every=(b-a)/(n-1),ranged=integers(a,b,every);return ranged.length==n?ranged:ranged.concat(b)}},{integers:35}],58:[function(require,module,exports){"use strict";module.exports=Math.log10||function(x){return Math.log(x)*Math.LOG10E}},{}],59:[function(require,module,exports){var linspace=require("linspace");module.exports=function logspace(a,b,n){return linspace(a,b,n).map(function(x){return Math.pow(10,x)})}},{linspace:57}],60:[function(require,module,exports){"use strict";module.exports=require("./lib/CodeGenerator")},{"./lib/CodeGenerator":61}],61:[function(require,module,exports){"use strict";var Parser=require("mr-parser").Parser;var Interpreter=require("./Interpreter");var extend=require("extend");function CodeGenerator(options,defs){this.statements=[];this.defs=defs||{};this.interpreter=new Interpreter(this,options)}CodeGenerator.prototype.setDefs=function(defs){this.defs=extend(this.defs,defs);return this};CodeGenerator.prototype.compile=function(namespace){if(!namespace||!(typeof namespace==="object"||typeof namespace==="function")){throw TypeError("namespace must be an object")}if(typeof namespace.factory!=="function"){throw TypeError("namespace.factory must be a function")}this.defs.ns=namespace;this.defs.$$mathCodegen={getProperty:function(symbol,scope,ns){if(symbol in scope){return scope[symbol]}if(symbol in ns){return ns[symbol]}throw SyntaxError('symbol "'+symbol+'" is undefined')},functionProxy:function(fn,name){if(typeof fn!=="function"){throw SyntaxError('symbol "'+name+'" must be a function')}return fn}};this.defs.$$processScope=this.defs.$$processScope||function(){};var defsCode=Object.keys(this.defs).map(function(name){return"var "+name+' = defs["'+name+'"]'});if(!this.statements.length){throw Error("there are no statements saved in this generator, make sure you parse an expression before compiling it")}this.statements[this.statements.length-1]="return "+this.statements[this.statements.length-1];var code=this.statements.join(";");var factoryCode=defsCode.join("\n")+"\n"+["return {"," eval: function (scope) {"," scope = scope || {}"," $$processScope(scope)"," "+code," },"," code: '"+code+"'","}"].join("\n");var factory=new Function("defs",factoryCode);return factory(this.defs)};CodeGenerator.prototype.parse=function(code){var self=this;var program=(new Parser).parse(code);this.statements=program.blocks.map(function(statement){return self.interpreter.next(statement)});return this};module.exports=CodeGenerator},{"./Interpreter":62,extend:34,"mr-parser":74}],62:[function(require,module,exports){"use strict";var extend=require("extend");var types={ArrayNode:require("./node/ArrayNode"),AssignmentNode:require("./node/AssignmentNode"),ConditionalNode:require("./node/ConditionalNode"),ConstantNode:require("./node/ConstantNode"),FunctionNode:require("./node/FunctionNode"),OperatorNode:require("./node/OperatorNode"),SymbolNode:require("./node/SymbolNode"),UnaryNode:require("./node/UnaryNode")};var Interpreter=function(owner,options){this.owner=owner;this.options=extend({factory:"ns.factory",raw:false,rawArrayExpressionElements:true,rawCallExpressionElements:false},options)};extend(Interpreter.prototype,types);Interpreter.prototype.next=function(node){if(!(node.type in this)){throw new TypeError("the node type "+node.type+" is not implemented")}return this[node.type](node)};Interpreter.prototype.rawify=function(test,fn){var oldRaw=this.options.raw;if(test){this.options.raw=true}fn();if(test){this.options.raw=oldRaw}};module.exports=Interpreter},{"./node/ArrayNode":65,"./node/AssignmentNode":66,"./node/ConditionalNode":67,"./node/ConstantNode":68,"./node/FunctionNode":69,"./node/OperatorNode":70,"./node/SymbolNode":71,"./node/UnaryNode":72,extend:34}],63:[function(require,module,exports){"use strict";module.exports={"+":"add","-":"sub","*":"mul","/":"div","^":"pow","%":"mod","!":"factorial","|":"bitwiseOR","^|":"bitwiseXOR","&":"bitwiseAND","||":"logicalOR",xor:"logicalXOR","&&":"logicalAND","<":"lessThan",">":"greaterThan","<=":"lessEqualThan",">=":"greaterEqualThan","===":"strictlyEqual","==":"equal","!==":"strictlyNotEqual","!=":"notEqual",">>":"shiftRight","<<":"shiftLeft",">>>":"unsignedRightShift"}},{}],64:[function(require,module,exports){"use strict";module.exports={"+":"positive","-":"negative","~":"oneComplement"}},{}],65:[function(require,module,exports){"use strict";module.exports=function(node){var self=this;var arr=[];this.rawify(this.options.rawArrayExpressionElements,function(){arr=node.nodes.map(function(el){return self.next(el)})});var arrString="["+arr.join(",")+"]";if(this.options.raw){return arrString}return this.options.factory+"("+arrString+")"}},{}],66:[function(require,module,exports){"use strict";module.exports=function(node){return'scope["'+node.name+'"] = '+this.next(node.expr)}},{}],67:[function(require,module,exports){"use strict";module.exports=function(node){var condition="!!("+this.next(node.condition)+")";var trueExpr=this.next(node.trueExpr);var falseExpr=this.next(node.falseExpr);return"("+condition+" ? ("+trueExpr+") : ("+falseExpr+") )"}},{}],68:[function(require,module,exports){"use strict";module.exports=function(node){if(this.options.raw){return node.value}return this.options.factory+"("+node.value+")"}},{}],69:[function(require,module,exports){"use strict";var SymbolNode=require("mr-parser").nodeTypes.SymbolNode;var functionProxy=function(node){return"$$mathCodegen.functionProxy("+this.next(new SymbolNode(node.name))+', "'+node.name+'")'};module.exports=function(node){var self=this;var method=functionProxy.call(this,node);var args=[];this.rawify(this.options.rawCallExpressionElements,function(){args=node.args.map(function(arg){return self.next(arg)})});return method+"("+args.join(", ")+")"};module.exports.functionProxy=functionProxy},{"mr-parser":74}],70:[function(require,module,exports){"use strict";var Operators=require("../misc/Operators");module.exports=function(node){if(this.options.raw){return["("+this.next(node.args[0]),node.op,this.next(node.args[1])+")"].join(" ")}var namedOperator=Operators[node.op];if(!namedOperator){throw TypeError("unidentified operator")}return this.FunctionNode({name:namedOperator,args:node.args})}},{"../misc/Operators":63}],71:[function(require,module,exports){"use strict";module.exports=function(node){var id=node.name;return'$$mathCodegen.getProperty("'+id+'", scope, ns)'}},{}],72:[function(require,module,exports){"use strict";var UnaryOperators=require("../misc/UnaryOperators");module.exports=function(node){if(this.options.raw){return node.op+this.next(node.argument)}if(!(node.op in UnaryOperators)){throw new SyntaxError(node.op+" not implemented")}var namedOperator=UnaryOperators[node.op];return this.FunctionNode({name:namedOperator,args:[node.argument]})}},{"../misc/UnaryOperators":64}],73:[function(require,module,exports){"use strict";module.exports=9007199254740991},{}],74:[function(require,module,exports){"use strict";module.exports.Lexer=require("./lib/Lexer");module.exports.Parser=require("./lib/Parser");module.exports.nodeTypes=require("./lib/node/")},{"./lib/Lexer":75,"./lib/Parser":76,"./lib/node/":87}],75:[function(require,module,exports){var tokenType=require("./token-type");var ESCAPES={n:"\n",f:"\f",r:"\r",t:" ",v:" ","'":"'",'"':'"'};var DELIMITERS={",":true,"(":true,")":true,"[":true,"]":true,";":true,"~":true,"!":true,"+":true,"-":true,"*":true,"/":true,"%":true,"^":true,"**":true,"|":true,"&":true,"^|":true,"=":true,":":true,"?":true,"||":true,"&&":true,xor:true,"==":true,"!=":true,"===":true,"!==":true,"<":true,">":true,">=":true,"<=":true,">>>":true,"<<":true,">>":true};function isDigit(c){return c>="0"&&c<="9"}function isIdentifier(c){return c>="a"&&c<="z"||c>="A"&&c<="Z"||c==="$"||c==="_"}function isWhitespace(c){return c===" "||c==="\r"||c===" "||c==="\n"||c===" "||c===" "}function isDelimiter(str){return DELIMITERS[str]}function isQuote(c){return c==="'"||c==='"'}function Lexer(){}Lexer.prototype.throwError=function(message,index){index=typeof index==="undefined"?this.index:index;var error=new Error(message+" at index "+index);error.index=index;error.description=message;throw error};Lexer.prototype.lex=function(text){this.text=text;this.index=0;this.tokens=[];while(this.index=this.text.length){return}return this.text.charAt(this.index+nth)};Lexer.prototype.consume=function(){var current=this.peek();this.index+=1;return current};Lexer.prototype.readNumber=function(){var number="";if(this.peek()==="."){number+=this.consume();if(!isDigit(this.peek())){this.throwError("number expected")}}else{while(isDigit(this.peek())){number+=this.consume()}if(this.peek()==="."){number+=this.consume()}}while(isDigit(this.peek())){number+=this.consume()}if(this.peek()==="e"||this.peek()==="E"){number+=this.consume();if(!(isDigit(this.peek())||this.peek()==="+"||this.peek()==="-")){this.throwError()}if(this.peek()==="+"||this.peek()==="-"){number+=this.consume()}if(!isDigit(this.peek())){this.throwError("number expected")}while(isDigit(this.peek())){number+=this.consume()}}return number};Lexer.prototype.readIdentifier=function(){var text="";while(isIdentifier(this.peek())||isDigit(this.peek())){text+=this.consume()}return text};Lexer.prototype.readString=function(){var quote=this.consume();var string="";var escape;while(true){var c=this.consume();if(!c){this.throwError("string is not closed")}if(escape){if(c==="u"){var hex=this.text.substring(this.index+1,this.index+5);if(!hex.match(/[\da-f]{4}/i)){this.throwError("invalid unicode escape")}this.index+=4;string+=String.fromCharCode(parseInt(hex,16))}else{var replacement=ESCAPES[c];if(replacement){string+=replacement}else{string+=c}}escape=false}else if(c===quote){break}else if(c==="\\"){escape=true}else{string+=c}}return string};module.exports=Lexer},{"./token-type":88}],76:[function(require,module,exports){var tokenType=require("./token-type");var Lexer=require("./Lexer");var ConstantNode=require("./node/ConstantNode");var OperatorNode=require("./node/OperatorNode");var UnaryNode=require("./node/UnaryNode");var SymbolNode=require("./node/SymbolNode");var FunctionNode=require("./node/FunctionNode");var ArrayNode=require("./node/ArrayNode");var ConditionalNode=require("./node/ConditionalNode");var AssignmentNode=require("./node/AssignmentNode");var BlockNode=require("./node/BlockNode");function Parser(){this.lexer=new Lexer;this.tokens=null}Parser.prototype.current=function(){return this.tokens[0]};Parser.prototype.next=function(){return this.tokens[1]};Parser.prototype.peek=function(){if(this.tokens.length){var first=this.tokens[0];for(var i=0;i=","<=",">","<")){var op=this.consume();var right=this.shift();return new OperatorNode(op.value,[left,right])}return left};Parser.prototype.shift=function(){var left=this.additive();if(this.peek(">>","<<",">>>")){var op=this.consume();var right=this.shift();return new OperatorNode(op.value,[left,right])}return left};Parser.prototype.additive=function(){var left=this.multiplicative();while(this.peek("+","-")){var op=this.consume();left=new OperatorNode(op.value,[left,this.multiplicative()])}return left};Parser.prototype.multiplicative=function(){var op,right;var left=this.unary();while(this.peek("*","/","%")){op=this.consume();left=new OperatorNode(op.value,[left,this.unary()])}if(this.current().type===tokenType.SYMBOL||this.peek("(")||!(left.type instanceof ConstantNode)&&this.current().type===tokenType.NUMBER){right=this.multiplicative();return new OperatorNode("*",[left,right])}return left};Parser.prototype.unary=function(){if(this.peek("-","+","~")){var op=this.consume();var right=this.unary();return new UnaryNode(op.value,right)}return this.pow()};Parser.prototype.pow=function(){var left=this.factorial();if(this.peek("^","**")){var op=this.consume();var right=this.unary();return new OperatorNode(op.value,[left,right])}return left};Parser.prototype.factorial=function(){var left=this.symbol();if(this.peek("!")){var op=this.consume();return new OperatorNode(op.value,[left])}return left};Parser.prototype.symbol=function(){var current=this.current();if(current.type===tokenType.SYMBOL){var symbol=this.consume();var node=this.functionCall(symbol);return node}return this.string()};Parser.prototype.functionCall=function(symbolToken){var name=symbolToken.value;if(this.peek("(")){this.consume();var params=[];while(!this.peek(")")&&!this.isEOF()){params.push(this.assignment());if(this.peek(",")){this.consume()}}this.expect(")");return new FunctionNode(name,params)}return new SymbolNode(name)};Parser.prototype.string=function(){if(this.current().type===tokenType.STRING){return new ConstantNode(this.consume().value,"string")}return this.array()};Parser.prototype.array=function(){if(this.peek("[")){this.consume();var params=[];while(!this.peek("]")&&!this.isEOF()){params.push(this.assignment());if(this.peek(",")){this.consume()}}this.expect("]");return new ArrayNode(params)}return this.number()};Parser.prototype.number=function(){var token=this.current();if(token.type===tokenType.NUMBER){return new ConstantNode(this.consume().value,"number")}return this.parentheses()};Parser.prototype.parentheses=function(){var token=this.current();if(token.value==="("){this.consume();var left=this.assignment();this.expect(")");return left}return this.end()};Parser.prototype.end=function(){var token=this.current();if(token.type!==tokenType.EOF){throw Error("unexpected end of expression")}};module.exports=Parser},{"./Lexer":75,"./node/ArrayNode":77,"./node/AssignmentNode":78,"./node/BlockNode":79,"./node/ConditionalNode":80,"./node/ConstantNode":81,"./node/FunctionNode":82,"./node/OperatorNode":84,"./node/SymbolNode":85,"./node/UnaryNode":86,"./token-type":88}],77:[function(require,module,exports){var Node=require("./Node");function ArrayNode(nodes){this.nodes=nodes}ArrayNode.prototype=Object.create(Node.prototype);ArrayNode.prototype.type="ArrayNode";module.exports=ArrayNode},{"./Node":83}],78:[function(require,module,exports){var Node=require("./Node");function AssignmentNode(name,expr){this.name=name;this.expr=expr}AssignmentNode.prototype=Object.create(Node.prototype);AssignmentNode.prototype.type="AssignmentNode";module.exports=AssignmentNode},{"./Node":83}],79:[function(require,module,exports){var Node=require("./Node");function BlockNode(blocks){this.blocks=blocks}BlockNode.prototype=Object.create(Node.prototype);BlockNode.prototype.type="BlockNode";module.exports=BlockNode},{"./Node":83}],80:[function(require,module,exports){var Node=require("./Node");function ConditionalNode(predicate,truthy,falsy){this.condition=predicate;this.trueExpr=truthy;this.falseExpr=falsy}ConditionalNode.prototype=Object.create(Node.prototype);ConditionalNode.prototype.type="ConditionalNode";module.exports=ConditionalNode},{"./Node":83}],81:[function(require,module,exports){var Node=require("./Node");var SUPPORTED_TYPES={number:true,string:true,"boolean":true,undefined:true,"null":true};function ConstantNode(value,type){if(!SUPPORTED_TYPES[type]){throw Error("unsupported type '"+type+"'")}this.value=value;this.valueType=type}ConstantNode.prototype=Object.create(Node.prototype);ConstantNode.prototype.type="ConstantNode";module.exports=ConstantNode},{"./Node":83}],82:[function(require,module,exports){var Node=require("./Node");function FunctionNode(name,args){this.name=name;this.args=args}FunctionNode.prototype=Object.create(Node.prototype);FunctionNode.prototype.type="FunctionNode";module.exports=FunctionNode},{"./Node":83}],83:[function(require,module,exports){function Node(){}Node.prototype.type="Node";module.exports=Node},{}],84:[function(require,module,exports){var Node=require("./Node");function OperatorNode(op,args){this.op=op;this.args=args||[]}OperatorNode.prototype=Object.create(Node.prototype);OperatorNode.prototype.type="OperatorNode";module.exports=OperatorNode},{"./Node":83}],85:[function(require,module,exports){var Node=require("./Node");function SymbolNode(name){this.name=name}SymbolNode.prototype=Object.create(Node.prototype);SymbolNode.prototype.type="SymbolNode";module.exports=SymbolNode},{"./Node":83}],86:[function(require,module,exports){var Node=require("./Node");function UnaryNode(op,argument){this.op=op;this.argument=argument}UnaryNode.prototype=Object.create(Node.prototype);UnaryNode.prototype.type="UnaryNode";module.exports=UnaryNode},{"./Node":83}],87:[function(require,module,exports){module.exports={ArrayNode:require("./ArrayNode"),AssignmentNode:require("./AssignmentNode"),BlockNode:require("./BlockNode"),ConditionalNode:require("./ConditionalNode"),ConstantNode:require("./ConstantNode"),FunctionNode:require("./FunctionNode"),Node:require("./Node"),OperatorNode:require("./OperatorNode"),SymbolNode:require("./SymbolNode"),UnaryNode:require("./UnaryNode")}},{"./ArrayNode":77,"./AssignmentNode":78,"./BlockNode":79,"./ConditionalNode":80,"./ConstantNode":81,"./FunctionNode":82,"./Node":83,"./OperatorNode":84,"./SymbolNode":85,"./UnaryNode":86}],88:[function(require,module,exports){module.exports={EOF:0,DELIMITER:1,NUMBER:2,STRING:3,SYMBOL:4}},{}],89:[function(require,module,exports){"use strict";var doubleBits=require("double-bits");var SMALLEST_DENORM=Math.pow(2,-1074);var UINT_MAX=-1>>>0;module.exports=nextafter;function nextafter(x,y){if(isNaN(x)||isNaN(y)){return NaN}if(x===y){return x}if(x===0){if(y<0){return-SMALLEST_DENORM}else{return SMALLEST_DENORM}}var hi=doubleBits.hi(x);var lo=doubleBits.lo(x);if(y>x===x>0){if(lo===UINT_MAX){hi+=1;lo=0}else{lo+=1}}else{if(lo===0){lo=UINT_MAX;hi-=1}else{lo-=1}}return doubleBits.pack(lo,hi)}},{"double-bits":33}],90:[function(require,module,exports){var ua=typeof window!=="undefined"?window.navigator.userAgent:"",isOSX=/OS X/.test(ua),isOpera=/Opera/.test(ua),maybeFirefox=!/like Gecko/.test(ua)&&!isOpera;var i,output=module.exports={0:isOSX?"":"",1:"",2:"",3:"", -4:"",5:"",6:"",8:"",9:"",12:"",13:"",16:"",17:"",18:"",19:"",20:"",21:"",23:"",24:"",25:"",27:"",28:"",29:"",30:"",31:"",27:"",32:"",33:"",34:"",35:"",36:"",37:"",38:"",39:"",40:"",41:"",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),jb(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&jb(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return lb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?lb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},gb.matches=function(a,b){return gb(a,null,null,b)},gb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return gb(b,n,null,[a]).length>0},gb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},gb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},gb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},gb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=gb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=gb.selectors={cacheLength:50,createPseudo:ib,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||gb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&gb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=gb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||gb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ib(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ib(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ib(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ib(function(a){return function(b){return gb(a,b).length>0}}),contains:ib(function(a){return a=a.replace(cb,db),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ib(function(a){return W.test(a||"")||gb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:ob(function(){return[0]}),last:ob(function(a,b){return[b-1]}),eq:ob(function(a,b,c){return[0>c?c+b:c]}),even:ob(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:ob(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:ob(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:ob(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function sb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function tb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ub(a,b,c){for(var d=0,e=b.length;e>d;d++)gb(a,b[d],c);return c}function vb(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wb(a,b,c,d,e,f){return d&&!d[u]&&(d=wb(d)),e&&!e[u]&&(e=wb(e,f)),ib(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ub(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:vb(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=vb(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=vb(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sb(function(a){return a===b},h,!0),l=sb(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sb(tb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wb(i>1&&tb(m),i>1&&rb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xb(a.slice(i,e)),f>e&&xb(a=a.slice(e)),f>e&&rb(a))}m.push(c)}return tb(m)}function yb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=vb(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&gb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ib(f):f}return h=gb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,yb(e,d)),f.selector=a}return f},i=gb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&pb(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&rb(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&pb(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=jb(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),jb(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||kb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&jb(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||kb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),jb(function(a){return null==a.getAttribute("disabled")})||kb(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),gb}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1; -return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthh;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML="
a",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function ab(){return!0}function bb(){return!1}function cb(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h]","i"),hb=/^\s+/,ib=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,jb=/<([\w:]+)/,kb=/\s*$/g,rb={option:[1,""],legend:[1,"
","
"],area:[1,"",""],param:[1,"",""],thead:[1,"","
"],tr:[2,"","
"],col:[2,"","
"],td:[3,"","
"],_default:k.htmlSerialize?[0,"",""]:[1,"X
","
"]},sb=db(y),tb=sb.appendChild(y.createElement("div"));rb.optgroup=rb.option,rb.tbody=rb.tfoot=rb.colgroup=rb.caption=rb.thead,rb.th=rb.td;function ub(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ub(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function vb(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wb(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xb(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function yb(a){var b=pb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function zb(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Ab(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Bb(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xb(b).text=a.text,yb(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!gb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(tb.innerHTML=a.outerHTML,tb.removeChild(f=tb.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ub(f),h=ub(a),g=0;null!=(e=h[g]);++g)d[g]&&Bb(e,d[g]);if(b)if(c)for(h=h||ub(a),d=d||ub(f),g=0;null!=(e=h[g]);g++)Ab(e,d[g]);else Ab(a,f);return d=ub(f,"script"),d.length>0&&zb(d,!i&&ub(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=db(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(lb.test(f)){h=h||o.appendChild(b.createElement("div")),i=(jb.exec(f)||["",""])[1].toLowerCase(),l=rb[i]||rb._default,h.innerHTML=l[1]+f.replace(ib,"<$1>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&hb.test(f)&&p.push(b.createTextNode(hb.exec(f)[0])),!k.tbody){f="table"!==i||kb.test(f)?""!==l[1]||kb.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ub(p,"input"),vb),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ub(o.appendChild(f),"script"),g&&zb(h),c)){e=0;while(f=h[e++])ob.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ub(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&zb(ub(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ub(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fb,""):void 0;if(!("string"!=typeof a||mb.test(a)||!k.htmlSerialize&&gb.test(a)||!k.leadingWhitespace&&hb.test(a)||rb[(jb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ib,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ub(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ub(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&nb.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ub(i,"script"),xb),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ub(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,yb),j=0;f>j;j++)d=g[j],ob.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qb,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Cb,Db={};function Eb(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fb(a){var b=y,c=Db[a];return c||(c=Eb(a,b),"none"!==c&&c||(Cb=(Cb||m(" - -
-

The end

- -

Check out other plugins by clicking on    and then on "Plugins ".

-

Have a look at the source code & documentation on Github.

- -
- - - - - - - - - - - -Fork me on GitHub - - - diff --git a/spreadsheet/data.csv b/spreadsheet/data.csv deleted file mode 100644 index b6976da..0000000 --- a/spreadsheet/data.csv +++ /dev/null @@ -1,4 +0,0 @@ -,January, February, March, April, May, June, July -My first dataset, 65, 59, 80, 81, 56, 55, 40 -My second dataset, 28, 48, 40, 19, 86, 27, 90 - diff --git a/toc.html b/toc.html index c0491fd..dc39880 100644 --- a/toc.html +++ b/toc.html @@ -1,11 +1,10 @@