-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtrianglify.js
2 lines (2 loc) · 35.8 KB
/
trianglify.js
1
2
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r;r="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,r.Trianglify=e()}}(function(){var e;return function r(e,f,n){function t(o,c){if(!f[o]){if(!e[o]){var i="function"==typeof require&&require;if(!c&&i)return i(o,!0);if(a)return a(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var d=f[o]={exports:{}};e[o][0].call(d.exports,function(r){var f=e[o][1][r];return t(f?f:r)},d,d.exports,r,e,f,n)}return f[o].exports}for(var a="function"==typeof require&&require,o=0;o<n.length;o++)t(n[o]);return t}({"./lib/trianglify.js":[function(e,r){function f(e){function r(e,r,f){return(e-r[0])*(f[1]-f[0])/(r[1]-r[0])+f[0]}function f(f,n){for(var t=[],a=-y;f+y>a;a+=e.cell_size)for(var o=-v;n+v>o;o+=e.cell_size){var c=a+e.cell_size/2+r(rand(),[0,1],[-w,w]),i=o+e.cell_size/2+r(rand(),[0,1],[-w,w]);t.push([c,i].map(Math.floor))}return t}function o(e){return{x:(e[0][0]+e[1][0]+e[2][0])/3,y:(e[0][1]+e[1][1]+e[2][1])/3}}function u(){if(e.palette instanceof Array)return e.palette[Math.floor(rand()*e.palette.length)];var r=Object.keys(e.palette);return e.palette[r[Math.floor(rand()*r.length)]]}function d(e,r){var f={};for(var n in e)f[n]=e[n];for(n in r){if(!e.hasOwnProperty(n))throw new Error(n+" is not a configuration option for Trianglify. Check your spelling?");f[n]=r[n]}return f}if(e=d(i,e),rand=t(e.seed),"random"===e.x_colors&&(e.x_colors=u()),"random"===e.y_colors&&(e.y_colors=u()),"match_x"===e.y_colors&&(e.y_colors=e.x_colors),!(e.width>0&&e.height>0))throw new Error("Width and height must be numbers greater than 0");if(e.cell_size<2)throw new Error("Cell size must be greater than 2.");var l;if(e.color_function)l=function(r,f){return a(e.color_function(r,f))};else{var s=a.scale(e.x_colors).mode(e.color_space),b=a.scale(e.y_colors).mode(e.color_space);l=function(r,f){return a.interpolate(s(r),b(f),.5,e.color_space)}}for(var h=e.width,g=e.height,p=Math.floor((h+4*e.cell_size)/e.cell_size),m=Math.floor((g+4*e.cell_size)/e.cell_size),y=(p*e.cell_size-h)/2,v=(m*e.cell_size-g)/2,w=e.cell_size*e.variance/2,_=function(e){return r(e,[-y,h+y],[0,1])},k=function(e){return r(e,[-v,g+v],[0,1])},j=f(h,g),x=n.triangulate(j),M=[],N=function(e){return j[e]},P=0;P<x.length;P+=3){var q=[x[P],x[P+1],x[P+2]].map(N),A=o(q),G=l(_(A.x),k(A.y)).hex();M.push([G,q])}return c(M,e)}var n=e("delaunay-fast"),t=e("seedrandom"),a=e("chroma-js"),o=e("./colorbrewer"),c=e("./pattern"),i={width:600,height:400,cell_size:75,variance:.75,seed:null,x_colors:"random",y_colors:"match_x",palette:o,color_space:"lab",color_function:null,stroke_width:1.51};f.colorbrewer=o,f.defaults=i,r.exports=f},{"./colorbrewer":"/Users/qrohlf/Projects/trianglify/lib/colorbrewer.js","./pattern":"/Users/qrohlf/Projects/trianglify/lib/pattern.js","chroma-js":"/Users/qrohlf/Projects/trianglify/node_modules/chroma-js/chroma.js","delaunay-fast":"/Users/qrohlf/Projects/trianglify/node_modules/delaunay-fast/delaunay.js",seedrandom:"/Users/qrohlf/Projects/trianglify/node_modules/seedrandom/seedrandom.js"}],"/Users/qrohlf/Projects/trianglify/lib/colorbrewer.js":[function(e,r){r.exports={YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]}},{}],"/Users/qrohlf/Projects/trianglify/lib/pattern.js":[function(e,r){(function(f){function n(r,n){function a(){var e=t.createElementNS("http://www.w3.org/2000/svg","svg");return e.setAttribute("width",n.width),e.setAttribute("height",n.height),r.forEach(function(r){var f=t.createElementNS("http://www.w3.org/2000/svg","path");f.setAttribute("d","M"+r[1].join("L")+"Z"),f.setAttribute("fill",r[0]),f.setAttribute("stroke",r[0]),f.setAttribute("stroke-width",n.stroke_width),e.appendChild(f)}),e}function o(a){if("undefined"!=typeof f)try{e("canvas")}catch(o){throw Error("The optional node-canvas dependency is needed for Trianglify to render using canvas in node.")}return a||(a=t.createElement("canvas")),a.setAttribute("width",n.width),a.setAttribute("height",n.height),ctx=a.getContext("2d"),ctx.canvas.width=n.width,ctx.canvas.height=n.height,r.forEach(function(e){ctx.fillStyle=ctx.strokeStyle=e[0],ctx.lineWidth=n.stroke_width,ctx.beginPath(),ctx.moveTo.apply(ctx,e[1][0]),ctx.lineTo.apply(ctx,e[1][1]),ctx.lineTo.apply(ctx,e[1][2]),ctx.fill(),ctx.stroke()}),a}function c(){return o().toDataURL("image/png")}return{polys:r,opts:n,svg:a,canvas:o,png:c}}var t="undefined"!=typeof document?document:e("jsdom").jsdom("<html/>");r.exports=n}).call(this,e("_process"))},{_process:"/Users/qrohlf/Projects/trianglify/node_modules/browserify/node_modules/process/browser.js",canvas:"/Users/qrohlf/Projects/trianglify/node_modules/browserify/node_modules/browser-resolve/empty.js",jsdom:"/Users/qrohlf/Projects/trianglify/node_modules/browserify/node_modules/browser-resolve/empty.js"}],"/Users/qrohlf/Projects/trianglify/node_modules/browserify/node_modules/browser-resolve/empty.js":[function(){},{}],"/Users/qrohlf/Projects/trianglify/node_modules/browserify/node_modules/process/browser.js":[function(e,r){function f(){if(!o){o=!0;for(var e,r=a.length;r;){e=a,a=[];for(var f=-1;++f<r;)e[f]();r=a.length}o=!1}}function n(){}var t=r.exports={},a=[],o=!1;t.nextTick=function(e){a.push(e),o||setTimeout(f,0)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.on=n,t.addListener=n,t.once=n,t.off=n,t.removeListener=n,t.removeAllListeners=n,t.emit=n,t.binding=function(){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(){throw new Error("process.chdir is not supported")},t.umask=function(){return 0}},{}],"/Users/qrohlf/Projects/trianglify/node_modules/chroma-js/chroma.js":[function(r,f,n){(function(){var r,t,a,o,c,i,u,d,l,s,b,h,g,p,m,y,v,w,_,k,j,x,M,N,P,q,A,G,E,B,I,R,U,S,O,z,T,Y,L;s=function(e,f,n,t){return new r(e,f,n,t)},"undefined"!=typeof f&&null!==f&&null!=f.exports&&(f.exports=s),"function"==typeof e&&e.amd?e([],function(){return s}):(S="undefined"!=typeof n&&null!==n?n:this,S.chroma=s),s.color=function(e,f,n,t){return new r(e,f,n,t)},s.hsl=function(e,f,n,t){return new r(e,f,n,t,"hsl")},s.hsv=function(e,f,n,t){return new r(e,f,n,t,"hsv")},s.rgb=function(e,f,n,t){return new r(e,f,n,t,"rgb")},s.hex=function(e){return new r(e)},s.css=function(e){return new r(e)},s.lab=function(e,f,n){return new r(e,f,n,"lab")},s.lch=function(e,f,n){return new r(e,f,n,"lch")},s.hsi=function(e,f,n){return new r(e,f,n,"hsi")},s.gl=function(e,f,n,t){return new r(255*e,255*f,255*n,t,"gl")},s.interpolate=function(e,f,n,t){return null==e||null==f?"#000":("string"===O(e)&&(e=new r(e)),"string"===O(f)&&(f=new r(f)),e.interpolate(n,f,t))},s.mix=s.interpolate,s.contrast=function(e,f){var n,t;return"string"===O(e)&&(e=new r(e)),"string"===O(f)&&(f=new r(f)),n=e.luminance(),t=f.luminance(),n>t?(n+.05)/(t+.05):(t+.05)/(n+.05)},s.luminance=function(e){return s(e).luminance()},s._Color=r,r=function(){function e(){var e,r,f,n,t,a,o,c,i,u,d,l,s,h,g,p;for(t=this,f=[],u=0,d=arguments.length;d>u;u++)r=arguments[u],null!=r&&f.push(r);if(0===f.length)l=[255,0,255,1,"rgb"],o=l[0],c=l[1],i=l[2],e=l[3],n=l[4];else if("array"===O(f[0])){if(3===f[0].length)s=f[0],o=s[0],c=s[1],i=s[2],e=1;else{if(4!==f[0].length)throw"unknown input argument";h=f[0],o=h[0],c=h[1],i=h[2],e=h[3]}n=null!=(g=f[1])?g:"rgb"}else"string"===O(f[0])?(o=f[0],n="hex"):"object"===O(f[0])?(p=f[0]._rgb,o=p[0],c=p[1],i=p[2],e=p[3],n="rgb"):f.length>=3&&(o=f[0],c=f[1],i=f[2]);3===f.length?(n="rgb",e=1):4===f.length?"string"===O(f[3])?(n=f[3],e=1):"number"===O(f[3])&&(n="rgb",e=f[3]):5===f.length&&(e=f[3],n=f[4]),null==e&&(e=1),"rgb"===n?t._rgb=[o,c,i,e]:"gl"===n?t._rgb=[255*o,255*c,255*i,e]:"hsl"===n?(t._rgb=v(o,c,i),t._rgb[3]=e):"hsv"===n?(t._rgb=w(o,c,i),t._rgb[3]=e):"hex"===n?t._rgb=m(o):"lab"===n?(t._rgb=k(o,c,i),t._rgb[3]=e):"lch"===n?(t._rgb=M(o,c,i),t._rgb[3]=e):"hsi"===n&&(t._rgb=y(o,c,i),t._rgb[3]=e),a=b(t._rgb)}return e.prototype.rgb=function(){return this._rgb.slice(0,3)},e.prototype.rgba=function(){return this._rgb},e.prototype.hex=function(){return A(this._rgb)},e.prototype.toString=function(){return this.name()},e.prototype.hsl=function(){return E(this._rgb)},e.prototype.hsv=function(){return B(this._rgb)},e.prototype.lab=function(){return I(this._rgb)},e.prototype.lch=function(){return R(this._rgb)},e.prototype.hsi=function(){return G(this._rgb)},e.prototype.gl=function(){return[this._rgb[0]/255,this._rgb[1]/255,this._rgb[2]/255,this._rgb[3]]},e.prototype.luminance=function(r,f){var n,t,a,o;return null==f&&(f="rgb"),arguments.length?(0===r&&(this._rgb=[0,0,0,this._rgb[3]]),1===r&&(this._rgb=[255,255,255,this._rgb[3]]),n=P(this._rgb),t=1e-7,a=20,o=function(e,n){var c,i;return i=e.interpolate(.5,n,f),c=i.luminance(),Math.abs(r-c)<t||!a--?i:c>r?o(e,i):o(i,n)},this._rgb=(n>r?o(new e("black"),this):o(this,new e("white"))).rgba(),this):P(this._rgb)},e.prototype.name=function(){var e,r;e=this.hex();for(r in s.colors)if(e===s.colors[r])return r;return e},e.prototype.alpha=function(e){return arguments.length?(this._rgb[3]=e,this):this._rgb[3]},e.prototype.css=function(e){var r,f,n,t;return null==e&&(e="rgb"),f=this,n=f._rgb,3===e.length&&n[3]<1&&(e+="a"),"rgb"===e?e+"("+n.slice(0,3).map(Math.round).join(",")+")":"rgba"===e?e+"("+n.slice(0,3).map(Math.round).join(",")+","+n[3]+")":"hsl"===e||"hsla"===e?(r=f.hsl(),t=function(e){return Math.round(100*e)/100},r[0]=t(r[0]),r[1]=t(100*r[1])+"%",r[2]=t(100*r[2])+"%",4===e.length&&(r[3]=n[3]),e+"("+r.join(",")+")"):void 0},e.prototype.interpolate=function(r,f,n){var t,a,o,c,i,u,d,l,s,b,h,g,p,m;if(l=this,null==n&&(n="rgb"),"string"===O(f)&&(f=new e(f)),"hsl"===n||"hsv"===n||"lch"===n||"hsi"===n)"hsl"===n?(p=l.hsl(),m=f.hsl()):"hsv"===n?(p=l.hsv(),m=f.hsv()):"hsi"===n?(p=l.hsi(),m=f.hsi()):"lch"===n&&(p=l.lch(),m=f.lch()),"h"===n.substr(0,1)?(o=p[0],h=p[1],u=p[2],c=m[0],g=m[1],d=m[2]):(u=p[0],h=p[1],o=p[2],d=m[0],g=m[1],c=m[2]),isNaN(o)||isNaN(c)?isNaN(o)?isNaN(c)?a=Number.NaN:(a=c,1!==u&&0!==u||"hsv"===n||(b=g)):(a=o,1!==d&&0!==d||"hsv"===n||(b=h)):(t=c>o&&c-o>180?c-(o+360):o>c&&o-c>180?c+360-o:c-o,a=o+r*t),null==b&&(b=h+r*(g-h)),i=u+r*(d-u),s="h"===n.substr(0,1)?new e(a,b,i,n):new e(i,b,a,n);else if("rgb"===n)p=l._rgb,m=f._rgb,s=new e(p[0]+r*(m[0]-p[0]),p[1]+r*(m[1]-p[1]),p[2]+r*(m[2]-p[2]),n);else{if("lab"!==n)throw"color mode "+n+" is not supported";p=l.lab(),m=f.lab(),s=new e(p[0]+r*(m[0]-p[0]),p[1]+r*(m[1]-p[1]),p[2]+r*(m[2]-p[2]),n)}return s.alpha(l.alpha()+r*(f.alpha()-l.alpha())),s},e.prototype.premultiply=function(){var e,r;return r=this.rgb(),e=this.alpha(),s(r[0]*e,r[1]*e,r[2]*e,e)},e.prototype.darken=function(e){var r,f;return null==e&&(e=20),f=this,r=f.lch(),r[0]-=e,s.lch(r).alpha(f.alpha())},e.prototype.darker=function(e){return this.darken(e)},e.prototype.brighten=function(e){return null==e&&(e=20),this.darken(-e)},e.prototype.brighter=function(e){return this.brighten(e)},e.prototype.saturate=function(e){var r,f;return null==e&&(e=20),f=this,r=f.lch(),r[1]+=e,s.lch(r).alpha(f.alpha())},e.prototype.desaturate=function(e){return null==e&&(e=20),this.saturate(-e)},e}(),b=function(e){var r;for(r in e)3>r?(e[r]<0&&(e[r]=0),e[r]>255&&(e[r]=255)):3===r&&(e[r]<0&&(e[r]=0),e[r]>1&&(e[r]=1));return e},p=function(e){var r,f,n,t,a,o,c,i;if(e=e.toLowerCase(),null!=s.colors&&s.colors[e])return m(s.colors[e]);if(n=e.match(/rgb\(\s*(\-?\d+),\s*(\-?\d+)\s*,\s*(\-?\d+)\s*\)/)){for(t=n.slice(1,4),f=a=0;2>=a;f=++a)t[f]=+t[f];t[3]=1}else if(n=e.match(/rgba\(\s*(\-?\d+),\s*(\-?\d+)\s*,\s*(\-?\d+)\s*,\s*([01]|[01]?\.\d+)\)/))for(t=n.slice(1,5),f=o=0;3>=o;f=++o)t[f]=+t[f];else if(n=e.match(/rgb\(\s*(\-?\d+(?:\.\d+)?)%,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*\)/)){for(t=n.slice(1,4),f=c=0;2>=c;f=++c)t[f]=Math.round(2.55*t[f]);t[3]=1}else if(n=e.match(/rgba\(\s*(\-?\d+(?:\.\d+)?)%,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)/)){for(t=n.slice(1,5),f=i=0;2>=i;f=++i)t[f]=Math.round(2.55*t[f]);t[3]=+t[3]}else(n=e.match(/hsl\(\s*(\-?\d+(?:\.\d+)?),\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*\)/))?(r=n.slice(1,4),r[1]*=.01,r[2]*=.01,t=v(r),t[3]=1):(n=e.match(/hsla\(\s*(\-?\d+(?:\.\d+)?),\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)/))&&(r=n.slice(1,4),r[1]*=.01,r[2]*=.01,t=v(r),t[3]=+n[4]);return t},m=function(e){var r,f,n,t,a,o;if(e.match(/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/))return(4===e.length||7===e.length)&&(e=e.substr(1)),3===e.length&&(e=e.split(""),e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),o=parseInt(e,16),t=o>>16,n=o>>8&255,f=255&o,[t,n,f,1];if(e.match(/^#?([A-Fa-f0-9]{8})$/))return 9===e.length&&(e=e.substr(1)),o=parseInt(e,16),t=o>>24&255,n=o>>16&255,f=o>>8&255,r=255&o,[t,n,f,r];if(a=p(e))return a;throw"unknown color: "+e},y=function(e,r,f){var n,t,c,i;return i=z(arguments),e=i[0],r=i[1],f=i[2],e/=360,1/3>e?(n=(1-r)/3,c=(1+r*g(o*e)/g(a-o*e))/3,t=1-(n+c)):2/3>e?(e-=1/3,c=(1-r)/3,t=(1+r*g(o*e)/g(a-o*e))/3,n=1-(c+t)):(e-=2/3,t=(1-r)/3,n=(1+r*g(o*e)/g(a-o*e))/3,c=1-(t+n)),c=N(f*c*3),t=N(f*t*3),n=N(f*n*3),[255*c,255*t,255*n]},v=function(){var e,r,f,n,t,a,o,c,i,u,d,l,s,b;if(s=z(arguments),n=s[0],c=s[1],a=s[2],0===c)o=f=e=255*a;else{for(d=[0,0,0],r=[0,0,0],u=.5>a?a*(1+c):a+c-a*c,i=2*a-u,n/=360,d[0]=n+1/3,d[1]=n,d[2]=n-1/3,t=l=0;2>=l;t=++l)d[t]<0&&(d[t]+=1),d[t]>1&&(d[t]-=1),r[t]=6*d[t]<1?i+6*(u-i)*d[t]:2*d[t]<1?u:3*d[t]<2?i+(u-i)*(2/3-d[t])*6:i;b=[Math.round(255*r[0]),Math.round(255*r[1]),Math.round(255*r[2])],o=b[0],f=b[1],e=b[2]}return[o,f,e]},w=function(){var e,r,f,n,t,a,o,c,i,u,d,l,s,b,h,g,p,m;if(l=z(arguments),n=l[0],i=l[1],d=l[2],d*=255,0===i)c=f=e=d;else switch(360===n&&(n=0),n>360&&(n-=360),0>n&&(n+=360),n/=60,t=Math.floor(n),r=n-t,a=d*(1-i),o=d*(1-i*r),u=d*(1-i*(1-r)),t){case 0:s=[d,u,a],c=s[0],f=s[1],e=s[2];break;case 1:b=[o,d,a],c=b[0],f=b[1],e=b[2];break;case 2:h=[a,d,u],c=h[0],f=h[1],e=h[2];break;case 3:g=[a,o,d],c=g[0],f=g[1],e=g[2];break;case 4:p=[u,a,d],c=p[0],f=p[1],e=p[2];break;case 5:m=[d,a,o],c=m[0],f=m[1],e=m[2]}return c=Math.round(c),f=Math.round(f),e=Math.round(e),[c,f,e]},t=18,c=.95047,i=1,u=1.08883,_=function(){var e,r,f,n,t,a;return a=z(arguments),t=a[0],e=a[1],r=a[2],f=Math.sqrt(e*e+r*r),n=Math.atan2(r,e)/Math.PI*180,[t,f,n]},k=function(e,r,f){var n,t,a,o,d,l,s;return void 0!==e&&3===e.length&&(l=e,e=l[0],r=l[1],f=l[2]),void 0!==e&&3===e.length&&(s=e,e=s[0],r=s[1],f=s[2]),o=(e+16)/116,a=o+r/500,d=o-f/200,a=j(a)*c,o=j(o)*i,d=j(d)*u,t=Y(3.2404542*a-1.5371385*o-.4985314*d),n=Y(-.969266*a+1.8760108*o+.041556*d),f=Y(.0556434*a-.2040259*o+1.0572252*d),[N(t,0,255),N(n,0,255),N(f,0,255),1]},j=function(e){return e>.206893034?e*e*e:(e-4/29)/7.787037},Y=function(e){return Math.round(255*(.00304>=e?12.92*e:1.055*Math.pow(e,1/2.4)-.055))},x=function(){var e,r,f,n;return n=z(arguments),f=n[0],e=n[1],r=n[2],r=r*Math.PI/180,[f,Math.cos(r)*e,Math.sin(r)*e]},M=function(e,r,f){var n,t,a,o,c,i,u;return i=x(e,r,f),n=i[0],t=i[1],a=i[2],u=k(n,t,a),c=u[0],o=u[1],a=u[2],[N(c,0,255),N(o,0,255),N(a,0,255)]},P=function(e,r,f){var n;return n=z(arguments),e=n[0],r=n[1],f=n[2],e=q(e),r=q(r),f=q(f),.2126*e+.7152*r+.0722*f},q=function(e){return e/=255,.03928>=e?e/12.92:Math.pow((e+.055)/1.055,2.4)},A=function(){var e,r,f,n,t,a;return a=z(arguments),f=a[0],r=a[1],e=a[2],t=f<<16|r<<8|e,n="000000"+t.toString(16),"#"+n.substr(n.length-6)},G=function(){var e,r,f,n,t,a,o,c,i;return i=z(arguments),o=i[0],f=i[1],r=i[2],e=2*Math.PI,o/=255,f/=255,r/=255,a=Math.min(o,f,r),t=(o+f+r)/3,c=1-a/t,0===c?n=0:(n=(o-f+(o-r))/2,n/=Math.sqrt((o-f)*(o-f)+(o-r)*(f-r)),n=Math.acos(n),r>f&&(n=e-n),n/=e),[360*n,c,t]},E=function(e,r,f){var n,t,a,o,c,i;return void 0!==e&&e.length>=3&&(i=e,e=i[0],r=i[1],f=i[2]),e/=255,r/=255,f/=255,o=Math.min(e,r,f),a=Math.max(e,r,f),t=(a+o)/2,a===o?(c=0,n=Number.NaN):c=.5>t?(a-o)/(a+o):(a-o)/(2-a-o),e===a?n=(r-f)/(a-o):r===a?n=2+(f-e)/(a-o):f===a&&(n=4+(e-r)/(a-o)),n*=60,0>n&&(n+=360),[n,c,t]},B=function(){var e,r,f,n,t,a,o,c,i,u;return u=z(arguments),o=u[0],f=u[1],e=u[2],a=Math.min(o,f,e),t=Math.max(o,f,e),r=t-a,i=t/255,0===t?(n=Number.NaN,c=0):(c=r/t,o===t&&(n=(f-e)/r),f===t&&(n=2+(e-o)/r),e===t&&(n=4+(o-f)/r),n*=60,0>n&&(n+=360)),[n,c,i]},I=function(){var e,r,f,n,t,a,o;return o=z(arguments),f=o[0],r=o[1],e=o[2],f=U(f),r=U(r),e=U(e),n=T((.4124564*f+.3575761*r+.1804375*e)/c),t=T((.2126729*f+.7151522*r+.072175*e)/i),a=T((.0193339*f+.119192*r+.9503041*e)/u),[116*t-16,500*(n-t),200*(t-a)]},U=function(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},T=function(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29},R=function(){var e,r,f,n,t,a,o;return a=z(arguments),t=a[0],f=a[1],r=a[2],o=I(t,f,r),n=o[0],e=o[1],r=o[2],_(n,e,r)},s.scale=function(e,r){var f,n,t,a,o,c,i,u,d,l,b,h,g,p,m,y,v,w,_,k,j;return y="rgb",v=s("#ccc"),j=0,g=!1,h=[0,1],l=[],_=!1,k=[],m=0,p=1,b=!1,w=0,d={},c=function(e,r){var f,n,t,a,c,i,u;if(null==e&&(e=["#ddd","#222"]),null!=e&&"string"===O(e)&&null!=(null!=(c=s.brewer)?c[e]:void 0)&&(e=s.brewer[e]),"array"===O(e)){for(e=e.slice(0),f=t=0,i=e.length-1;i>=0?i>=t:t>=i;f=i>=0?++t:--t)n=e[f],"string"===O(n)&&(e[f]=s(n));if(null!=r)k=r;else for(k=[],f=a=0,u=e.length-1;u>=0?u>=a:a>=u;f=u>=0?++a:--a)k.push(f/(e.length-1))}return o(),l=e},i=function(e){return null==e&&(e=[]),h=e,m=e[0],p=e[e.length-1],o(),w=2===e.length?0:e.length-1},t=function(e){var r,f;if(null!=h){for(f=h.length-1,r=0;f>r&&e>=h[r];)r++;return r-1}return 0},u=function(e){return e},f=function(e){var r,f,n,a,o;return o=e,h.length>2&&(a=h.length-1,r=t(e),n=h[0]+(h[1]-h[0])*(0+.5*j),f=h[a-1]+(h[a]-h[a-1])*(1-.5*j),o=m+(h[r]+.5*(h[r+1]-h[r])-n)/(f-n)*(p-m)),o},a=function(e,r){var f,n,a,o,c,i,b,g,_;if(null==r&&(r=!1),isNaN(e))return v;if(r?b=e:h.length>2?(f=t(e),b=f/(w-1)):(b=a=m!==p?(e-m)/(p-m):0,b=a=(e-m)/(p-m),b=Math.min(1,Math.max(0,b))),r||(b=u(b)),c=Math.floor(1e4*b),d[c])n=d[c];else{if("array"===O(l))for(o=g=0,_=k.length-1;_>=0?_>=g:g>=_;o=_>=0?++g:--g){if(i=k[o],i>=b){n=l[o];break}if(b>=i&&o===k.length-1){n=l[o];break}if(b>i&&b<k[o+1]){b=(b-i)/(k[o+1]-i),n=s.interpolate(l[o],l[o+1],b,y);break}}else"function"===O(l)&&(n=l(b));d[c]=n}return n},o=function(){return d={}},c(e,r),n=function(e){var r;return r=a(e),_&&r[_]?r[_]():r},n.domain=function(e,r,f,t){var a;return null==f&&(f="e"),arguments.length?(null!=r&&(a=s.analyze(e,t),e=0===r?[a.min,a.max]:s.limits(a,f,r)),i(e),n):h},n.mode=function(e){return arguments.length?(y=e,o(),n):y},n.range=function(e,r){return c(e,r),n},n.out=function(e){return _=e,n},n.spread=function(e){return arguments.length?(j=e,n):j},n.correctLightness=function(e){return arguments.length?(b=e,o(),u=b?function(e){var r,f,n,t,o,c,i,u,d;for(r=a(0,!0).lab()[0],f=a(1,!0).lab()[0],i=r>f,n=a(e,!0).lab()[0],o=r+(f-r)*e,t=n-o,u=0,d=1,c=20;Math.abs(t)>.01&&c-->0;)!function(){return i&&(t*=-1),0>t?(u=e,e+=.5*(d-e)):(d=e,e+=.5*(u-e)),n=a(e,!0).lab()[0],t=n-o}();return e}:function(e){return e},n):b},n.colors=function(r){var f,t,a,o,c,i;if(null==r&&(r="hex"),e=[],t=[],h.length>2)for(f=a=1,i=h.length;i>=1?i>a:a>i;f=i>=1?++a:--a)t.push(.5*(h[f-1]+h[f]));else t=h;for(o=0,c=t.length;c>o;o++)f=t[o],e.push(n(f)[r]());return e},n},null==(L=s.scales)&&(s.scales={}),s.scales.cool=function(){return s.scale([s.hsl(180,1,.9),s.hsl(250,.7,.4)])},s.scales.hot=function(){return s.scale(["#000","#f00","#ff0","#fff"],[0,.25,.75,1]).mode("rgb")},s.analyze=function(e,r,f){var n,t,a,o,c,i,u;if(a={min:Number.MAX_VALUE,max:-1*Number.MAX_VALUE,sum:0,values:[],count:0},null==f&&(f=function(){return!0}),n=function(e){null==e||isNaN(e)||(a.values.push(e),a.sum+=e,e<a.min&&(a.min=e),e>a.max&&(a.max=e),a.count+=1)},c=function(e,t){return f(e,t)?null!=r&&"function"===O(r)?n(r(e)):null!=r&&"string"===O(r)||"number"===O(r)?n(e[r]):n(e):void 0},"array"===O(e))for(i=0,u=e.length;u>i;i++)o=e[i],c(o);else for(t in e)o=e[t],c(o,t);return a.domain=[a.min,a.max],a.limits=function(e,r){return s.limits(a,e,r)},a},s.limits=function(e,r,f){var n,t,a,o,c,i,u,d,l,b,h,g,p,m,y,v,w,_,k,j,x,M,N,P,q,A,G,E,B,I,R,U,S,z,T,Y,L,C,F,V,D,X,W,$,Z,H,J,K,Q,er,rr,fr,nr,tr,ar,or;if(null==r&&(r="equal"),null==f&&(f=7),"array"===O(e)&&(e=s.analyze(e)),p=e.min,h=e.max,N=e.sum,A=e.values.sort(function(e,r){return e-r}),b=[],"c"===r.substr(0,1)&&(b.push(p),b.push(h)),"e"===r.substr(0,1)){for(b.push(p),u=G=1,L=f-1;L>=1?L>=G:G>=L;u=L>=1?++G:--G)b.push(p+u/f*(h-p));b.push(h)}else if("l"===r.substr(0,1)){if(0>=p)throw"Logarithmic scales are only possible for values > 0";for(m=Math.LOG10E*Math.log(p),g=Math.LOG10E*Math.log(h),b.push(p),u=E=1,$=f-1;$>=1?$>=E:E>=$;u=$>=1?++E:--E)b.push(Math.pow(10,m+u/f*(g-m)));b.push(h)}else if("q"===r.substr(0,1)){for(b.push(p),u=B=1,Z=f-1;Z>=1?Z>=B:B>=Z;u=Z>=1?++B:--B)k=A.length*u/f,j=Math.floor(k),j===k?b.push(A[j]):(x=k-j,b.push(A[j]*x+A[j+1]*(1-x)));b.push(h)}else if("k"===r.substr(0,1)){for(v=A.length,n=new Array(v),c=new Array(f),M=!0,w=0,a=null,a=[],a.push(p),u=I=1,H=f-1;H>=1?H>=I:I>=H;u=H>=1?++I:--I)a.push(p+u/f*(h-p));for(a.push(h);M;){for(d=R=0,J=f-1;J>=0?J>=R:R>=J;d=J>=0?++R:--R)c[d]=0;for(u=U=0,K=v-1;K>=0?K>=U:U>=K;u=K>=0?++U:--U){for(q=A[u],y=Number.MAX_VALUE,d=S=0,Q=f-1;Q>=0?Q>=S:S>=Q;d=Q>=0?++S:--S)i=Math.abs(a[d]-q),y>i&&(y=i,t=d);c[t]++,n[u]=t}for(_=new Array(f),d=z=0,er=f-1;er>=0?er>=z:z>=er;d=er>=0?++z:--z)_[d]=null;for(u=T=0,rr=v-1;rr>=0?rr>=T:T>=rr;u=rr>=0?++T:--T)o=n[u],null===_[o]?_[o]=A[u]:_[o]+=A[u];for(d=Y=0,C=f-1;C>=0?C>=Y:Y>=C;d=C>=0?++Y:--Y)_[d]*=1/c[d];for(M=!1,d=fr=0,F=f-1;F>=0?F>=fr:fr>=F;d=F>=0?++fr:--fr)if(_[d]!==a[u]){M=!0;break}a=_,w++,w>200&&(M=!1)}for(l={},d=nr=0,V=f-1;V>=0?V>=nr:nr>=V;d=V>=0?++nr:--nr)l[d]=[];for(u=tr=0,D=v-1;D>=0?D>=tr:tr>=D;u=D>=0?++tr:--tr)o=n[u],l[o].push(A[u]);for(P=[],d=ar=0,X=f-1;X>=0?X>=ar:ar>=X;d=X>=0?++ar:--ar)P.push(l[d][0]),P.push(l[d][l[d].length-1]);for(P=P.sort(function(e,r){return e-r}),b.push(P[0]),u=or=1,W=P.length-1;W>=or;u=or+=2)isNaN(P[u])||b.push(P[u])}return b},s.brewer=l={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},s.colors=h={indigo:"#4b0082",gold:"#ffd700",hotpink:"#ff69b4",firebrick:"#b22222",indianred:"#cd5c5c",yellow:"#ffff00",mistyrose:"#ffe4e1",darkolivegreen:"#556b2f",olive:"#808000",darkseagreen:"#8fbc8f",pink:"#ffc0cb",tomato:"#ff6347",lightcoral:"#f08080",orangered:"#ff4500",navajowhite:"#ffdead",lime:"#00ff00",palegreen:"#98fb98",darkslategrey:"#2f4f4f",greenyellow:"#adff2f",burlywood:"#deb887",seashell:"#fff5ee",mediumspringgreen:"#00fa9a",fuchsia:"#ff00ff",papayawhip:"#ffefd5",blanchedalmond:"#ffebcd",chartreuse:"#7fff00",dimgray:"#696969",black:"#000000",peachpuff:"#ffdab9",springgreen:"#00ff7f",aquamarine:"#7fffd4",white:"#ffffff",orange:"#ffa500",lightsalmon:"#ffa07a",darkslategray:"#2f4f4f",brown:"#a52a2a",ivory:"#fffff0",dodgerblue:"#1e90ff",peru:"#cd853f",lawngreen:"#7cfc00",chocolate:"#d2691e",crimson:"#dc143c",forestgreen:"#228b22",darkgrey:"#a9a9a9",lightseagreen:"#20b2aa",cyan:"#00ffff",mintcream:"#f5fffa",silver:"#c0c0c0",antiquewhite:"#faebd7",mediumorchid:"#ba55d3",skyblue:"#87ceeb",gray:"#808080",darkturquoise:"#00ced1",goldenrod:"#daa520",darkgreen:"#006400",floralwhite:"#fffaf0",darkviolet:"#9400d3",darkgray:"#a9a9a9",moccasin:"#ffe4b5",saddlebrown:"#8b4513",grey:"#808080",darkslateblue:"#483d8b",lightskyblue:"#87cefa",lightpink:"#ffb6c1",mediumvioletred:"#c71585",slategrey:"#708090",red:"#ff0000",deeppink:"#ff1493",limegreen:"#32cd32",darkmagenta:"#8b008b",palegoldenrod:"#eee8aa",plum:"#dda0dd",turquoise:"#40e0d0",lightgrey:"#d3d3d3",lightgoldenrodyellow:"#fafad2",darkgoldenrod:"#b8860b",lavender:"#e6e6fa",maroon:"#800000",yellowgreen:"#9acd32",sandybrown:"#f4a460",thistle:"#d8bfd8",violet:"#ee82ee",navy:"#000080",magenta:"#ff00ff",dimgrey:"#696969",tan:"#d2b48c",rosybrown:"#bc8f8f",olivedrab:"#6b8e23",blue:"#0000ff",lightblue:"#add8e6",ghostwhite:"#f8f8ff",honeydew:"#f0fff0",cornflowerblue:"#6495ed",slateblue:"#6a5acd",linen:"#faf0e6",darkblue:"#00008b",powderblue:"#b0e0e6",seagreen:"#2e8b57",darkkhaki:"#bdb76b",snow:"#fffafa",sienna:"#a0522d",mediumblue:"#0000cd",royalblue:"#4169e1",lightcyan:"#e0ffff",green:"#008000",mediumpurple:"#9370db",midnightblue:"#191970",cornsilk:"#fff8dc",paleturquoise:"#afeeee",bisque:"#ffe4c4",slategray:"#708090",darkcyan:"#008b8b",khaki:"#f0e68c",wheat:"#f5deb3",teal:"#008080",darkorchid:"#9932cc",deepskyblue:"#00bfff",salmon:"#fa8072",darkred:"#8b0000",steelblue:"#4682b4",palevioletred:"#db7093",lightslategray:"#778899",aliceblue:"#f0f8ff",lightslategrey:"#778899",lightgreen:"#90ee90",orchid:"#da70d6",gainsboro:"#dcdcdc",mediumseagreen:"#3cb371",lightgray:"#d3d3d3",mediumturquoise:"#48d1cc",lemonchiffon:"#fffacd",cadetblue:"#5f9ea0",lightyellow:"#ffffe0",lavenderblush:"#fff0f5",coral:"#ff7f50",purple:"#800080",aqua:"#00ffff",whitesmoke:"#f5f5f5",mediumslateblue:"#7b68ee",darkorange:"#ff8c00",mediumaquamarine:"#66cdaa",darksalmon:"#e9967a",beige:"#f5f5dc",blueviolet:"#8a2be2",azure:"#f0ffff",lightsteelblue:"#b0c4de",oldlace:"#fdf5e6"},O=function(){var e,r,f,n,t;for(e={},t="Boolean Number String Function Array Date RegExp Undefined Null".split(" "),f=0,n=t.length;n>f;f++)r=t[f],e["[object "+r+"]"]=r.toLowerCase();return function(r){var f;return f=Object.prototype.toString.call(r),e[f]||"object"}}(),N=function(e,r,f){return null==r&&(r=0),null==f&&(f=1),r>e&&(e=r),e>f&&(e=f),e},z=function(e){return e.length>=3?e:e[0]},o=2*Math.PI,a=Math.PI/3,g=Math.cos,d=function(e){var r,f,n,t,a,o,c,i,u,l,b;return e=function(){var r,f,n;for(n=[],r=0,f=e.length;f>r;r++)t=e[r],n.push(s(t));return n}(),2===e.length?(u=function(){var r,f,n;for(n=[],r=0,f=e.length;f>r;r++)t=e[r],n.push(t.lab());return n}(),a=u[0],o=u[1],r=function(e){var r,f;return f=function(){var f,n;for(n=[],r=f=0;2>=f;r=++f)n.push(a[r]+e*(o[r]-a[r]));return n
}(),s.lab.apply(s,f)}):3===e.length?(l=function(){var r,f,n;for(n=[],r=0,f=e.length;f>r;r++)t=e[r],n.push(t.lab());return n}(),a=l[0],o=l[1],c=l[2],r=function(e){var r,f;return f=function(){var f,n;for(n=[],r=f=0;2>=f;r=++f)n.push((1-e)*(1-e)*a[r]+2*(1-e)*e*o[r]+e*e*c[r]);return n}(),s.lab.apply(s,f)}):4===e.length?(b=function(){var r,f,n;for(n=[],r=0,f=e.length;f>r;r++)t=e[r],n.push(t.lab());return n}(),a=b[0],o=b[1],c=b[2],i=b[3],r=function(e){var r,f;return f=function(){var f,n;for(n=[],r=f=0;2>=f;r=++f)n.push((1-e)*(1-e)*(1-e)*a[r]+3*(1-e)*(1-e)*e*o[r]+3*(1-e)*e*e*c[r]+e*e*e*i[r]);return n}(),s.lab.apply(s,f)}):5===e.length&&(f=d(e.slice(0,3)),n=d(e.slice(2,5)),r=function(e){return.5>e?f(2*e):n(2*(e-.5))}),r},s.interpolate.bezier=d}).call(this)},{}],"/Users/qrohlf/Projects/trianglify/node_modules/delaunay-fast/delaunay.js":[function(e,r){var f;!function(){"use strict";function e(e){var r,f,n,t,a,o,c=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY,d=Number.NEGATIVE_INFINITY;for(r=e.length;r--;)e[r][0]<c&&(c=e[r][0]),e[r][0]>u&&(u=e[r][0]),e[r][1]<i&&(i=e[r][1]),e[r][1]>d&&(d=e[r][1]);return f=u-c,n=d-i,t=Math.max(f,n),a=c+.5*f,o=i+.5*n,[[a-20*t,o-t],[a,o+20*t],[a+20*t,o-t]]}function n(e,r,f,n){var t,o,c,i,u,d,l,s,b,h,g=e[r][0],p=e[r][1],m=e[f][0],y=e[f][1],v=e[n][0],w=e[n][1],_=Math.abs(p-y),k=Math.abs(y-w);if(a>_&&a>k)throw new Error("Eek! Coincident points!");return a>_?(i=-((v-m)/(w-y)),d=(m+v)/2,s=(y+w)/2,t=(m+g)/2,o=i*(t-d)+s):a>k?(c=-((m-g)/(y-p)),u=(g+m)/2,l=(p+y)/2,t=(v+m)/2,o=c*(t-u)+l):(c=-((m-g)/(y-p)),i=-((v-m)/(w-y)),u=(g+m)/2,d=(m+v)/2,l=(p+y)/2,s=(y+w)/2,t=(c*u-i*d+s-l)/(c-i),o=_>k?c*(t-u)+l:i*(t-d)+s),b=m-t,h=y-o,{i:r,j:f,k:n,x:t,y:o,r:b*b+h*h}}function t(e){var r,f,n,t,a,o;for(f=e.length;f;)for(t=e[--f],n=e[--f],r=f;r;)if(o=e[--r],a=e[--r],n===a&&t===o||n===o&&t===a){e.splice(f,2),e.splice(r,2);break}}var a=1/1048576;f={triangulate:function(r,f){var o,c,i,u,d,l,s,b,h,g,p,m,y=r.length;if(3>y)return[];if(r=r.slice(0),f)for(o=y;o--;)r[o]=r[o][f];for(i=new Array(y),o=y;o--;)i[o]=o;for(i.sort(function(e,f){return r[f][0]-r[e][0]}),u=e(r),r.push(u[0],u[1],u[2]),d=[n(r,y+0,y+1,y+2)],l=[],s=[],o=i.length;o--;s.length=0){for(m=i[o],c=d.length;c--;)b=r[m][0]-d[c].x,b>0&&b*b>d[c].r?(l.push(d[c]),d.splice(c,1)):(h=r[m][1]-d[c].y,b*b+h*h-d[c].r>a||(s.push(d[c].i,d[c].j,d[c].j,d[c].k,d[c].k,d[c].i),d.splice(c,1)));for(t(s),c=s.length;c;)p=s[--c],g=s[--c],d.push(n(r,g,p,m))}for(o=d.length;o--;)l.push(d[o]);for(d.length=0,o=l.length;o--;)l[o].i<y&&l[o].j<y&&l[o].k<y&&d.push(l[o].i,l[o].j,l[o].k);return d},contains:function(e,r){if(r[0]<e[0][0]&&r[0]<e[1][0]&&r[0]<e[2][0]||r[0]>e[0][0]&&r[0]>e[1][0]&&r[0]>e[2][0]||r[1]<e[0][1]&&r[1]<e[1][1]&&r[1]<e[2][1]||r[1]>e[0][1]&&r[1]>e[1][1]&&r[1]>e[2][1])return null;var f=e[1][0]-e[0][0],n=e[2][0]-e[0][0],t=e[1][1]-e[0][1],a=e[2][1]-e[0][1],o=f*a-n*t;if(0===o)return null;var c=(a*(r[0]-e[0][0])-n*(r[1]-e[0][1]))/o,i=(f*(r[1]-e[0][1])-t*(r[0]-e[0][0]))/o;return 0>c||0>i||c+i>1?null:[c,i]}},"undefined"!=typeof r&&(r.exports=f)}()},{}],"/Users/qrohlf/Projects/trianglify/node_modules/seedrandom/seedrandom.js":[function(r,f){!function(e,f,n,t,a,o,c,i,u){function d(e){var r,f=e.length,n=this,a=0,o=n.i=n.j=0,c=n.S=[];for(f||(e=[f++]);t>a;)c[a]=a++;for(a=0;t>a;a++)c[a]=c[o=w&o+e[a%f]+(r=c[a])],c[o]=r;(n.g=function(e){for(var r,f=0,a=n.i,o=n.j,c=n.S;e--;)r=c[a=w&a+1],f=f*t+c[w&(c[a]=c[o=w&o+r])+(c[o]=r)];return n.i=a,n.j=o,f})(t)}function l(e,r){return r.i=e.i,r.j=e.j,r.S=e.S.slice(),r}function s(e,r){var f,n=[],t=typeof e;if(r&&"object"==t)for(f in e)try{n.push(s(e[f],r-1))}catch(a){}return n.length?n:"string"==t?e:e+"\x00"}function b(e,r){for(var f,n=e+"",t=0;t<n.length;)r[w&t]=w&(f^=19*r[w&t])+n.charCodeAt(t++);return g(r)}function h(r){try{return p?g(p.randomBytes(t)):(e.crypto.getRandomValues(r=new Uint8Array(t)),g(r))}catch(n){return[+new Date,e,(r=e.navigator)&&r.plugins,e.screen,g(f)]}}function g(e){return String.fromCharCode.apply(0,e)}var p,m=n.pow(t,a),y=n.pow(2,o),v=2*y,w=t-1,_=n["seed"+u]=function(e,r,o){var c=[];r=1==r?{entropy:!0}:r||{};var i=b(s(r.entropy?[e,g(f)]:null==e?h():e,3),c),p=new d(c);return b(g(p.S),f),(r.pass||o||function(e,r,f,t){return t&&(t.S&&l(t,p),e.state=function(){return l(p,{})}),f?(n[u]=e,r):e})(function(){for(var e=p.g(a),r=m,f=0;y>e;)e=(e+f)*t,r*=t,f=p.g(1);for(;e>=v;)e/=2,r/=2,f>>>=1;return(e+f)/r},i,"global"in r?r.global:this==n,r.state)};if(b(n[u](),f),c&&c.exports){c.exports=_;try{p=r("crypto")}catch(k){}}else i&&i.amd&&i(function(){return _})}(this,[],Math,256,6,52,"object"==typeof f&&f,"function"==typeof e&&e,"random")},{crypto:!1}]},{},["./lib/trianglify.js"])("./lib/trianglify.js")});