From 70809a0711fe300643133421ae48e27168c2dfd5 Mon Sep 17 00:00:00 2001 From: Alessandro Burato Date: Thu, 8 Sep 2016 17:27:23 +0200 Subject: [PATCH 1/2] - pie chart click now correctly adds curvenumber and trace info to evt data --- src/traces/pie/plot.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/traces/pie/plot.js b/src/traces/pie/plot.js index 18088fc43b1..b0730d90fd3 100644 --- a/src/traces/pie/plot.js +++ b/src/traces/pie/plot.js @@ -144,7 +144,8 @@ module.exports = function plot(gd, cdpie) { function handleClick() { gd._hoverdata = [pt]; - gd._hoverdata.trace = cd.trace; + pt.curveNumber = cd[0].trace.index; + gd._hoverdata.trace = cd[0].trace; Fx.click(gd, { target: true }); } From fdea20e388b716105d138748508ef268b2fbd030 Mon Sep 17 00:00:00 2001 From: Alessandro Burato Date: Mon, 12 Sep 2016 14:23:42 +0200 Subject: [PATCH 2/2] Fix for pie click args --- CHANGELOG.md | 7 +++++++ dist/README.md | 12 ++++++------ dist/plotly-cartesian.min.js | 8 ++++---- dist/plotly.min.js | 16 ++++++++-------- package.json | 2 +- src/assets/geo_assets.js | 2 +- src/core.js | 2 +- 7 files changed, 28 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f274e256b76..4bdd929c231 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,13 @@ https://github.com/plotly/plotly.js/compare/vX.Y.Z...master where X.Y.Z is the semver of most recent plotly.js release. +## [1.16.3-d16] -- 2016-09-08 + +### Changed +- Ale: fixed a bug where clicks on pie slices yielded a NULL trace in the event args. +- Added curveindex to pie click args. + + ## [1.16.3-d15] -- 2016-09-08 ### Changed diff --git a/dist/README.md b/dist/README.md index 4b714e1510c..a5297724fc4 100644 --- a/dist/README.md +++ b/dist/README.md @@ -36,11 +36,11 @@ The main plotly.js bundle includes all the official (non-beta) trace modules. It be can imported as minified javascript - using dist file `dist/plotly.min.js` -- using CDN URL https://cdn.plot.ly/plotly-plotly-latest.min.js OR https://cdn.plot.ly/plotly-plotly-1.16.3-d15.min.js +- using CDN URL https://cdn.plot.ly/plotly-plotly-latest.min.js OR https://cdn.plot.ly/plotly-plotly-1.16.3-d16.min.js or as raw javascript: - using dist file `dist/plotly.js` -- using CDN URL https://cdn.plot.ly/plotly-plotly-latest.js OR https://cdn.plot.ly/plotly-plotly-1.16.3-d15.js +- using CDN URL https://cdn.plot.ly/plotly-plotly-latest.js OR https://cdn.plot.ly/plotly-plotly-1.16.3-d16.js - using CommonJS with `require('plotly.js')` If you would like to have access to the attribute meta information (including attribute descriptions as on the [schema reference page](https://plot.ly/javascript/reference/)), use dist file `dist/plotly-with-meta.js` @@ -49,7 +49,7 @@ The main plotly.js bundle weights in at: | plotly.js | plotly.min.js | plotly.min.js + gzip | plotly-with-meta.js | |-----------|---------------|----------------------|---------------------| -| 3.9 MB | 1.6 MB | 499.8 kB | 4 MB | +| 3.9 MB | 1.6 MB | 499.9 kB | 4 MB | ## Partial bundles @@ -67,13 +67,13 @@ The `cartesian` partial bundle contains the `scatter`, `bar`, `box`, `heatmap`, | dist bundle (minified) | `dist/plotly-cartesian.min.js` | | CDN URL (latest) | https://cdn.plot.ly/plotly-cartesian-latest.js | | CDN URL (latest minified) | https://cdn.plot.ly/plotly-cartesian-latest.min.js | -| CDN URL (tagged) | https://cdn.plot.ly/plotly-cartesian-1.16.3-d15.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-cartesian-1.16.3-d15.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-cartesian-1.16.3-d16.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-cartesian-1.16.3-d16.min.js | | CommonJS | `require('plotly.js/lib/index-cartesian')` | | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 1.6 MB | 620.2 kB | 202 kB | +| 1.6 MB | 620.3 kB | 202 kB | ---------------- diff --git a/dist/plotly-cartesian.min.js b/dist/plotly-cartesian.min.js index 3633675b37d..39f995f8f01 100644 --- a/dist/plotly-cartesian.min.js +++ b/dist/plotly-cartesian.min.js @@ -1,5 +1,5 @@ /** -* plotly.js (cartesian - minified) v1.16.3-d15 +* plotly.js (cartesian - minified) v1.16.3-d16 * Copyright 2012-2016, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -13,7 +13,7 @@ E[0]=f[P],E[1]=d[N]}else ui.event.altKey&&(x=E.slice());M.style("pointer-events" valType:"enumerated",values:["paper",o.idRegex.x.toString()]},x:{valType:"number"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},yref:{valType:"enumerated",values:["paper",o.idRegex.y.toString()]},y:{valType:"number"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":101,"../../plots/cartesian/constants":129,"../../plots/font_attributes":142,"./arrow_paths":21}],23:[function(t,e,n){"use strict";function r(t,e){function n(e,n){return c.coerce(t,r,m.layoutAttributes,e,n)}var r={};n("opacity"),n("align"),n("bgcolor");var a=n("bordercolor"),o=f.opacity(a);n("borderpad");var i=n("borderwidth"),l=n("showarrow");l&&(n("arrowcolor",o?r.bordercolor:f.defaultLine),n("arrowhead"),n("arrowsize"),n("arrowwidth",2*(o&&i||1)),n("ax"),n("ay"),n("axref"),n("ayref"),c.noneOrAll(t,r,["ax","ay"])),n("text",l?" ":"new text"),n("textangle"),c.coerceFont(n,"font",e.font);for(var s=["x","y"],d=0;2>d;d++){var h=s[d],p={_fullLayout:e},g=u.coerceRef(t,r,p,h),v=u.coerceARef(t,r,p,h),y=.5;if("paper"!==g){var x=u.getFromId(p,g);if(y=x.range[0]+y*(x.range[1]-x.range[0]),-1!==["date","category"].indexOf(x.type)&&"string"==typeof t[h]){var b;if("date"===x.type){if(b=c.dateTime2ms(t[h]),b!==!1&&(t[h]=b),v===g){var _=c.dateTime2ms(t["a"+h]);_!==!1&&(t["a"+h]=_)}}else(x._categories||[]).length&&(b=x._categories.indexOf(t[h]),-1!==b&&(t[h]=b))}}n(h,y),l||n(h+"anchor")}return c.noneOrAll(t,r,["x","y"]),r}function a(t){var e=t._fullLayout;e.annotations.forEach(function(e){var n=u.getFromId(t,e.xref),r=u.getFromId(t,e.yref);if(n||r){var a=(e._xsize||0)/2,o=e._xshift||0,i=(e._ysize||0)/2,l=e._yshift||0,s=a-o,c=a+o,f=i-l,d=i+l;if(e.showarrow){var h=3*e.arrowsize*e.arrowwidth;s=Math.max(s,h),c=Math.max(c,h),f=Math.max(f,h),d=Math.max(d,h)}n&&n.autorange&&u.expand(n,[n.l2c(e.x)],{ppadplus:c,ppadminus:s}),r&&r.autorange&&u.expand(r,[r.l2c(e.y)],{ppadplus:d,ppadminus:f})}})}function o(t,e,n,r,a,o,i,l){var s=n-t,c=a-t,u=i-a,f=r-e,d=o-e,h=l-o,p=s*h-u*f;if(0===p)return null;var g=(c*h-u*d)/p,m=(c*f-s*d)/p;return 0>m||m>1||0>g||g>1?null:{x:t+s*g,y:e+f*g}}var i=t("d3"),l=t("fast-isnumeric"),s=t("../../plotly"),c=t("../../lib"),u=t("../../plots/cartesian/axes"),f=t("../color"),d=t("../drawing"),h=t("../../lib/svg_text_utils"),p=t("../../lib/setcursor"),g=t("../dragelement"),m=e.exports={};m.ARROWPATHS=t("./arrow_paths"),m.layoutAttributes=t("./attributes"),m.supplyLayoutDefaults=function(t,e){for(var n=t.annotations||[],a=e.annotations=[],o=0;ot?"left":t>2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}tt.selectAll("tspan.line").attr({y:0,x:0});var r=G.select(".annotation-math-group"),a=!r.empty(),l=d.bBox((a?r:tt).node()),h=l.width,v=l.height,y=Math.round(h+2*W),x=Math.round(v+2*W);B._w=h,B._h=v;var b=!1;if(["x","y"].forEach(function(e){var r,a=B[e+"ref"]||e,o=u.getFromId(t,a),i=(U+("x"===e?0:90))*Math.PI/180,l=y*Math.abs(Math.cos(i))+x*Math.abs(Math.sin(i)),s=B[e+"anchor"];if(o){if(!o.autorange&&(B[e]-o.range[0])*(B[e]-o.range[1])>0&&(B["a"+e+"ref"]===a?(B["a"+e]-o.range[0])*(B["a"+e]-o.range[1])>0&&(b=!0):b=!0,b))return;Z[e]=o._offset+o.l2p(B[e]),r=.5}else r=B[e],"y"===e&&(r=1-r),Z[e]="x"===e?S.l+S.w*r:S.t+S.h*r;var c=0;B["a"+e+"ref"]===a?Z["aa"+e]=o._offset+o.l2p(B["a"+e]):(c=B.showarrow?B["a"+e]:l*n(r,s),Z[e]+=c),B["_"+e+"type"]=o&&o.type,B["_"+e+"size"]=l,B["_"+e+"shift"]=c}),b)return void G.remove();var w,k;B.showarrow&&(w=B.axref===B.xref?Z.x:c.constrain(Z.x-B.ax,1,_.width-1),k=B.ayref===B.yref?Z.y:c.constrain(Z.y-B.ay,1,_.height-1)),Z.x=c.constrain(Z.x,1,_.width-1),Z.y=c.constrain(Z.y,1,_.height-1);var M=W-l.top,A=W-l.left;a?r.select("svg").attr({x:W-1,y:W}):(tt.attr({x:A,y:M}),tt.selectAll("tspan.line").attr({y:M,x:A})),J.call(d.setRect,$/2,$/2,y-$,x-$);var T=0,L=0;T=B.axref===B.xref?Math.round(Z.aax-y/2):Math.round(Z.x-y/2),L=B.ayref===B.yref?Math.round(Z.aay-x/2):Math.round(Z.y-x/2),G.call(c.setTranslate,T,L);var z="annotations["+e+"]",C=function(n,r){i.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var a,l;a=B.axref===B.xref?Z.aax+n:Z.x+n,l=B.ayref===B.yref?Z.aay+r:Z.y+r;var u=c.rotationXYMatrix(U,a,l),d=c.apply2DTransform(u),h=c.apply2DTransform2(u),p=J.attr("width")/2,v=J.attr("height")/2,y=[[a-p,l-v,a-p,l+v],[a-p,l+v,a+p,l+v],[a+p,l+v,a+p,l-v],[a+p,l-v,a-p,l-v]].map(h);if(!y.reduce(function(t,e){return t^!!o(w,k,w+1e6,k+1e6,e[0],e[1],e[2],e[3])},!1)){y.forEach(function(t){var e=o(a,l,w,k,t[0],t[1],t[2],t[3]);e&&(a=e.x,l=e.y)});var x=B.arrowwidth,b=B.arrowcolor,_=Y.append("g").style({opacity:f.opacity(b)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),M=_.append("path").attr("d","M"+a+","+l+"L"+w+","+k).style("stroke-width",x+"px").call(f.stroke,f.rgb(b));m.arrowhead(M,B.arrowhead,"end",B.arrowsize);var A=_.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(a-w)+","+(l-k),transform:"translate("+w+","+k+")"}).style("stroke-width",x+6+"px").call(f.stroke,"rgba(0,0,0,0)").call(f.fill,"rgba(0,0,0,0)");if(t._context.editable){var T,L,C;g.init({element:A.node(),prepFn:function(){var t=c.getTranslate(G);L=t.x,C=t.y,T={},H&&H.autorange&&(T[H._name+".autorange"]=!0),V&&V.autorange&&(T[V._name+".autorange"]=!0)},moveFn:function(t,e){_.attr("transform","translate("+t+","+e+")");var n=d(L,C),r=n[0]+t,a=n[1]+e;G.call(c.setTranslate,r,a),T[z+".x"]=H?B.x+t/H._m:(w+t-S.l)/S.w,T[z+".y"]=V?B.y+e/V._m:1-(k+e-S.t)/S.h,B.axref===B.xref&&(T[z+".ax"]=H?B.ax+t/H._m:(w+t-S.l)/S.w),B.ayref===B.yref&&(T[z+".ay"]=V?B.ay+e/V._m:1-(k+e-S.t)/S.h),X.attr({transform:"rotate("+U+","+r+","+a+")"})},doneFn:function(e){if(e){s.relayout(t,T);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}};B.showarrow&&C(0,0);var E=c.rotationXYMatrix(U,Z.x,Z.y),O=c.apply2DTransform(E);if(t._context.editable){var P,N,D;g.init({element:G.node(),prepFn:function(){var t=c.getTranslate(G);P=t.x,N=t.y,D={}},moveFn:function(t,e){G.call(c.setTranslate,P+t,N+e);var n="pointer";if(B.showarrow)B.axref===B.xref?D[z+".ax"]=H.p2l(H.l2p(B.ax)+t):D[z+".ax"]=B.ax+t,B.ayref===B.yref?D[z+".ay"]=V.p2l(V.l2p(B.ay)+e):D[z+".ay"]=B.ay+e,C(t,e);else{if(H)D[z+".x"]=B.x+t/H._m;else{var r=B._xsize/S.w,a=B.x+B._xshift/S.w-r/2;D[z+".x"]=g.align(a+t/S.w,r,0,1,B.xanchor)}if(V)D[z+".y"]=B.y+e/V._m;else{var o=B._ysize/S.h,i=B.y-B._yshift/S.h-o/2;D[z+".y"]=g.align(i-e/S.h,o,0,1,B.yanchor)}H&&V||(n=g.getCursor(H?.5:D[z+".x"],V?.5:D[z+".y"],B.xanchor,B.yanchor))}var l=O(P,N),s=l[0]+t,u=l[1]+e;G.call(c.setTranslate,P+t,N+e),X.attr({transform:"rotate("+U+","+s+","+u+")"}),p(G,n)},doneFn:function(e){if(p(G),e){s.relayout(t,D);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}var x,b=t.layout,_=t._fullLayout;if(!l(e)||-1===e){if(!e&&Array.isArray(a))return b.annotations=a,m.supplyLayoutDefaults(b,_),void m.drawAll(t);if("remove"===a)return delete b.annotations,_.annotations=[],void m.drawAll(t);if(n&&"add"!==a){for(x=0;x<_.annotations.length;x++)m.draw(t,x,n,a);return}e=_.annotations.length,_.annotations.push({})}if(!n&&a){if("remove"===a){for(_._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove(),_.annotations.splice(e,1),b.annotations.splice(e,1),x=e;x<_.annotations.length;x++)_._infolayer.selectAll('.annotation[data-index="'+(x+1)+'"]').attr("data-index",String(x)),m.draw(t,x);return}if("add"===a||c.isPlainObject(a)){_.annotations.splice(e,0,{});var w=c.isPlainObject(a)?c.extendFlat({},a):{text:"New text"};for(b.annotations?b.annotations.splice(e,0,w):b.annotations=[w],x=_.annotations.length-1;x>e;x--)_._infolayer.selectAll('.annotation[data-index="'+(x-1)+'"]').attr("data-index",String(x)),m.draw(t,x)}}_._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var k=b.annotations[e],M=_.annotations[e];if(k){var A={xref:k.xref,yref:k.yref},T={};"string"==typeof n&&n?T[n]=a:c.isPlainObject(n)&&(T=n);var L=Object.keys(T);for(x=0;xx;x++){var E=C[x];if(void 0===T[E]&&void 0!==k[E]){var O=u.getFromId(t,u.coerceRef(A,{},t,E)),P=u.getFromId(t,u.coerceRef(k,{},t,E)),N=k[E],D=M["_"+E+"type"];if(void 0!==T[E+"ref"]){var I="auto"===k[E+"anchor"],R="x"===E?S.w:S.h,j=(M["_"+E+"size"]||0)/(2*R);if(O&&P)N=(N-O.range[0])/(O.range[1]-O.range[0]),N=P.range[0]+N*(P.range[1]-P.range[0]);else if(O){if(N=(N-O.range[0])/(O.range[1]-O.range[0]),N=O.domain[0]+N*(O.domain[1]-O.domain[0]),I){var F=N+j,q=N-j;2/3>N+q?N=q:N+F>4/3&&(N=F)}}else P&&(I&&(1/3>N?N+=j:N>2/3&&(N-=j)),N=(N-P.domain[0])/(P.domain[1]-P.domain[0]),N=P.range[0]+N*(P.range[1]-P.range[0]))}P&&P===O&&D&&("log"===D&&"log"!==P.type?N=Math.pow(10,N):"log"!==D&&"log"===P.type&&(N=N>0?Math.log(N)/Math.LN10:void 0)),k[E]=N}}var B=r(k,_);_.annotations[e]=B;var H=u.getFromId(t,B.xref),V=u.getFromId(t,B.yref),Z={x:0,y:0},U=+B.textangle||0,Y=_._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",B.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:k,fullAnnotation:B})}),X=Y.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),G=X.append("g"),$=B.borderwidth,Q=B.borderpad,W=$+Q,J=G.append("rect").attr("class","bg").style("stroke-width",$+"px").call(f.stroke,B.bordercolor).call(f.fill,B.bgcolor),K=B.font,tt=G.append("text").classed("annotation",!0).attr("data-unformatted",B.text).text(B.text);t._context.editable?tt.call(h.makeEditable,G).call(v).on("edit",function(n){B.text=n,this.attr({"data-unformatted":B.text}),this.call(v);var r={};r["annotations["+e+"].text"]=B.text,H&&H.autorange&&(r[H._name+".autorange"]=!0),V&&V.autorange&&(r[V._name+".autorange"]=!0),s.relayout(t,r)}):tt.call(v),X.attr({transform:"rotate("+U+","+Z.x+","+Z.y+")"}).call(d.setPosition,Z.x,Z.y)}},m.arrowhead=function(t,e,n,r){l(r)||(r=1);var a=t.node(),o=m.ARROWPATHS[e||0];if(o){"string"==typeof n&&n||(n="end");var s,c,u,h,p=(d.getPx(t,"stroke-width")||1)*r,g=t.style("stroke")||f.defaultLine,v=t.style("stroke-opacity")||1,y=n.indexOf("start")>=0,x=n.indexOf("end")>=0,b=o.backoff*p;if("line"===a.nodeName){if(s={x:+t.attr("x1"),y:+t.attr("y1")},c={x:+t.attr("x2"),y:+t.attr("y2")},u=Math.atan2(s.y-c.y,s.x-c.x),h=u+Math.PI,b){var _=b*Math.cos(u),w=b*Math.sin(u);y&&(s.x-=_,s.y-=w,t.attr({x1:s.x,y1:s.y})),x&&(c.x+=_,c.y+=w,t.attr({x2:c.x,y2:c.y}))}}else if("path"===a.nodeName){var k=a.getTotalLength(),M="";if(y){var A=a.getPointAtLength(0),T=a.getPointAtLength(.1);u=Math.atan2(A.y-T.y,A.x-T.x),s=a.getPointAtLength(Math.min(b,k)),b&&(M="0px,"+b+"px,")}if(x){var L=a.getPointAtLength(k),z=a.getPointAtLength(k-.1);if(h=Math.atan2(L.y-z.y,L.x-z.x),c=a.getPointAtLength(Math.max(0,k-b)),b){var S=M?2*b:b;M+=k-S+"px,"+k+"px"}}else M&&(M+=k+"px");M&&t.style("stroke-dasharray",M)}var C=function(n,r){e>5&&(r=0),i.select(a.parentElement).append("path").attr({"class":t.attr("class"),d:o.path,transform:"translate("+n.x+","+n.y+")rotate("+180*r/Math.PI+")scale("+p+")"}).style({fill:g,opacity:v,"stroke-width":0})};y&&C(s,u),x&&C(c,h)}},m.calcAutorange=function(t){var e=t._fullLayout,n=e.annotations;if(n.length&&t._fullData.length){var r={};n.forEach(function(t){r[t.xref]=!0,r[t.yref]=!0});var o=u.list(t).filter(function(t){return t.autorange&&r[t._id]});if(o.length)return c.syncOrAsync([m.drawAll,a],t)}}},{"../../lib":103,"../../lib/setcursor":112,"../../lib/svg_text_utils":114,"../../plotly":121,"../../plots/cartesian/axes":124,"../color":25,"../dragelement":46,"../drawing":48,"./arrow_paths":21,"./attributes":22,d3:14,"fast-isnumeric":17}],24:[function(t,e,n){"use strict";n.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],n.defaultLine="#444",n.lightLine="#eee",n.background="#fff",n.borderLine="#BEC8D9",n.lightFraction=1e3/11},{}],25:[function(t,e,n){"use strict";function r(t){if(o(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var n=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!n)return t;var r=n[1].trim().split(/\s*[\s,]\s*/),a="a"===e.charAt(3)&&4===r.length;if(!a&&3!==r.length)return t;for(var i=0;i=0))return t;if(3===i)r[i]>1&&(r[i]=1);else if(r[i]>=1)return t}var l=Math.round(255*r[0])+", "+Math.round(255*r[1])+", "+Math.round(255*r[2]);return a?"rgba("+l+", "+r[3]+")":"rgb("+l+")"}var a=t("tinycolor2"),o=t("fast-isnumeric"),i=e.exports={},l=t("./attributes");i.defaults=l.defaults,i.defaultLine=l.defaultLine,i.lightLine=l.lightLine,i.background=l.background,i.overrideDefaults=function(t){i.defaults=t},i.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},i.rgb=function(t){return i.tinyRGB(a(t))},i.opacity=function(t){return t?a(t).getAlpha():0},i.addOpacity=function(t,e){var n=a(t).toRgb();return"rgba("+Math.round(n.r)+", "+Math.round(n.g)+", "+Math.round(n.b)+", "+e+")"},i.combine=function(t,e){var n=a(t).toRgb();if(1===n.a)return a(t).toRgbString();var r=a(e||i.background).toRgb(),o=1===r.a?r:{r:255*(1-r.a)+r.r*r.a,g:255*(1-r.a)+r.g*r.a,b:255*(1-r.a)+r.b*r.a},l={r:o.r*(1-n.a)+n.r*n.a,g:o.g*(1-n.a)+n.g*n.a,b:o.b*(1-n.a)+n.b*n.a};return a(l).toRgbString()},i.contrast=function(t,e,n){var r=a(t),o=r.isLight()?r.darken(n):r.lighten(e);return o.toString()},i.stroke=function(t,e){var n=a(e);t.style({stroke:i.tinyRGB(n),"stroke-opacity":n.getAlpha()})},i.fill=function(t,e){var n=a(e);t.style({fill:i.tinyRGB(n),"fill-opacity":n.getAlpha()})},i.clean=function(t){if(t&&"object"==typeof t){var e,n,a,o,l=Object.keys(t);for(e=0;es&&(o[1]-=(it-s)/2)):n.node()&&!n.classed("js-placeholder")&&(it=d.bBox(e.node()).height),it){if(it+=5,"top"===b.titleside)J.domain[1]-=it/A.h,o[1]*=-1;else{J.domain[0]+=it/A.h;var u=Math.max(1,n.selectAll("tspan.line").size());o[1]+=(1-u)*s}e.attr("transform","translate("+o+")"),J.setScale()}}at.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(A.h*(1-J.domain[1]))+")");var f=at.select(".cbfills").selectAll("rect.cbfill").data(S);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var n=[0===e?L[0]:(S[e]+S[e-1])/2,e===S.length-1?L[1]:(S[e]+S[e+1])/2].map(J.c2p).map(Math.round);e!==S.length-1&&(n[1]+=n[1]>n[0]?1:-1);var o=E(t).replace("e-",""),i=a(o).toHexString();r.select(this).attr({x:Y,width:Math.max(F,2),y:r.min(n),height:Math.max(r.max(n)-r.min(n),2),fill:i})});var h=at.select(".cblines").selectAll("path.cbline").data(b.line.color&&b.line.width?z:[]);return h.enter().append("path").classed("cbline",!0),h.exit().remove(),h.each(function(t){r.select(this).attr("d","M"+Y+","+(Math.round(J.c2p(t))+b.line.width/2%1)+"h"+F).call(d.lineGroupStyle,b.line.width,C(t),b.line.dash)}),J._axislayer.selectAll("g."+J._id+"tick,path").remove(),J._pos=Y+F+(b.outlinewidth||0)/2-("outside"===b.ticks?1:0),J.side="right",c.syncOrAsync([function(){return l.doTicks(t,J,!0)},function(){if(-1===["top","bottom"].indexOf(b.titleside)){var e=J.titlefont.size,n=J._offset+J._length/2,a=A.l+(J.position||0)*A.w+("right"===J.side?10+e*(J.showticklabels?1:.5):-10-e*(J.showticklabels?.5:0));w("h"+J._id+"title",{avoid:{selection:r.select(t).selectAll("g."+J._id+"tick"),side:b.titleside,offsetLeft:A.l,offsetTop:A.t,maxShift:M.width},attributes:{x:a,y:n,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function w(e,n){var r,a=x();r=i.traceIs(a,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var o={propContainer:J,propName:r,traceIndex:a.index,dfltName:"colorscale",containerGroup:at.select(".cbtitle")},l="h"===e.charAt(0)?e.substr(1):"h"+e;at.selectAll("."+l+",."+l+"-math-group").remove(),p.draw(t,e,u(o,n||{}))}function k(){var n=F+b.outlinewidth/2+d.bBox(J._axislayer.node()).width;if(I=ot.select("text"),I.node()&&!I.classed("js-placeholder")){var r,a=ot.select(".h"+J._id+"title-math-group").node();r=a&&-1!==["top","bottom"].indexOf(b.titleside)?d.bBox(a).width:d.bBox(ot.node()).right-Y-A.l,n=Math.max(n,r)}var o=2*b.xpad+n+b.borderwidth+b.outlinewidth/2,l=$-Q;at.select(".cbbg").attr({x:Y-b.xpad-(b.borderwidth+b.outlinewidth)/2,y:Q-Z,width:Math.max(o,2),height:Math.max(l+2*Z,2)}).call(h.fill,b.bgcolor).call(h.stroke,b.bordercolor).style({"stroke-width":b.borderwidth}),at.selectAll(".cboutline").attr({x:Y,y:Q+b.ypad+("top"===b.titleside?it:0),width:Math.max(F,2),height:Math.max(l-2*b.ypad-it,2)}).call(h.stroke,b.outlinecolor).style({fill:"None","stroke-width":b.outlinewidth});var s=({center:.5,right:1}[b.xanchor]||0)*o;at.attr("transform","translate("+(A.l-s)+","+A.t+")"),i.autoMargin(t,e,{x:b.x,y:b.y,l:o*({right:1,center:.5}[b.xanchor]||0),r:o*({left:1,center:.5}[b.xanchor]||0),t:l*({bottom:1,middle:.5}[b.yanchor]||0),b:l*({top:1,middle:.5}[b.yanchor]||0)})}var M=t._fullLayout,A=M._size;if("function"!=typeof b.fillcolor&&"function"!=typeof b.line.color)return void M._infolayer.selectAll("g."+e).remove();var T,L=r.extent(("function"==typeof b.fillcolor?b.fillcolor:b.line.color).domain()),z=[],S=[],C="function"==typeof b.line.color?b.line.color:function(){return b.line.color},E="function"==typeof b.fillcolor?b.fillcolor:function(){return b.fillcolor},O=b.levels.end+b.levels.size/100,P=b.levels.size,N=1.001*L[0]-.001*L[1],D=1.001*L[1]-.001*L[0];for(T=b.levels.start;0>(T-O)*P;T+=P)T>N&&D>T&&z.push(T);if("function"==typeof b.fillcolor)if(b.filllevels)for(O=b.filllevels.end+b.filllevels.size/100,P=b.filllevels.size,T=b.filllevels.start;0>(T-O)*P;T+=P)T>L[0]&&T1){var rt=Math.pow(10,Math.floor(Math.log(nt)/Math.LN10));tt*=rt*c.roundUp(nt/rt,[2,5,10]),(Math.abs(b.levels.start)/b.levels.size+1e-6)%1<2e-6&&(J.tick0=0)}J.dtick=tt}J.domain=[G+U,G+H-U],J.setScale();var at=M._infolayer.selectAll("g."+e).data([0]);at.enter().append("g").classed(e,!0).each(function(){var t=r.select(this);t.append("rect").classed("cbbg",!0),t.append("g").classed("cbfills",!0),t.append("g").classed("cblines",!0),t.append("g").classed("cbaxis",!0).classed("crisp",!0),t.append("g").classed("cbtitleunshift",!0).append("g").classed("cbtitle",!0),t.append("rect").classed("cboutline",!0),t.select(".cbtitle").datum(0)}),at.attr("transform","translate("+Math.round(A.l)+","+Math.round(A.t)+")");var ot=at.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(A.l)+",-"+Math.round(A.t)+")");J._axislayer=at.select(".cbaxis");var it=0;if(-1!==["top","bottom"].indexOf(b.titleside)){var lt,st=A.l+(b.x+V)*A.w,ct=J.titlefont.size;lt="top"===b.titleside?(1-(G+H-U))*A.h+A.t+3+.75*ct:(1-(G+U))*A.h+A.t-3-.25*ct,w(J._id+"title",{attributes:{x:st,y:lt,"text-anchor":"start"}})}var ut=c.syncOrAsync([i.previousPromises,_,i.previousPromises,k],t);if(ut&&ut.then&&(t._promises||[]).push(ut),t._context.editable){var ft,dt,ht;s.init({element:at.node(),prepFn:function(){ft=at.attr("transform"),f(at)},moveFn:function(t,e){at.attr("transform",ft+" translate("+t+","+e+")"),dt=s.align(X+t/A.w,q,0,1,b.xanchor),ht=s.align(G-e/A.h,H,0,1,b.yanchor);var n=s.getCursor(dt,ht,b.xanchor,b.yanchor);f(at,n)},doneFn:function(e){f(at),e&&void 0!==dt&&void 0!==ht&&o.restyle(t,{"colorbar.x":dt,"colorbar.y":ht},x().index)}})}return ut}function x(){var n,r,a=e.substr(2);for(n=0;nu*f?a.RdBu:u>=0?a.Reds:a.Blues,s.colorscale=d,l.reversescale&&(d=o(d)),l.colorscale=d)}},{"../../lib":103,"./flip_scale":36,"./scales":43}],33:[function(t,e,n){"use strict";var r=t("./attributes"),a=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:a({},r.colorscale,{}),cauto:a({},r.zauto,{}),cmax:a({},r.zmax,{}),cmin:a({},r.zmin,{}),autocolorscale:a({},r.autocolorscale,{}),reversescale:a({},r.reversescale,{})}}},{"../../lib/extend":101,"./attributes":31,"./scales.js":43}],34:[function(t,e,n){"use strict";var r=t("./scales");e.exports=r.RdBu},{"./scales":43}],35:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("../colorbar/has_colorbar"),i=t("../colorbar/defaults"),l=t("./is_valid_scale"),s=t("./flip_scale");e.exports=function(t,e,n,c,u){var f=u.prefix,d=u.cLetter,h=f.slice(0,f.length-1),p=f?a.nestedProperty(t,h).get()||{}:t,g=f?a.nestedProperty(e,h).get()||{}:e,m=p[d+"min"],v=p[d+"max"],y=p.colorscale,x=r(m)&&r(v)&&v>m;c(f+d+"auto",!x),c(f+d+"min"),c(f+d+"max");var b;void 0!==y&&(b=!l(y)),c(f+"autocolorscale",b);var _=c(f+"colorscale"),w=c(f+"reversescale");if(w&&(g.colorscale=s(_)),"marker.line."!==f){var k;f&&(k=o(p));var M=c(f+"showscale",k);M&&i(p,g,n)}}},{"../../lib":103,"../colorbar/defaults":27,"../colorbar/has_colorbar":29,"./flip_scale":36,"./is_valid_scale":40,"fast-isnumeric":17}],36:[function(t,e,n){"use strict";e.exports=function(t){for(var e,n=t.length,r=new Array(n),a=n-1,o=0;a>=0;a--,o++)e=t[a],r[o]=[1-e[0],e[1]];return r}},{}],37:[function(t,e,n){"use strict";var r=t("./scales"),a=t("./default_scale"),o=t("./is_valid_scale_array");e.exports=function(t,e){function n(){try{t=r[t]||JSON.parse(t)}catch(n){t=e}}return e||(e=a),t?("string"==typeof t&&(n(),"string"==typeof t&&n()),o(t)?t:e):e}},{"./default_scale":34,"./is_valid_scale_array":41,"./scales":43}],38:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("./is_valid_scale");e.exports=function(t,e){var n=e?a.nestedProperty(t,e).get()||{}:t,i=n.color,l=!1;if(Array.isArray(i))for(var s=0;sd;d++)s=t[d],u[d]=e+s[0]*(n-e),f[d]=a(s[1]).toRgb();var h=r.scale.linear().domain(u).interpolate(r.interpolateObject).range(f);return function(t){if(o(t)){var r=i.constrain(t,e,n),s=h(r);return a(s).toRgbString()}return a(t).isValid()?t:l.defaultLine}}},{"../../lib":103,"../color":25,d3:14,"fast-isnumeric":17,tinycolor2:20}],43:[function(t,e,n){"use strict";e.exports={Greys:[[0,"rgb(0,0,0)"],[1,"rgb(255,255,255)"]],YlGnBu:[[0,"rgb(8,29,88)"],[.125,"rgb(37,52,148)"],[.25,"rgb(34,94,168)"],[.375,"rgb(29,145,192)"],[.5,"rgb(65,182,196)"],[.625,"rgb(127,205,187)"],[.75,"rgb(199,233,180)"],[.875,"rgb(237,248,217)"],[1,"rgb(255,255,217)"]],Greens:[[0,"rgb(0,68,27)"],[.125,"rgb(0,109,44)"],[.25,"rgb(35,139,69)"],[.375,"rgb(65,171,93)"],[.5,"rgb(116,196,118)"],[.625,"rgb(161,217,155)"],[.75,"rgb(199,233,192)"],[.875,"rgb(229,245,224)"],[1,"rgb(247,252,245)"]],YlOrRd:[[0,"rgb(128,0,38)"],[.125,"rgb(189,0,38)"],[.25,"rgb(227,26,28)"],[.375,"rgb(252,78,42)"],[.5,"rgb(253,141,60)"],[.625,"rgb(254,178,76)"],[.75,"rgb(254,217,118)"],[.875,"rgb(255,237,160)"],[1,"rgb(255,255,204)"]], Bluered:[[0,"rgb(0,0,255)"],[1,"rgb(255,0,0)"]],RdBu:[[0,"rgb(5,10,172)"],[.35,"rgb(106,137,247)"],[.5,"rgb(190,190,190)"],[.6,"rgb(220,170,132)"],[.7,"rgb(230,145,90)"],[1,"rgb(178,10,28)"]],Reds:[[0,"rgb(220,220,220)"],[.2,"rgb(245,195,157)"],[.4,"rgb(245,160,105)"],[1,"rgb(178,10,28)"]],Blues:[[0,"rgb(5,10,172)"],[.35,"rgb(40,60,190)"],[.5,"rgb(70,100,245)"],[.6,"rgb(90,120,245)"],[.7,"rgb(106,137,247)"],[1,"rgb(220,220,220)"]],Picnic:[[0,"rgb(0,0,255)"],[.1,"rgb(51,153,255)"],[.2,"rgb(102,204,255)"],[.3,"rgb(153,204,255)"],[.4,"rgb(204,204,255)"],[.5,"rgb(255,255,255)"],[.6,"rgb(255,204,255)"],[.7,"rgb(255,153,255)"],[.8,"rgb(255,102,204)"],[.9,"rgb(255,102,102)"],[1,"rgb(255,0,0)"]],Rainbow:[[0,"rgb(150,0,90)"],[.125,"rgb(0,0,200)"],[.25,"rgb(0,25,255)"],[.375,"rgb(0,152,255)"],[.5,"rgb(44,255,150)"],[.625,"rgb(151,255,0)"],[.75,"rgb(255,234,0)"],[.875,"rgb(255,111,0)"],[1,"rgb(255,0,0)"]],Portland:[[0,"rgb(12,51,131)"],[.25,"rgb(10,136,186)"],[.5,"rgb(242,211,56)"],[.75,"rgb(242,143,56)"],[1,"rgb(217,30,30)"]],Jet:[[0,"rgb(0,0,131)"],[.125,"rgb(0,60,170)"],[.375,"rgb(5,255,255)"],[.625,"rgb(255,255,0)"],[.875,"rgb(250,0,0)"],[1,"rgb(128,0,0)"]],Hot:[[0,"rgb(0,0,0)"],[.3,"rgb(230,0,0)"],[.6,"rgb(255,210,0)"],[1,"rgb(255,255,255)"]],Blackbody:[[0,"rgb(0,0,0)"],[.2,"rgb(230,0,0)"],[.4,"rgb(230,210,0)"],[.7,"rgb(255,255,255)"],[1,"rgb(160,200,255)"]],Earth:[[0,"rgb(0,0,130)"],[.1,"rgb(0,180,180)"],[.2,"rgb(40,210,40)"],[.4,"rgb(230,230,50)"],[.6,"rgb(120,70,20)"],[1,"rgb(255,255,255)"]],Electric:[[0,"rgb(0,0,0)"],[.15,"rgb(30,0,100)"],[.4,"rgb(120,0,100)"],[.6,"rgb(160,90,0)"],[.8,"rgb(230,200,0)"],[1,"rgb(255,250,220)"]],Viridis:[[0,"#440154"],[.06274509803921569,"#48186a"],[.12549019607843137,"#472d7b"],[.18823529411764706,"#424086"],[.25098039215686274,"#3b528b"],[.3137254901960784,"#33638d"],[.3764705882352941,"#2c728e"],[.4392156862745098,"#26828e"],[.5019607843137255,"#21918c"],[.5647058823529412,"#1fa088"],[.6274509803921569,"#28ae80"],[.6901960784313725,"#3fbc73"],[.7529411764705882,"#5ec962"],[.8156862745098039,"#84d44b"],[.8784313725490196,"#addc30"],[.9411764705882353,"#d8e219"],[1,"#fde725"]]}},{}],44:[function(t,e,n){"use strict";e.exports=function(t,e,n,r,a){var o=(t-n)/(r-n),i=o+e/(r-n),l=(o+i)/2;return"left"===a||"bottom"===a?o:"center"===a||"middle"===a?l:"right"===a||"top"===a?i:2/3-l>o?o:i>4/3-l?i:l}},{}],45:[function(t,e,n){"use strict";var r=t("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,n,o){return t="left"===n?0:"center"===n?1:"right"===n?2:r.constrain(Math.floor(3*t),0,2),e="bottom"===o?0:"middle"===o?1:"top"===o?2:r.constrain(Math.floor(3*e),0,2),a[e][t]}},{"../../lib":103}],46:[function(t,e,n){"use strict";function r(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function a(t){t._dragging=!1,t._replotPending&&o.plot(t)}var o=t("../../plotly"),i=t("../../lib"),l=t("../../plots/cartesian/constants"),s=e.exports={};s.align=t("./align"),s.getCursor=t("./cursor");var c=t("./unhover");s.unhover=c.wrapped,s.unhoverRaw=c.raw,s.init=function(t){function e(e){return t.element.onmousemove=p,g._dragged=!1,g._dragging=!0,c=e.clientX,u=e.clientY,h=e.target,f=(new Date).getTime(),f-g._mouseDownTimev&&(m=Math.max(m-1,1)),t.doneFn&&t.doneFn(g._dragged,m),!g._dragged){var n=document.createEvent("MouseEvents");n.initEvent("click",!0,!0),h.dispatchEvent(n)}return a(g),g._dragged=!1,i.pauseEvent(e)}var c,u,f,d,h,p,g=i.getPlotDiv(t.element)||{},m=1,v=l.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),p=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"}},{"../../lib":103,"../../plotly":121,"../../plots/cartesian/constants":129,"./align":44,"./cursor":45,"./unhover":47}],47:[function(t,e,n){"use strict";var r=t("../../lib/events"),a=e.exports={};a.wrapped=function(t,e,n){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),a.raw(t,e,n)},a.raw=function(t,e){var n=t._fullLayout;e||(e={}),e.target&&r.triggerHandler(t,"plotly_beforehover",e)===!1||(n._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":100}],48:[function(t,e,n){"use strict";function r(t,e,n,r){var o=t[0]-e[0],i=t[1]-e[1],l=n[0]-e[0],s=n[1]-e[1],c=Math.pow(o*o+i*i,b/2),u=Math.pow(l*l+s*s,b/2),f=(u*u*o-c*c*l)*r,d=(u*u*i-c*c*s)*r,h=3*u*(c+u),p=3*c*(c+u);return[[a.round(e[0]+(h&&f/h),2),a.round(e[1]+(h&&d/h),2)],[a.round(e[0]-(p&&f/p),2),a.round(e[1]-(p&&d/p),2)]]}var a=t("d3"),o=t("fast-isnumeric"),i=t("../../plots/plots"),l=t("../color"),s=t("../colorscale"),c=t("../../lib"),u=t("../../lib/svg_text_utils"),f=t("../../constants/xmlns_namespaces"),d=t("../../traces/scatter/subtypes"),h=t("../../traces/scatter/make_bubble_size_func"),p=e.exports={};p.font=function(t,e,n,r){e&&e.family&&(r=e.color,n=e.size,e=e.family),e&&t.style("font-family",e),n+1&&t.style("font-size",n+"px"),r&&t.call(l.fill,r)},p.setPosition=function(t,e,n){t.attr("x",e).attr("y",n)},p.setSize=function(t,e,n){t.attr("width",e).attr("height",n)},p.setRect=function(t,e,n,r,a){t.call(p.setPosition,e,n).call(p.setSize,r,a)},p.translatePoints=function(t,e,n){t.each(function(t){var r=t.xp||e.c2p(t.x),i=t.yp||n.c2p(t.y),l=a.select(this);o(r)&&o(i)?"text"===this.nodeName?l.attr("x",r).attr("y",i):l.attr("transform","translate("+r+","+i+")"):l.remove()})},p.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},p.crispRound=function(t,e,n){return e&&o(e)?t._context.staticPlot?e:1>e?1:Math.round(e):n||0},p.lineGroupStyle=function(t,e,n,r){t.style("fill","none").each(function(t){var o=(((t||[])[0]||{}).trace||{}).line||{},i=e||o.width||0,s=r||o.dash||"";a.select(this).call(l.stroke,n||o.color).call(p.dashLine,s,i)})},p.dashLine=function(t,e,n){var r=Math.max(n,3);"solid"===e?e="":"dot"===e?e=r+"px,"+r+"px":"dash"===e?e=3*r+"px,"+3*r+"px":"longdash"===e?e=5*r+"px,"+5*r+"px":"dashdot"===e?e=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===e&&(e=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t.style({"stroke-dasharray":e,"stroke-width":n+"px"})},p.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var n=a.select(this);try{n.call(l.fill,e[0].trace.fillcolor)}catch(r){c.error(r,t),n.remove()}})};var g=t("./symbol_defs");p.symbolNames=[],p.symbolFuncs=[],p.symbolNeedLines={},p.symbolNoDot={},p.symbolList=[],Object.keys(g).forEach(function(t){var e=g[t];p.symbolList=p.symbolList.concat([e.n,t,e.n+100,t+"-open"]),p.symbolNames[e.n]=t,p.symbolFuncs[e.n]=e.f,e.needLine&&(p.symbolNeedLines[e.n]=!0),e.noDot?p.symbolNoDot[e.n]=!0:p.symbolList=p.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var m=p.symbolNames.length,v="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";p.symbolNumber=function(t){if("string"==typeof t){var e=0;t.indexOf("-open")>0&&(e=100,t=t.replace("-open","")),t.indexOf("-dot")>0&&(e+=200,t=t.replace("-dot","")),t=p.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=m||t>=400?0:Math.floor(Math.max(t,0))},p.pointStyle=function(t,e){if(t.size()){var n=e.marker,r=n.line;if(i.traceIs(e,"symbols")){var o=h(e);t.attr("d",function(t){var r;r="various"===t.ms||"various"===n.size?3:d.isBubble(e)?o(t.ms):(n.size||6)/2,t.mrc=r;var a=p.symbolNumber(t.mx||n.symbol)||0,i=a%100;return t.om=a%200>=100,p.symbolFuncs[i](r)+(a>=200?v:"")}).style("opacity",function(t){return(t.mo+1||n.opacity+1)-1})}var s=(e._input||{}).marker||{},c=p.tryColorscale(n,s,""),u=p.tryColorscale(n,s,"line.");t.each(function(t){var e,o,i;t.so?(i=r.outlierwidth,o=r.outliercolor,e=n.outliercolor):(i=(t.mlw+1||r.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,o="mlc"in t?t.mlcc=u(t.mlc):Array.isArray(r.color)?l.defaultLine:r.color,e="mc"in t?t.mcc=c(t.mc):Array.isArray(n.color)?l.defaultLine:n.color||"rgba(0,0,0,0)");var s=a.select(this);t.om?s.call(l.stroke,e).style({"stroke-width":(i||1)+"px",fill:"none"}):(s.style("stroke-width",i+"px").call(l.fill,e),i&&s.call(l.stroke,o))})}},p.tryColorscale=function(t,e,n){var r=c.nestedProperty(t,n+"color").get(),a=c.nestedProperty(t,n+"colorscale").get(),i=c.nestedProperty(t,n+"cauto").get(),l=c.nestedProperty(t,n+"cmin"),u=c.nestedProperty(t,n+"cmax"),f=l.get(),d=u.get();return a&&Array.isArray(r)?(!i&&o(f)&&o(d)||(f=1/0,d=-(1/0),r.forEach(function(t){o(t)&&(f>t&&(f=+t),t>d&&(d=+t))}),f>d&&(f=0,d=1),l.set(f),u.set(d),c.nestedProperty(e,n+"cmin").set(f),c.nestedProperty(e,n+"cmax").set(d)),s.makeScaleFunction(a,f,d)):c.identity};var y={start:1,end:-1,middle:0,bottom:1,top:-1},x=1.3;p.textPointStyle=function(t,e){t.each(function(t){var n=a.select(this),r=t.tx||e.text;if(!r||Array.isArray(r))return void n.remove();var i=t.tp||e.textposition,l=-1!==i.indexOf("top")?"top":-1!==i.indexOf("bottom")?"bottom":"middle",s=-1!==i.indexOf("left")?"end":-1!==i.indexOf("right")?"start":"middle",c=t.ts||e.textfont.size,f=t.mrc?t.mrc/.8+1:0;c=o(c)&&c>0?c:0,n.call(p.font,t.tf||e.textfont.family,c,t.tc||e.textfont.color).attr("text-anchor",s).text(r).call(u.convertToTspans);var d=a.select(this.parentNode),h=n.selectAll("tspan.line"),g=((h[0].length||1)-1)*x+1,m=y[s]*f,v=.75*c+y[l]*f+(y[l]-1)*g*c/2;d.attr("transform","translate("+m+","+v+")"),g>1&&h.attr({x:n.attr("x"),y:n.attr("y")})})};var b=.5;p.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var n,a="M"+t[0],o=[];for(n=1;nn;n++)i.push(r(t[n-1],t[n],t[n+1],e));for(i.push(r(t[o-1],t[o],t[0],e)),n=1;o>=n;n++)a+="C"+i[n-1][1]+" "+i[n][0]+" "+t[n];return a+="C"+i[o][1]+" "+i[0][0]+" "+t[0]+"Z"};var _={hv:function(t,e){return"H"+a.round(e[0],2)+"V"+a.round(e[1],2)},vh:function(t,e){return"V"+a.round(e[1],2)+"H"+a.round(e[0],2)},hvh:function(t,e){return"H"+a.round((t[0]+e[0])/2,2)+"V"+a.round(e[1],2)+"H"+a.round(e[0],2)},vhv:function(t,e){return"V"+a.round((t[1]+e[1])/2,2)+"H"+a.round(e[0],2)+"V"+a.round(e[1],2)}},w=function(t,e){return"L"+a.round(e[0],2)+","+a.round(e[1],2)};p.steps=function(t){var e=_[t]||w;return function(t){for(var n="M"+a.round(t[0][0],2)+","+a.round(t[0][1],2),r=1;r=M&&(a.selectAll("[data-bb]").attr("data-bb",null),k=[]),t.setAttribute("data-bb",k.length),k.push(s),c.extendFlat({},s)},p.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var n="#"+e,r=a.select("base");r.size()&&r.attr("href")&&(n=window.location.href+n),t.attr("clip-path","url("+n+")")}},{"../../constants/xmlns_namespaces":95,"../../lib":103,"../../lib/svg_text_utils":114,"../../plots/plots":144,"../../traces/scatter/make_bubble_size_func":251,"../../traces/scatter/subtypes":256,"../color":25,"../colorscale":39,"./symbol_defs":49,d3:14,"fast-isnumeric":17}],49:[function(t,e,n){"use strict";var r=t("d3");e.exports={circle:{n:0,f:function(t){var e=r.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=r.round(.4*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H"+e+"V"+n+"H-"+e+"V"+e+"H-"+n+"V-"+e+"H-"+e+"V-"+n+"H"+e+"V-"+e+"H"+n+"Z"}},x:{n:4,f:function(t){var e=r.round(.8*t/Math.sqrt(2),2),n="l"+e+","+e,a="l"+e+",-"+e,o="l-"+e+",-"+e,i="l-"+e+","+e;return"M0,"+e+n+a+o+a+o+i+o+i+n+i+n+"Z"}},"triangle-up":{n:5,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+","+n+"H"+e+"L0,-"+a+"Z"}},"triangle-down":{n:6,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+e+",-"+n+"H"+e+"L0,"+a+"Z"}},"triangle-left":{n:7,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M"+n+",-"+e+"V"+e+"L-"+a+",0Z"}},"triangle-right":{n:8,f:function(t){var e=r.round(2*t/Math.sqrt(3),2),n=r.round(t/2,2),a=r.round(t,2);return"M-"+n+",-"+e+"V"+e+"L"+a+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+n+",-"+e+"H"+e+"V"+n+"Z"}},"triangle-se":{n:10,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+e+",-"+n+"V"+e+"H-"+n+"Z"}},"triangle-sw":{n:11,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M"+n+","+e+"H-"+e+"V-"+n+"Z"}},"triangle-nw":{n:12,f:function(t){var e=r.round(.6*t,2),n=r.round(1.2*t,2);return"M-"+e+","+n+"V-"+e+"H"+n+"Z"}},pentagon:{n:13,f:function(t){var e=r.round(.951*t,2),n=r.round(.588*t,2),a=r.round(-t,2),o=r.round(t*-.309,2),i=r.round(.809*t,2);return"M"+e+","+o+"L"+n+","+i+"H-"+n+"L-"+e+","+o+"L0,"+a+"Z"}},hexagon:{n:14,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M"+a+",-"+n+"V"+n+"L0,"+e+"L-"+a+","+n+"V-"+n+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=r.round(t,2),n=r.round(t/2,2),a=r.round(t*Math.sqrt(3)/2,2);return"M-"+n+","+a+"H"+n+"L"+e+",0L"+n+",-"+a+"H-"+n+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=r.round(.924*t,2),n=r.round(.383*t,2);return"M-"+n+",-"+e+"H"+n+"L"+e+",-"+n+"V"+n+"L"+n+","+e+"H-"+n+"L-"+e+","+n+"V-"+n+"Z"}},star:{n:17,f:function(t){var e=1.4*t,n=r.round(.225*e,2),a=r.round(.951*e,2),o=r.round(.363*e,2),i=r.round(.588*e,2),l=r.round(-e,2),s=r.round(e*-.309,2),c=r.round(.118*e,2),u=r.round(.809*e,2),f=r.round(.382*e,2);return"M"+n+","+s+"H"+a+"L"+o+","+c+"L"+i+","+u+"L0,"+f+"L-"+i+","+u+"L-"+o+","+c+"L-"+a+","+s+"H-"+n+"L0,"+l+"Z"}},hexagram:{n:18,f:function(t){var e=r.round(.66*t,2),n=r.round(.38*t,2),a=r.round(.76*t,2);return"M-"+a+",0l-"+n+",-"+e+"h"+a+"l"+n+",-"+e+"l"+n+","+e+"h"+a+"l-"+n+","+e+"l"+n+","+e+"h-"+a+"l-"+n+","+e+"l-"+n+",-"+e+"h-"+a+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M-"+e+","+n+i+e+","+n+i+"0,-"+a+i+"-"+e+","+n+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=r.round(t*Math.sqrt(3)*.8,2),n=r.round(.8*t,2),a=r.round(1.6*t,2),o=r.round(4*t,2),i="A "+o+","+o+" 0 0 1 ";return"M"+e+",-"+n+i+"-"+e+",-"+n+i+"0,"+a+i+e+",-"+n+"Z"}},"star-square":{n:21,f:function(t){var e=r.round(1.1*t,2),n=r.round(2*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",-"+e+a+"-"+e+","+e+a+e+","+e+a+e+",-"+e+a+"-"+e+",-"+e+"Z"}},"star-diamond":{n:22,f:function(t){var e=r.round(1.4*t,2),n=r.round(1.9*t,2),a="A "+n+","+n+" 0 0 1 ";return"M-"+e+",0"+a+"0,"+e+a+e+",0"+a+"0,-"+e+a+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=r.round(.7*t,2),n=r.round(1.4*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=r.round(1.4*t,2),n=r.round(.7*t,2);return"M0,"+n+"L"+e+",0L0,-"+n+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=r.round(t,2),n=r.round(t/Math.sqrt(2),2);return"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=r.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=r.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=r.round(1.3*t,2),n=r.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+n+",-"+n+"L"+n+","+n+"M-"+n+","+n+"L"+n+",-"+n},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=r.round(1.2*t,2),n=r.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+n+","+n+"L-"+n+",-"+n+"M"+n+",-"+n+"L-"+n+","+n},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=r.round(t/2,2),n=r.round(t,2);return"M"+e+","+n+"V-"+n+"m-"+n+",0V"+n+"M"+n+","+e+"H-"+n+"m0,-"+n+"H"+n},needLine:!0},"y-up":{n:37,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+","+a+"L0,0M"+e+","+a+"L0,0M0,-"+n+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+e+",-"+a+"L0,0M"+e+",-"+a+"L0,0M0,"+n+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M"+a+","+e+"L0,0M"+a+",-"+e+"L0,0M-"+n+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=r.round(1.2*t,2),n=r.round(1.6*t,2),a=r.round(.8*t,2);return"M-"+a+","+e+"L0,0M-"+a+",-"+e+"L0,0M"+n+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=r.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=r.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=r.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=r.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:14}],50:[function(t,e,n){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],51:[function(t,e,n){"use strict";function r(t,e,n,r){var o=e["error_"+r]||{},s=o.visible&&-1!==["linear","log"].indexOf(n.type),c=[];if(s){for(var u=l(o),f=0;fl;l++)i[l]={x:n[l],y:a[l]};return i[0].trace=t,r.calc({calcdata:[i],_fullLayout:e}),i},r.plot=t("./plot"),r.style=t("./style"),r.hoverInfo=function(t,e,n){(e.error_y||{}).visible&&(n.yerr=t.yh-t.y,e.error_y.symmetric||(n.yerrneg=t.y-t.ys)),(e.error_x||{}).visible&&(n.xerr=t.xh-t.x,e.error_x.symmetric||(n.xerrneg=t.x-t.xs))}},{"./attributes":50,"./calc":51,"./defaults":53,"./plot":55,"./style":56}],55:[function(t,e,n){"use strict";function r(t,e,n){var r={x:e.c2p(t.x),y:n.c2p(t.y)};return void 0!==t.yh&&(r.yh=n.c2p(t.yh),r.ys=n.c2p(t.ys),o(r.ys)||(r.noYS=!0,r.ys=n.c2p(t.ys,!0))),void 0!==t.xh&&(r.xh=e.c2p(t.xh),r.xs=e.c2p(t.xs),o(r.xs)||(r.noXS=!0,r.xs=e.c2p(t.xs,!0))),r}var a=t("d3"),o=t("fast-isnumeric"),i=t("../../lib"),l=t("../../traces/scatter/subtypes");e.exports=function(t,e){var n=e.x(),s=e.y();t.each(function(t){var e=t[0].trace,c=e.error_x||{},u=e.error_y||{},f=l.hasMarkers(e)&&e.marker.maxdisplayed>0;if(u.visible||c.visible){var d=a.select(this).selectAll("g.errorbar").data(i.identity);d.enter().append("g").classed("errorbar",!0),d.each(function(t){var e=a.select(this),i=r(t,n,s);if(!f||t.vis){var l;if(u.visible&&o(i.x)&&o(i.yh)&&o(i.ys)){var d=u.width;l="M"+(i.x-d)+","+i.yh+"h"+2*d+"m-"+d+",0V"+i.ys,i.noYS||(l+="m-"+d+",0h"+2*d),e.append("path").classed("yerror",!0).attr("d",l)}if(c.visible&&o(i.y)&&o(i.xh)&&o(i.xs)){var h=(c.copy_ystyle?u:c).width;l="M"+i.xh+","+(i.y-h)+"v"+2*h+"m0,-"+h+"H"+i.xs,i.noXS||(l+="m0,-"+h+"v"+2*h),e.append("path").classed("xerror",!0).attr("d",l)}}})}})}},{"../../lib":103,"../../traces/scatter/subtypes":256,d3:14,"fast-isnumeric":17}],56:[function(t,e,n){"use strict";var r=t("d3"),a=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,n=e.error_y||{},o=e.error_x||{},i=r.select(this);i.selectAll("path.yerror").style("stroke-width",n.thickness+"px").call(a.stroke,n.color),o.copy_ystyle&&(o=n),i.selectAll("path.xerror").style("stroke-width",o.thickness+"px").call(a.stroke,o.color)})}},{"../color":25,d3:14}],57:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:!0,source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"number",dflt:0},y:{valType:"number",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",r.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",r.idRegex.y.toString()],dflt:"paper"}}},{"../../plots/cartesian/constants":129}],58:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,i,n,r)}e=e||{},r("source"),r("layer"),r("x"),r("y"),r("xanchor"),r("yanchor"),r("sizex"),r("sizey"),r("sizing"),r("opacity");for(var l=0;2>l;l++){var s={_fullLayout:n},c=["x","y"][l];a.coerceRef(t,e,s,c,"paper")}return e}var a=t("../../plots/cartesian/axes"),o=t("../../lib"),i=t("./attributes");e.exports=function(t,e){if(t.images&&Array.isArray(t.images))for(var n=t.images,a=e.images=[],o=0;o=2/3},n.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},n.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},n.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],62:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:o({},r,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":101,"../../plots/font_attributes":142,"../color/attributes":24}],63:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],64:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../plots/plots"),o=t("./attributes"),i=t("./helpers");e.exports=function(t,e,n){function l(t,e){return r.coerce(d,h,o,t,e)}for(var s,c,u,f,d=t.legend||{},h=e.legend={},p=0,g="normal",m=0;m1);if(y!==!1){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),r.coerceFont(l,"font",e.font),l("orientation"),"h"===h.orientation){var x=t.xaxis;x&&x.rangeslider&&x.rangeslider.visible?(s=0,u="left",c=1.1,f="bottom"):(s=0,u="left",c=-.1,f="top")}l("traceorder",g),i.isGrouped(e.legend)&&l("tracegroupgap"),l("x",s),l("xanchor",u),l("y",c),l("yanchor",f),r.noneOrAll(d,h,["x","y"])}}},{"../../lib":103,"../../plots/plots":144,"./attributes":62,"./helpers":67}],65:[function(t,e,n){"use strict";function r(t,e){function n(n){u.util.convertToTspans(n,function(){n.selectAll("tspan.line").attr({x:n.attr("x")}),t.call(o,e)})}var r=t.data()[0][0],a=e._fullLayout,i=r.trace,l=d.traceIs(i,"pie"),s=i.index,c=l?r.label:i.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr({x:40,y:0,"data-unformatted":c}).style("text-anchor","start").classed("user-select-none",!0).call(p.font,a.legend.font).text(c),e._context.editable&&!l?f.call(u.util.makeEditable).call(n).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(n),this.text()||(t=" "),u.restyle(e,"name",t,s)}):f.call(n)}function a(t,e){var n=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],r=t.selectAll("rect").data([0]);r.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(g.fill,"rgba(0,0,0,0)"),r.on("click",function(){if(!e._dragged){var r,a,o=t.data()[0][0],i=e._fullData,l=o.trace,s=l.legendgroup,c=[]; if(d.traceIs(l,"pie")){var f=o.label,h=n.indexOf(f);-1===h?n.push(f):n.splice(h,1),u.relayout(e,"hiddenlabels",n)}else{if(""===s)c=[l.index];else for(var p=0;ptspan"),h=d[0].length||1;n=s*h,r=u.node()&&p.bBox(u.node()).width;var g=s*(.3+(1-h)/2);u.attr("y",g),d.attr("y",g)}n=Math.max(n,16)+3,o.attr({x:0,y:-n/2,height:n}),a.height=n,a.width=r}function i(t,e,n){var r=t._fullLayout,a=r.legend,o=a.borderwidth,i=x.isGrouped(a);if(x.isVertical(a))i&&e.each(function(t,e){f.setTranslate(this,0,e*a.tracegroupgap)}),a.width=0,a.height=0,n.each(function(t){var e=t[0],n=e.height,r=e.width;f.setTranslate(this,o,5+o+a.height+n/2),a.height+=n,a.width=Math.max(a.width,r)}),a.width+=45+2*o,a.height+=10+2*o,i&&(a.height+=(a._lgroupsLength-1)*a.tracegroupgap),n.selectAll(".legendtoggle").attr("width",(t._context.editable?0:a.width)+40),a.width=Math.ceil(a.width),a.height=Math.ceil(a.height);else if(i){a.width=0,a.height=0;for(var l=[a.width],s=e.data(),u=0,d=s.length;d>u;u++){var h=s[u].map(function(t){return t[0].width}),p=40+Math.max.apply(null,h);a.width+=a.tracegroupgap+p,l.push(a.width)}e.each(function(t,e){f.setTranslate(this,l[e],0)}),e.each(function(){var t=c.select(this),e=t.selectAll("g.traces"),n=0;e.each(function(t){var e=t[0],r=e.height;f.setTranslate(this,0,5+o+n+r/2),n+=r}),a.height=Math.max(a.height,n)}),a.height+=10+2*o,a.width+=2*o,a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.selectAll(".legendtoggle").attr("width",t._context.editable?0:a.width)}else{a.width=0,a.height=0;var g=0,m=0,v=0,y=0;n.each(function(t){v=Math.max(40+t[0].width,v)}),n.each(function(t){var e=t[0],n=v,i=a.tracegroupgap||5;o+y+i+n>r.width-(r.margin.r+r.margin.l)&&(y=0,g+=m,a.height=a.height+m,m=0),f.setTranslate(this,o+y,5+o+e.height/2+g),a.width+=i+n,a.height=Math.max(a.height,e.height),y+=i+n,m=Math.max(e.height,m)}),a.width+=2*o,a.height+=10+2*o,a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),n.selectAll(".legendtoggle").attr("width",t._context.editable?0:a.width)}}function l(t){var e=t._fullLayout,n=e.legend,r="left";b.isRightAnchor(n)?r="right":b.isCenterAnchor(n)&&(r="center");var a="top";b.isBottomAnchor(n)?a="bottom":b.isMiddleAnchor(n)&&(a="middle"),d.autoMargin(t,"legend",{x:n.x,y:n.y,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:n.height*({top:1,middle:.5}[a]||0),t:n.height*({bottom:1,middle:.5}[a]||0)})}function s(t){var e=t._fullLayout,n=e.legend,r="left";b.isRightAnchor(n)?r="right":b.isCenterAnchor(n)&&(r="center"),d.autoMargin(t,"legend",{x:n.x,y:.5,l:n.width*({right:1,center:.5}[r]||0),r:n.width*({left:1,center:.5}[r]||0),b:0,t:0})}var c=t("d3"),u=t("../../plotly"),f=t("../../lib"),d=t("../../plots/plots"),h=t("../dragelement"),p=t("../drawing"),g=t("../color"),m=t("./constants"),v=t("./get_legend_data"),y=t("./style"),x=t("./helpers"),b=t("./anchor_utils");e.exports=function(t){function e(t,e){T.attr("data-scroll",e).call(f.setTranslate,0,e),L.call(p.setRect,j,t,m.scrollBarWidth,m.scrollBarHeight),M.select("rect").attr({y:x.borderwidth-e})}var n=t._fullLayout,o="legend"+n._uid;if(n._infolayer&&t.calcdata){var x=n.legend,_=n.showlegend&&v(t.calcdata,x),w=n.hiddenlabels||[];if(!n.showlegend||!_.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var k=n._infolayer.selectAll("g.legend").data([0]);k.enter().append("g").attr({"class":"legend","pointer-events":"all"});var M=n._topdefs.selectAll("#"+o).data([0]);M.enter().append("clipPath").attr("id",o).append("rect");var A=k.selectAll("rect.bg").data([0]);A.enter().append("rect").attr({"class":"bg","shape-rendering":"crispEdges"}),A.call(g.stroke,x.bordercolor),A.call(g.fill,x.bgcolor),A.style("stroke-width",x.borderwidth+"px");var T=k.selectAll("g.scrollbox").data([0]);T.enter().append("g").attr("class","scrollbox");var L=k.selectAll("rect.scrollbar").data([0]);L.enter().append("rect").attr({"class":"scrollbar",rx:20,ry:2,width:0,height:0}).call(g.fill,"#808BA4");var z=T.selectAll("g.groups").data(_);z.enter().append("g").attr("class","groups"),z.exit().remove();var S=z.selectAll("g.traces").data(f.identity);S.enter().append("g").attr("class","traces"),S.exit().remove(),S.call(y).style("opacity",function(t){var e=t[0].trace;return d.traceIs(e,"pie")?-1!==w.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(r,t).call(a,t)});var C=0!==k.enter().size();C&&(i(t,z,S),l(t));var E=0,O=n.width,P=0,N=n.height;i(t,z,S),x.height>N?s(t):l(t);var D=n._size,I=D.l+D.w*x.x,R=D.t+D.h*(1-x.y);b.isRightAnchor(x)?I-=x.width:b.isCenterAnchor(x)&&(I-=x.width/2),b.isBottomAnchor(x)?R-=x.height:b.isMiddleAnchor(x)&&(R-=x.height/2);var j=x.width;D.w;I+j>O&&(I=O-j),E>I&&(I=E),j=Math.min(O-I,x.width);var F=x.height,q=D.h;F>q?(R=D.t,F=q):(R+F>N&&(R=N-F),P>R&&(R=P),F=Math.min(N-R,x.height)),f.setTranslate(k,I,R);var B,H,V=F-m.scrollBarHeight-2*m.scrollBarMargin,Z=x.height-F;if(x.height<=F||t._context.staticPlot)A.attr({width:j-x.borderwidth,height:F-x.borderwidth,x:x.borderwidth/2,y:x.borderwidth/2}),f.setTranslate(T,0,0),M.select("rect").attr({width:j-2*x.borderwidth,height:F-2*x.borderwidth,x:x.borderwidth,y:x.borderwidth}),T.call(p.setClipUrl,o);else{B=m.scrollBarMargin,H=T.attr("data-scroll")||0,A.attr({width:j-2*x.borderwidth+m.scrollBarWidth+m.scrollBarMargin,height:F-x.borderwidth,x:x.borderwidth/2,y:x.borderwidth/2}),M.select("rect").attr({width:j-2*x.borderwidth+m.scrollBarWidth+m.scrollBarMargin,height:F-2*x.borderwidth,x:x.borderwidth,y:x.borderwidth-H}),T.call(p.setClipUrl,o),C&&e(B,H),k.on("wheel",null),k.on("wheel",function(){H=f.constrain(T.attr("data-scroll")-c.event.deltaY/V*Z,-Z,0),B=m.scrollBarMargin-H/Z*V,e(B,H),c.event.preventDefault()}),L.on(".drag",null),T.on(".drag",null);var U=c.behavior.drag().on("drag",function(){B=f.constrain(c.event.y-m.scrollBarHeight/2,m.scrollBarMargin,m.scrollBarMargin+V),H=-(B-m.scrollBarMargin)/V*Z,e(B,H)});L.call(U),T.call(U)}if(t._context.editable){var Y,X,G,$;k.classed("cursor-move",!0),h.init({element:k.node(),prepFn:function(){var t=f.getTranslate(k);G=t.x,$=t.y},moveFn:function(t,e){var n=G+t,r=$+e;f.setTranslate(k,n,r),Y=h.align(n,0,D.l,D.l+D.w,x.xanchor),X=h.align(r,0,D.t+D.h,D.t,x.yanchor)},doneFn:function(e){e&&void 0!==Y&&void 0!==X&&u.relayout(t,{"legend.x":Y,"legend.y":X})}})}}}},{"../../lib":103,"../../plotly":121,"../../plots/plots":144,"../color":25,"../dragelement":46,"../drawing":48,"./anchor_utils":61,"./constants":63,"./get_legend_data":66,"./helpers":67,"./style":69,d3:14}],66:[function(t,e,n){"use strict";var r=t("../../plots/plots"),a=t("./helpers");e.exports=function(t,e){function n(t,n){if(""!==t&&a.isGrouped(e))-1===s.indexOf(t)?(s.push(t),c=!0,l[t]=[[n]]):l[t].push([n]);else{var r="~~i"+f;s.push(r),l[r]=[[n]],f++}}var o,i,l={},s=[],c=!1,u={},f=0;for(o=0;oo;o++)v=l[s[o]],y[o]=a.isReversed(e)?v.reverse():v;else{for(y=[new Array(x)],o=0;x>o;o++)v=l[s[o]][0],y[0][a.isReversed(e)?x-o-1:o]=v;x=1}return e._lgroupsLength=x,y}},{"../../plots/plots":144,"./helpers":67}],67:[function(t,e,n){"use strict";var r=t("../../plots/plots");n.legendGetsTrace=function(t){return t.visible&&r.traceIs(t,"showLegend")},n.isGrouped=function(t){return-1!==(t.traceorder||"").indexOf("grouped")},n.isVertical=function(t){return"h"!==t.orientation},n.isReversed=function(t){return-1!==(t.traceorder||"").indexOf("reversed")}},{"../../plots/plots":144}],68:[function(t,e,n){"use strict";var r=e.exports={};r.layoutAttributes=t("./attributes"),r.supplyLayoutDefaults=t("./defaults"),r.draw=t("./draw"),r.style=t("./style")},{"./attributes":62,"./defaults":64,"./draw":65,"./style":69}],69:[function(t,e,n){"use strict";function r(t){var e=t[0].trace,n=e.visible&&e.fill&&"none"!==e.fill,r=h.hasLines(e),a=s.select(this).select(".legendfill").selectAll("path").data(n?[t]:[]);a.enter().append("path").classed("js-fill",!0),a.exit().remove(),a.attr("d","M5,0h30v6h-30z").call(f.fillGroupStyle);var o=s.select(this).select(".legendlines").selectAll("path").data(r?[t]:[]);o.enter().append("path").classed("js-line",!0).attr("d","M5,0h30"),o.exit().remove(),o.call(f.lineGroupStyle)}function a(t){function e(t,e,n){var r=c.nestedProperty(i,t).get(),a=Array.isArray(r)&&e?e(r):r;if(n){if(an[1])return n[1]}return a}function n(t){return t[0]}var r,a,o=t[0],i=o.trace,l=h.hasMarkers(i),u=h.hasText(i),d=h.hasLines(i);if(l||u||d){var p={},g={};l&&(p.mc=e("marker.color",n),p.mo=e("marker.opacity",c.mean,[.2,1]),p.ms=e("marker.size",c.mean,[2,16]),p.mlc=e("marker.line.color",n),p.mlw=e("marker.line.width",c.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),d&&(g.line={width:e("line.width",n,[0,10])}),u&&(p.tx="Aa",p.tp=e("textposition",n),p.ts=10,p.tc=e("textfont.color",n),p.tf=e("textfont.family",n)),r=[c.minExtend(o,p)],a=c.minExtend(i,g)}var m=s.select(this).select("g.legendpoints"),v=m.selectAll("path.scatterpts").data(l?r:[]);v.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),v.exit().remove(),v.call(f.pointStyle,a),l&&(r[0].mrc=3);var y=m.selectAll("g.pointtext").data(u?r:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(f.textPointStyle,a)}function o(t){var e=t[0].trace,n=e.marker||{},r=n.line||{},a=s.select(this).select("g.legendpoints").selectAll("path.legendbar").data(u.traceIs(e,"bar")?[t]:[]);a.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),a.exit().remove(),a.each(function(t){var e=(t.mlw+1||r.width+1)-1,a=s.select(this);a.style("stroke-width",e+"px").call(d.fill,t.mc||n.color),e&&a.call(d.stroke,t.mlc||r.color)})}function i(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendbox").data(u.traceIs(e,"box")&&e.visible?[t]:[]);n.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.each(function(t){var n=(t.lw+1||e.line.width+1)-1,r=s.select(this);r.style("stroke-width",n+"px").call(d.fill,t.fc||e.fillcolor),n&&r.call(d.stroke,t.lc||e.line.color)})}function l(t){var e=t[0].trace,n=s.select(this).select("g.legendpoints").selectAll("path.legendpie").data(u.traceIs(e,"pie")&&e.visible?[t]:[]);n.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),n.exit().remove(),n.size()&&n.call(p,t[0],e)}var s=t("d3"),c=t("../../lib"),u=t("../../plots/plots"),f=t("../drawing"),d=t("../color"),h=t("../../traces/scatter/subtypes"),p=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=s.select(this),n=e.selectAll("g.legendfill").data([t]);n.enter().append("g").classed("legendfill",!0);var r=e.selectAll("g.legendlines").data([t]);r.enter().append("g").classed("legendlines",!0);var a=e.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.style("opacity",t[0].trace.opacity),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(i).each(l).each(r).each(a)}},{"../../lib":103,"../../plots/plots":144,"../../traces/pie/style_one":235,"../../traces/scatter/subtypes":256,"../color":25,"../drawing":48,d3:14}],70:[function(t,e,n){"use strict";function r(t,e){var n=e.currentTarget,r=n.getAttribute("data-attr"),a=n.getAttribute("data-val")||!0,o=t._fullLayout,i={};if("zoom"===r){for(var l,s,u="in"===a?.5:2,f=(1+u)/2,d=(1-u)/2,h=c.Axes.list(t,null,!0),p=0;py;y++){var x=l[y];d=v[x]={};for(var b=0;b1)return r(["resetViews","toggleHover"]),i(m,n);u&&(r(["zoom3d","pan3d","orbitRotation","tableRotation"]),r(["resetCameraDefault3d","resetCameraLastSave3d"]),r(["hoverClosest3d"])),d&&(r(["zoomInGeo","zoomOutGeo","resetGeo"]),r(["hoverClosestGeo"]));var v=a(l),y=[];return((c||p)&&!v||g)&&(y=["zoom2d","pan2d"]),(c||g)&&o(s)&&(y.push("select2d"),y.push("lasso2d")),y.length&&r(y),!c&&!p||v||g||r(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?r(["toggleHover"]):p?r(["hoverClosestGl2d"]):c?r(["hoverClosestCartesian","hoverCompareCartesian"]):h&&r(["hoverClosestPie"]),i(m,n)}function a(t){for(var e=s.Axes.list({_fullLayout:t},null,!0),n=!0,r=0;r0);if(p){var g=a(e,n,s);u("x",g[0]),u("y",g[1]),o.noneOrAll(t,e,["x","y"]),u("xanchor"),u("yanchor"),o.coerceFont(u,"font",n.font);var m=u("bgcolor");u("activecolor",i.contrast(m,c.lightAmount,c.darkAmount)),u("bordercolor"),u("borderwidth")}}},{"../../lib":103,"../color":25,"./attributes":73,"./button_attributes":74,"./constants":75}],77:[function(t,e,n){"use strict";function r(t){for(var e=v.list(t,"x",!0),n=[],r=0;re){var n=e;e=t,t=n}l.setAttributes(w,{"data-min":t,"data-max":e}),l.setAttributes(P,{x:t,width:e-t}),l.setAttributes(A,{width:t}),l.setAttributes(T,{x:e,width:p-e}),l.setAttributes(L,{transform:"translate("+(t-m-1)+")"}),l.setAttributes(C,{ -transform:"translate("+e+")"})}var f=t._fullLayout,d=f._infolayer.selectAll("g.range-slider"),h=f.xaxis.rangeslider,p=f._size.w,g=(f.height-f.margin.b-f.margin.t)*h.thickness,m=2,v=Math.floor(h.borderwidth/2),y=f.margin.l,x=f.height-g-f.margin.b,b=0,_=p,w=document.createElementNS(i,"g");l.setAttributes(w,{"class":"range-slider","data-min":b,"data-max":_,"pointer-events":"all",transform:"translate("+y+","+x+")"});var k=document.createElementNS(i,"rect"),M=h.borderwidth%2===0?h.borderwidth:h.borderwidth-1;l.setAttributes(k,{fill:h.bgcolor,stroke:h.bordercolor,"stroke-width":h.borderwidth,height:g+M,width:p+M,transform:"translate(-"+v+", -"+v+")","shape-rendering":"crispEdges"});var A=document.createElementNS(i,"rect");l.setAttributes(A,{x:0,width:b,height:g,fill:"rgba(0,0,0,0.4)"});var T=document.createElementNS(i,"rect");l.setAttributes(T,{x:_,width:p-_,height:g,fill:"rgba(0,0,0,0.4)"});var L=document.createElementNS(i,"g"),z=document.createElementNS(i,"rect"),S=document.createElementNS(i,"rect");l.setAttributes(L,{transform:"translate("+(b-m-1)+")"}),l.setAttributes(z,{width:10,height:g,x:-6,fill:"transparent",cursor:"col-resize"}),l.setAttributes(S,{width:m,height:g/2,y:g/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges"}),l.appendChildren(L,[S,z]);var C=document.createElementNS(i,"g"),E=document.createElementNS(i,"rect"),O=document.createElementNS(i,"rect");l.setAttributes(C,{transform:"translate("+_+")"}),l.setAttributes(E,{width:10,height:g,x:-2,fill:"transparent",cursor:"col-resize"}),l.setAttributes(O,{width:m,height:g/2,y:g/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges"}),l.appendChildren(C,[O,E]);var P=document.createElementNS(i,"rect");l.setAttributes(P,{x:b,width:_-b,height:g,cursor:"ew-resize",fill:"transparent"}),w.addEventListener("mousedown",function(t){function n(t){var n,r,f=+t.clientX-o;switch(a){case P:w.style.cursor="ew-resize",n=+l+f,r=+s+f,u(n,r),c(e(n),e(r));break;case z:w.style.cursor="col-resize",n=+l+f,r=+s,u(n,r),c(e(n),e(r));break;case E:w.style.cursor="col-resize",n=+l,r=+s+f,u(n,r),c(e(n),e(r));break;default:w.style.cursor="ew-resize",n=i,r=i+f,u(n,r),c(e(n),e(r))}}function r(){window.removeEventListener("mousemove",n),window.removeEventListener("mouseup",r),w.style.cursor="auto"}var a=t.target,o=t.clientX,i=o-w.getBoundingClientRect().left,l=w.getAttribute("data-min"),s=w.getAttribute("data-max");window.addEventListener("mousemove",n),window.addEventListener("mouseup",r)}),h.range||(h.range=a.getAutoRange(f.xaxis));var N=s(t,p,g);l.appendChildren(w,[k,N,A,T,P,L,C]),n(f.xaxis.range[0],f.xaxis.range[1]),d.data([0]).enter().append(function(){return h.setRange=n,w})}},{"../../constants/xmlns_namespaces":95,"../../lib":103,"../../plotly":121,"../../plots/cartesian/axes":124,"./helpers":83,"./range_plot":85}],82:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes");e.exports=function(t,e,n,o){function i(t,e){return r.coerce(l,s,a,t,e)}if(t[n].rangeslider){var l=r.isPlainObject(t[n].rangeslider)?t[n].rangeslider:{},s=e[n].rangeslider={};if(i("bgcolor"),i("bordercolor"),i("borderwidth"),i("thickness"),i("visible"),i("range"),s.range&&!e[n].autorange){var c=s.range,u=e[n].range;c[0]=Math.min(c[0],u[0]),c[1]=Math.max(c[1],u[1])}else e[n]._needsExpand=!0;s.visible&&o.forEach(function(t){var n=e[t]||{};n.fixedrange=!0,e[t]=n})}}},{"../../lib":103,"./attributes":80}],83:[function(t,e,n){"use strict";n.setAttributes=function(t,e){for(var n in e)t.setAttribute(n,e[n])},n.appendChildren=function(t,e){for(var n=0;ns;s++){var c=l[s],u={_fullLayout:e},f=A.coerceRef(t,r,u,c);if("path"!==i){var d=.25,h=.75;if("paper"!==f){var p=A.getFromId(u,f),g=o(p);d=g(p.range[0]+d*(p.range[1]-p.range[0])),h=g(p.range[0]+h*(p.range[1]-p.range[0]))}n(c+"0",d),n(c+"1",h)}}return"path"===i?n("path"):M.noneOrAll(t,r,["x0","x1","y0","y1"]),r}function a(t){return"category"===t.type?t.c2l:t.d2l}function o(t){return"category"===t.type?t.l2c:t.l2d}function i(t,e){t.layout.shapes=e,C.supplyLayoutDefaults(t.layout,t._fullLayout),C.drawAll(t)}function l(t){delete t.layout.shapes,t._fullLayout.shapes=[],C.drawAll(t)}function s(t,e,n){for(var r=0;re;a--)h(t,a).selectAll('[data-index="'+(a-1)+'"]').attr("data-index",a),C.draw(t,a)}function f(t,e,n,i){function l(n){var r={"data-index":e,"fill-rule":"evenodd",d:x(t,C)},a=C.line.width?C.line.color:"rgba(0,0,0,0)",o=n.append("path").attr(r).style("opacity",C.opacity).call(T.stroke,a).call(T.fill,C.fillcolor).call(L.dashLine,C.line.dash,C.line.width);E&&o.call(L.setClipUrl,"clip"+t._fullLayout._uid+E),t._context.editable&&d(t,o,C,e)}var s,c;h(t,e).selectAll('[data-index="'+e+'"]').remove();var u=t.layout.shapes[e];if(u){var f={xref:u.xref,yref:u.yref},g={};"string"==typeof n&&n?g[n]=i:M.isPlainObject(n)&&(g=n);var m=Object.keys(g);for(s=0;ss;s++){var b=y[s];if(void 0===g[b]&&void 0!==u[b]){var _,w=b.charAt(0),k=A.getFromId(t,A.coerceRef(f,{},t,w)),z=A.getFromId(t,A.coerceRef(u,{},t,w)),S=u[b];void 0!==g[w+"ref"]&&(k?(_=a(k)(S),S=(_-k.range[0])/(k.range[1]-k.range[0])):S=(S-z.domain[0])/(z.domain[1]-z.domain[0]),z?(_=z.range[0]+S*(z.range[1]-z.range[0]),S=o(z)(_)):S=k.domain[0]+S*(k.domain[1]-k.domain[0])),u[b]=S}}var C=r(u,t._fullLayout);t._fullLayout.shapes[e]=C;var E;if("below"!==C.layer)E=(C.xref+C.yref).replace(/paper/g,""),l(t._fullLayout._shapeUpperLayer);else if("paper"===C.xref&&"paper"===C.yref)E="",l(t._fullLayout._shapeLowerLayer);else{var O,P=t._fullLayout._plots||{},N=Object.keys(P);for(s=0,c=N.length;c>s;s++)O=P[N[s]],E=N[s],p(t,C,O)&&l(O.shapelayer)}}}function d(t,e,n,r){function a(t){var n=W.right-W.left,r=W.bottom-W.top,a=t.clientX-W.left,o=t.clientY-W.top,i=n>G&&r>$&&!t.shiftKey?z.getCursor(a/n,1-o/r):"move";S(e,i),X=i.split("-")[0]}function o(e){B=A.getFromId(t,n.xref),H=A.getFromId(t,n.yref),V=v(t,B),Z=v(t,H,!0),U=y(t,B),Y=y(t,H,!0);var o="shapes["+r+"]";"path"===n.type?(F=n.path,q=o+".path"):(u=V(n.x0),f=Z(n.y0),d=V(n.x1),h=Z(n.y1),p=o+".x0",g=o+".y0",_=o+".x1",w=o+".y1"),d>u?(L=u,P=o+".x0",R="x0",C=d,N=o+".x1",j="x1"):(L=d,P=o+".x1",R="x1",C=u,N=o+".x0",j="x0"),h>f?(M=f,E=o+".y0",D="y0",T=h,O=o+".y1",I="y1"):(M=h,E=o+".y1",D="y1",T=f,O=o+".y0",I="y0"),c={},a(e),Q.moveFn="move"===X?l:s}function i(n){S(e),n&&k.relayout(t,c)}function l(r,a){if("path"===n.type){var o=function(t){return U(V(t)+r)};B&&"date"===B.type&&(o=m(o));var i=function(t){return Y(Z(t)+a)};H&&"date"===H.type&&(i=m(i)),n.path=b(F,o,i),c[q]=n.path}else c[p]=n.x0=U(u+r),c[g]=n.y0=Y(f+a),c[_]=n.x1=U(d+r),c[w]=n.y1=Y(h+a);e.attr("d",x(t,n))}function s(r,a){if("path"===n.type){var o=function(t){return U(V(t)+r)};B&&"date"===B.type&&(o=m(o));var i=function(t){return Y(Z(t)+a)};H&&"date"===H.type&&(i=m(i)),n.path=b(F,o,i),c[q]=n.path}else{var l=~X.indexOf("n")?M+a:M,s=~X.indexOf("s")?T+a:T,u=~X.indexOf("w")?L+r:L,f=~X.indexOf("e")?C+r:C;s-l>$&&(c[E]=n[D]=Y(l),c[O]=n[I]=Y(s)),f-u>G&&(c[P]=n[R]=U(u),c[N]=n[j]=U(f))}e.attr("d",x(t,n))}var c,u,f,d,h,p,g,_,w,M,T,L,C,E,O,P,N,D,I,R,j,F,q,B,H,V,Z,U,Y,X,G=10,$=10,Q={setCursor:a,element:e.node(),prepFn:o,doneFn:i},W=Q.element.getBoundingClientRect();z.init(Q)}function h(t,e){var n=t._fullLayout.shapes[e],r=t._fullLayout._shapeUpperLayer;return n?"below"===n.layer&&(r="paper"===n.xref&&"paper"===n.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):M.log("getShapeLayer: undefined shape: index",e),r}function p(t,e,n){var r=k.Axes.getFromId(t,n.id,"x")._id,a=k.Axes.getFromId(t,n.id,"y")._id,o="below"===e.layer,i=r===e.xref||a===e.yref,l=!!n.shapelayer;return o&&i&&l}function g(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}}function m(t){return function(e){return t(e).replace(" ","_")}}function v(t,e,n){var r,o=t._fullLayout._size;if(e){var i=a(e);r=function(t){return e._offset+e.l2p(i(t,!0))},"date"===e.type&&(r=g(r))}else r=n?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return r}function y(t,e,n){var r,a=t._fullLayout._size;if(e){var i=o(e);r=function(t){return i(e.p2l(t-e._offset))}}else r=n?function(t){return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return r}function x(t,e){var n,r,o,i,l=e.type,s=A.getFromId(t,e.xref),c=A.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(n=a(s),r=function(t){return s._offset+s.l2p(n(t,!0))}):r=function(t){return u.l+u.w*t},c?(o=a(c),i=function(t){return c._offset+c.l2p(o(t,!0))}):i=function(t){return u.t+u.h*(1-t)},"path"===l)return s&&"date"===s.type&&(r=g(r)),c&&"date"===c.type&&(i=g(i)),C.convertPath(e.path,r,i);var f=r(e.x0),d=r(e.x1),h=i(e.y0),p=i(e.y1);if("line"===l)return"M"+f+","+h+"L"+d+","+p;if("rect"===l)return"M"+f+","+h+"H"+d+"V"+p+"H"+f+"Z";var m=(f+d)/2,v=(h+p)/2,y=Math.abs(m-f),x=Math.abs(v-h),b="A"+y+","+x,_=m+y+","+v,w=m+","+(v-x);return"M"+_+b+" 0 1,1 "+w+b+" 0 0,1 "+_+"Z"}function b(t,e,n){return t.replace(E,function(t){var r=0,a=t.charAt(0),o=P[a],i=N[a],l=D[a],s=t.substr(1).replace(O,function(t){return r>=l?t:(o[r]?t=e(t):i[r]&&(t=n(t)),r++,t)});return a+s})}function _(t,e,n,r,a){var o="category"===t.type?Number:t.d2c;if(void 0!==e)return[o(e),o(n)];if(r){var i,l,s,c,u,f=1/0,d=-(1/0),h=r.match(E);for("date"===t.type&&(o=g(o)),i=0;iu&&(f=u),u>d&&(d=u)));return d>=f?[f,d]:void 0}}var w=t("fast-isnumeric"),k=t("../../plotly"),M=t("../../lib"),A=t("../../plots/cartesian/axes"),T=t("../color"),L=t("../drawing"),z=t("../dragelement"),S=t("../../lib/setcursor"),C=e.exports={};C.layoutAttributes=t("./attributes"),C.supplyLayoutDefaults=function(t,e){for(var n=t.shapes||[],a=e.shapes=[],o=0;ol&&(t="X"),t});return r>l&&(s=s.replace(/[\s,]*X.*/,""),M.log("Ignoring extra params in segment "+t)),a+s})},C.calcAutorange=function(t){var e,n,r,a,o,i=t._fullLayout,l=i.shapes;if(l.length&&t._fullData.length)for(e=0;ed?n=d:(u.left-=x.offsetLeft,u.right-=x.offsetLeft,u.top-=x.offsetTop,u.bottom-=x.offsetTop,x.selection.each(function(){var t=s.bBox(this);l.bBoxIntersect(u,t,c)&&(n=Math.max(n,i*(t[x.side]-u[o])+c))}),n=Math.min(d,n)),n>0||0>d){var h={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+h+")")}}}function p(){L=0,z=!0,S=E,k._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var g=n.propContainer,m=n.propName,v=n.traceIndex,y=n.dfltName,x=n.avoid||{},b=n.attributes,_=n.transform,w=n.containerGroup,k=t._fullLayout,M=g.titlefont.family,A=g.titlefont.size,T=g.titlefont.color,L=1,z=!1,S=g.title.trim();""===S&&(L=0),S.match(/Click to enter .+ title/)&&(L=.2,z=!0),w||(w=k._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var C=w.selectAll("text").data([0]);C.enter().append("text"),C.text(S).attr("class",e),C.attr({"data-unformatted":S}).call(f);var E="Click to enter "+y+" title",O=t._context.editable;O&&(g===k?O=t._context.editableMainTitle:g===k.xaxis?O=t._context.editableAxisXTitle:g===k.yaxis?O=t._context.editableAxisYTitle:g===k.yaxis2?O=t._context.editableAxisY2Title:g===k.xaxis2&&(O=t._context.editableAxisX2Title)),O?(S||p(),C.call(u.makeEditable).on("edit",function(e){void 0!==v?o.restyle(t,m,e,v):o.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):S&&!S.match(/Click to enter .+ title/)||C.remove(),C.classed("js-placeholder",z),g._titleElement=C}},{"../../lib":103,"../../lib/svg_text_utils":114,"../../plotly":121,"../../plots/plots":144,"../color":25,"../drawing":48,d3:14,"fast-isnumeric":17}],89:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:!0,visible:{valType:"boolean"},active:{valType:"integer",min:-1,dflt:0},buttons:i,x:{valType:"number",min:-2,max:3,dflt:-.05},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"right"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"bottom"},font:o({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":101,"../../plots/font_attributes":142,"../color/attributes":24}],90:[function(t,e,n){"use strict";e.exports={name:"updatemenus",itemName:"updatemenu",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",buttonGroupClassName:"updatemenu-button-group",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],91:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,i,n,r)}var l=a(t,e),s=r("visible",l.length>0);s&&(r("active"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),o.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function a(t,e){function n(t,e){return o.coerce(r,a,c,t,e)}for(var r,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(s.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),s.exit().remove(),s.exit().size()&&v(t),0!==n.length){var c=s.selectAll("g."+T.headerGroupClassName).data(n,a);c.enter().append("g").classed(T.headerGroupClassName,!0);var u=s.selectAll("g."+T.buttonGroupClassName).data([0]);u.enter().append("g").classed(T.buttonGroupClassName,!0).style("pointer-events","all"),c.enter().size()&&u.call(m).attr(T.menuIndexAttrName,"-1"),c.exit().each(function(e){y.select(this).remove(),u.call(m).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var f=0;f",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],95:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],96:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.16.3-d15",n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=r.register,n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=r.Snapshot,n.PlotSchema=r.PlotSchema,n.Queue=r.Queue,n.d3=t("d3")},{"../build/ploticon":2,"./plot_api/set_plot_config":118,"./plot_api/to_image":119,"./plot_api/validate":120,"./plotly":121,"./snapshot/download":159,d3:14}],97:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],98:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("tinycolor2"),o=t("./nested_property"),i=t("../components/colorscale/get_scale"),l=(Object.keys(t("../components/colorscale/scales")),/^([2-9]|[1-9][0-9]+)$/);n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),-1===r.values.indexOf(t)?e.set(n):e.set(t)}},"boolean":{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,a){!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,a){t%1||!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var a="number"==typeof t;r.strict!==!0&&a?e.set(String(t)):e.set(n)}else r.noBlank&&!t?e.set(n):e.set(t)}},color:{coerceFunction:function(t,e,n){a(t).isValid()?e.set(t):e.set(n)}},colorscale:{coerceFunction:function(t,e,n){e.set(i(t,n))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):r(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,n){var r=n.length;return"string"==typeof t&&t.substr(0,r)===n&&l.test(t.substr(r))?void e.set(t):void e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n?!0:"string"!=typeof t?!1:!(t.substr(0,r)!==n||!l.test(t.substr(r)))}},flaglist:{coerceFunction:function(t,e,n,r){if("string"!=typeof t)return void e.set(n);if(-1!==(r.extras||[]).indexOf(t))return void e.set(t);for(var a=t.split("+"),o=0;os;s++){var c=l[s],u={_fullLayout:e},f=A.coerceRef(t,r,u,c);if("path"!==i){var d=.25,h=.75;if("paper"!==f){var p=A.getFromId(u,f),g=o(p);d=g(p.range[0]+d*(p.range[1]-p.range[0])),h=g(p.range[0]+h*(p.range[1]-p.range[0]))}n(c+"0",d),n(c+"1",h)}}return"path"===i?n("path"):M.noneOrAll(t,r,["x0","x1","y0","y1"]),r}function a(t){return"category"===t.type?t.c2l:t.d2l}function o(t){return"category"===t.type?t.l2c:t.l2d}function i(t,e){t.layout.shapes=e,C.supplyLayoutDefaults(t.layout,t._fullLayout),C.drawAll(t)}function l(t){delete t.layout.shapes,t._fullLayout.shapes=[],C.drawAll(t)}function s(t,e,n){for(var r=0;re;a--)h(t,a).selectAll('[data-index="'+(a-1)+'"]').attr("data-index",a),C.draw(t,a)}function f(t,e,n,i){function l(n){var r={"data-index":e,"fill-rule":"evenodd",d:x(t,C)},a=C.line.width?C.line.color:"rgba(0,0,0,0)",o=n.append("path").attr(r).style("opacity",C.opacity).call(T.stroke,a).call(T.fill,C.fillcolor).call(L.dashLine,C.line.dash,C.line.width);E&&o.call(L.setClipUrl,"clip"+t._fullLayout._uid+E),t._context.editable&&d(t,o,C,e)}var s,c;h(t,e).selectAll('[data-index="'+e+'"]').remove();var u=t.layout.shapes[e];if(u){var f={xref:u.xref,yref:u.yref},g={};"string"==typeof n&&n?g[n]=i:M.isPlainObject(n)&&(g=n);var m=Object.keys(g);for(s=0;ss;s++){var b=y[s];if(void 0===g[b]&&void 0!==u[b]){var _,w=b.charAt(0),k=A.getFromId(t,A.coerceRef(f,{},t,w)),z=A.getFromId(t,A.coerceRef(u,{},t,w)),S=u[b];void 0!==g[w+"ref"]&&(k?(_=a(k)(S),S=(_-k.range[0])/(k.range[1]-k.range[0])):S=(S-z.domain[0])/(z.domain[1]-z.domain[0]),z?(_=z.range[0]+S*(z.range[1]-z.range[0]),S=o(z)(_)):S=k.domain[0]+S*(k.domain[1]-k.domain[0])),u[b]=S}}var C=r(u,t._fullLayout);t._fullLayout.shapes[e]=C;var E;if("below"!==C.layer)E=(C.xref+C.yref).replace(/paper/g,""),l(t._fullLayout._shapeUpperLayer);else if("paper"===C.xref&&"paper"===C.yref)E="",l(t._fullLayout._shapeLowerLayer);else{var O,P=t._fullLayout._plots||{},N=Object.keys(P);for(s=0,c=N.length;c>s;s++)O=P[N[s]],E=N[s],p(t,C,O)&&l(O.shapelayer)}}}function d(t,e,n,r){function a(t){var n=W.right-W.left,r=W.bottom-W.top,a=t.clientX-W.left,o=t.clientY-W.top,i=n>G&&r>$&&!t.shiftKey?z.getCursor(a/n,1-o/r):"move";S(e,i),X=i.split("-")[0]}function o(e){B=A.getFromId(t,n.xref),H=A.getFromId(t,n.yref),V=v(t,B),Z=v(t,H,!0),U=y(t,B),Y=y(t,H,!0);var o="shapes["+r+"]";"path"===n.type?(F=n.path,q=o+".path"):(u=V(n.x0),f=Z(n.y0),d=V(n.x1),h=Z(n.y1),p=o+".x0",g=o+".y0",_=o+".x1",w=o+".y1"),d>u?(L=u,P=o+".x0",R="x0",C=d,N=o+".x1",j="x1"):(L=d,P=o+".x1",R="x1",C=u,N=o+".x0",j="x0"),h>f?(M=f,E=o+".y0",D="y0",T=h,O=o+".y1",I="y1"):(M=h,E=o+".y1",D="y1",T=f,O=o+".y0",I="y0"),c={},a(e),Q.moveFn="move"===X?l:s}function i(n){S(e),n&&k.relayout(t,c)}function l(r,a){if("path"===n.type){var o=function(t){return U(V(t)+r)};B&&"date"===B.type&&(o=m(o));var i=function(t){return Y(Z(t)+a)};H&&"date"===H.type&&(i=m(i)),n.path=b(F,o,i),c[q]=n.path}else c[p]=n.x0=U(u+r),c[g]=n.y0=Y(f+a),c[_]=n.x1=U(d+r),c[w]=n.y1=Y(h+a);e.attr("d",x(t,n))}function s(r,a){if("path"===n.type){var o=function(t){return U(V(t)+r)};B&&"date"===B.type&&(o=m(o));var i=function(t){return Y(Z(t)+a)};H&&"date"===H.type&&(i=m(i)),n.path=b(F,o,i),c[q]=n.path}else{var l=~X.indexOf("n")?M+a:M,s=~X.indexOf("s")?T+a:T,u=~X.indexOf("w")?L+r:L,f=~X.indexOf("e")?C+r:C;s-l>$&&(c[E]=n[D]=Y(l),c[O]=n[I]=Y(s)),f-u>G&&(c[P]=n[R]=U(u),c[N]=n[j]=U(f))}e.attr("d",x(t,n))}var c,u,f,d,h,p,g,_,w,M,T,L,C,E,O,P,N,D,I,R,j,F,q,B,H,V,Z,U,Y,X,G=10,$=10,Q={setCursor:a,element:e.node(),prepFn:o,doneFn:i},W=Q.element.getBoundingClientRect();z.init(Q)}function h(t,e){var n=t._fullLayout.shapes[e],r=t._fullLayout._shapeUpperLayer;return n?"below"===n.layer&&(r="paper"===n.xref&&"paper"===n.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):M.log("getShapeLayer: undefined shape: index",e),r}function p(t,e,n){var r=k.Axes.getFromId(t,n.id,"x")._id,a=k.Axes.getFromId(t,n.id,"y")._id,o="below"===e.layer,i=r===e.xref||a===e.yref,l=!!n.shapelayer;return o&&i&&l}function g(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}}function m(t){return function(e){return t(e).replace(" ","_")}}function v(t,e,n){var r,o=t._fullLayout._size;if(e){var i=a(e);r=function(t){return e._offset+e.l2p(i(t,!0))},"date"===e.type&&(r=g(r))}else r=n?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return r}function y(t,e,n){var r,a=t._fullLayout._size;if(e){var i=o(e);r=function(t){return i(e.p2l(t-e._offset))}}else r=n?function(t){return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return r}function x(t,e){var n,r,o,i,l=e.type,s=A.getFromId(t,e.xref),c=A.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(n=a(s),r=function(t){return s._offset+s.l2p(n(t,!0))}):r=function(t){return u.l+u.w*t},c?(o=a(c),i=function(t){return c._offset+c.l2p(o(t,!0))}):i=function(t){return u.t+u.h*(1-t)},"path"===l)return s&&"date"===s.type&&(r=g(r)),c&&"date"===c.type&&(i=g(i)),C.convertPath(e.path,r,i);var f=r(e.x0),d=r(e.x1),h=i(e.y0),p=i(e.y1);if("line"===l)return"M"+f+","+h+"L"+d+","+p;if("rect"===l)return"M"+f+","+h+"H"+d+"V"+p+"H"+f+"Z";var m=(f+d)/2,v=(h+p)/2,y=Math.abs(m-f),x=Math.abs(v-h),b="A"+y+","+x,_=m+y+","+v,w=m+","+(v-x);return"M"+_+b+" 0 1,1 "+w+b+" 0 0,1 "+_+"Z"}function b(t,e,n){return t.replace(E,function(t){var r=0,a=t.charAt(0),o=P[a],i=N[a],l=D[a],s=t.substr(1).replace(O,function(t){return r>=l?t:(o[r]?t=e(t):i[r]&&(t=n(t)),r++,t)});return a+s})}function _(t,e,n,r,a){var o="category"===t.type?Number:t.d2c;if(void 0!==e)return[o(e),o(n)];if(r){var i,l,s,c,u,f=1/0,d=-(1/0),h=r.match(E);for("date"===t.type&&(o=g(o)),i=0;iu&&(f=u),u>d&&(d=u)));return d>=f?[f,d]:void 0}}var w=t("fast-isnumeric"),k=t("../../plotly"),M=t("../../lib"),A=t("../../plots/cartesian/axes"),T=t("../color"),L=t("../drawing"),z=t("../dragelement"),S=t("../../lib/setcursor"),C=e.exports={};C.layoutAttributes=t("./attributes"),C.supplyLayoutDefaults=function(t,e){for(var n=t.shapes||[],a=e.shapes=[],o=0;ol&&(t="X"),t});return r>l&&(s=s.replace(/[\s,]*X.*/,""),M.log("Ignoring extra params in segment "+t)),a+s})},C.calcAutorange=function(t){var e,n,r,a,o,i=t._fullLayout,l=i.shapes;if(l.length&&t._fullData.length)for(e=0;ed?n=d:(u.left-=x.offsetLeft,u.right-=x.offsetLeft,u.top-=x.offsetTop,u.bottom-=x.offsetTop,x.selection.each(function(){var t=s.bBox(this);l.bBoxIntersect(u,t,c)&&(n=Math.max(n,i*(t[x.side]-u[o])+c))}),n=Math.min(d,n)),n>0||0>d){var h={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+h+")")}}}function p(){L=0,z=!0,S=E,k._infolayer.select("."+e).attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){r.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(1e3).style("opacity",0)})}var g=n.propContainer,m=n.propName,v=n.traceIndex,y=n.dfltName,x=n.avoid||{},b=n.attributes,_=n.transform,w=n.containerGroup,k=t._fullLayout,M=g.titlefont.family,A=g.titlefont.size,T=g.titlefont.color,L=1,z=!1,S=g.title.trim();""===S&&(L=0),S.match(/Click to enter .+ title/)&&(L=.2,z=!0),w||(w=k._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var C=w.selectAll("text").data([0]);C.enter().append("text"),C.text(S).attr("class",e),C.attr({"data-unformatted":S}).call(f);var E="Click to enter "+y+" title",O=t._context.editable;O&&(g===k?O=t._context.editableMainTitle:g===k.xaxis?O=t._context.editableAxisXTitle:g===k.yaxis?O=t._context.editableAxisYTitle:g===k.yaxis2?O=t._context.editableAxisY2Title:g===k.xaxis2&&(O=t._context.editableAxisX2Title)),O?(S||p(),C.call(u.makeEditable).on("edit",function(e){void 0!==v?o.restyle(t,m,e,v):o.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(f)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):S&&!S.match(/Click to enter .+ title/)||C.remove(),C.classed("js-placeholder",z),g._titleElement=C}},{"../../lib":103,"../../lib/svg_text_utils":114,"../../plotly":121,"../../plots/plots":144,"../color":25,"../drawing":48,d3:14,"fast-isnumeric":17}],89:[function(t,e,n){"use strict";var r=t("../../plots/font_attributes"),a=t("../color/attributes"),o=t("../../lib/extend").extendFlat,i={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:!0,visible:{valType:"boolean"},active:{valType:"integer",min:-1,dflt:0},buttons:i,x:{valType:"number",min:-2,max:3,dflt:-.05},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"right"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"bottom"},font:o({},r,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":101,"../../plots/font_attributes":142,"../color/attributes":24}],90:[function(t,e,n){"use strict";e.exports={name:"updatemenus",itemName:"updatemenu",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",buttonGroupClassName:"updatemenu-button-group",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],91:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,i,n,r)}var l=a(t,e),s=r("visible",l.length>0);s&&(r("active"),r("x"),r("y"),o.noneOrAll(t,e,["x","y"]),r("xanchor"),r("yanchor"),o.coerceFont(r,"font",n.font),r("bgcolor",n.paper_bgcolor),r("bordercolor"),r("borderwidth"))}function a(t,e){function n(t,e){return o.coerce(r,a,c,t,e)}for(var r,a,i=t.buttons||[],l=e.buttons=[],s=0;s0?[0]:[]);if(s.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),s.exit().remove(),s.exit().size()&&v(t),0!==n.length){var c=s.selectAll("g."+T.headerGroupClassName).data(n,a);c.enter().append("g").classed(T.headerGroupClassName,!0);var u=s.selectAll("g."+T.buttonGroupClassName).data([0]);u.enter().append("g").classed(T.buttonGroupClassName,!0).style("pointer-events","all"),c.enter().size()&&u.call(m).attr(T.menuIndexAttrName,"-1"),c.exit().each(function(e){y.select(this).remove(),u.call(m).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var f=0;f",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],95:[function(t,e,n){"use strict";n.xmlns="http://www.w3.org/2000/xmlns/",n.svg="http://www.w3.org/2000/svg",n.xlink="http://www.w3.org/1999/xlink",n.svgAttrs={xmlns:n.svg,"xmlns:xlink":n.xlink}},{}],96:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.16.3-d16",n.plot=r.plot,n.newPlot=r.newPlot,n.restyle=r.restyle,n.relayout=r.relayout,n.redraw=r.redraw,n.extendTraces=r.extendTraces,n.prependTraces=r.prependTraces,n.addTraces=r.addTraces,n.deleteTraces=r.deleteTraces,n.moveTraces=r.moveTraces,n.purge=r.purge,n.setPlotConfig=t("./plot_api/set_plot_config"),n.register=r.register,n.toImage=t("./plot_api/to_image"),n.downloadImage=t("./snapshot/download"),n.validate=t("./plot_api/validate"),n.Icons=t("../build/ploticon"),n.Plots=r.Plots,n.Fx=r.Fx,n.Snapshot=r.Snapshot,n.PlotSchema=r.PlotSchema,n.Queue=r.Queue,n.d3=t("d3")},{"../build/ploticon":2,"./plot_api/set_plot_config":118,"./plot_api/to_image":119,"./plot_api/validate":120,"./plotly":121,"./snapshot/download":159,d3:14}],97:[function(t,e,n){"use strict";"undefined"!=typeof MathJax?(n.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):n.MathJax=!1},{}],98:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("tinycolor2"),o=t("./nested_property"),i=t("../components/colorscale/get_scale"),l=(Object.keys(t("../components/colorscale/scales")),/^([2-9]|[1-9][0-9]+)$/);n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),-1===r.values.indexOf(t)?e.set(n):e.set(t)}},"boolean":{coerceFunction:function(t,e,n){t===!0||t===!1?e.set(t):e.set(n)}},number:{coerceFunction:function(t,e,n,a){!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,a){t%1||!r(t)||void 0!==a.min&&ta.max?e.set(n):e.set(+t)}},string:{coerceFunction:function(t,e,n,r){if("string"!=typeof t){var a="number"==typeof t;r.strict!==!0&&a?e.set(String(t)):e.set(n)}else r.noBlank&&!t?e.set(n):e.set(t)}},color:{coerceFunction:function(t,e,n){a(t).isValid()?e.set(t):e.set(n)}},colorscale:{coerceFunction:function(t,e,n){e.set(i(t,n))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):r(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,n){var r=n.length;return"string"==typeof t&&t.substr(0,r)===n&&l.test(t.substr(r))?void e.set(t):void e.set(n)},validateFunction:function(t,e){var n=e.dflt,r=n.length;return t===n?!0:"string"!=typeof t?!1:!(t.substr(0,r)!==n||!l.test(t.substr(r)))}},flaglist:{coerceFunction:function(t,e,n,r){if("string"!=typeof t)return void e.set(n);if(-1!==(r.extras||[]).indexOf(t))return void e.set(t);for(var a=t.split("+"),o=0;o2)return!1;var s=i[0].split("-");if(s.length>3||3!==s.length&&i[1])return!1;if(4===s[0].length)n=Number(s[0]);else{if(2!==s[0].length)return!1;var c=(new Date).getFullYear();n=((Number(s[0])-c+70)%100+200)%100+c-70}return l(n)?1===s.length?new Date(n,0,1).getTime():(r=Number(s[1])-1,s[1].length>2||!(r>=0&&11>=r)?!1:2===s.length?new Date(n,r,1).getTime():(a=Number(s[2]),s[2].length>2||!(a>=1&&31>=a)?!1:(a=new Date(n,r,a).getTime(),i[1]?(s=i[1].split(":"),s.length>3?!1:(o=Number(s[0]),s[0].length>2||!(o>=0&&23>=o)?!1:(a+=36e5*o,1===s.length?a:(r=Number(s[1]),s[1].length>2||!(r>=0&&59>=r)?!1:(a+=6e4*r,2===s.length?a:(t=Number(s[2]),t>=0&&60>t?a+1e3*t:!1)))))):a))):!1},n.isDateTime=function(t){return n.dateTime2ms(t)!==!1},n.ms2DateTime=function(t,e){if("undefined"==typeof i)return void s.error("d3 is not defined.");e||(e=0);var n=new Date(t),a=i.time.format("%Y-%m-%d")(n);return 7776e6>e?(a+=" "+r(n.getHours(),2),432e6>e&&(a+=":"+r(n.getMinutes(),2),108e5>e&&(a+=":"+r(n.getSeconds(),2),3e5>e&&(a+="."+r(n.getMilliseconds(),3)))),a.replace(/([:\s]00)*\.?[0]*$/,"")):a};var c={H:["%H:%M:%S~%L","%H:%M:%S","%H:%M"],I:["%I:%M:%S~%L%p","%I:%M:%S%p","%I:%M%p"],D:["%H","%I%p","%Hh"]},u={Y:["%Y~%m~%d","%Y%m%d","%y%m%d","%m~%d~%Y","%d~%m~%Y"],Yb:["%b~%d~%Y","%d~%b~%Y","%Y~%d~%b","%Y~%b~%d"],y:["%m~%d~%y","%d~%m~%y","%y~%m~%d"],yb:["%b~%d~%y","%d~%b~%y","%y~%d~%b","%y~%b~%d"]},f=i.time.format.utc,d={Y:{H:["%Y~%m~%dT%H:%M:%S","%Y~%m~%dT%H:%M:%S~%L"].map(f),I:[],D:["%Y%m%d%H%M%S","%Y~%m","%m~%Y"].map(f)},Yb:{H:[],I:[],D:["%Y~%b","%b~%Y"].map(f)},y:{H:[],I:[],D:[]},yb:{H:[],I:[],D:[]}};["Y","Yb","y","yb"].forEach(function(t){u[t].forEach(function(e){d[t].D.push(f(e)),["H","I","D"].forEach(function(n){c[n].forEach(function(r){var a=d[t][n];a.push(f(e+"~"+r)),a.push(f(r+"~"+e))})})})});var h=/[a-z]*/g,p=function(t){return t.substr(0,3)},g=/(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g,m=/[\s,\/\-\.\(\)]+/g,v=/~?([ap])~?m(~|$)/,y=function(t,e){return e+"m "},x=/\d\d\d\d/,b=/(^|~)[a-z]{3}/,_=/[ap]m/,w=/:/,k=/q([1-4])/,M=["31~mar","30~jun","30~sep","31~dec"],A=function(t,e){return M[e-1]},T=/ ?([+\-]\d\d:?\d\d|Z)$/;n.parseDate=function(t){if(t.getTime)return t;if("string"!=typeof t)return!1;t=t.toLowerCase().replace(h,p).replace(g,"").replace(m,"~").replace(v,y).replace(k,A).trim().replace(T,"");var e,n,r=null,i=a(t),l=o(t);e=d[i][l],n=e.length;for(var s=0;n>s&&!(r=e[s].parse(t));s++);if(!(r instanceof Date))return!1;var c=r.getTimezoneOffset();return r.setTime(r.getTime()+60*c*1e3),r}},{"../lib":103,d3:14,"fast-isnumeric":17}],100:[function(t,e,n){"use strict";var r=t("events").EventEmitter,a={init:function(t){if(t._ev instanceof r)return t;var e=new r;return t._ev=e,t.on=e.on.bind(e),t.once=e.once.bind(e),t.removeListener=e.removeListener.bind(e),t.removeAllListeners=e.removeAllListeners.bind(e),t.emit=function(n,r){"undefined"!=typeof jQuery&&jQuery(t).trigger(n,r),e.emit(n,r)},t},triggerHandler:function(t,e,n){var r,a;"undefined"!=typeof jQuery&&(r=jQuery(t).triggerHandler(e,n));var o=t._ev;if(!o)return r;var i=o._events[e];if(!i)return r;"function"==typeof i&&(i=[i]);for(var l=i.pop(),s=0;sv;v++){s=t[v];for(c in s)u=g[c],f=s[c],l&&i(f)?g[c]=f:e&&f&&(o(f)||(d=i(f)))?(d?(d=!1,h=u&&i(u)?u:[]):h=u&&o(u)?u:{},g[c]=a([h,f],e,n,l)):("undefined"!=typeof f||n)&&(g[c]=f)}return g}var o=t("./is_plain_object.js"),i=Array.isArray;n.extendFlat=function(){return a(arguments,!1,!1,!1)},n.extendDeep=function(){return a(arguments,!0,!1,!1)},n.extendDeepAll=function(){return a(arguments,!0,!0,!1)},n.extendDeepNoArrays=function(){return a(arguments,!0,!1,!0)}},{"./is_plain_object.js":104}],102:[function(t,e,n){"use strict";e.exports=function(t){for(var e=[],n=0;nn?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},a.bBoxIntersect=function(t,e,n){return n=n||0,t.left<=e.right+n&&e.left<=t.right+n&&t.top<=e.bottom+n&&e.top<=t.bottom+n},a.identity=function(t){return t},a.randstr=function d(t,e,n){if(n||(n=16),void 0===e&&(e=24),0>=e)return"0";var r,a,o,i=Math.log(Math.pow(2,e))/Math.log(n),l="";for(r=2;i===1/0;r*=2)i=Math.log(Math.pow(2,e/r))/Math.log(n)*r;var s=i-Math.floor(i);for(r=0;r-1||c!==1/0&&c>=Math.pow(2,e)?d(t,e,n):l},a.OptionControl=function(t,e){t||(t={}),e||(e="opt");var n={};return n.optionList=[],n._newoption=function(r){r[e]=t,n[r.name]=r,n.optionList.push(r)},n["_"+e]=t,n},a.smooth=function(t,e){if(e=Math.round(e)||0,2>e)return t;var n,r,a,o,i=t.length,l=2*i,s=2*e-1,c=new Array(s),u=new Array(i);for(n=0;s>n;n++)c[n]=(1-Math.cos(Math.PI*(n+1)/e))/(2*e);for(n=0;i>n;n++){for(o=0,r=0;s>r;r++)a=n+r+1-e,-i>a?a-=l*Math.round(a/l):a>=l&&(a-=l*Math.floor(a/l)),0>a?a=-1-a:a>=i&&(a=l-1-a),o+=t[a]*c[r];u[n]=o}return u},a.syncOrAsync=function(t,e,n){function r(){return a.syncOrAsync(t,e,n)}for(var o,i;t.length;)if(i=t.splice(0,1)[0],o=i(e),o&&o.then)return o.then(r).then(void 0,a.promiseError);return n&&n(e)},a.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},a.noneOrAll=function(t,e,n){if(t){var r,a,o=!1,i=!0;for(r=0;ra;a++)e[a][n]=t[a]},a.minExtend=function(t,e){var n={};"object"!=typeof e&&(e={});var r,o,i,l=3,s=Object.keys(t);for(r=0;r1?r+o[1]:"";if(a&&(o.length>1||i.length>4))for(;n.test(i);)i=i.replace(n,"$1"+a+"$2");return i+l}},{"./coerce":98,"./dates":99,"./extend":101,"./is_plain_object":104,"./loggers":105,"./matrix":106,"./nested_property":107,"./notifier":108,"./search":111,"./stats":113,d3:14}],104:[function(t,e,n){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],105:[function(t,e,n){"use strict";var r=t("../plot_api/plot_config"),a=e.exports={};a.log=function(){if(r.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;er;r++)n[r]=new Array(e);return n},n.transposeRagged=function(t){var e,n,r=0,a=t.length;for(e=0;a>e;e++)r=Math.max(r,t[e].length);var o=new Array(r);for(e=0;r>e;e++)for(o[e]=new Array(a),n=0;a>n;n++)o[e][n]=t[n][e];return o},n.dot=function(t,e){if(!t.length||!e.length||t.length!==e.length)return null;var r,a,o=t.length;if(t[0].length)for(r=new Array(o),a=0;o>a;a++)r[a]=n.dot(t[a],e);else if(e[0].length){var i=n.transposeRagged(e);for(r=new Array(i.length),a=0;aa;a++)r+=t[a]*e[a];return r},n.translationMatrix=function(t,e){return[[1,0,t],[0,1,e],[0,0,1]]},n.rotationMatrix=function(t){var e=t*Math.PI/180;return[[Math.cos(e),-Math.sin(e),0],[Math.sin(e),Math.cos(e),0],[0,0,1]]},n.rotationXYMatrix=function(t,e,r){return n.dot(n.dot(n.translationMatrix(e,r),n.rotationMatrix(t)),n.translationMatrix(-e,-r))},n.apply2DTransform=function(t){return function(){var e=arguments;3===e.length&&(e=e[0]);var r=1===arguments.length?e[0]:[e[0],e[1]];return n.dot(t,[r[0],r[1],1]).slice(0,2)}},n.apply2DTransform2=function(t){var e=n.apply2DTransform(t);return function(t){return e(t.slice(0,2)).concat(e(t.slice(2,4)))}}},{}],107:[function(t,e,n){"use strict";function r(t,e){return function(){var n,a,o,i,l,s=t;for(i=0;i=0;e--){if(r=t[e],i=!1,Array.isArray(r))for(n=r.length-1;n>=0;n--)c(r[n])?i?r[n]=void 0:r.pop():i=!0;else if("object"==typeof r&&null!==r)for(o=Object.keys(r),i=!1,n=o.length-1;n>=0;n--)c(r[o[n]])&&!a(r[o[n]],o[n])?delete r[o[n]]:i=!0;if(i)return}}function c(t){return void 0===t||null===t?!0:"object"!=typeof t?!1:Array.isArray(t)?!t.length:!Object.keys(t).length}function u(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var f=t("fast-isnumeric");e.exports=function(t,e){if(f(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var n,a,i,l=0,s=e.split(".");ln||n>o||i>r||r>l?!1:!e||!c(t)}function n(t,e){var n=t[0],s=t[1];if(a>n||n>o||i>s||s>l)return!1;var c,u,f,d,h,p=r.length,g=r[0][0],m=r[0][1],v=0;for(c=1;p>c;c++)if(u=g,f=m,g=r[c][0],m=r[c][1],d=Math.min(u,g),!(d>n||n>Math.max(u,g)||s>Math.max(f,m)))if(s=s&&n!==d&&v++}return v%2===1}var r=t.slice(),a=r[0][0],o=a,i=r[0][1],l=i;r.push(r[0]);for(var s=1;so;o++)if(i=[t[o][0]-s[0],t[o][1]-s[1]],l=r(i,c),0>l||l>u||Math.abs(r(i,d))>a)return!0;return!1};a.filter=function(t,e){function n(n){t.push(n);var l=r.length,s=a;r.splice(i+1);for(var c=s+1;c1){var l=t.pop();n(l)}return{addPt:n,raw:t,filtered:r}}},{"./matrix":106}],110:[function(t,e,n){"use strict";function r(t,e){for(var n,r=[],o=0;oo.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},i.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},i.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},i.undo=function(t){var e,n;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;n=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,n=0;nt}function a(t,e){return e>=t}function o(t,e){return t>e}function i(t,e){return t>=e}var l=t("fast-isnumeric"),s=t("../lib");n.findBin=function(t,e,n){if(l(e.start))return n?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var c,u,f=0,d=e.length,h=0;for(u=e[e.length-1]>=e[0]?n?r:a:n?i:o;d>f&&h++<100;)c=Math.floor((f+d)/2),u(e[c],t)?f=c+1:d=c;return h>90&&s.log("Long binary search..."),f-1},n.sorterAsc=function(t,e){return t-e},n.sorterDes=function(t,e){return e-t},n.distinctVals=function(t){var e=t.slice();e.sort(n.sorterAsc);for(var r=e.length-1,a=e[r]-e[0]||1,o=a/(r||1)/1e4,i=[e[0]],l=0;r>l;l++)e[l+1]>e[l]+o&&(a=Math.min(a,e[l+1]-e[l]),i.push(e[l+1]));return{vals:i,minDiff:a}},n.roundUp=function(t,e,n){for(var r,a=0,o=e.length-1,i=0,l=n?0:1,s=n?1:0,c=n?Math.ceil:Math.floor;o>a&&i++<100;)r=c((a+o)/2),e[r]<=t?a=r+l:o=r-s;return e[a]}},{"../lib":103,"fast-isnumeric":17}],112:[function(t,e,n){"use strict";e.exports=function(t,e){(t.attr("class")||"").split(" ").forEach(function(e){0===e.indexOf("cursor-")&&t.classed(e,!1)}),e&&t.classed("cursor-"+e,!0)}},{}],113:[function(t,e,n){"use strict";var r=t("fast-isnumeric");n.aggNums=function(t,e,a,o){var i,l;if(o||(o=a.length),r(e)||(e=!1),Array.isArray(a[0])){for(l=new Array(o),i=0;o>i;i++)l[i]=n.aggNums(t,e,a[i]);a=l}for(i=0;o>i;i++)r(e)?r(a[i])&&(e=t(+e,+a[i])):e=a[i];return e},n.len=function(t){return n.aggNums(function(t){return t+1},0,t)},n.mean=function(t,e){return e||(e=n.len(t)),n.aggNums(function(t,e){return t+e},0,t)/e},n.variance=function(t,e,a){return e||(e=n.len(t)),r(a)||(a=n.mean(t,e)),n.aggNums(function(t,e){return t+Math.pow(e-a,2)},0,t)/e},n.stdev=function(t,e,r){return Math.sqrt(n.variance(t,e,r))},n.interp=function(t,e){if(!r(e))throw"n should be a finite number";if(e=e*t.length-.5,0>e)return t[0];if(e>t.length-1)return t[t.length-1];var n=e%1;return n*t[Math.ceil(e)]+(1-n)*t[Math.floor(e)]}},{"fast-isnumeric":17}],114:[function(t,e,n){"use strict";function r(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function o(t,e,n){var r="math-output-"+d.randstr([],64),o=f.select("body").append("div").attr({id:r}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(a(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())d.log("There was an error in the tex syntax.",t),n();else{var r=o.select("svg").node().getBoundingClientRect();n(o.select(".MathJax_SVG"),e,r)}o.remove()})}function i(t,e){for(var n=t||"",r=0;r]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),r=e&&e[2].toLowerCase(),a=g[r];if(void 0!==a){var o=e[1],i=e[3],l=i.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===r){if(o)return"";if("href"!==i.substr(0,4).toLowerCase())return"";var c=i.substr(4).replace(/["']/g,"").replace(/=/,""),u=document.createElement("a");return u.href=c,-1===m.indexOf(u.protocol)?"":''}if("br"===r)return"
";if(o)return"sup"===r?'':"sub"===r?'':"";var f=""}return n.xml_entity_encode(t).replace(/");a>0;a=e.indexOf("
",a+1))r.push(a);var o=0;r.forEach(function(t){for(var n=t+o,r=e.slice(0,n),a="",i=r.length-1;i>=0;i--){var l=r[i].match(/<(\/?).*>/i);if(l&&"
"!==r[i]){l[1]||(a=r[i]);break}}a&&(e.splice(n+1,0,a),e.splice(n,0,""),o+=2)});var i=e.join(""),c=i.split(/
/gi);return c.length>1&&(e=c.map(function(t,e){return''+t+""})),e.join("")}function u(t,e,n){var r,a,o,i=n.horizontalAlign,l=n.verticalAlign||"top",s=t.node().getBoundingClientRect(),c=e.node().getBoundingClientRect();return a="bottom"===l?function(){return s.bottom-r.height}:"middle"===l?function(){return s.top+(s.height-r.height)/2}:function(){return s.top},o="right"===i?function(){return s.right-r.width}:"center"===i?function(){return s.left+(s.width-r.width)/2}:function(){return s.left},function(){return r=this.node().getBoundingClientRect(),this.style({top:a()-c.top+"px",left:o()-c.left+"px","z-index":1e3}),this}}var f=t("d3"),d=t("../lib"),h=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings");f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),n=(new DOMParser).parseFromString(e,"application/xml"),r=n.documentElement.firstChild;r;)this.node().appendChild(this.node().ownerDocument.importNode(r,!0)),r=r.nextSibling;return n.querySelector("parsererror")?(d.log(n.querySelector("parsererror div").textContent),null):f.select(this.node().lastChild)},n.html_entity_decode=function(t){var e=f.select("body").append("div").style({display:"none"}).html(""),n=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),n},n.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},n.convertToTspans=function(t,e){function n(){h.empty()||(p=l.attr("class")+"-math",h.select("svg."+p).remove()),t.text("").style({visibility:"visible","white-space":"pre"}),u=t.appendSVG(i),u||t.text(a),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(l)}var a=t.text(),i=c(a),l=t,s=!l.attr("data-notex")&&i.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),u=a,h=f.select(l.node().parentNode);if(!h.empty()){var p=l.attr("class")?l.attr("class").split(" ")[0]:"text";p+="-math",h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove(),t.style({visibility:null});for(var g=t.node();g&&g.removeAttribute;g=g.parentNode)g.removeAttribute("data-bb");if(s){var m=d.getPlotDiv(l.node());(m&&m._promises||[]).push(new Promise(function(t){l.style({visibility:"hidden"});var a={fontSize:parseInt(l.style("font-size"),10)};o(s[2],a,function(a,o,i){h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove();var s=a&&a.select("svg");if(!s||!s.node())return n(),void t();var c=h.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});c.node().appendChild(s.node()),o&&o.node()&&s.node().insertBefore(o.node().cloneNode(!0),s.node().firstChild),s.attr({"class":p,height:i.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=l.style("fill")||"black";s.select("g").attr({fill:u,stroke:u});var f=r(s,"width"),d=r(s,"height"),g=+l.attr("x")-f*{start:0,middle:.5,end:1}[l.attr("text-anchor")||"start"],m=parseInt(l.style("font-size"),10)||r(l,"height"),v=-m/4;"y"===p[0]?(c.attr({transform:"rotate("+[-90,+l.attr("x"),+l.attr("y")]+") translate("+[-f/2,v-d/2]+")"}),s.attr({x:+l.attr("x"),y:+l.attr("y")})):"l"===p[0]?s.attr({x:l.attr("x"),y:v-d/2}):"a"===p[0]?s.attr({x:0,y:v}):s.attr({x:g,y:+l.attr("y")+v-d/2}),e&&e.call(l,c),t(c)})}))}else n();return t}};var g={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},m=["http:","https:","mailto:"],v=new RegExp("]*)?/?>","g"),y=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),x=Object.keys(p.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+p.unicodeToEntity[t]+";"}});n.plainText=function(t){return(t||"").replace(v," ")},n.makeEditable=function(t,e,n){function r(){o(),i.style({opacity:0});var t,e=c.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0})}function a(t){var e=t.node(),n=document.createRange();n.selectNodeContents(e);var r=window.getSelection();r.removeAllRanges(),r.addRange(n),e.focus()}function o(){var t=f.select(d.getPlotDiv(i.node())),e=t.select(".svg-container"),r=e.append("div");r.classed("plugin-editable editable",!0).style({position:"absolute","font-family":i.style("font-family")||"Arial","font-size":i.style("font-size")||12,color:n.fill||i.style("fill")||"black",opacity:1,"background-color":n.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(i.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(n.text||i.attr("data-unformatted")).call(u(i,e,n)).on("blur",function(){i.text(this.textContent).style({opacity:1});var t,e=f.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&f.select(i.node().parentNode).select(t).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),l.edit.call(i,n)}).on("focus",function(){var t=this;f.select(document).on("mouseup",function(){return f.event.target===t?!1:void(document.activeElement===r.node()&&r.node().blur())})}).on("keyup",function(){27===f.event.which?(i.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(i,this.textContent)):(l.input.call(i,this.textContent),f.select(this).call(u(i,e,n)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(a)}n||(n={});var i=this,l=f.dispatch("edit","input","cancel"),s=f.select(this.node()).style({"pointer-events":"all"}),c=e||s;return e&&s.style({"pointer-events":"none"}),n.immediate?r():c.on("click",r),f.rebind(this,l,"on")}},{"../constants/string_mappings":94,"../constants/xmlns_namespaces":95,"../lib":103,d3:14}],115:[function(t,e,n){"use strict";function r(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t}function a(t){Array.isArray(t._promises)&&t._promises.length>0&&N.log("Clearing previous rejected promises from queue."),t._promises=[]}function o(t,e){t._fullLayout._paperdiv.style("background","white"),P.defaultConfig.setBackground(t,e)}function i(t,e){t._context||(t._context=N.extendFlat({},P.defaultConfig));var n=t._context;e&&(Object.keys(e).forEach(function(t){t in n&&("setBackground"===t&&"opaque"===e[t]?n[t]=o:n[t]=e[t])}),e.plot3dPixelRatio&&!n.plotGlPixelRatio&&(n.plotGlPixelRatio=n.plot3dPixelRatio)),n.staticPlot&&(n.editable=!1,n.autosizable=!1,n.scrollZoom=!1,n.doubleClick=!1,n.showTips=!1,n.showLink=!1,n.displayModeBar=!1)}function l(t,e,n){var r=C.select(t).selectAll(".plot-container").data([0]);r.enter().insert("div",":first-child").classed("plot-container plotly",!0);var a=r.selectAll(".svg-container").data([0]);a.enter().append("div").classed("svg-container",!0).style("position","relative"),a.html(""),e&&(t.data=e),n&&(t.layout=n),P.micropolar.manager.fillLayout(t),"initial"===t._fullLayout.autosize&&t._context.autosizable&&(k(t,{}),t._fullLayout.autosize=n.autosize=!0),a.style({width:t._fullLayout.width+"px",height:t._fullLayout.height+"px"}),t.framework=P.micropolar.manager.framework(t),t.framework({data:t.data,layout:t.layout},a.node()),t.framework.setUndoPoint();var o=t.framework.svg(),i=1,l=t._fullLayout.title;""!==l&&l||(i=0);var s="Click to enter title",c=function(){this.call(P.util.convertToTspans)},u=o.select(".title-group text").call(c);if(t._context.editable){u.attr({"data-unformatted":l}),l&&l!==s||(i=.2,u.attr({"data-unformatted":s}).text(s).style({opacity:i}).on("mouseover.opacity",function(){C.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){C.select(this).transition().duration(1e3).style("opacity",0)}));var f=function(){this.call(P.util.makeEditable).on("edit",function(e){t.framework({layout:{title:e}}),this.attr({"data-unformatted":e}).text(e).call(c),this.call(f)}).on("cancel",function(){ var t=this.attr("data-unformatted");this.text(t).call(c)})};u.call(f)}return t._context.setBackground(t,t._fullLayout.paper_bgcolor),R.addLinks(t),Promise.resolve()}function s(t){var e,n;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var r=P.Axes.list({_fullLayout:t});for(e=0;ee;e++){var i=t.annotations[e];i.ref&&("paper"===i.ref?(i.xref="paper",i.yref="paper"):"data"===i.ref&&(i.xref="x",i.yref="y"),delete i.ref),c(i,"xref"),c(i,"yref")}void 0===t.shapes||Array.isArray(t.shapes)||(N.warn("Shapes must be an array."),delete t.shapes);var l=(t.shapes||[]).length;for(e=0;l>e;e++){var s=t.shapes[e];c(s,"xref"),c(s,"yref")}var u=t.legend;u&&(u.x>3?(u.x=1.02,u.xanchor="left"):u.x<-2&&(u.x=-.02,u.xanchor="right"),u.y>3?(u.y=1.02,u.yanchor="bottom"):u.y<-2&&(u.y=-.02,u.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var f=R.getSubplotIds(t,"gl3d");for(e=0;en;++n)x[n]=m[e]+v*y[2+4*n];h.camera={eye:{x:x[0],y:x[1],z:x[2]},center:{x:m[0],y:m[1],z:m[2]},up:{x:y[1],y:y[5],z:y[9]}},delete h.cameraposition}}return F.clean(t),t}function c(t,e){var n=t[e],r=e.charAt(0);n&&"paper"!==n&&(t[e]=P.Axes.cleanId(n,r))}function u(t,e){for(var n=[],r=(t.concat(Array.isArray(e)?e:[]).filter(function(t){return"uid"in t}).map(function(t){return t.uid})),a=0;ao&&(l=N.randstr(r),-1!==n.indexOf(l));o++);i.uid=N.randstr(r),r.push(i.uid)}if(n.push(i.uid),"histogramy"===i.type&&"xbins"in i&&!("ybins"in i)&&(i.ybins=i.xbins,delete i.xbins),i.error_y&&"opacity"in i.error_y){var s=F.defaults,c=i.error_y.color||(R.traceIs(i,"bar")?F.defaultLine:s[a%s.length]);i.error_y.color=F.addOpacity(F.rgb(c),F.opacity(c)*i.error_y.opacity),delete i.error_y.opacity}if("bardir"in i&&("h"!==i.bardir||!R.traceIs(i,"bar")&&"histogram"!==i.type.substr(0,9)||(i.orientation="h",_(i)),delete i.bardir),"histogramy"===i.type&&_(i),"histogramx"!==i.type&&"histogramy"!==i.type||(i.type="histogram"),"scl"in i&&(i.colorscale=i.scl,delete i.scl),"reversescl"in i&&(i.reversescale=i.reversescl,delete i.reversescl),i.xaxis&&(i.xaxis=P.Axes.cleanId(i.xaxis,"x")),i.yaxis&&(i.yaxis=P.Axes.cleanId(i.yaxis,"y")),R.traceIs(i,"gl3d")&&i.scene&&(i.scene=R.subplotsRegistry.gl3d.cleanId(i.scene)),R.traceIs(i,"pie")||(Array.isArray(i.textposition)?i.textposition=i.textposition.map(f):i.textposition&&(i.textposition=f(i.textposition))),R.traceIs(i,"2dMap")&&("YIGnBu"===i.colorscale&&(i.colorscale="YlGnBu"),"YIOrRd"===i.colorscale&&(i.colorscale="YlOrRd")),R.traceIs(i,"markerColorscale")&&i.marker){var u=i.marker;"YIGnBu"===u.colorscale&&(u.colorscale="YlGnBu"),"YIOrRd"===u.colorscale&&(u.colorscale="YlOrRd")}if("surface"===i.type&&N.isPlainObject(i.contours)){var h=["x","y","z"];for(o=0;or?o.push(a+r):o.push(r);return o}function g(t,e,n){var r,a;for(r=0;r=t.data.length||a<-t.data.length)throw new Error(n+" must be valid indices for gd.data.");if(e.indexOf(a,r+1)>-1||a>=0&&e.indexOf(-t.data.length+a)>-1||0>a&&e.indexOf(t.data.length+a)>-1)throw new Error("each index in "+n+" must be unique.")}}function m(t,e,n){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),g(t,e,"currentIndices"),"undefined"==typeof n||Array.isArray(n)||(n=[n]),"undefined"!=typeof n&&g(t,n,"newIndices"),"undefined"!=typeof n&&e.length!==n.length)throw new Error("current and new indices must be of equal length.")}function v(t,e,n){var r,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&s0){var l=w(t._boundingBoxMargins),s=l.left+l.right,c=l.bottom+l.top,u=o._container.node().getBoundingClientRect(),f=1-2*i.frameMargins;a=Math.round(f*(u.width-s)),r=Math.round(f*(u.height-c))}else n=window.getComputedStyle(t),r=parseFloat(n.height)||o.height,a=parseFloat(n.width)||o.width;return Math.abs(o.width-a)>1||Math.abs(o.height-r)>1?(o.height=t.layout.height=r,o.width=t.layout.width=a):"initial"!==o.autosize&&(delete e.autosize,o.autosize=t.layout.autosize=!0),R.sanitizeMargins(o),e}function M(t){var e=C.select(t),n=t._fullLayout;if(n._container=e.selectAll(".plot-container").data([0]),n._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),n._paperdiv=n._container.selectAll(".svg-container").data([0]),n._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),"initial"===n.autosize&&(k(t,{}),n.autosize=!0,t.layout.autosize=!0),n._glcontainer=n._paperdiv.selectAll(".gl-container").data([0]),n._glcontainer.enter().append("div").classed("gl-container",!0),n._geocontainer=n._paperdiv.selectAll(".geo-container").data([0]),n._geocontainer.enter().append("div").classed("geo-container",!0),n._paperdiv.selectAll(".main-svg").remove(),n._paper=n._paperdiv.insert("svg",":first-child").classed("main-svg",!0),n._toppaper=n._paperdiv.append("svg").classed("main-svg",!0),!n._uid){var r=[];C.selectAll("defs").each(function(){this.id&&r.push(this.id.split("-")[1])}),n._uid=N.randstr(r)}n._paperdiv.selectAll(".main-svg").attr(Q.svgAttrs),n._defs=n._paper.append("defs").attr("id","defs-"+n._uid),n._topdefs=n._toppaper.append("defs").attr("id","topdefs-"+n._uid),n._draggers=n._paper.append("g").classed("draglayer",!0);var a=n._paper.append("g").classed("layer-below",!0);n._imageLowerLayer=a.append("g").classed("imagelayer",!0),n._shapeLowerLayer=a.append("g").classed("shapelayer",!0);var o=P.Axes.getSubplots(t);o.join("")!==Object.keys(t._fullLayout._plots||{}).join("")&&A(t,o),n._has("cartesian")&&T(t,o),n._ternarylayer=n._paper.append("g").classed("ternarylayer",!0);var i=n._paper.selectAll(".layer-subplot");n._imageSubplotLayer=i.selectAll(".imagelayer"),n._shapeSubplotLayer=i.selectAll(".shapelayer");var l=n._paper.append("g").classed("layer-above",!0);n._imageUpperLayer=l.append("g").classed("imagelayer",!0),n._shapeUpperLayer=l.append("g").classed("shapelayer",!0),n._pielayer=n._paper.append("g").classed("pielayer",!0),n._glimages=n._paper.append("g").classed("glimages",!0),n._geoimages=n._paper.append("g").classed("geoimages",!0),n._infolayer=n._toppaper.append("g").classed("infolayer",!0),n._zoomlayer=n._toppaper.append("g").classed("zoomlayer",!0),n._hoverlayer=n._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework");var s=N.syncOrAsync([L,function(){return P.Axes.doTicks(t,"redraw")},j.init],t);return s&&s.then&&t._promises.push(s),s}function A(t,e){function n(e,n){return function(){return P.Axes.getFromId(t,e,n)}}for(var r,a,o=t._fullLayout._plots={},i=0;i0,_=P.Axes.getSubplots(t).join(""),w=Object.keys(t._fullLayout._plots||{}).join(""),k=w===_;b?t.framework===M&&!x&&k||(t.framework=M,M(t)):k?x&&M(t):(t.framework=M,M(t)),x&&P.Axes.saveRangeInitial(t);var A=t._fullLayout,T=!t.calcdata||t.calcdata.length!==(t.data||[]).length;T&&h(t);for(var z=0;zG.range[0]?[1,2]:[2,1]);else{var Q=G.range[0],W=G.range[1];"log"===j?(0>=Q&&0>=W&&o(U+".autorange",!0),0>=Q?Q=W/1e6:0>=W&&(W=Q/1e6),o(U+".range[0]",Math.log(Q)/Math.LN10),o(U+".range[1]",Math.log(W)/Math.LN10)):(o(U+".range[0]",Math.pow(10,Q)),o(U+".range[1]",Math.pow(10,W)))}else o(U+".autorange",!0)}if("reverse"===B)Y.range?Y.range.reverse():(o(U+".autorange",!0),Y.range=[1,0]),X.autorange?w=!0:_=!0;else if("annotations"===D.parts[0]||"shapes"===D.parts[0]){var J=D.parts[1],K=D.parts[0],tt=g[K]||[],et=P[N.titleCase(K)],nt=tt[J]||{};2===D.parts.length&&("add"===v[E]||N.isPlainObject(v[E])?z[E]="remove":"remove"===v[E]?-1===J?(z[K]=tt,delete z[E]):z[E]=nt:N.log("???",v)),!i(nt,"x")&&!i(nt,"y")||N.containsAny(E,["color","opacity","align","dash"])||(w=!0),et.draw(t,J,D.parts.slice(2).join("."),v[E]),delete v[E]}else if("images"===D.parts[0]){var at=N.objectFromPath(E,j);N.extendDeepAll(t.layout,at),H.supplyLayoutDefaults(t.layout,t._fullLayout),H.draw(t)}else if("mapbox"===D.parts[0]&&"layers"===D.parts[1]){N.extendDeepAll(t.layout,N.objectFromPath(E,j));var ot=(t._fullLayout.mapbox||{}).layers||[];for(O=D.parts[2]+1-ot.length,p=0;O>p;p++)ot.push({});_=!0}else if("updatemenus"===D.parts[0]){N.extendDeepAll(t.layout,N.objectFromPath(E,j));var it=t._fullLayout.updatemenus||[];for(O=D.parts[2]+1-it.length,p=0;O>p;p++)it.push({});_=!0}else 0===D.parts[0].indexOf("scene")?_=!0:0===D.parts[0].indexOf("geo")?_=!0:0===D.parts[0].indexOf("ternary")?_=!0:!m._has("gl2d")||-1===E.indexOf("axis")&&"plot_bgcolor"!==D.parts[0]?"hiddenlabels"===E?w=!0:-1!==D.parts[0].indexOf("legend")?y=!0:-1!==E.indexOf("title")?x=!0:-1!==D.parts[0].indexOf("bgcolor")?b=!0:D.parts.length>1&&N.containsAny(D.parts[1],["tick","exponent","grid","zeroline"])?x=!0:-1!==E.indexOf(".linewidth")&&-1!==E.indexOf("axis")?x=b=!0:D.parts.length>1&&-1!==D.parts[1].indexOf("line")?b=!0:D.parts.length>1&&"mirror"===D.parts[1]?x=b=!0:"margin.pad"===E?x=b=!0:"margin"===D.parts[0]||"autorange"===D.parts[1]||"rangemode"===D.parts[1]||"type"===D.parts[1]||"domain"===D.parts[1]||E.match(/^(bar|box|font)/)?w=!0:-1!==["hovermode","dragmode"].indexOf(E)?M=!0:-1===["hovermode","dragmode","height","width","autosize"].indexOf(E)&&(_=!0):_=!0,D.set(j)}I.add(t,rt,[t,z],rt,[t,T]),v.autosize&&(v=k(t,v)),(v.height||v.width||v.autosize)&&(w=!0);var lt=Object.keys(v),st=[R.previousPromises];if(_||w)st.push(function(){return t.layout=void 0,w&&(t.calcdata=void 0),P.plot(t,"",g)});else if(lt.length&&(R.supplyDefaults(t),m=t._fullLayout,y&&st.push(function(){return V.draw(t),R.previousPromises(t)}),b&&st.push(L),x&&st.push(function(){return P.Axes.doTicks(t,"redraw"),S(t),R.previousPromises(t)}),M)){var ct;for($(t),P.Fx.supplyLayoutDefaults(t.layout,m,t._fullData),P.Fx.init(t),ct=R.getSubplotIds(m,"gl3d"),p=0;p1)};c(n.width)&&c(n.height)||l(new Error("Height and width should be pixel values."));var u=r.clone(e,{format:"png",height:n.height,width:n.width}),f=u.td;f.style.position="absolute",f.style.left="-5000px",document.body.appendChild(f);var d=r.getRedrawFunc(f);o.plot(f,u.data,u.layout,u.config).then(d).then(s).then(function(e){t(e)}).catch(function(t){l(t)})});return l}var a=t("fast-isnumeric"),o=t("../plotly"),i=t("../lib");e.exports=r},{"../lib":103,"../plotly":121,"../snapshot":161,"fast-isnumeric":17}],120:[function(t,e,n){"use strict";function r(t,e,n,a,o,c){c=c||[];for(var u=Object.keys(t),d=0;d1&&s.push(i("object","layout"))),d.supplyDefaults(c);for(var u=c._fullData,m=n.length,v=0;m>v;v++){var y=n[v],x=["data",v];if(p(y)){var b=u[v],_=b.type,w=l.traces[_].attributes;w.type={valType:"enumerated",values:[_]},b.visible===!1&&y.visible!==!1&&s.push(i("invisible",x)),r(y,b,w,s,x);var k=y.transforms,M=b.transforms;if(k){g(k)||s.push(i("array",x,["transforms"])),x.push("transforms");for(var A=0;Ac&&u>e&&(void 0===a[n]?o[f]=T.tickText(t,e):o[f]=l(t,e,String(a[n])),f++);return f=864e5?t._tickround="d":n>=36e5?t._tickround="H":n>=6e4?t._tickround="M":n>=1e3?t._tickround="S":t._tickround=3-Math.round(Math.log(n/2)/Math.LN10);else{x(n)||(n=Number(n.substr(1))),t._tickround=2-Math.floor(Math.log(n)/Math.LN10+.01),e="log"===t.type?Math.pow(10,Math.max(t.range[0],t.range[1])):Math.max(Math.abs(t.range[0]),Math.abs(t.range[1]));var r=Math.floor(Math.log(e)/Math.LN10+.01);Math.abs(r)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((r-1)/3):t._tickexponent=r)}else"M"===n.charAt(0)?t._tickround=2===n.length?"m":"y":t._tickround=null}function i(t,e){var n=t.match(B),r=new Date(e);if(n){var a=Math.min(+n[1]||6,6),o=String(e/1e3%1+2.0000005).substr(2,a).replace(/0+$/,"")||"0";return y.time.format(t.replace(B,o))(r)}return y.time.format(t)(r)}function l(t,e,n){var r=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:n||"",fontSize:r.size,font:r.family,fontColor:r.color}}function s(t,e,n,r){var a,o=e.x,l=t._tickround,s=new Date(o),c="";n&&t.hoverformat?a=i(t.hoverformat,o):t.tickformat?a=i(t.tickformat,o):(r&&(x(l)?l+=2:l={y:"m",m:"d",d:"H",H:"M",M:"S",S:2}[l]),"y"===l?a=D(s):"m"===l?a=I(s):(o!==t._tmin||n||(c="
"+D(s)),"d"===l?a=R(s):"H"===l?a=j(s):(o!==t._tmin||n||(c="
"+R(s)+", "+D(s)),a=F(s),"M"!==l&&(a+=q(s),"S"!==l&&(a+=d(v(o/1e3,1),t,"none",n).substr(1)))))),e.text=a+c}function c(t,e,n,r,a){var o=t.dtick,i=e.x;if(!r||"string"==typeof o&&"L"===o.charAt(0)||(o="L3"),t.tickformat||"string"==typeof o&&"L"===o.charAt(0))e.text=d(Math.pow(10,i),t,a,r);else if(x(o)||"D"===o.charAt(0)&&v(i+.01,1)<.1)if(-1!==["e","E","power"].indexOf(t.exponentformat)){var l=Math.round(i);0===l?e.text=1:1===l?e.text="10":l>1?e.text="10"+l+"":e.text="10\u2212"+-l+"",e.fontSize*=1.25}else e.text=d(Math.pow(10,i),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,v(i,1)))),e.fontSize*=.75}if("D1"===t.dtick){var s=String(e.text).charAt(0);"0"!==s&&"1"!==s||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(0>i?.5:.25)))}}function u(t,e){var n=t._categories[Math.round(e.x)];void 0===n&&(n=""),e.text=String(n)}function f(t,e,n,r,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=d(e.x,t,a,r)}function d(t,e,n,r){var a=0>t,i=e._tickround,l=n||e.exponentformat||"B",s=e._tickexponent,c=e.tickformat;if(r){var u={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range:[0,t||1]};o(u),i=(Number(u._tickround)||0)+4,s=u._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return y.format(c)(t).replace(/-/g,"\u2212");var f=Math.pow(10,-i)/2;if("none"===l&&(s=0),t=Math.abs(t),f>t)t="0",a=!1;else{if(t+=f,s&&(t*=Math.pow(10,-s),i+=s),0===i)t=String(Math.floor(t));else if(0>i){t=String(Math.round(t)),t=t.substr(0,t.length+i);for(var d=i;0>d;d++)t+="0"}else{t=String(t);var h=t.indexOf(".")+1;h&&(t=t.substr(0,h+i).replace(/\.?0+$/,""))}t=_.numSeparate(t,e._gd._fullLayout.separators)}if(s&&"hide"!==l){var p;p=0>s?"\u2212"+-s:"power"!==l?"+"+s:String(s),"e"===l||("SI"===l||"B"===l)&&(s>12||-15>s)?t+="e"+p:"E"===l?t+="E"+p:"power"===l?t+="\xd710"+p+"":"B"===l&&9===s?t+="B":"SI"!==l&&"B"!==l||(t+=H[s/3+5])}return a?"\u2212"+t:t}function h(t,e){var n,r,a=[];for(n=0;n1)for(r=1;r2e-6||((n-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},T.getAutoRange=function(t){var e,n=[],r=t._min[0].val,a=t._max[0].val;for(e=1;e0&&u>0&&f/u>d&&(s=i,c=l,d=f/u);if(r===a){var p=r-1,g=r+1;n="tozero"===t.rangemode?0>r?[p,0]:[0,g]:"nonnegative"===t.rangemode?[Math.max(0,p),Math.max(0,g)]:[p,g]}else d&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(s.val>=0&&(s={val:0,pad:0}),c.val<=0&&(c={val:0,pad:0})):"nonnegative"===t.rangemode&&(s.val-d*s.pad<0&&(s={val:0,pad:0}),c.val<0&&(c={val:1,pad:0})),d=(c.val-s.val)/(t._length-s.pad-c.pad)),n=[s.val-d*s.pad,c.val+d*c.pad]);return n[0]===n[1]&&("tozero"===t.rangemode?n=n[0]<0?[n[0],0]:n[0]>0?[0,n[0]]:[0,1]:(n=[n[0]-1,n[0]+1],"nonnegative"===t.rangemode&&(n[0]=Math.max(0,n[0])))),h&&n.reverse(),n},T.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=T.getAutoRange(t);var n=t._gd.layout[t._name];n||(t._gd.layout[t._name]=n={}),n!==t&&(n.range=t.range.slice(),n.autorange=t.autorange)}},T.saveRangeInitial=function(t,e){for(var n=T.list(t,"",!0),r=!1,a=0;ap&&(p=g/10),c=t.c2l(p),u=t.c2l(g),y&&(c=Math.min(0,c),u=Math.max(0,u)),r(c)){for(h=!0,i=0;i=d?h=!1:l.val>=c&&l.pad<=d&&(t._min.splice(i,1),i--);h&&t._min.push({val:c,pad:y&&0===c?0:d})}if(r(u)){for(h=!0,i=0;i=u&&l.pad>=f?h=!1:l.val<=u&&l.pad<=f&&(t._max.splice(i,1),i--);h&&t._max.push({val:u,pad:y&&0===u?0:f})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),n||(n={}),t._m||t.setScale();var o,i,l,s,c,u,f,d,h,p,g,m=e.length,v=n.padded?.05*t._length:0,y=n.tozero&&("linear"===t.type||"-"===t.type),b=r((t._m>0?n.ppadplus:n.ppadminus)||n.ppad||0),_=r((t._m>0?n.ppadminus:n.ppadplus)||n.ppad||0),w=r(n.vpadplus||n.vpad),k=r(n.vpadminus||n.vpad);for(o=0;6>o;o++)a(o);for(o=m-1;o>5;o--)a(o)}},T.autoBin=function(t,e,n,r){function a(t){return(1+100*(t-h)/f.dtick)%100<2}var o=_.aggNums(Math.min,null,t),i=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:o-.5,end:i+.5,size:1};var l;if(n)l=(i-o)/n;else{var s=_.distinctVals(t),c=Math.pow(10,Math.floor(Math.log(s.minDiff)/Math.LN10)),u=c*_.roundUp(s.minDiff/c,[.9,1.9,4.9,9.9],!0);l=Math.max(u,2*_.stdev(t)/Math.pow(t.length,r?.25:.4))}var f={type:"log"===e.type?"linear":e.type,range:[o,i]};T.autoTicks(f,l);var d,h=T.tickIncrement(T.tickFirst(f),f.dtick,"reverse");if("number"==typeof f.dtick){for(var p=0,g=0,m=0,v=0,y=0;yg&&(p>.3*b||a(o)||a(i))){var w=f.dtick/2;h+=o>h+w?w:-w}var k=1+Math.floor((i-h)/f.dtick);d=h+k*f.dtick}else for(d=h;i>=d;)d=T.tickIncrement(d,f.dtick);return{start:h,end:d,size:f.dtick}},T.calcTicks=function(t){if("array"===t.tickmode)return r(t);if("auto"===t.tickmode||!t.dtick){var e,n=t.nticks;n||("category"===t.type?(e=t.tickfont?1.2*(t.tickfont.size||12):15,n=t._length/e):(e="y"===t._id.charAt(0)?40:80,n=_.constrain(t._length/e,4,9)+1)),T.autoTicks(t,Math.abs(t.range[1]-t.range[0])/n),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t._forceTick0)}t.tick0||(t.tick0="date"===t.type?new Date(2e3,0,1).getTime():0),o(t),t._tmin=T.tickFirst(t);var a=t.range[1]=l:l>=s)&&(i.push(s),!(i.length>1e3));s=T.tickIncrement(s,t.dtick,a));t._tmax=i[i.length-1];for(var c=new Array(i.length),u=0;u157788e5?(e/=315576e5,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*a(e,n,S)):e>12096e5?(e/=26298e5,t.dtick="M"+a(e,1,C)):e>432e5?(t.dtick=a(e,864e5,O),t.tick0=new Date(2e3,0,2).getTime()):e>18e5?t.dtick=a(e,36e5,C):e>3e4?t.dtick=a(e,6e4,E):e>500?t.dtick=a(e,1e3,E):(n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,S));else if("log"===t.type)if(t.tick0=0,e>.7)t.dtick=Math.ceil(e);else if(Math.abs(t.range[1]-t.range[0])<1){var r=1.5*Math.abs((t.range[1]-t.range[0])/e);e=Math.abs(Math.pow(10,t.range[1])-Math.pow(10,t.range[0]))/r,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+a(e,n,S)}else t.dtick=e>.3?"D2":"D1";else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,n,S));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var o=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(o)}},T.tickIncrement=function(t,e,n){var r=n?-1:1;if(x(e))return t+r*e;var a=e.charAt(0),o=r*Number(e.substr(1));if("M"===a){var i=new Date(t);return i.setMonth(i.getMonth()+o)}if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var l="D2"===e?N:P,s=t+.01*r,c=_.roundUp(v(s,1),l,n);return Math.floor(s)+Math.log(y.round(Math.pow(10,c),1))/Math.LN10}throw"unrecognized dtick "+String(e)},T.tickFirst=function(t){var e=t.range[1]r:r>c;)c=T.tickIncrement(c,a,e);return c}if("L"===u)return Math.log(n((Math.pow(10,r)-o)/f)*f+o)/Math.LN10;if("D"===u){var d="D2"===a?N:P,h=_.roundUp(v(r,1),d,e);return Math.floor(r)+Math.log(y.round(Math.pow(10,h),1))/Math.LN10}throw"unrecognized dtick "+String(a)};var D=y.time.format("%Y"),I=y.time.format("%b %Y"),R=y.time.format("%b %-d"),j=y.time.format("%b %-d %Hh"),F=y.time.format("%H:%M"),q=y.time.format(":%S"),B=/%(\d?)f/g;T.tickText=function(t,e,n){function r(r){var a;return void 0===r?!0:n?"none"===r:(a={first:t._tmin,last:t._tmax}[r],"all"!==r&&e!==a)}var a,o,i=l(t,e),d="array"===t.tickmode,h=n||d;if(d&&Array.isArray(t.ticktext)){var p=Math.abs(t.range[1]-t.range[0])/1e4;for(o=0;oo&&(e=(n-1)/(a.l+a.r),a.l=Math.floor(e*a.l),a.r=Math.floor(e*a.r)),0>i&&(e=(r-1)/(a.t+a.b),a.t=Math.floor(e*a.t),a.b=Math.floor(e*a.b))}},h.autoMargin=function(t,e,n){var r=t._fullLayout;if(r._pushmargin||(r._pushmargin={}),r.margin.autoexpand!==!1){if(n){var a=void 0===n.pad?12:n.pad;n.l+n.r>.5*r.width&&(n.l=n.r=0),n.b+n.t>.5*r.height&&(n.b=n.t=0),r._pushmargin[e]={l:{val:n.x,size:n.l+a},r:{val:n.x,size:n.r+a},b:{val:n.y,size:n.b+a},t:{val:n.y,size:n.t+a}}}else delete r._pushmargin[e];t._replotting||h.doAutoMargin(t)}},h.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var n=e._size,r=JSON.stringify(n),a=Math.max(e.margin.l||0,0),o=Math.max(e.margin.r||0,0),i=Math.max(e.margin.t||0,0),l=Math.max(e.margin.b||0,0),s=e._pushmargin;return e.margin.autoexpand!==!1&&(s.base={l:{val:0,size:a},r:{val:1,size:o},t:{val:1,size:i},b:{val:0,size:l}},Object.keys(s).forEach(function(t){var n=s[t].l||{},r=s[t].b||{},u=n.val,f=n.size,d=r.val,h=r.size;Object.keys(s).forEach(function(t){if(c(f)&&s[t].r){var n=s[t].r.val,r=s[t].r.size;if(n>u){var p=(f*n+(r-e.width)*u)/(n-u),g=(r*(1-u)+(f-e.width)*(1-n))/(n-u);p>=0&&g>=0&&p+g>a+o&&(a=p,o=g)}}if(c(h)&&s[t].t){var m=s[t].t.val,v=s[t].t.size;if(m>d){var y=(h*m+(v-e.height)*d)/(m-d),x=(v*(1-d)+(h-e.height)*(1-m))/(m-d);y>=0&&x>=0&&y+x>l+i&&(l=y,i=x)}}})})),n.l=Math.round(a),n.r=Math.round(o),n.t=Math.round(i),n.b=Math.round(l),n.p=Math.round(e.margin.pad),n.w=Math.round(e.width)-n.l-n.r,n.h=Math.round(e.height)-n.t-n.b,t._replotting||"{}"===r||r===JSON.stringify(e._size)?void 0:u.plot(t)},h.graphJson=function(t,e,n,r,a){function o(t){if("function"==typeof t)return null;if(f.isPlainObject(t)){var e,r,a={};for(e in t)if("function"!=typeof t[e]&&-1===["_","["].indexOf(e.charAt(0))){if("keepdata"===n){if("src"===e.substr(e.length-3))continue}else if("keepstream"===n){if(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0&&!f.isPlainObject(t.stream))continue}else if("keepall"!==n&&(r=t[e+"src"],"string"==typeof r&&r.indexOf(":")>0))continue;a[e]=o(t[e])}return a}return Array.isArray(t)?t.map(o):t&&t.getTime?f.ms2DateTime(t):t}(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&h.supplyDefaults(t);var i=a?t._fullData:t.data,l=a?t._fullLayout:t.layout,s={data:(i||[]).map(function(t){var n=o(t);return e&&delete n.fit,n})};return e||(s.layout=o(l)),t.framework&&t.framework.isPolar&&(s=t.framework.getConfig()),"object"===r?s:JSON.stringify(s)}},{"../components/color":25,"../lib":103,"../plotly":121,"./attributes":122,"./font_attributes":142,"./layout_attributes":143,d3:14,"fast-isnumeric":17}],145:[function(t,e,n){"use strict";var r=t("../../traces/scatter/attributes"),a=r.marker;e.exports={r:r.r,t:r.t,marker:{color:a.color,size:a.size,symbol:a.symbol,opacity:a.opacity}}},{"../../traces/scatter/attributes":237}],146:[function(t,e,n){"use strict";function r(t,e){var n={showline:{valType:"boolean"},showticklabels:{valType:"boolean"},tickorientation:{valType:"enumerated",values:["horizontal","vertical"]},ticklen:{valType:"number",min:0},tickcolor:{valType:"color"},ticksuffix:{valType:"string"},endpadding:{valType:"number"},visible:{valType:"boolean"}};return o({},e,n)}var a=t("../cartesian/layout_attributes"),o=t("../../lib/extend").extendFlat,i=o({},a.domain,{});e.exports={radialaxis:r("radial",{range:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},domain:i,orientation:{valType:"number"}}),angularaxis:r("angular",{range:{valType:"info_array",items:[{valType:"number",dflt:0},{valType:"number",dflt:360}]},domain:i}),layout:{direction:{valType:"enumerated",values:["clockwise","counterclockwise"]},orientation:{valType:"angle"}}}},{"../../lib/extend":101,"../cartesian/layout_attributes":133}],147:[function(t,e,n){var r=t("../../plotly"),a=t("d3"),o=e.exports={version:"0.2.2",manager:t("./micropolar_manager")},i=r.Lib.extendDeepAll;o.Axis=function(){function t(t){n=t||n;var c=s.data,f=s.layout;return("string"==typeof n||n.nodeName)&&(n=a.select(n)),n.datum(c).each(function(t,n){function s(t,e){return l(t)%360+f.orientation}var c=t.slice();u={data:o.util.cloneJson(c),layout:o.util.cloneJson(f)};var d=0;c.forEach(function(t,e){t.color||(t.color=f.defaultColorRange[d],d=(d+1)%f.defaultColorRange.length),t.strokeColor||(t.strokeColor="LinePlot"===t.geometry?t.color:a.rgb(t.color).darker().toString()),u.data[e].color=t.color,u.data[e].strokeColor=t.strokeColor,u.data[e].strokeDash=t.strokeDash,u.data[e].strokeSize=t.strokeSize});var h=c.filter(function(t,e){var n=t.visible;return"undefined"==typeof n||n===!0}),p=!1,g=h.map(function(t,e){return p=p||"undefined"!=typeof t.groupId,t});if(p){var m=a.nest().key(function(t,e){return"undefined"!=typeof t.groupId?t.groupId:"unstacked"}).entries(g),v=[],y=m.map(function(t,e){if("unstacked"===t.key)return t.values;var n=t.values[0].r.map(function(t,e){return 0});return t.values.forEach(function(t,e,r){t.yStack=[n],v.push(n),n=o.util.sumArrays(t.r,n)}),t.values});h=a.merge(y)}h.forEach(function(t,e){t.t=Array.isArray(t.t[0])?t.t:[t.t],t.r=Array.isArray(t.r[0])?t.r:[t.r]});var x=Math.min(f.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2;x=Math.max(10,x);var b,_=[f.margin.left+x,f.margin.top+x];if(p){var w=a.max(o.util.sumArrays(o.util.arrayLast(h).r[0],o.util.arrayLast(v)));b=[0,w]}else b=a.extent(o.util.flattenArray(h.map(function(t,e){return t.r})));f.radialAxis.domain!=o.DATAEXTENT&&(b[0]=0),r=a.scale.linear().domain(f.radialAxis.domain!=o.DATAEXTENT&&f.radialAxis.domain?f.radialAxis.domain:b).range([0,x]),u.layout.radialAxis.domain=r.domain();var k,M=o.util.flattenArray(h.map(function(t,e){return t.t})),A="string"==typeof M[0];A&&(M=o.util.deduplicate(M),k=M.slice(),M=a.range(M.length),h=h.map(function(t,e){var n=t;return t.t=[M],p&&(n.yStack=t.yStack),n}));var T=h.filter(function(t,e){return"LinePlot"===t.geometry||"DotPlot"===t.geometry}).length===h.length,L=null===f.needsEndSpacing?A||!T:f.needsEndSpacing,z=f.angularAxis.domain&&f.angularAxis.domain!=o.DATAEXTENT&&!A&&f.angularAxis.domain[0]>=0,S=z?f.angularAxis.domain:a.extent(M),C=Math.abs(M[1]-M[0]);T&&!A&&(C=0);var E=S.slice();L&&A&&(E[1]+=C);var O=f.angularAxis.ticksCount||4;O>8&&(O=O/(O/8)+O%8),f.angularAxis.ticksStep&&(O=(E[1]-E[0])/O);var P=f.angularAxis.ticksStep||(E[1]-E[0])/(O*(f.minorTicks+1));k&&(P=Math.max(Math.round(P),1)),E[2]||(E[2]=P);var N=a.range.apply(this,E);if(N=N.map(function(t,e){return parseFloat(t.toPrecision(12))}),l=a.scale.linear().domain(E.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=L?C:0,e=a.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var D="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '",I=(new DOMParser).parseFromString(D,"application/xml"),R=this.appendChild(this.ownerDocument.importNode(I.documentElement,!0));e=a.select(R)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var j,F=e.select(".chart-group"),q={fill:"none",stroke:f.tickColor},B={"font-size":f.font.size,"font-family":f.font.family,fill:f.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+f.font.outlineColor}).join(",")};if(f.showLegend){j=e.select(".legend-group").attr({transform:"translate("+[x,f.margin.top]+")"}).style({display:"block"});var H=h.map(function(t,e){var n=o.util.cloneJson(t);return n.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",n.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,n.color="LinePlot"===t.geometry?t.strokeColor:t.color,n});o.Legend().config({data:h.map(function(t,e){return t.name||"Element"+e}),legendConfig:i({},o.Legend.defaultConfig().legendConfig,{container:j,elements:H,reverseOrder:f.legend.reverseOrder})})();var V=j.node().getBBox();x=Math.min(f.width-V.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,x=Math.max(10,x),_=[f.margin.left+x,f.margin.top+x],r.range([0,x]),u.layout.radialAxis.domain=r.domain(),j.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else j=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),F.attr("transform","translate("+_+")").style({cursor:"crosshair"});var Z=[(f.width-(f.margin.left+f.margin.right+2*x+(V?V.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*x))/2];if(Z[0]=Math.max(0,Z[0]),Z[1]=Math.max(0,Z[1]),e.select(".outer-group").attr("transform","translate("+Z+")"),f.title){var U=e.select("g.title-group text").style(B).text(f.title),Y=U.node().getBBox();U.attr({x:_[0]-Y.width/2,y:_[1]-x-20})}var X=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var G=X.selectAll("circle.grid-circle").data(r.ticks(5));G.enter().append("circle").attr({"class":"grid-circle"}).style(q),G.attr("r",r),G.exit().remove()}X.select("circle.outside-circle").attr({r:x}).style(q);var $=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Q=a.svg.axis().scale(r).ticks(5).tickSize(5);X.call(Q).attr({transform:"rotate("+f.radialAxis.orientation+")"}),X.selectAll(".domain").style(q),X.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(B).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===f.radialAxis.tickOrientation?"rotate("+-f.radialAxis.orientation+") translate("+[0,B["font-size"]]+")":"translate("+[0,B["font-size"]]+")"}}),X.selectAll("g>line").style({stroke:"black"})}var W=e.select(".angular.axis-group").selectAll("g.angular-tick").data(N),J=W.enter().append("g").classed("angular-tick",!0);W.attr({transform:function(t,e){return"rotate("+s(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),W.exit().remove(),J.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(f.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(f.minorTicks+1)==0)}).style(q),J.selectAll(".minor").style({stroke:f.minorTickColor}),W.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),J.append("text").classed("axis-text",!0).style(B);var K=W.select("text.axis-text").attr({x:x+f.labelOffset,dy:".35em",transform:function(t,e){var n=s(t,e),r=x+f.labelOffset,a=f.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-n+" "+r+" 0)":"radial"==a?270>n&&n>90?"rotate(180 "+r+" 0)":null:"rotate("+(180>=n&&n>0?-90:90)+" "+r+" 0)"}}).style({"text-anchor":"middle",display:f.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(f.minorTicks+1)!=0?"":k?k[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(B);f.angularAxis.rewriteTicks&&K.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var tt=a.max(F.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));j.attr({transform:"translate("+[x+tt,f.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,nt=e.select("g.geometry-group").selectAll("g.geometry").data(h);if(nt.enter().append("g").attr({"class":function(t,e){return"geometry geometry"+e}}),nt.exit().remove(),h[0]||et){var rt=[];h.forEach(function(t,e){var n={};n.radialScale=r,n.angularScale=l,n.container=nt.filter(function(t,n){return n==e}),n.geometry=t.geometry,n.orientation=f.orientation,n.direction=f.direction,n.index=e,rt.push({data:t,geometryConfig:n})});var at=a.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(rt),ot=[];at.forEach(function(t,e){"unstacked"===t.key?ot=ot.concat(t.values.map(function(t,e){return[t]})):ot.push(t.values)}),ot.forEach(function(t,e){var n;n=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var r=t.map(function(t,e){return i(o[n].defaultConfig(),t)});o[n]().config(r)()})}var it,lt,st=e.select(".guides-group"),ct=e.select(".tooltips-group"),ut=o.tooltipPanel().config({container:ct,fontSize:8})(),ft=o.tooltipPanel().config({container:ct,fontSize:8})(),dt=o.tooltipPanel().config({container:ct,hasTick:!0})();if(!A){var ht=st.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});F.on("mousemove.angular-guide",function(t,e){var n=o.util.getMousePos($).angle;ht.attr({x2:-x,transform:"rotate("+n+")"}).style({opacity:.5});var r=(n+180+360-f.orientation)%360;it=l.invert(r);var a=o.util.convertToCartesian(x+12,n+180);ut.text(o.util.round(it)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){st.select("line").style({opacity:0})})}var pt=st.select("circle").style({stroke:"grey",fill:"none"});F.on("mousemove.radial-guide",function(t,e){var n=o.util.getMousePos($).radius;pt.attr({r:n}).style({opacity:.5}),lt=r.invert(o.util.getMousePos($).radius);var a=o.util.convertToCartesian(n,f.radialAxis.orientation);ft.text(o.util.round(lt)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),dt.hide(),ut.hide(),ft.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,n){var r=a.select(this),i=r.style("fill"),l="black",s=r.style("opacity")||1;if(r.attr({"data-opacity":s}),"none"!=i){r.attr({"data-fill":i}),l=a.hsl(i).darker().toString(),r.style({fill:l,opacity:1});var c={t:o.util.round(t[0]),r:o.util.round(t[1])};A&&(c.t=k[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),h=[f.left+f.width/2-Z[0]-d.left,f.top+f.height/2-Z[1]-d.top];dt.config({color:l}).text(u),dt.move(h)}else i=r.style("stroke"),r.attr({"data-stroke":i}),l=a.hsl(i).darker().toString(),r.style({stroke:l,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0!=a.event.which?!1:void(a.select(this).attr("data-fill")&&dt.show())}).on("mouseout.tooltip",function(t,e){dt.hide();var n=a.select(this),r=n.attr("data-fill");r?n.style({fill:r,opacity:n.attr("data-opacity")}):n.style({stroke:n.attr("data-stroke"),opacity:n.attr("data-opacity")})})}),d}var e,n,r,l,s={data:[],layout:{}},c={},u={},f=a.dispatch("hover"),d={};return d.render=function(e){return t(e),this},d.config=function(t){if(!arguments.length)return s;var e=o.util.cloneJson(t);return e.data.forEach(function(t,e){s.data[e]||(s.data[e]={}),i(s.data[e],o.Axis.defaultConfig().data[0]),i(s.data[e],t)}),i(s.layout,o.Axis.defaultConfig().layout),i(s.layout,e.layout),this},d.getLiveConfig=function(){return u},d.getinputConfig=function(){return c},d.radialScale=function(t){return r},d.angularScale=function(t){return l},d.svg=function(){return e},a.rebind(d,f,"on"),d},o.Axis.defaultConfig=function(t,e){var n={data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:a.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}};return n},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var n in t)n in e&&(e[n]=t[n])},o.util._extend=function(t,e){for(var n in t)e[n]=t[n]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var n=e||6,r=a.range(0,360+n,n).map(function(e,n){var r=e*Math.PI/180,a=t(r);return[e,a]});return r},o.util.dataFromEquation=function(t,e,n){var r=e||6,o=[],i=[];a.range(0,360+r,r).forEach(function(e,n){var r=e*Math.PI/180,a=t(r);o.push(e),i.push(a)});var l={t:o,r:i};return n&&(l.name=n),l},o.util.ensureArray=function(t,e){if("undefined"==typeof t)return null;var n=[].concat(t);return a.range(e).map(function(t,e){return n[e]||n[0]})},o.util.fillArrays=function(t,e,n){return e.forEach(function(e,r){t[e]=o.util.ensureArray(t[e],n)}),t},o.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},o.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var n=e.shift();return t[n]&&(!e.length||objHasKeys(t[n],e))},o.util.sumArrays=function(t,e){return a.zip(t,e).map(function(t,e){return a.sum(t)})},o.util.arrayLast=function(t){return t[t.length-1]},o.util.arrayEqual=function(t,e){for(var n=Math.max(t.length,e.length,1);n-- >=0&&t[n]===e[n];);return-2===n},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,n){return n.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var n=e*Math.PI/180,r=t*Math.cos(n),a=t*Math.sin(n);return[r,a]},o.util.round=function(t,e){var n=e||2,r=Math.pow(10,n);return Math.round(t*r)/r},o.util.getMousePos=function(t){var e=a.mouse(t.node()),n=e[0],r=e[1],o={};return o.x=n,o.y=r,o.pos=e,o.angle=180*(Math.atan2(r,n)+Math.PI)/Math.PI,o.radius=Math.sqrt(n*n+r*r),o},o.util.duplicatesCount=function(t){for(var e,n={},r={},a=0,o=t.length;o>a;a++)e=t[a],e in n?(n[e]++,r[e]=n[e]):n[e]=1;return r},o.util.duplicates=function(t){return Object.keys(o.util.duplicatesCount(t))},o.util.translator=function(t,e,n,r){if(r){var a=n.slice();n=e,e=a}var o=e.reduce(function(t,e){return"undefined"!=typeof t?t[e]:void 0},t);"undefined"!=typeof o&&(e.reduce(function(t,n,r){return"undefined"!=typeof t?(r===e.length-1&&delete t[n],t[n]):void 0},t),n.reduce(function(t,e,r){return"undefined"==typeof t[e]&&(t[e]={}),r===n.length-1&&(t[e]=o),t[e]},t))},o.PolyChart=function(){function t(){var t=n[0].geometryConfig,e=t.container;"string"==typeof e&&(e=a.select(e)),e.datum(n).each(function(e,n){function r(e,n){var r=t.radialScale(e[1]),a=(t.angularScale(e[0])+t.orientation)*Math.PI/180;return{r:r,t:a}}function o(t){var e=t.r*Math.cos(t.t),n=t.r*Math.sin(t.t);return{x:e,y:n}}var i=!!e[0].data.yStack,s=e.map(function(t,e){return i?a.zip(t.data.t[0],t.data.r[0],t.data.yStack[0]):a.zip(t.data.t[0],t.data.r[0])}),c=t.angularScale,u=t.radialScale.domain()[0],f={};f.bar=function(n,r,o){var i=e[o].data,l=t.radialScale(n[1])-t.radialScale(0),s=t.radialScale(n[2]||0),u=i.barWidth;a.select(this).attr({"class":"mark bar",d:"M"+[[l+s,-u/2],[l+s,u/2],[s,u/2],[s,-u/2]].join("L")+"Z",transform:function(e,n){return"rotate("+(t.orientation+c(e[0]))+")"}})},f.dot=function(t,n,i){var l=t[2]?[t[0],t[1]+t[2]]:t,s=a.svg.symbol().size(e[i].data.dotSize).type(e[i].data.dotType)(t,n);a.select(this).attr({"class":"mark dot",d:s,transform:function(t,e){var n=o(r(l));return"translate("+[n.x,n.y]+")"}})};var d=a.svg.line.radial().interpolate(e[0].data.lineInterpolation).radius(function(e){return t.radialScale(e[1])}).angle(function(e){return t.angularScale(e[0])*Math.PI/180});f.line=function(n,r,o){var i=n[2]?s[o].map(function(t,e){return[t[0],t[1]+t[2]]}):s[o];if(a.select(this).each(f.dot).style({opacity:function(t,n){return+e[o].data.dotVisible},fill:m.stroke(n,r,o)}).attr({"class":"mark dot"}),!(r>0)){var l=a.select(this.parentNode).selectAll("path.line").data([0]);l.enter().insert("path"),l.attr({"class":"line",d:d(i),transform:function(e,n){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return m.fill(n,r,o)},"fill-opacity":0,stroke:function(t,e){return m.stroke(n,r,o)},"stroke-width":function(t,e){return m["stroke-width"](n,r,o)},"stroke-dasharray":function(t,e){return m["stroke-dasharray"](n,r,o)},opacity:function(t,e){return m.opacity(n,r,o)},display:function(t,e){return m.display(n,r,o)}})}};var h=t.angularScale.range(),p=Math.abs(h[1]-h[0])/s[0].length*Math.PI/180,g=a.svg.arc().startAngle(function(t){return-p/2}).endAngle(function(t){return p/2}).innerRadius(function(e){return t.radialScale(u+(e[2]||0))}).outerRadius(function(e){return t.radialScale(u+(e[2]||0))+t.radialScale(e[1])});f.arc=function(e,n,r){a.select(this).attr({"class":"mark arc",d:g,transform:function(e,n){return"rotate("+(t.orientation+c(e[0])+90)+")"}})};var m={fill:function(t,n,r){return e[r].data.color},stroke:function(t,n,r){return e[r].data.strokeColor},"stroke-width":function(t,n,r){return e[r].data.strokeSize+"px"},"stroke-dasharray":function(t,n,r){return l[e[r].data.strokeDash]},opacity:function(t,n,r){return e[r].data.opacity},display:function(t,n,r){return"undefined"==typeof e[r].data.visible||e[r].data.visible?"block":"none"}},v=a.select(this).selectAll("g.layer").data(s);v.enter().append("g").attr({"class":"layer"});var y=v.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({"class":"mark"}),y.style(m).each(f[t.geometryType]),y.exit().remove(),v.exit().remove()})}var e,n=[o.PolyChart.defaultConfig()],r=a.dispatch("hover"),l={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){n[e]||(n[e]={}),i(n[e],o.PolyChart.defaultConfig()),i(n[e],t)}),this):n},t.getColorScale=function(){return e},a.rebind(t,r,"on"),t},o.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:a.scale.category20()}};return t},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t},o.Legend=function(){function t(){var n=e.legendConfig,r=e.data.map(function(t,e){return[].concat(t).map(function(t,r){var a=i({},n.elements[e]);return a.name=t,a.color=[].concat(n.elements[e].color)[r],a})}),o=a.merge(r);o=o.filter(function(t,e){return n.elements[e]&&(n.elements[e].visibleInLegend||"undefined"==typeof n.elements[e].visibleInLegend)}),n.reverseOrder&&(o=o.reverse());var l=n.container;("string"==typeof l||l.nodeName)&&(l=a.select(l));var s=o.map(function(t,e){return t.color}),c=n.fontSize,u=null==n.isContinuous?"number"==typeof o[0]:n.isContinuous,f=u?n.height:c*o.length,d=l.classed("legend-group",!0),h=d.selectAll("svg").data([0]),p=h.enter().append("svg").attr({width:300,height:f+c,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var g=a.range(o.length),m=a.scale[u?"linear":"ordinal"]().domain(g).range(s),v=a.scale[u?"linear":"ordinal"]().domain(g)[u?"range":"rangePoints"]([0,f]),y=function(t,e){var n=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":-1!=a.svg.symbolTypes.indexOf(t)?a.svg.symbol().type(t).size(n)():a.svg.symbol().type("square").size(n)()};if(u){var x=h.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(s);x.enter().append("stop"),x.attr({offset:function(t,e){return e/(s.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),h.append("rect").classed("legend-mark",!0).attr({height:n.height,width:n.colorBandWidth,fill:"url(#grad1)"})}else{var b=h.select(".legend-marks").selectAll("path.legend-mark").data(o);b.enter().append("path").classed("legend-mark",!0),b.attr({transform:function(t,e){return"translate("+[c/2,v(e)+c/2]+")"},d:function(t,e){var n=t.symbol;return y(n,c)},fill:function(t,e){return m(e)}}),b.exit().remove()}var _=a.svg.axis().scale(v).orient("right"),w=h.select("g.legend-axis").attr({transform:"translate("+[u?n.colorBandWidth:c,c/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:u?n.textColor:"none"}),w.selectAll("text").style({fill:n.textColor,"font-size":n.fontSize}).text(function(t,e){return o[e].name}),t}var e=o.Legend.defaultConfig(),n=a.dispatch("hover");return t.config=function(t){return arguments.length?(i(e,t),this):e},a.rebind(t,n,"on"),t},o.Legend.defaultConfig=function(t,e){var n={data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}};return n},o.tooltipPanel=function(){var t,e,n,r={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+o.tooltipPanel.uid++,s=10,c=function(){t=r.container.selectAll("g."+l).data([0]);var a=t.enter().append("g").classed(l,!0).style({"pointer-events":"none",display:"none"});return n=a.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),e=a.append("text").attr({dx:r.padding+s,dy:.3*+r.fontSize}),c};return c.text=function(o){var i=a.hsl(r.color).l,l=i>=.5?"#aaa":"white",u=i>=.5?"black":"white",f=o||"";e.style({fill:u,"font-size":r.fontSize+"px"}).text(f);var d=r.padding,h=e.node().getBBox(),p={fill:r.color,stroke:l,"stroke-width":"2px"},g=h.width+2*d+s,m=h.height+2*d;return n.attr({d:"M"+[[s,-m/2],[s,-m/4],[r.hasTick?0:s,0],[s,m/4],[s,m/2],[g,m/2],[g,-m/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[s,-m/2+2*d]+")"}),t.style({display:"block"}),c},c.move=function(e){return t?(t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),c):void 0},c.hide=function(){return t?(t.style({display:"none"}),c):void 0},c.show=function(){return t?(t.style({display:"block"}),c):void 0},c.config=function(t){return i(r,t),c},c},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var t={};return t.convert=function(t,e){var n={};if(t.data&&(n.data=t.data.map(function(t,n){var r=i({},t),a=[[r,["marker","color"],["color"]],[r,["marker","opacity"],["opacity"]],[r,["marker","line","color"],["strokeColor"]],[r,["marker","line","dash"],["strokeDash"]],[r,["marker","line","width"],["strokeSize"]],[r,["marker","symbol"],["dotType"]],[r,["marker","size"],["dotSize"]],[r,["marker","barWidth"],["barWidth"]],[r,["line","interpolation"],["lineInterpolation"]],[r,["showlegend"],["visibleInLegend"]]];return a.forEach(function(t,n){o.util.translator.apply(null,t.concat(e))}),e||delete r.marker,e&&delete r.groupId,e?("LinePlot"===r.geometry?(r.type="scatter",r.dotVisible===!0?(delete r.dotVisible,r.mode="lines+markers"):r.mode="lines"):"DotPlot"===r.geometry?(r.type="scatter",r.mode="markers"):"AreaChart"===r.geometry?r.type="area":"BarChart"===r.geometry&&(r.type="bar"),delete r.geometry):("scatter"===r.type?"lines"===r.mode?r.geometry="LinePlot":"markers"===r.mode?r.geometry="DotPlot":"lines+markers"===r.mode&&(r.geometry="LinePlot",r.dotVisible=!0):"area"===r.type?r.geometry="AreaChart":"bar"===r.type&&(r.geometry="BarChart"),delete r.mode,delete r.type),r}),!e&&t.layout&&"stack"===t.layout.barmode)){var r=o.util.duplicates(n.data.map(function(t,e){return t.geometry}));n.data.forEach(function(t,e){var a=r.indexOf(t.geometry);-1!=a&&(n.data[e].groupId=a)})}if(t.layout){var l=i({},t.layout),s=[[l,["plot_bgcolor"],["backgroundColor"]],[l,["showlegend"],["showLegend"]],[l,["radialaxis"],["radialAxis"]],[l,["angularaxis"],["angularAxis"]],[l.angularaxis,["showline"],["gridLinesVisible"]],[l.angularaxis,["showticklabels"],["labelsVisible"]],[l.angularaxis,["nticks"],["ticksCount"]],[l.angularaxis,["tickorientation"],["tickOrientation"]],[l.angularaxis,["ticksuffix"],["ticksSuffix"]],[l.angularaxis,["range"],["domain"]],[l.angularaxis,["endpadding"],["endPadding"]],[l.radialaxis,["showline"],["gridLinesVisible"]],[l.radialaxis,["tickorientation"],["tickOrientation"]],[l.radialaxis,["ticksuffix"],["ticksSuffix"]],[l.radialaxis,["range"],["domain"]],[l.angularAxis,["showline"],["gridLinesVisible"]],[l.angularAxis,["showticklabels"],["labelsVisible"]],[l.angularAxis,["nticks"],["ticksCount"]],[l.angularAxis,["tickorientation"],["tickOrientation"]],[l.angularAxis,["ticksuffix"],["ticksSuffix"]],[l.angularAxis,["range"],["domain"]],[l.angularAxis,["endpadding"],["endPadding"]],[l.radialAxis,["showline"],["gridLinesVisible"]],[l.radialAxis,["tickorientation"],["tickOrientation"]],[l.radialAxis,["ticksuffix"],["ticksSuffix"]],[l.radialAxis,["range"],["domain"]],[l.font,["outlinecolor"],["outlineColor"]],[l.legend,["traceorder"],["reverseOrder"]],[l,["labeloffset"],["labelOffset"]],[l,["defaultcolorrange"],["defaultColorRange"]]];if(s.forEach(function(t,n){o.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&"undefined"!=typeof l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&"undefined"!=typeof l.angularAxis.tickcolor&&(l.tickColor=l.angularAxis.tickcolor)),l.legend&&"boolean"!=typeof l.legend.reverseOrder&&(l.legend.reverseOrder="normal"!=l.legend.reverseOrder),l.legend&&"boolean"==typeof l.legend.traceorder&&(l.legend.traceorder=l.legend.traceorder?"reversed":"normal",delete l.legend.reverseOrder),l.margin&&"undefined"!=typeof l.margin.t){var c=["t","r","b","l","pad"],u=["top","right","bottom","left","pad"],f={};a.entries(l.margin).forEach(function(t,e){f[u[c.indexOf(t.key)]]=t.value}),l.margin=f}e&&(delete l.needsEndSpacing,delete l.minorTickColor,delete l.minorTicks,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksCount,delete l.angularaxis.ticksStep,delete l.angularaxis.rewriteTicks,delete l.angularaxis.nticks,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksCount,delete l.radialaxis.ticksStep,delete l.radialaxis.rewriteTicks,delete l.radialaxis.nticks),n.layout=l}return n},t}},{"../../plotly":121,"./micropolar_manager":148,d3:14}],148:[function(t,e,n){"use strict";var r=t("../../plotly"),a=t("d3"),o=t("./undo_manager"),i=e.exports={},l=r.Lib.extendDeepAll; i.framework=function(t){function e(e,o){return o&&(f=o),a.select(a.select(f).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),n=n?l(n,e):e,c||(c=r.micropolar.Axis()),u=r.micropolar.adapter.plotly().convert(n),c.config(u).render(f),t.data=n.data,t.layout=n.layout,i.fillLayout(t),n}var n,s,c,u,f,d=new o;return e.isPolar=!0,e.svg=function(){return c.svg()},e.getConfig=function(){return n},e.getLiveConfig=function(){return r.micropolar.adapter.plotly().convert(c.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:c.angularScale(),r:c.radialScale()}},e.setUndoPoint=function(){var t=this,e=r.micropolar.util.cloneJson(n);!function(e,n){d.add({undo:function(){n&&t(n)},redo:function(){t(e)}})}(e,s),s=r.micropolar.util.cloneJson(e)},e.undo=function(){d.undo()},e.redo=function(){d.redo()},e},i.fillLayout=function(t){var e=a.select(t).selectAll(".plot-container"),n=e.selectAll(".svg-container"),o=t.framework&&t.framework.svg&&t.framework.svg(),i={width:800,height:600,paper_bgcolor:r.Color.background,_container:e,_paperdiv:n,_paper:o};t._fullLayout=l(i,t.layout)}},{"../../plotly":121,"./undo_manager":149,d3:14}],149:[function(t,e,n){"use strict";e.exports=function(){function t(t,e){return t?(a=!0,t[e](),a=!1,this):this}var e,n=[],r=-1,a=!1;return{add:function(t){return a?this:(n.splice(r+1,n.length-r),n.push(t),r=n.length-1,this)},setCallback:function(t){e=t},undo:function(){var a=n[r];return a?(t(a,"undo"),r-=1,e&&e(a.undo),this):this},redo:function(){var a=n[r+1];return a?(t(a,"redo"),r+=1,e&&e(a.redo),this):this},clear:function(){n=[],r=-1},hasUndo:function(){return-1!==r},hasRedo:function(){return rg;g++){var m=h[g];l=t[m]?t[m]:t[m]={},e[m]=s={},i("domain."+d,[g/p,(g+1)/p]),i("domain."+{x:"y",y:"x"}[d]),o.id=m,f(l,s,i,o)}}},{"../lib":103,"./plots":144}],151:[function(t,e,n){"use strict";var r=t("./ternary"),a=t("../../plots/plots");n.name="ternary",n.attr="subplot",n.idRoot="ternary",n.idRegex=/^ternary([2-9]|[1-9][0-9]+)?$/,n.attrRegex=/^ternary([2-9]|[1-9][0-9]+)?$/,n.attributes=t("./layout/attributes"),n.layoutAttributes=t("./layout/layout_attributes"),n.supplyLayoutDefaults=t("./layout/defaults"),n.plot=function(t){for(var e=t._fullLayout,n=t._fullData,o=a.getSubplotIds(e,"ternary"),i=0;i=i&&(h.min=0,p.min=0,g.min=0,t.aaxis&&delete t.aaxis.min,t.baxis&&delete t.baxis.min,t.caxis&&delete t.caxis.min)}var a=t("../../../components/color"),o=t("../../subplot_defaults"),i=t("./layout_attributes"),l=t("./axis_defaults"),s=["aaxis","baxis","caxis"];e.exports=function(t,e,n){o(t,e,n,{type:"ternary",attributes:i,handleDefaults:r,font:e.font,paper_bgcolor:e.paper_bgcolor})}},{"../../../components/color":25,"../../subplot_defaults":150,"./axis_defaults":154,"./layout_attributes":156}],156:[function(t,e,n){"use strict";var r=t("../../../components/color/attributes"),a=t("./axis_attributes");e.exports={domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},bgcolor:{valType:"color",dflt:r.background},sum:{valType:"number",dflt:1,min:0},aaxis:a,baxis:a,caxis:a}},{"../../../components/color/attributes":24,"./axis_attributes":153}],157:[function(t,e,n){"use strict";function r(t,e){this.id=t.id,this.graphDiv=t.graphDiv,this.init(e),this.makeFramework()}function a(t){o.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}var o=t("d3"),i=t("tinycolor2"),l=t("../../plotly"),s=t("../../lib"),c=t("../../components/color"),u=t("../../components/drawing"),f=t("../cartesian/set_convert"),d=t("../../lib/extend").extendFlat,h=t("../cartesian/axes"),p=t("../../lib/filter_visible"),g=t("../../components/dragelement"),m=t("../../components/titles"),v=t("../cartesian/select"),y=t("../cartesian/constants"),x=t("../cartesian/graph_interact");e.exports=r;var b=r.prototype;b.init=function(t){this.container=t._ternarylayer,this.defs=t._defs,this.layoutId=t._uid,this.traceHash={}},b.plot=function(t,e){var n,r=this,a=e[r.id],o=e._size;s.getPlotDiv(r.plotContainer.node())!==r.graphDiv&&(r.init(r.graphDiv._fullLayout),r.makeFramework()),r.adjustLayout(a,o);var i=r.traceHash,l={};for(n=0;n_*y?(o=y,a=o*_):(a=v,o=a/_),i=g*a/v,l=m*o/y,n=e.l+e.w*h-a/2,r=e.t+e.h*(1-p)-o/2,s.x0=n,s.y0=r,s.w=a,s.h=o,s.sum=x,s.xaxis={type:"linear",range:[b+2*k-x,x-b-2*w],domain:[h-i/2,h+i/2],_id:"x",_gd:s.graphDiv},f(s.xaxis),s.xaxis.setScale(),s.yaxis={type:"linear",range:[b,x-w-k],domain:[p-l/2,p+l/2],_id:"y",_gd:s.graphDiv},f(s.yaxis),s.yaxis.setScale();var M=s.yaxis.domain[0],A=s.aaxis=d({},t.aaxis,{range:[b,x-w-k],side:"left",_counterangle:30,tickangle:(+t.aaxis.tickangle||0)-30,domain:[M,M+l*_],_axislayer:s.layers.aaxis,_gridlayer:s.layers.agrid,_pos:0,_gd:s.graphDiv,_id:"y",_length:a,_gridpath:"M0,0l"+o+",-"+a/2});f(A);var T=s.baxis=d({},t.baxis,{range:[x-b-k,w],side:"bottom",_counterangle:30,domain:s.xaxis.domain,_axislayer:s.layers.baxis,_gridlayer:s.layers.bgrid,_counteraxis:s.aaxis,_pos:0,_gd:s.graphDiv,_id:"x",_length:a,_gridpath:"M0,0l-"+a/2+",-"+o});f(T),A._counteraxis=T;var L=s.caxis=d({},t.caxis,{range:[x-b-w,k],side:"right",_counterangle:30,tickangle:(+t.caxis.tickangle||0)+30,domain:[M,M+l*_],_axislayer:s.layers.caxis,_gridlayer:s.layers.cgrid,_counteraxis:s.baxis,_pos:0,_gd:s.graphDiv,_id:"y",_length:a,_gridpath:"M0,0l-"+o+","+a/2});f(L);var z="M"+n+","+(r+o)+"h"+a+"l-"+a/2+",-"+o+"Z";s.clipDef.select("path").attr("d",z),s.layers.plotbg.select("path").attr("d",z);var S="translate("+n+","+r+")";s.plotContainer.selectAll(".scatterlayer,.maplayer,.zoom").attr("transform",S);var C="translate("+n+","+(r+o)+")";s.layers.baxis.attr("transform",C),s.layers.bgrid.attr("transform",C);var E="translate("+(n+a/2)+","+r+")rotate(30)";s.layers.aaxis.attr("transform",E),s.layers.agrid.attr("transform",E);var O="translate("+(n+a/2)+","+r+")rotate(-30)";s.layers.caxis.attr("transform",O),s.layers.cgrid.attr("transform",O),s.drawAxes(!0),s.plotContainer.selectAll(".crisp").classed("crisp",!1);var P=s.layers.axlines;P.select(".aline").attr("d",A.showline?"M"+n+","+(r+o)+"l"+a/2+",-"+o:"M0,0").call(c.stroke,A.linecolor||"#000").style("stroke-width",(A.linewidth||0)+"px"),P.select(".bline").attr("d",T.showline?"M"+n+","+(r+o)+"h"+a:"M0,0").call(c.stroke,T.linecolor||"#000").style("stroke-width",(T.linewidth||0)+"px"),P.select(".cline").attr("d",L.showline?"M"+(n+a/2)+","+r+"l"+a/2+","+o:"M0,0").call(c.stroke,L.linecolor||"#000").style("stroke-width",(L.linewidth||0)+"px")},b.drawAxes=function(t){var e=this,n=e.graphDiv,r=e.id.substr(7)+"title",a=e.aaxis,o=e.baxis,i=e.caxis;if(h.doTicks(n,a,!0),h.doTicks(n,o,!0),h.doTicks(n,i,!0),t){var l=Math.max(a.showticklabels?a.tickfont.size/2:0,(i.showticklabels?.75*i.tickfont.size:0)+("outside"===i.ticks?.87*i.ticklen:0));m.draw(n,"a"+r,{propContainer:a,propName:e.id+".aaxis.title",dfltName:"Component A",attributes:{x:e.x0+e.w/2,y:e.y0-a.titlefont.size/3-l,"text-anchor":"middle"}});var s=(o.showticklabels?o.tickfont.size:0)+("outside"===o.ticks?o.ticklen:0)+3;m.draw(n,"b"+r,{propContainer:o,propName:e.id+".baxis.title",dfltName:"Component B",attributes:{x:e.x0-s,y:e.y0+e.h+.83*o.titlefont.size+s,"text-anchor":"middle"}}),m.draw(n,"c"+r,{propContainer:i,propName:e.id+".caxis.title",dfltName:"Component C",attributes:{x:e.x0+e.w+s,y:e.y0+e.h+.83*i.titlefont.size+s,"text-anchor":"middle"}})}};var w=y.MINZOOM/2+.87,k="m-0.87,.5h"+w+"v3h-"+(w+5.2)+"l"+(w/2+2.6)+",-"+(.87*w+4.5)+"l2.6,1.5l-"+w/2+","+.87*w+"Z",M="m0.87,.5h-"+w+"v3h"+(w+5.2)+"l-"+(w/2+2.6)+",-"+(.87*w+4.5)+"l-2.6,1.5l"+w/2+","+.87*w+"Z",A="m0,1l"+w/2+","+.87*w+"l2.6,-1.5l-"+(w/2+2.6)+",-"+(.87*w+4.5)+"l-"+(w/2+2.6)+","+(.87*w+4.5)+"l2.6,1.5l"+w/2+",-"+.87*w+"Z",T="m0.5,0.5h5v-2h-5v-5h-2v5h-5v2h5v5h2Z",L=!0;b.initInteractions=function(){function t(t,e,n){var r=R.getBoundingClientRect();b=e-r.left,w=n-r.top,z={a:I.aaxis.range[0],b:I.baxis.range[1],c:I.caxis.range[1]},C=z,S=I.aaxis.range[1]-z.a,E=i(I.graphDiv._fullLayout[I.id].bgcolor).getLuminance(),O="M0,"+I.h+"L"+I.w/2+", 0L"+I.w+","+I.h+"Z",P=!1,N=F.append("path").attr("class","zoombox").style({fill:E>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("d",O),D=F.append("path").attr("class","zoombox-corners").style({fill:c.background,stroke:c.defaultLine,"stroke-width":1,opacity:0}).attr("d","M0,0Z"),p()}function e(t,e){return 1-e/I.h}function n(t,e){return 1-(t+(I.h-e)/Math.sqrt(3))/I.w}function r(t,e){return(t-(I.h-e)/Math.sqrt(3))/I.w}function o(t,a){var o=b+t,i=w+a,l=Math.max(0,Math.min(1,e(b,w),e(o,i))),s=Math.max(0,Math.min(1,n(b,w),n(o,i))),c=Math.max(0,Math.min(1,r(b,w),r(o,i))),u=(l/2+c)*I.w,f=(1-l/2-s)*I.w,d=(u+f)/2,h=f-u,p=(1-l)*I.h,g=p-h/_;h.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),D.transition().style("opacity",1).duration(200),P=!0)}function u(t,e){if(C===z)return 2===e&&m(),a(j);a(j);var n={};n[I.id+".aaxis.min"]=C.a,n[I.id+".baxis.min"]=C.b,n[I.id+".caxis.min"]=C.c,l.relayout(j,n),L&&j.data&&j._context.showTips&&(s.notifier("Double-click to
zoom back out","long"),L=!1)}function f(){z={a:I.aaxis.range[0],b:I.baxis.range[1],c:I.caxis.range[1]},C=z}function d(t,e){var n=t/I.xaxis._m,r=e/I.yaxis._m;C={a:z.a-r,b:z.b+(n+r)/2,c:z.c-(n-r)/2};var a=[C.a,C.b,C.c].sort(),o={a:a.indexOf(C.a),b:a.indexOf(C.b),c:a.indexOf(C.c)};a[0]<0&&(a[1]+a[0]/2<0?(a[2]+=a[0]+a[1],a[0]=a[1]=0):(a[2]+=a[0]/2,a[1]+=a[0]/2,a[0]=0),C={a:a[o.a],b:a[o.b],c:a[o.c]},e=(z.a-C.a)*I.yaxis._m,t=(z.c-C.c-z.b+C.b)*I.xaxis._m);var i="translate("+(I.x0+t)+","+(I.y0+e)+")";I.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",i),I.aaxis.range=[C.a,I.sum-C.b-C.c],I.baxis.range=[I.sum-C.a-C.c,C.b],I.caxis.range=[I.sum-C.a-C.b,C.c],I.drawAxes(!1),I.plotContainer.selectAll(".crisp").classed("crisp",!1)}function h(t,e){if(t){var n={};n[I.id+".aaxis.min"]=C.a,n[I.id+".baxis.min"]=C.b,n[I.id+".caxis.min"]=C.c,l.relayout(j,n)}else 2===e&&m()}function p(){I.plotContainer.selectAll(".select-outline").remove()}function m(){var t={};t[I.id+".aaxis.min"]=0,t[I.id+".baxis.min"]=0,t[I.id+".caxis.min"]=0,j.emit("plotly_doubleclick",null),l.relayout(j,t)}var b,w,z,S,C,E,O,P,N,D,I=this,R=I.layers.plotbg.select("path").node(),j=I.graphDiv,F=I.layers.zoom,q={element:R,gd:j,plotinfo:{plot:F},doubleclick:m,subplot:I.id,prepFn:function(e,n,r){q.xaxes=[I.xaxis],q.yaxes=[I.yaxis];var a=j._fullLayout.dragmode;e.shiftKey&&(a="pan"===a?"zoom":"pan"),"lasso"===a?q.minDrag=1:q.minDrag=void 0,"zoom"===a?(q.moveFn=o,q.doneFn=u,t(e,n,r)):"pan"===a?(q.moveFn=d,q.doneFn=h,f(),p()):"select"!==a&&"lasso"!==a||v(e,n,r,q,a)}};R.onmousemove=function(t){x.hover(j,t,I.id),j._fullLayout._lasthover=R,j._fullLayout._hoversubplot=I.id},R.onmouseout=function(t){j._dragging||g.unhover(j,t)},R.onclick=function(t){x.click(j,t)},g.init(q)}},{"../../components/color":25,"../../components/dragelement":46,"../../components/drawing":48,"../../components/titles":88,"../../lib":103,"../../lib/extend":101,"../../lib/filter_visible":102,"../../plotly":121,"../cartesian/axes":124,"../cartesian/constants":129,"../cartesian/graph_interact":131,"../cartesian/select":137,"../cartesian/set_convert":138,d3:14,tinycolor2:20}],158:[function(t,e,n){"use strict";function r(t){var e;switch(t){case"themes__thumb":e={autosize:!0,width:150,height:150,title:"",showlegend:!1,margin:{l:5,r:5,t:5,b:5,pad:0},annotations:[]};break;case"thumbnail":e={title:"",hidesources:!0,showlegend:!1,borderwidth:0,bordercolor:"",margin:{l:1,r:1,t:1,b:1,pad:0},annotations:[]};break;default:e={}}return e}function a(t){var e=["xaxis","yaxis","zaxis"];return e.indexOf(t.slice(0,5))>-1}var o=t("../plotly"),i=o.Lib.extendFlat,l=o.Lib.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var n,s=t.data,c=t.layout,u=l([],s),f=l({},c,r(e.tileClass));if(e.width&&(f.width=e.width),e.height&&(f.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){f.annotations=[];var d=Object.keys(f);for(n=0;ns;s++)r(n[s])&&h.push({p:n[s],s:l[s],b:0});return o(e,"marker")&&i(e,e.marker.color,"marker","c"),o(e,"marker.line")&&i(e,e.marker.line.color,"marker.line","c"),h}},{"../../components/colorscale/calc":32,"../../components/colorscale/has_colorscale":38,"../../plots/cartesian/axes":124,"fast-isnumeric":17}],168:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../components/color"),o=t("../scatter/xy_defaults"),i=t("../bar/style_defaults"),l=t("../../components/errorbars/defaults"),s=t("./attributes");e.exports=function(t,e,n,c){function u(n,a){return r.coerce(t,e,s,n,a)}var f=o(t,e,u);return f?(u("orientation",e.x&&!e.y?"h":"v"),u("text"),i(t,e,u,n,c),l(t,e,a.defaultLine,{axis:"y"}),void l(t,e,a.defaultLine,{axis:"x",inherit:"y"})):void(e.visible=!1)}},{"../../components/color":25,"../../components/errorbars/defaults":53,"../../lib":103,"../bar/style_defaults":176,"../scatter/xy_defaults":258,"./attributes":166}],169:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/graph_interact"),a=t("../../components/errorbars"),o=t("../../components/color");e.exports=function(t,e,n,i){var l,s=t.cd,c=s[0].trace,u=s[0].t,f=t.xa,d=t.ya,h="closest"===i?u.barwidth/2:u.dbar*(1-f._gd._fullLayout.bargap)/2;l="closest"!==i?function(t){return t.p}:"h"===c.orientation?function(t){return t.y}:function(t){return t.x};var p,g;"h"===c.orientation?(p=function(t){return r.inbox(t.b-e,t.x-e)+(t.x-e)/(t.x-t.b)},g=function(t){var e=l(t)-n;return r.inbox(e-h,e+h)}):(g=function(t){return r.inbox(t.b-n,t.y-n)+(t.y-n)/(t.y-t.b)},p=function(t){var n=l(t)-e;return r.inbox(n-h,n+h)});var m=r.getDistanceFunction(i,p,g);if(r.getClosest(s,m,t),t.index!==!1){var v=s[t.index],y=v.mcc||c.marker.color,x=v.mlcc||c.marker.line.color,b=v.mlw||c.marker.line.width;return o.opacity(y)?t.color=y:o.opacity(x)&&b&&(t.color=x),"h"===c.orientation?(t.x0=t.x1=f.c2p(v.x,!0),t.xLabelVal=v.s,t.y0=d.c2p(l(v)-h,!0),t.y1=d.c2p(l(v)+h,!0),t.yLabelVal=v.p):(t.y0=t.y1=d.c2p(v.y,!0),t.yLabelVal=v.s,t.x0=f.c2p(l(v)-h,!0),t.x1=f.c2p(l(v)+h,!0),t.xLabelVal=v.p),v.tx&&(t.text=v.tx),a.hoverInfo(v,c,t),[t]}}},{"../../components/color":25,"../../components/errorbars":54,"../../plots/cartesian/graph_interact":131}],170:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.layoutAttributes=t("./layout_attributes"),r.supplyDefaults=t("./defaults"),r.supplyLayoutDefaults=t("./layout_defaults"),r.calc=t("./calc"),r.setPositions=t("./set_positions"),r.colorbar=t("../scatter/colorbar"),r.arraysToCalcdata=t("./arrays_to_calcdata"),r.plot=t("./plot"),r.style=t("./style"),r.hoverPoints=t("./hover"),r.moduleType="trace",r.name="bar",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","bar","oriented","markerColorscale","errorBarsOK","showLegend"],r.meta={},e.exports=r},{"../../plots/cartesian":132,"../scatter/colorbar":240,"./arrays_to_calcdata":165,"./attributes":166,"./calc":167,"./defaults":168,"./hover":169,"./layout_attributes":171,"./layout_defaults":172,"./plot":173,"./set_positions":174,"./style":175}],171:[function(t,e,n){"use strict";e.exports={barmode:{valType:"enumerated",values:["stack","group","overlay","relative"],dflt:"group"},barnorm:{valType:"enumerated",values:["","fraction","percent"],dflt:""},bargap:{valType:"number",min:0,max:1},bargroupgap:{valType:"number",min:0,max:1,dflt:0}}},{}],172:[function(t,e,n){"use strict";var r=t("../../plots/plots"),a=t("../../plots/cartesian/axes"),o=t("../../lib"),i=t("./layout_attributes");e.exports=function(t,e,n){function l(n,r){return o.coerce(t,e,i,n,r)}for(var s=!1,c=!1,u=!1,f={},d=0;d=2?o(t):t>e?Math.ceil(t):Math.floor(t)}var d,h,p,g;if("h"===l.orientation?(p=u.c2p(n.poffset+e.p,!0),g=u.c2p(n.poffset+e.p+n.barwidth,!0),d=c.c2p(e.b,!0),h=c.c2p(e.s+e.b,!0)):(d=c.c2p(n.poffset+e.p,!0),h=c.c2p(n.poffset+e.p+n.barwidth,!0),g=u.c2p(e.s+e.b,!0),p=u.c2p(e.b,!0)),!(a(d)&&a(h)&&a(p)&&a(g)&&d!==h&&p!==g))return void r.select(this).remove();var m=(e.mlw+1||l.marker.line.width+1||(e.trace?e.trace.marker.line.width:0)+1)-1,v=r.round(m/2%1,2);if(!t._context.staticPlot){var y=i.opacity(e.mc||l.marker.color),x=1>y||m>.01?o:s;d=x(d,h),h=x(h,d),p=x(p,g),g=x(g,p)}r.select(this).attr("d","M"+d+","+p+"V"+g+"H"+h+"V"+p+"Z")})}),d.call(l.plot,e)}},{"../../components/color":25,"../../components/errorbars":54,"../../lib":103,"./arrays_to_calcdata":165,d3:14,"fast-isnumeric":17}],174:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../plots/plots"),o=t("../../plots/cartesian/axes"),i=t("../../lib");e.exports=function(t,e){var n,l,s=t._fullLayout,c=e.x(),u=e.y();["v","h"].forEach(function(f){function d(e){function n(t){t[p]=t.p+d}var r=[];e.forEach(function(e){t.calcdata[e].forEach(function(t){r.push(t.p)})});var a=i.distinctVals(r),l=a.vals,c=a.minDiff,u=!1,f=[];"group"===s.barmode&&e.forEach(function(e){u||(t.calcdata[e].forEach(function(t){u||f.forEach(function(e){Math.abs(t.p-e)_&&(S=!0,A=_),_>M+P&&(S=!0,M=_))}o.expand(v,[A,M],{tozero:!0,padded:S})}else{var N=function(t){return t[g]=t.s,t.s};for(n=0;n1||0===l.bargap&&0===l.bargroupgap&&!t[0].trace.marker.line.width)&&r.select(this).attr("shape-rendering","crispEdges")}),e.selectAll("g.points").each(function(t){var e=t[0].trace,n=e.marker,i=n.line,l=(e._input||{}).marker||{},s=o.tryColorscale(n,l,""),c=o.tryColorscale(n,l,"line.");r.select(this).selectAll("path").each(function(t){var e,o,l=(t.mlw+1||i.width+1)-1,u=r.select(this);e="mc"in t?t.mcc=s(t.mc):Array.isArray(n.color)?a.defaultLine:n.color,u.style("stroke-width",l+"px").call(a.fill,e),l&&(o="mlc"in t?t.mlcc=c(t.mlc):Array.isArray(i.color)?a.defaultLine:i.color,u.call(a.stroke,o))})}),e.call(i.style)}},{"../../components/color":25,"../../components/drawing":48,"../../components/errorbars":54,d3:14}],176:[function(t,e,n){"use strict";var r=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults");e.exports=function(t,e,n,i,l){n("marker.color",i),a(t,"marker")&&o(t,e,l,n,{prefix:"marker.",cLetter:"c"}),n("marker.line.color",r.defaultLine),a(t,"marker.line")&&o(t,e,l,n,{prefix:"marker.line.",cLetter:"c"}),n("marker.line.width")}},{"../../components/color":25,"../../components/colorscale/defaults":35,"../../components/colorscale/has_colorscale":38}],177:[function(t,e,n){"use strict";var r=t("../scatter/attributes"),a=t("../../components/color/attributes"),o=t("../../lib/extend").extendFlat,i=r.marker,l=i.line;e.exports={y:{valType:"data_array"},x:{valType:"data_array"},x0:{valType:"any"},y0:{valType:"any"},whiskerwidth:{valType:"number",min:0,max:1,dflt:.5},boxpoints:{valType:"enumerated",values:["all","outliers","suspectedoutliers",!1],dflt:"outliers"},boxmean:{valType:"enumerated",values:[!0,"sd",!1],dflt:!1},jitter:{valType:"number",min:0,max:1},pointpos:{valType:"number",min:-2,max:2},orientation:{valType:"enumerated",values:["v","h"]},marker:{outliercolor:{valType:"color",dflt:"rgba(0, 0, 0, 0)"},symbol:o({},i.symbol,{arrayOk:!1}),opacity:o({},i.opacity,{arrayOk:!1,dflt:1}),size:o({},i.size,{arrayOk:!1}),color:o({},i.color,{arrayOk:!1}),line:{color:o({},l.color,{arrayOk:!1,dflt:a.defaultLine}),width:o({},l.width,{arrayOk:!1,dflt:0}),outliercolor:{valType:"color"},outlierwidth:{valType:"number",min:0,dflt:1}}},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2}},fillcolor:r.fillcolor}},{"../../components/color/attributes":24,"../../lib/extend":101,"../scatter/attributes":237}],178:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/cartesian/axes");e.exports=function(t,e){function n(t,e,n,o,i){var l;return n in e?p=o.makeCalcdata(e,n):(l=n+"0"in e?e[n+"0"]:"name"in e&&("category"===o.type||r(e.name)&&-1!==["linear","log"].indexOf(o.type)||a.isDateTime(e.name)&&"date"===o.type)?e.name:t.numboxes,l=o.d2c(l),p=i.map(function(){return l})),p}function i(t,e,n,o,i){var l,s,c,u,f=o.length,d=e.length,h=[],p=[];for(l=0;f>l;++l)s=o[l],t[l]={pos:s},p[l]=s-i,h[l]=[];for(p.push(o[f-1]+i),l=0;d>l;++l)u=e[l],r(u)&&(c=a.findBin(n[l],p),c>=0&&d>c&&h[c].push(u));return h}function l(t,e){var n,r,o,i;for(i=0;i1,v=n.dPos*(1-d.boxgap)*(1-d.boxgroupgap)/(m?t.numboxes:1),y=m?2*n.dPos*(-.5+(n.boxnum+.5)/t.numboxes)*(1-d.boxgap):0,x=v*g.whiskerwidth;return g.visible!==!0||n.emptybox?void o.select(this).remove():("h"===g.orientation?(s=p,f=h):(s=h,f=p),n.bPos=y,n.bdPos=v,r(),o.select(this).selectAll("path.box").data(i.identity).enter().append("path").attr("class","box").each(function(t){var e=s.c2p(t.pos+y,!0),n=s.c2p(t.pos+y-v,!0),r=s.c2p(t.pos+y+v,!0),a=s.c2p(t.pos+y-x,!0),l=s.c2p(t.pos+y+x,!0),c=f.c2p(t.q1,!0),u=f.c2p(t.q3,!0),d=i.constrain(f.c2p(t.med,!0),Math.min(c,u)+1,Math.max(c,u)-1),h=f.c2p(g.boxpoints===!1?t.min:t.lf,!0),p=f.c2p(g.boxpoints===!1?t.max:t.uf,!0);"h"===g.orientation?o.select(this).attr("d","M"+d+","+n+"V"+r+"M"+c+","+n+"V"+r+"H"+u+"V"+n+"ZM"+c+","+e+"H"+h+"M"+u+","+e+"H"+p+(0===g.whiskerwidth?"":"M"+h+","+a+"V"+l+"M"+p+","+a+"V"+l)):o.select(this).attr("d","M"+n+","+d+"H"+r+"M"+n+","+c+"H"+r+"V"+u+"H"+n+"ZM"+e+","+c+"V"+h+"M"+e+","+u+"V"+p+(0===g.whiskerwidth?"":"M"+a+","+h+"H"+l+"M"+a+","+p+"H"+l))}),g.boxpoints&&o.select(this).selectAll("g.points").data(function(t){return t.forEach(function(t){t.t=n,t.trace=g}),t}).enter().append("g").attr("class","points").selectAll("path").data(function(t){var e,n,r,o,l,s,f,d="all"===g.boxpoints?t.val:t.val.filter(function(e){return et.uf}),h=(t.q3-t.q1)*u,p=[],m=0;if(g.jitter){for(e=0;et.lo&&(r.so=!0),r})}).enter().append("path").call(l.translatePoints,h,p),void(g.boxmean&&o.select(this).selectAll("path.mean").data(i.identity).enter().append("path").attr("class","mean").style("fill","none").each(function(t){var e=s.c2p(t.pos+y,!0),n=s.c2p(t.pos+y-v,!0),r=s.c2p(t.pos+y+v,!0),a=f.c2p(t.mean,!0),i=f.c2p(t.mean-t.sd,!0),l=f.c2p(t.mean+t.sd,!0);"h"===g.orientation?o.select(this).attr("d","M"+a+","+n+"V"+r+("sd"!==g.boxmean?"":"m0,0L"+i+","+e+"L"+a+","+n+"L"+l+","+e+"Z")):o.select(this).attr("d","M"+n+","+a+"H"+r+("sd"!==g.boxmean?"":"m0,0L"+e+","+i+"L"+n+","+a+"L"+e+","+l+"Z"))})))})}},{"../../components/drawing":48,"../../lib":103,d3:14}],185:[function(t,e,n){"use strict";var r=t("../../plots/plots"),a=t("../../plots/cartesian/axes"),o=t("../../lib");e.exports=function(t,e){var n,i,l,s,c=t._fullLayout,u=e.x(),f=e.y(),d=["v","h"];for(i=0;in;n++)e=f[n],h[n]=e[0]*(t.zmax-t.zmin)+t.zmin,p[n]=e[1];var g=r.extent([t.zmin,t.zmax,o.start,o.start+s*(c-1)]),m=g[t.zminn;n++)e=f[n],h[n]=(e[0]*(c+u-1)-u/2)*s+i,p[n]=e[1];var y=r.scale.linear().interpolate(r.interpolateRgb).domain(h).range(p);return y}},{"../../components/colorscale/get_scale":37,d3:14}],194:[function(t,e,n){"use strict";function r(t,e,n){var r=n[0].trace,o=n[0].x,l=n[0].y,c=r.contours,u=r.uid,f=e.x(),d=e.y(),m=t._fullLayout,x="contour"+u,b=a(c,e,n[0]);if(r.visible!==!0)return m._paper.selectAll("."+x+",.hm"+u).remove(),void m._infolayer.selectAll(".cb"+u).remove();"heatmap"===c.coloring?(r.zauto&&r.autocontour===!1&&(r._input.zmin=r.zmin=c.start-c.size/2,r._input.zmax=r.zmax=r.zmin+b.length*c.size),k(t,e,[n])):m._paper.selectAll(".hm"+u).remove(),i(b),s(b);var _=f.c2p(o[0],!0),w=f.c2p(o[o.length-1],!0),M=d.c2p(l[0],!0),A=d.c2p(l[l.length-1],!0),T=[[_,A],[w,A],[w,M],[_,M]],L=h(e,n,x);p(L,T,c),g(L,b,T,c),v(L,b,c),y(L,e,n[0],T)}function a(t,e,n){for(var r=t.size||1,a=[],o=t.start;ot?0:1)+(e[0][1]>t?0:2)+(e[1][1]>t?0:4)+(e[1][0]>t?0:8);if(5===n||10===n){var r=(e[0][0]+e[0][1]+e[1][0]+e[1][1])/4;return t>r?5===n?713:1114:5===n?104:208}return 15===n?0:n}function i(t){var e,n,r,a,i,l,s,c,u,f=t[0].z,d=f.length,h=f[0].length,p=2===d||2===h;for(n=0;d-1>n;n++)for(a=[],0===n&&(a=a.concat(M)),n===d-2&&(a=a.concat(A)),e=0;h-1>e;e++)for(r=a.slice(),0===e&&(r=r.concat(T)),e===h-2&&(r=r.concat(L)),i=e+","+n,l=[[f[n][e],f[n][e+1]],[f[n+1][e],f[n+1][e+1]]],u=0;ua;a++){if(l>20?(l=S[l][(s[0]||s[1])<0?0:1],t.crossings[i]=C[l]):delete t.crossings[i],s=z[l],!s){_.log("Found bad marching index:",l,e,t.level);break}if(h.push(d(t,e,s)),e[0]+=s[0],e[1]+=s[1],u(h[h.length-1],h[h.length-2])&&h.pop(),i=e.join(","),i===o&&s.join(",")===p||n&&(s[0]&&(e[0]<0||e[0]>m-2)||s[1]&&(e[1]<0||e[1]>g-2)))break;l=t.crossings[i]}1e4===a&&_.log("Infinite loop in contour?");var v,y,x,b,w,k,M,A=u(h[0],h[h.length-1]),T=0,L=.2*t.smoothing,E=[],O=0;for(a=1;a=O;a--)if(v=E[a],P>v){for(x=0,y=a-1;y>=O&&v+E[y]x&&v+E[x]e;)e++,n=Object.keys(a.crossings)[0].split(",").map(Number),l(a,n);1e4===e&&_.log("Infinite loop in contour?")}}function c(t,e,n){var r=0,a=0;return t>20&&e?208===t||1114===t?r=0===n[0]?1:-1:a=0===n[1]?1:-1:-1!==M.indexOf(t)?a=1:-1!==T.indexOf(t)?r=1:-1!==A.indexOf(t)?a=-1:r=-1,[r,a]}function u(t,e){return Math.abs(t[0]-e[0])<.01&&Math.abs(t[1]-e[1])<.01}function f(t,e){var n=t[0]-e[0],r=t[1]-e[1];return Math.sqrt(n*n+r*r)}function d(t,e,n){var r=e[0]+Math.max(n[0],0),a=e[1]+Math.max(n[1],0),o=t.z[a][r],i=t.xaxis,l=t.yaxis;if(n[1]){var s=(t.level-o)/(t.z[a][r+1]-o);return[i.c2p((1-s)*t.x[r]+s*t.x[r+1],!0),l.c2p(t.y[a],!0)]}var c=(t.level-o)/(t.z[a+1][r]-o);return[i.c2p(t.x[r],!0),l.c2p((1-c)*t.y[a]+c*t.y[a+1],!0)]}function h(t,e,n){var r=t.plot.select(".maplayer").selectAll("g.contour."+n).data(e);return r.enter().append("g").classed("contour",!0).classed(n,!0),r.exit().remove(),r}function p(t,e,n){var r=t.selectAll("g.contourbg").data([0]);r.enter().append("g").classed("contourbg",!0);var a=r.selectAll("path").data("fill"===n.coloring?[0]:[]);a.enter().append("path"),a.exit().remove(),a.attr("d","M"+e.join("L")+"Z").style("stroke","none")}function g(t,e,n,r){var a=t.selectAll("g.contourfill").data([0]);a.enter().append("g").classed("contourfill",!0);var o=a.selectAll("path").data("fill"===r.coloring?e:[]);o.enter().append("path"),o.exit().remove(),o.each(function(t){var e=m(t,n);e?b.select(this).attr("d",e).style("stroke","none"):b.select(this).remove()})}function m(t,e){function n(t){return Math.abs(t[1]-e[0][1])<.01}function r(t){return Math.abs(t[1]-e[2][1])<.01}function a(t){return Math.abs(t[0]-e[0][0])<.01}function o(t){return Math.abs(t[0]-e[2][0])<.01}for(var i,l,s,c,u,f,d=t.edgepaths.length||t.z[0][0]s;s++){if(!i){_.log("Missing end?",h,t);break}for(n(i)&&!o(i)?l=e[1]:a(i)?l=e[0]:r(i)?l=e[3]:o(i)&&(l=e[2]),u=0;u=0&&(l=m,c=u):Math.abs(i[1]-l[1])<.01?Math.abs(i[1]-m[1])<.01&&(m[0]-i[0])*(l[0]-m[0])>=0&&(l=m,c=u):_.log("endpt to newendpt is not vert. or horz.",i,l,m)}if(i=l,c>=0)break;d+="L"+l}if(c===t.edgepaths.length){_.log("unclosed perimeter path");break}h=c,g=-1===p.indexOf(h),g&&(h=p[0],d+="Z")}for(h=0;he;e++)l.push(1);for(e=0;o>e;e++)a.push(l.slice());for(e=0;ei;i++)for(r=a(s,i),u[i]=new Array(r),l=0;r>l;l++)u[i][l]=e(o(s,i,l));return u}function a(t,e,n,r,a,o){var i,l,s,c=[],u=d.traceIs(t,"contour"),f=d.traceIs(t,"histogram"),h=d.traceIs(t,"gl2d"),p=Array.isArray(e)&&e.length>1;if(p&&!f&&"category"!==o.type){e=e.map(o.d2c);var g=e.length;if(!(a>=g))return u?e.slice(0,a):e.slice(0,a+1);if(u||h)c=e.slice(0,a);else if(1===a)c=[e[0]-.5,e[0]+.5];else{for(c=[1.5*e[0]-.5*e[1]],s=1;g>s;s++)c.push(.5*(e[s-1]+e[s]));c.push(1.5*e[g-1]-.5*e[g-2])}if(a>g){var m=c[c.length-1],v=m-c[c.length-2];for(s=g;a>s;s++)m+=v,c.push(m)}}else for(l=r||1,i=f||"category"===o.type?n||0:Array.isArray(e)&&1===e.length?e[0]:void 0===n?0:o.d2c(n),s=u||h?0:-.5;a>s;s++)c.push(i+l*s);return c}function o(t){return.5-.25*Math.min(1,.5*t)}function i(t,e,n){var r,a,i=1;if(Array.isArray(n))for(r=0;rr&&i>y;r++)i=s(t,e,o(i));return i>y&&u.log("interp2d didn't converge quickly",i),t}function l(t){var e,n,r,a,o,i,l,s,c=[],u={},f=[],d=t[0],h=[],p=[0,0,0],g=v(t);for(n=0;nr;r++)void 0===h[r]&&(i=(void 0!==h[r-1]?1:0)+(void 0!==h[r+1]?1:0)+(void 0!==e[r]?1:0)+(void 0!==d[r]?1:0),i?(0===n&&i++,0===r&&i++,n===t.length-1&&i++,r===h.length-1&&i++,4>i&&(u[[n,r]]=[n,r,i]),c.push([n,r,i])):f.push([n,r]));for(;f.length;){for(l={},s=!1,o=f.length-1;o>=0;o--)a=f[o],n=a[0],r=a[1],i=((u[[n-1,r]]||p)[2]+(u[[n+1,r]]||p)[2]+(u[[n,r-1]]||p)[2]+(u[[n,r+1]]||p)[2])/20,i&&(l[a]=[n,r,i],f.splice(o,1),s=!0);if(!s)throw"findEmpties iterated with no new neighbors";for(a in l)u[a]=l[a],c.push(l[a])}return c.sort(function(t,e){return e[2]-t[2]})}function s(t,e,n){var r,a,o,i,l,s,c,u,f,d,h,p,g,m=0;for(i=0;il;l++)s=x[l],c=t[a+s[0]],c&&(u=c[o+s[1]],void 0!==u&&(0===d?p=g=u:(p=Math.min(p,u),g=Math.max(g,u)),f++,d+=u));if(0===f)throw"iterateInterp2d order is wrong: no defined neighbors";t[a][o]=d/f,void 0===h?4>f&&(m=1):(t[a][o]=(1+n)*t[a][o]-n*h,g>p&&(m=Math.max(m,Math.abs(t[a][o]-h)/(g-p))))}return m}var c=t("fast-isnumeric"),u=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../../plots/plots"),h=t("../histogram2d/calc"),p=t("../../components/colorscale/calc"),g=t("./has_columns"),m=t("./convert_column_xyz"),v=t("./max_row_length");e.exports=function(t,e){function n(t){z=e._input.zsmooth=e.zsmooth=!1,u.notifier("cannot fast-zsmooth: "+t)}var o,s,c,y,x,b,_,w,k=f.getFromId(t,e.xaxis||"x"),M=f.getFromId(t,e.yaxis||"y"),A=d.traceIs(e,"contour"),T=d.traceIs(e,"histogram"),L=d.traceIs(e,"gl2d"),z=A?"best":e.zsmooth;if(k._minDtick=0,M._minDtick=0,T){var S=h(t,e);o=S.x,s=S.x0,c=S.dx,y=S.y,x=S.y0,b=S.dy,_=S.z}else g(e)&&m(e,k,M),o=e.x?k.makeCalcdata(e,"x"):[],y=e.y?M.makeCalcdata(e,"y"):[],s=e.x0||0,c=e.dx||1,x=e.y0||0,b=e.dy||1,_=r(e),(A||e.connectgaps)&&(e._emptypoints=l(_),e._interpz=i(_,e._emptypoints,e._interpz));if("fast"===z)if("log"===k.type||"log"===M.type)n("log axis found");else if(!T){if(o.length){var C=(o[o.length-1]-o[0])/(o.length-1),E=Math.abs(C/100);for(w=0;wE){n("x scale is not linear");break}}if(y.length&&"fast"===z){var O=(y[y.length-1]-y[0])/(y.length-1),P=Math.abs(O/100);for(w=0;wP){n("y scale is not linear");break}}}var N=v(_),D="scaled"===e.xtype?"":e.x,I=a(e,D,s,c,N,k),R="scaled"===e.ytype?"":e.y,j=a(e,R,x,b,_.length,M);L||(f.expand(k,I),f.expand(M,j));var F={x:I,y:j,z:_};if(p(e,_,"","z"),A&&e.contours&&"heatmap"===e.contours.coloring){var q="contour"===e.type?"heatmap":"histogram2d";F.xfill=a(q,D,s,c,N,k),F.yfill=a(q,R,x,b,_.length,M)}return[F]};var y=.01,x=[[-1,0],[1,0],[0,-1],[0,1]]},{"../../components/colorscale/calc":32,"../../lib":103,"../../plots/cartesian/axes":124,"../../plots/plots":144,"../histogram2d/calc":210,"./convert_column_xyz":200,"./has_columns":202,"./max_row_length":205,"fast-isnumeric":17}],199:[function(t,e,n){"use strict";var r=t("d3"),a=t("fast-isnumeric"),o=t("../../lib"),i=t("../../plots/plots"),l=t("../../components/colorscale/get_scale"),s=t("../../components/colorbar/draw");e.exports=function(t,e){var n=e[0].trace,c="cb"+n.uid,u=l(n.colorscale),f=n.zmin,d=n.zmax;if(a(f)||(f=o.aggNums(Math.min,null,n.z)),a(d)||(d=o.aggNums(Math.max,null,n.z)),t._fullLayout._infolayer.selectAll("."+c).remove(),!n.showscale)return void i.autoMargin(t,c);var h=e[0].t.cb=s(t,c);h.fillcolor(r.scale.linear().domain(u.map(function(t){return f+t[0]*(d-f)})).range(u.map(function(t){return t[1]}))).filllevels({start:f,end:d,size:(d-f)/254}).options(n.colorbar)()}},{"../../components/colorbar/draw":28,"../../components/colorscale/get_scale":37, -"../../lib":103,"../../plots/plots":144,d3:14,"fast-isnumeric":17}],200:[function(t,e,n){"use strict";var r=t("../../lib");e.exports=function(t,e,n){var a,o=t.x.slice(),i=t.y.slice(),l=t.z,s=t.text,c=Math.min(o.length,i.length,l.length),u=void 0!==s&&!Array.isArray(s[0]);for(ca;a++)o[a]=e.d2c(o[a]),i[a]=n.d2c(i[a]);var f,d,h,p=r.distinctVals(o),g=p.vals,m=r.distinctVals(i),v=m.vals,y=r.init2dArray(v.length,g.length);for(u&&(h=r.init2dArray(v.length,g.length)),a=0;c>a;a++)f=r.findBin(o[a]+p.minDiff/2,g),d=r.findBin(i[a]+m.minDiff/2,v),y[d][f]=l[a],u&&(h[d][f]=s[a]);t.x=g,t.y=v,t.z=y,u&&(t.text=h)}},{"../../lib":103}],201:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./has_columns"),o=t("./xyz_defaults"),i=t("../../components/colorscale/defaults"),l=t("./attributes");e.exports=function(t,e,n,s){function c(n,a){return r.coerce(t,e,l,n,a)}var u=o(t,e,c);return u?(c("text"),c("zsmooth"),c("connectgaps",a(e)&&e.zsmooth!==!1),void i(t,e,s,c,{prefix:"",cLetter:"z"})):void(e.visible=!1)}},{"../../components/colorscale/defaults":35,"../../lib":103,"./attributes":197,"./has_columns":202,"./xyz_defaults":208}],202:[function(t,e,n){"use strict";e.exports=function(t){return!Array.isArray(t.z[0])}},{}],203:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/graph_interact"),a=t("../../lib"),o=t("../../plots/cartesian/constants").MAXDIST;e.exports=function(t,e,n,i,l){if(!(t.distanceu||u>=y[0].length||0>f||f>y.length)return}else{if(r.inbox(e-m[0],e-m[m.length-1])>o||r.inbox(n-v[0],n-v[v.length-1])>o)return;if(l){var k;for(b=[2*m[0]-m[1]],k=1;k0;)_=m.c2p(C[A]),A--;for(b>_&&(w=_,_=b,b=w,I=!0),A=0;void 0===k&&A0;)M=v.c2p(E[A]),A--;if(k>M&&(w=k,k=M,M=w,R=!0),O&&(C=n[0].xfill,E=n[0].yfill),"fast"!==P){var j="best"===P?0:.5;b=Math.max(-j*m._length,b),_=Math.min((1+j)*m._length,_),k=Math.max(-j*v._length,k),M=Math.min((1+j)*v._length,M)}var F=Math.round(_-b),q=Math.round(M-k),B=0>=F||0>=q,H=e.plot.select(".imagelayer").selectAll("g.hm."+x).data(B?[]:[0]);if(H.enter().append("g").classed("hm",!0).classed(x,!0),H.exit().remove(),!B){var V,Z;"fast"===P?(V=D,Z=N):(V=F,Z=q);var U=document.createElement("canvas");U.width=V,U.height=Z;var Y,X,G=U.getContext("2d"),$=a.scale.linear().domain(S.map(function(t){return t[0]})).range(S.map(function(t){var e=o(t[1]).toRgb();return[e.r,e.g,e.b,e.a]})).clamp(!0);"fast"===P?(Y=I?function(t){return D-1-t}:i.identity,X=R?function(t){return N-1-t}:i.identity):(Y=function(t){return i.constrain(Math.round(m.c2p(C[t])-b),0,F)},X=function(t){return i.constrain(Math.round(v.c2p(E[t])-k),0,q)});var Q,W,J,K,tt,et,nt=X(0),rt=[nt,nt],at=I?0:1,ot=R?0:1,it=0,lt=0,st=0,ct=0;if(P){var ut=0,ft=new Uint8Array(F*q*4);if("best"===P){var dt,ht,pt,gt=new Array(C.length),mt=new Array(E.length),vt=new Array(F);for(A=0;AA;A++)vt[A]=r(A,gt);for(W=0;q>W;W++)for(dt=r(W,mt),ht=T[dt.bin0],pt=T[dt.bin1],A=0;F>A;A++,ut+=4)et=h(ht,pt,vt[A],dt),d(ft,ut,et)}else for(W=0;N>W;W++)for(tt=T[W],rt=X(W),A=0;F>A;A++)et=f(tt[A],1),ut=4*(rt*F+Y(A)),d(ft,ut,et);var yt=G.createImageData(F,q);yt.data.set(ft),G.putImageData(yt,0,0)}else for(W=0;N>W;W++)if(tt=T[W],rt.reverse(),rt[ot]=X(W+1),rt[0]!==rt[1]&&void 0!==rt[0]&&void 0!==rt[1])for(J=Y(0),Q=[J,J],A=0;D>A;A++)Q.reverse(),Q[at]=Y(A+1),Q[0]!==Q[1]&&void 0!==Q[0]&&void 0!==Q[1]&&(K=tt[A],et=f(K,(Q[1]-Q[0])*(rt[1]-rt[0])),G.fillStyle="rgba("+et.join(",")+")",G.fillRect(Q[0],rt[0],Q[1]-Q[0],rt[1]-rt[0]));lt=Math.round(lt/it),st=Math.round(st/it),ct=Math.round(ct/it);var xt=o("rgb("+lt+","+st+","+ct+")");t._hmpixcount=(t._hmpixcount||0)+it,t._hmlumcount=(t._hmlumcount||0)+it*xt.getLuminance();var bt=H.selectAll("image").data(n);bt.enter().append("svg:image").attr({xmlns:c.svg,preserveAspectRatio:"none"}),bt.attr({height:q,width:F,x:b,y:k,"xlink:href":U.toDataURL("image/png")}),bt.exit().remove()}}var a=t("d3"),o=t("tinycolor2"),i=t("../../lib"),l=t("../../plots/plots"),s=t("../../components/colorscale/get_scale"),c=t("../../constants/xmlns_namespaces"),u=t("./max_row_length");e.exports=function(t,e,n){for(var a=0;a0&&(r=!0);for(var l=0;lv&&p.splice(v,p.length-v),m.length>v&&m.splice(v,m.length-v),!e.autobinx&&"xbins"in e||(e.xbins=a.autoBin(p,h,e.nbinsx,"2d"),"histogram2dcontour"===e.type&&(e.xbins.start-=e.xbins.size,e.xbins.end+=e.xbins.size),e._input.xbins=e.xbins),!e.autobiny&&"ybins"in e||(e.ybins=a.autoBin(m,g,e.nbinsy,"2d"),"histogram2dcontour"===e.type&&(e.ybins.start-=e.ybins.size,e.ybins.end+=e.ybins.size),e._input.ybins=e.ybins),f=[];var y,x,b=[],_=[],w="string"==typeof e.xbins.size?[]:e.xbins,k="string"==typeof e.xbins.size?[]:e.ybins,M=0,A=[],T=e.histnorm,L=e.histfunc,z=-1!==T.indexOf("density"),S="max"===L||"min"===L,C=S?null:0,E=o.count,O=i[T],P=!1,N=[],D=[],I="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";I&&"count"!==L&&(P="avg"===L,E=o[L]);var R=e.xbins,j=R.end+(R.start-a.tickIncrement(R.start,R.size))/1e6;for(d=R.start;j>d;d=a.tickIncrement(d,R.size))b.push(C),Array.isArray(w)&&w.push(d),P&&_.push(0);Array.isArray(w)&&w.push(d);var F=b.length;for(n=e.xbins.start,s=(d-n)/F,n+=s/2,R=e.ybins,j=R.end+(R.start-a.tickIncrement(R.start,R.size))/1e6,d=R.start;j>d;d=a.tickIncrement(d,R.size))f.push(b.concat()),Array.isArray(k)&&k.push(d),P&&A.push(_.concat());Array.isArray(k)&&k.push(d);var q=f.length;for(c=e.ybins.start,u=(d-c)/q,c+=u/2,z&&(N=b.map(function(t,e){return Array.isArray(w)?1/(w[e+1]-w[e]):1/s}),D=f.map(function(t,e){return Array.isArray(k)?1/(k[e+1]-k[e]):1/u})),d=0;v>d;d++)y=r.findBin(p[d],w),x=r.findBin(m[d],k),y>=0&&F>y&&x>=0&&q>x&&(M+=E(y,d,f[x],I,A[x]));if(P)for(x=0;q>x;x++)M+=l(f[x],A[x]);if(O)for(x=0;q>x;x++)O(f[x],M,N,D[x]);return{x:p,x0:n,dx:s,y:m,y0:c,dy:u,z:f}}},{"../../lib":103,"../../plots/cartesian/axes":124,"../histogram/average":218,"../histogram/bin_functions":220,"../histogram/norm_functions":224}],211:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./sample_defaults"),o=t("../../components/colorscale/defaults"),i=t("./attributes");e.exports=function(t,e,n){function l(n,a){return r.coerce(t,e,i,n,a)}a(t,e,l),l("zsmooth"),o(t,e,n,l,{prefix:"",cLetter:"z"})}},{"../../components/colorscale/defaults":35,"../../lib":103,"./attributes":209,"./sample_defaults":213}],212:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.calc=t("../heatmap/calc"),r.plot=t("../heatmap/plot"),r.colorbar=t("../heatmap/colorbar"),r.style=t("../heatmap/style"),r.hoverPoints=t("../heatmap/hover"),r.moduleType="trace",r.name="histogram2d",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","2dMap","histogram"],r.meta={},e.exports=r},{"../../plots/cartesian":132,"../heatmap/calc":198,"../heatmap/colorbar":199,"../heatmap/hover":203,"../heatmap/plot":206,"../heatmap/style":207,"./attributes":209,"./defaults":211}],213:[function(t,e,n){"use strict";var r=t("../histogram/bin_defaults");e.exports=function(t,e,n){var a=n("x"),o=n("y");if(!(a&&a.length&&o&&o.length))return void(e.visible=!1);var i=n("z")||n("marker.color");i&&n("histfunc");var l=["x","y"];r(t,e,n,l)}},{"../histogram/bin_defaults":219}],214:[function(t,e,n){"use strict";var r=t("../histogram2d/attributes"),a=t("../contour/attributes"),o=t("../../components/colorscale/attributes"),i=t("../../lib/extend").extendFlat;e.exports=i({},{x:r.x,y:r.y,z:r.z,marker:r.marker,histnorm:r.histnorm,histfunc:r.histfunc,autobinx:r.autobinx,nbinsx:r.nbinsx,xbins:r.xbins,autobiny:r.autobiny,nbinsy:r.nbinsy,ybins:r.ybins,autocontour:a.autocontour,ncontours:a.ncontours,contours:a.contours,line:a.line,_nestedModules:{colorbar:"Colorbar"}},o)},{"../../components/colorscale/attributes":31,"../../lib/extend":101,"../contour/attributes":187,"../histogram2d/attributes":209}],215:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../histogram2d/sample_defaults"),o=t("../contour/style_defaults"),i=t("./attributes");e.exports=function(t,e,n,l){function s(n,a){return r.coerce(t,e,i,n,a)}a(t,e,s);var c=r.coerce2(t,e,i,"contours.start"),u=r.coerce2(t,e,i,"contours.end"),f=s("autocontour",!(c&&u));s(f?"ncontours":"contours.size"),o(t,e,s,l)}},{"../../lib":103,"../contour/style_defaults":196,"../histogram2d/sample_defaults":213,"./attributes":214}],216:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.calc=t("../contour/calc"),r.plot=t("../contour/plot"),r.style=t("../contour/style"),r.colorbar=t("../contour/colorbar"),r.hoverPoints=t("../contour/hover"),r.moduleType="trace",r.name="histogram2dcontour",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","2dMap","contour","histogram"],r.meta={},e.exports=r},{"../../plots/cartesian":132,"../contour/calc":188,"../contour/colorbar":189,"../contour/hover":191,"../contour/plot":194,"../contour/style":195,"./attributes":214,"./defaults":215}],217:[function(t,e,n){"use strict";function r(t){return{start:{valType:"number",dflt:null},end:{valType:"number",dflt:null},size:{valType:"any",dflt:1}}}var a=t("../bar/attributes");e.exports={x:{valType:"data_array"},y:{valType:"data_array"},text:a.text,orientation:a.orientation,histfunc:{valType:"enumerated",values:["count","sum","avg","min","max"],dflt:"count"},histnorm:{valType:"enumerated",values:["","percent","probability","density","probability density"],dflt:""},autobinx:{valType:"boolean",dflt:!0},nbinsx:{valType:"integer",min:0,dflt:0},xbins:r("x"),autobiny:{valType:"boolean",dflt:!0},nbinsy:{valType:"integer",min:0,dflt:0},ybins:r("y"),marker:a.marker,_nestedModules:{error_y:"ErrorBars",error_x:"ErrorBars","marker.colorbar":"Colorbar"},_deprecated:{bardir:a._deprecated.bardir}}},{"../bar/attributes":166}],218:[function(t,e,n){"use strict";e.exports=function(t,e){for(var n=t.length,r=0,a=0;n>a;a++)e[a]?(t[a]/=e[a],r+=t[a]):t[a]=null;return r}},{}],219:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){return n("histnorm"),r.forEach(function(t){var e=n(t+"bins.start"),r=n(t+"bins.end"),a=n("autobin"+t,!(e&&r));n(a?"nbins"+t:t+"bins.size")}),e}},{}],220:[function(t,e,n){"use strict";var r=t("fast-isnumeric");e.exports={count:function(t,e,n){return n[t]++,1},sum:function(t,e,n,a){var o=a[e];return r(o)?(o=Number(o),n[t]+=o,o):0},avg:function(t,e,n,a,o){var i=a[e];return r(i)&&(i=Number(i),n[t]+=i,o[t]++),0},min:function(t,e,n,a){var o=a[e];if(r(o)){if(o=Number(o),!r(n[t]))return n[t]=o,o;if(n[t]>o)return n[t]=o,o-n[t]}return 0},max:function(t,e,n,a){var o=a[e];if(r(o)){if(o=Number(o),!r(n[t]))return n[t]=o,o;if(n[t]n&&c.length<5e3;)g=o.tickIncrement(n,x.size),c.push((n+g)/2),u.push(S),b&&_.push(n),L&&w.push(1/(g-n)),O&&k.push(0),n=g;var P=u.length;for(n=0;n=0&&P>v&&(M+=C(v,n,u,y,k));O&&(M=s(u,k)),E&&E(u,M,w);var N=Math.min(c.length,u.length),D=[],I=0,R=N-1;for(n=0;N>n;n++)if(u[n]){I=n;break}for(n=N-1;n>I;n--)if(u[n]){R=n;break}for(n=I;R>=n;n++)r(c[n])&&r(u[n])&&D.push({p:c[n],s:u[n],b:0});return D}}},{"../../lib":103,"../../plots/cartesian/axes":124,"./average":218,"./bin_functions":220,"./norm_functions":224,"fast-isnumeric":17}],222:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../components/color"),o=t("./bin_defaults"),i=t("../bar/style_defaults"),l=t("../../components/errorbars/defaults"),s=t("./attributes");e.exports=function(t,e,n,c){function u(n,a){return r.coerce(t,e,s,n,a)}var f=u("x"),d=u("y");u("text");var h=u("orientation",d&&!f?"h":"v"),p=e["v"===h?"x":"y"];if(!p||!p.length)return void(e.visible=!1);var g=e["h"===h?"x":"y"];g&&u("histfunc");var m="h"===h?["y"]:["x"];o(t,e,u,m),i(t,e,u,n,c),l(t,e,a.defaultLine,{axis:"y"}),l(t,e,a.defaultLine,{axis:"x",inherit:"y"})}},{"../../components/color":25,"../../components/errorbars/defaults":53,"../../lib":103,"../bar/style_defaults":176,"./attributes":217,"./bin_defaults":219}],223:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.layoutAttributes=t("../bar/layout_attributes"),r.supplyDefaults=t("./defaults"),r.supplyLayoutDefaults=t("../bar/layout_defaults"),r.calc=t("./calc"),r.setPositions=t("../bar/set_positions"),r.plot=t("../bar/plot"),r.style=t("../bar/style"),r.colorbar=t("../scatter/colorbar"),r.hoverPoints=t("../bar/hover"),r.moduleType="trace",r.name="histogram",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","bar","histogram","oriented","errorBarsOK","showLegend"],r.meta={},e.exports=r},{"../../plots/cartesian":132,"../bar/hover":169,"../bar/layout_attributes":171,"../bar/layout_defaults":172,"../bar/plot":173,"../bar/set_positions":174,"../bar/style":175,"../scatter/colorbar":240,"./attributes":217,"./calc":221,"./defaults":222}],224:[function(t,e,n){"use strict";e.exports={percent:function(t,e){for(var n=t.length,r=100/e,a=0;n>a;a++)t[a]*=r},probability:function(t,e){for(var n=t.length,r=0;n>r;r++)t[r]/=e},density:function(t,e,n,r){var a=t.length;r=r||1;for(var o=0;a>o;o++)t[o]*=n[o]*r},"probability density":function(t,e,n,r){var a=t.length;r&&(e/=r);for(var o=0;a>o;o++)t[o]*=n[o]/e}}},{}],225:[function(t,e,n){"use strict";var r=t("../../components/color/attributes"),a=t("../../plots/font_attributes"),o=t("../../plots/attributes"),i=t("../../lib/extend").extendFlat;e.exports={labels:{valType:"data_array"},label0:{valType:"number",dflt:0},dlabel:{valType:"number",dflt:1},values:{valType:"data_array"},marker:{colors:{valType:"data_array"},line:{color:{valType:"color",dflt:r.defaultLine,arrayOk:!0},width:{valType:"number",min:0,dflt:0,arrayOk:!0}}},text:{valType:"data_array"},scalegroup:{valType:"string",dflt:""},textinfo:{valType:"flaglist",flags:["label","text","value","percent"],extras:["none"]},hoverinfo:i({},o.hoverinfo,{flags:["label","text","value","percent","name"]}),textposition:{valType:"enumerated",values:["inside","outside","auto","none"],dflt:"auto",arrayOk:!0},textfont:i({},a,{}),insidetextfont:i({},a,{}),outsidetextfont:i({},a,{}),domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},hole:{valType:"number",min:0,max:1,dflt:0},sort:{valType:"boolean",dflt:!0},direction:{valType:"enumerated",values:["clockwise","counterclockwise"],dflt:"counterclockwise"},rotation:{valType:"number",min:-360,max:360,dflt:0},pull:{valType:"number",min:0,max:1,dflt:0,arrayOk:!0}}},{"../../components/color/attributes":24,"../../lib/extend":101,"../../plots/attributes":122,"../../plots/font_attributes":142}],226:[function(t,e,n){"use strict";function r(t,e){for(var n=[],r=0;rs||(c=p[n],void 0!==c&&""!==c||(c=n),c=String(c),void 0===y[c]&&(y[c]=!0,u=o(e.marker.colors[n]),u.isValid()?(u=i.addOpacity(u,u.getAlpha()),v[c]||(v[c]=u)):v[c]?u=v[c]:(u=!1,x=!0),f=-1!==_.indexOf(c),f||(b+=s),g.push({v:s,label:c,color:u,i:n,hidden:f}))));if(e.sort&&g.sort(function(t,e){return e.v-t.v}),x)for(n=0;n")}return g};var s},{"../../components/color":25,"./helpers":229,"fast-isnumeric":17,tinycolor2:20}],228:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes");e.exports=function(t,e,n,o){function i(n,o){return r.coerce(t,e,a,n,o)}var l=r.coerceFont,s=i("values");if(!Array.isArray(s)||!s.length)return void(e.visible=!1);var c=i("labels");Array.isArray(c)||(i("label0"),i("dlabel"));var u=i("marker.line.width");u&&i("marker.line.color");var f=i("marker.colors");Array.isArray(f)||(e.marker.colors=[]),i("scalegroup");var d=i("text"),h=i("textinfo",Array.isArray(d)?"text+percent":"percent");if(i("hoverinfo",1===o._dataLength?"label+text+value+percent":void 0),h&&"none"!==h){var p=i("textposition"),g=Array.isArray(p)||"auto"===p,m=g||"inside"===p,v=g||"outside"===p;if(m||v){var y=l(i,"textfont",o.font);m&&l(i,"insidetextfont",y),v&&l(i,"outsidetextfont",y)}}i("domain.x"),i("domain.y"),i("hole"),i("sort"),i("direction"),i("rotation"),i("pull")}},{"../../lib":103,"./attributes":225}],229:[function(t,e,n){"use strict";var r=t("../../lib");n.formatPiePercent=function(t,e){var n=(100*t).toPrecision(3);return-1!==n.lastIndexOf(".")&&(n=n.replace(/[.]?0+$/,"")),r.numSeparate(n,e)+"%"},n.formatPieValue=function(t,e){var n=t.toPrecision(10);return-1!==n.lastIndexOf(".")&&(n=n.replace(/[.]?0+$/,"")),r.numSeparate(n,e)}},{"../../lib":103}],230:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.supplyLayoutDefaults=t("./layout_defaults"),r.layoutAttributes=t("./layout_attributes"),r.calc=t("./calc"),r.plot=t("./plot"),r.style=t("./style"),r.styleOne=t("./style_one"),r.moduleType="trace",r.name="pie",r.basePlotModule=t("./base_plot"),r.categories=["pie","showLegend"],r.meta={},e.exports=r},{"./attributes":225,"./base_plot":226,"./calc":227,"./defaults":228,"./layout_attributes":231,"./layout_defaults":232,"./plot":233,"./style":234,"./style_one":235}],231:[function(t,e,n){"use strict";e.exports={hiddenlabels:{valType:"data_array"}}},{}],232:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e){function n(n,o){return r.coerce(t,e,a,n,o)}n("hiddenlabels")}},{"../../lib":103,"./layout_attributes":231}],233:[function(t,e,n){"use strict";function r(t,e,n){var r=Math.sqrt(t.width*t.width+t.height*t.height),o=t.width/t.height,i=Math.PI*Math.min(e.v/n.vTotal,.5),l=1-n.trace.hole,s=a(e,n),c={scale:s*n.r*2/r,rCenter:1-s,rotate:0};if(c.scale>=1)return c;var u=o+1/(2*Math.tan(i)),f=n.r*Math.min(1/(Math.sqrt(u*u+.5)+u),l/(Math.sqrt(o*o+l/2)+o)),d={scale:2*f/t.height,rCenter:Math.cos(f/n.r)-f*o/n.r,rotate:(180/Math.PI*e.midangle+720)%180-90},h=1/o,p=h+1/(2*Math.tan(i)),g=n.r*Math.min(1/(Math.sqrt(p*p+.5)+p),l/(Math.sqrt(h*h+l/2)+h)),m={scale:2*g/t.width,rCenter:Math.cos(g/n.r)-g/o/n.r,rotate:(180/Math.PI*e.midangle+810)%180-90},v=m.scale>d.scale?m:d;return c.scale<1&&v.scale>c.scale?v:c}function a(t,e){if(t.v===e.vTotal&&!e.trace.hole)return 1;var n=Math.PI*Math.min(t.v/e.vTotal,.5);return Math.min(1/(1+1/Math.sin(n)),(1-e.trace.hole)/2)}function o(t,e){var n=e.pxmid[0],r=e.pxmid[1],a=t.width/2,o=t.height/2;return 0>n&&(a*=-1),0>r&&(o*=-1),{scale:1,rCenter:1,rotate:0,x:a+Math.abs(o)*(a>0?1:-1)/2,y:o/(1+n*n/(r*r)),outside:!0}}function i(t,e){function n(t,e){return t.pxmid[1]-e.pxmid[1]}function r(t,e){return e.pxmid[1]-t.pxmid[1]}function a(t,n){n||(n={});var r,a,o,l,d,h,g=n.labelExtraY+(i?n.yLabelMax:n.yLabelMin),m=i?t.yLabelMin:t.yLabelMax,v=i?t.yLabelMax:t.yLabelMin,y=t.cyFinal+c(t.px0[1],t.px1[1]),x=g-m;if(x*f>0&&(t.labelExtraY=x),Array.isArray(e.pull))for(a=0;a=e.pull[o.i]||((t.pxmid[1]-o.pxmid[1])*f>0?(l=o.cyFinal+c(o.px0[1],o.px1[1]),x=l-m-t.labelExtraY,x*f>0&&(t.labelExtraY+=x)):(v+t.labelExtraY-y)*f>0&&(r=3*u*Math.abs(a-p.indexOf(t)),d=o.cxFinal+s(o.px0[0],o.px1[0]),h=d+r-(t.cxFinal+t.pxmid[0])-t.labelExtraX,h*u>0&&(t.labelExtraX+=h)))}var o,i,l,s,c,u,f,d,h,p,g,m,v;for(i=0;2>i;i++)for(l=i?n:r,c=i?Math.max:Math.min,f=i?1:-1,o=0;2>o;o++){for(s=o?Math.max:Math.min,u=o?1:-1,d=t[i][o],d.sort(l),h=t[1-i][o],p=h.concat(d),m=[],g=0;gu&&(u=l.pull[o]);i.r=Math.min(n/c(l.tilt,Math.sin(s),l.depth),r/c(l.tilt,Math.cos(s),l.depth))/(2+2*u),i.cx=e.l+e.w*(l.domain.x[1]+l.domain.x[0])/2,i.cy=e.t+e.h*(2-l.domain.y[1]-l.domain.y[0])/2,l.scalegroup&&-1===h.indexOf(l.scalegroup)&&h.push(l.scalegroup)}for(o=0;of.vTotal/2?1:0)}function c(t,e,n){if(!t)return 1;var r=Math.sin(t*Math.PI/180);return Math.max(.01,n*r*Math.abs(e)+2*Math.sqrt(1-r*r*e*e))}var u=t("d3"),f=t("../../plots/cartesian/graph_interact"),d=t("../../components/color"),h=t("../../components/drawing"),p=t("../../lib/svg_text_utils"),g=t("./helpers");e.exports=function(t,e){var n=t._fullLayout;l(e,n._size);var c=n._pielayer.selectAll("g.trace").data(e);c.enter().append("g").attr({"stroke-linejoin":"round","class":"trace"}),c.exit().remove(),c.order(),c.each(function(e){var l=u.select(this),c=e[0],m=c.trace,v=0,y=(m.depth||0)*c.r*Math.sin(v)/2,x=m.tiltaxis||0,b=x*Math.PI/180,_=[y*Math.sin(b),y*Math.cos(b)],w=c.r*Math.cos(v),k=l.selectAll("g.part").data(m.tilt?["top","sides"]:["top"]);k.enter().append("g").attr("class",function(t){return t+" part"}),k.exit().remove(),k.order(),s(e),l.selectAll(".top").each(function(){var l=u.select(this).selectAll("g.slice").data(e);l.enter().append("g").classed("slice",!0),l.exit().remove();var s=[[[],[]],[[],[]]],v=!1;l.each(function(i){function l(e){var r=t._fullLayout,o=t._fullData[m.index],l=o.hoverinfo;if("all"===l&&(l="label+text+value+percent+name"),!t._dragging&&r.hovermode!==!1&&"none"!==l&&l){var s=a(i,c),u=k+i.pxmid[0]*(1-s),d=M+i.pxmid[1]*(1-s),h=n.separators,p=[];-1!==l.indexOf("label")&&p.push(i.label),o.text&&o.text[i.i]&&-1!==l.indexOf("text")&&p.push(o.text[i.i]),-1!==l.indexOf("value")&&p.push(g.formatPieValue(i.v,h)),-1!==l.indexOf("percent")&&p.push(g.formatPiePercent(i.v/c.vTotal,h)),f.loneHover({x0:u-s*c.r,x1:u+s*c.r,y:d,text:p.join("
"),name:-1!==l.indexOf("name")?o.name:void 0,color:i.color,idealAlign:i.pxmid[0]<0?"left":"right"},{container:r._hoverlayer.node(),outerContainer:r._paper.node()}),f.hover(t,e,"pie"),L=!0}}function d(e){t.emit("plotly_unhover",{points:[e]}),L&&(f.loneUnhover(n._hoverlayer.node()),L=!1)}function y(){t._hoverdata=[i],t._hoverdata.trace=e.trace,f.click(t,{target:!0})}function b(t,e,n,r){return"a"+r*c.r+","+r*w+" "+x+" "+i.largeArc+(n?" 1 ":" 0 ")+r*(e[0]-t[0])+","+r*(e[1]-t[1])}if(i.hidden)return void u.select(this).selectAll("path,g").remove();s[i.pxmid[1]<0?0:1][i.pxmid[0]<0?0:1].push(i);var k=c.cx+_[0],M=c.cy+_[1],A=u.select(this),T=A.selectAll("path.surface").data([i]),L=!1;if(T.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),A.select("path.textline").remove(),A.on("mouseover",l).on("mouseout",d).on("click",y).on("contextmenu",y),m.pull){var z=+(Array.isArray(m.pull)?m.pull[i.i]:m.pull)||0;z>0&&(k+=z*i.pxmid[0],M+=z*i.pxmid[1])}i.cxFinal=k,i.cyFinal=M;var S=m.hole;if(i.v===c.vTotal){var C="M"+(k+i.px0[0])+","+(M+i.px0[1])+b(i.px0,i.pxmid,!0,1)+b(i.pxmid,i.px0,!0,1)+"Z";S?T.attr("d","M"+(k+S*i.px0[0])+","+(M+S*i.px0[1])+b(i.px0,i.pxmid,!1,S)+b(i.pxmid,i.px0,!1,S)+"Z"+C):T.attr("d",C)}else{var E=b(i.px0,i.px1,!0,1);if(S){var O=1-S;T.attr("d","M"+(k+S*i.px1[0])+","+(M+S*i.px1[1])+b(i.px1,i.px0,!1,S)+"l"+O*i.px0[0]+","+O*i.px0[1]+E+"Z")}else T.attr("d","M"+k+","+M+"l"+i.px0[0]+","+i.px0[1]+E+"Z")}var P=Array.isArray(m.textposition)?m.textposition[i.i]:m.textposition,N=A.selectAll("g.slicetext").data(i.text&&"none"!==P?[0]:[]);N.enter().append("g").classed("slicetext",!0),N.exit().remove(),N.each(function(){var t=u.select(this).selectAll("text").data([0]);t.enter().append("text").attr("data-notex",1),t.exit().remove(),t.text(i.text).attr({"class":"slicetext",transform:"","data-bb":"","text-anchor":"middle",x:0,y:0}).call(h.font,"outside"===P?m.outsidetextfont:m.insidetextfont).call(p.convertToTspans),t.selectAll("tspan.line").attr({x:0,y:0});var e,n=h.bBox(t.node());"outside"===P?e=o(n,i):(e=r(n,i,c),"auto"===P&&e.scale<1&&(t.call(h.font,m.outsidetextfont),m.outsidetextfont.family===m.insidetextfont.family&&m.outsidetextfont.size===m.insidetextfont.size||(t.attr({"data-bb":""}),n=h.bBox(t.node())),e=o(n,i)));var a=k+i.pxmid[0]*e.rCenter+(e.x||0),l=M+i.pxmid[1]*e.rCenter+(e.y||0);e.outside&&(i.yLabelMin=l-n.height/2,i.yLabelMid=l, -i.yLabelMax=l+n.height/2,i.labelExtraX=0,i.labelExtraY=0,v=!0),t.attr("transform","translate("+a+","+l+")"+(e.scale<1?"scale("+e.scale+")":"")+(e.rotate?"rotate("+e.rotate+")":"")+"translate("+-(n.left+n.right)/2+","+-(n.top+n.bottom)/2+")")})}),v&&i(s,m),l.each(function(t){if(t.labelExtraX||t.labelExtraY){var e=u.select(this),n=e.select("g.slicetext text");n.attr("transform","translate("+t.labelExtraX+","+t.labelExtraY+")"+n.attr("transform"));var r=t.cxFinal+t.pxmid[0],a=t.cyFinal+t.pxmid[1],o="M"+r+","+a,i=(t.yLabelMax-t.yLabelMin)*(t.pxmid[0]<0?-1:1)/4;if(t.labelExtraX){var l=t.labelExtraX*t.pxmid[1]/t.pxmid[0],s=t.yLabelMid+t.labelExtraY-(t.cyFinal+t.pxmid[1]);o+=Math.abs(l)>Math.abs(s)?"l"+s*t.pxmid[0]/t.pxmid[1]+","+s+"H"+(r+t.labelExtraX+i):"l"+t.labelExtraX+","+l+"v"+(s-l)+"h"+i}else o+="V"+(t.yLabelMid+t.labelExtraY)+"h"+i;e.append("path").classed("textline",!0).call(d.stroke,m.outsidetextfont.color).attr({"stroke-width":Math.min(2,m.outsidetextfont.size/8),d:o,fill:"none"})}})})}),setTimeout(function(){c.selectAll("tspan").each(function(){var t=u.select(this);t.attr("dy")&&t.attr("dy",t.attr("dy"))})},0)}},{"../../components/color":25,"../../components/drawing":48,"../../lib/svg_text_utils":114,"../../plots/cartesian/graph_interact":131,"./helpers":229,d3:14}],234:[function(t,e,n){"use strict";var r=t("d3"),a=t("./style_one");e.exports=function(t){t._fullLayout._pielayer.selectAll(".trace").each(function(t){var e=t[0],n=e.trace,o=r.select(this);o.style({opacity:n.opacity}),o.selectAll(".top path.surface").each(function(t){r.select(this).call(a,t,n)})})}},{"./style_one":235,d3:14}],235:[function(t,e,n){"use strict";var r=t("../../components/color");e.exports=function(t,e,n){var a=n.marker.line.color;Array.isArray(a)&&(a=a[e.i]||r.defaultLine);var o=n.marker.line.width||0;Array.isArray(o)&&(o=o[e.i]||0),t.style({"stroke-width":o,fill:e.color}).call(r.stroke,a)}},{"../../components/color":25}],236:[function(t,e,n){"use strict";var r=t("../../lib");e.exports=function(t){var e=t[0].trace,n=e.marker;if(r.mergeArray(e.text,t,"tx"),r.mergeArray(e.textposition,t,"tp"),e.textfont&&(r.mergeArray(e.textfont.size,t,"ts"),r.mergeArray(e.textfont.color,t,"tc"),r.mergeArray(e.textfont.family,t,"tf")),n&&n.line){var a=n.line;r.mergeArray(n.opacity,t,"mo"),r.mergeArray(n.symbol,t,"mx"),r.mergeArray(n.color,t,"mc"),r.mergeArray(a.color,t,"mlc"),r.mergeArray(a.width,t,"mlw")}}},{"../../lib":103}],237:[function(t,e,n){"use strict";var r=t("../../components/colorscale/color_attributes"),a=t("../../components/drawing"),o=(t("./constants"),t("../../lib/extend").extendFlat);e.exports={x:{valType:"data_array"},x0:{valType:"any",dflt:0},dx:{valType:"number",dflt:1},y:{valType:"data_array"},y0:{valType:"any",dflt:0},dy:{valType:"number",dflt:1},text:{valType:"string",dflt:"",arrayOk:!0},mode:{valType:"flaglist",flags:["lines","markers","text"],extras:["none"]},hoveron:{valType:"flaglist",flags:["points","fills"]},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2},shape:{valType:"enumerated",values:["linear","spline","hv","vh","hvh","vhv"],dflt:"linear"},smoothing:{valType:"number",min:0,max:1.3,dflt:1},dash:{valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"}},connectgaps:{valType:"boolean",dflt:!1},fill:{valType:"enumerated",values:["none","tozeroy","tozerox","tonexty","tonextx","toself","tonext"],dflt:"none"},fillcolor:{valType:"color"},marker:o({},{symbol:{valType:"enumerated",values:a.symbolList,dflt:"circle",arrayOk:!0},opacity:{valType:"number",min:0,max:1,arrayOk:!0},size:{valType:"number",min:0,dflt:6,arrayOk:!0},maxdisplayed:{valType:"number",min:0,dflt:0},sizeref:{valType:"number",dflt:1},sizemin:{valType:"number",min:0,dflt:0},sizemode:{valType:"enumerated",values:["diameter","area"],dflt:"diameter"},showscale:{valType:"boolean",dflt:!1},line:o({},{width:{valType:"number",min:0,arrayOk:!0}},r("marker.line"))},r("marker")),textposition:{valType:"enumerated",values:["top left","top center","top right","middle left","middle center","middle right","bottom left","bottom center","bottom right"],dflt:"middle center",arrayOk:!0},textfont:{family:{valType:"string",noBlank:!0,strict:!0,arrayOk:!0},size:{valType:"number",min:1,arrayOk:!0},color:{valType:"color",arrayOk:!0}},r:{valType:"data_array"},t:{valType:"data_array"},_nestedModules:{error_y:"ErrorBars",error_x:"ErrorBars","marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":33,"../../components/drawing":48,"../../lib/extend":101,"./constants":242}],238:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../plots/cartesian/axes"),o=t("../../lib"),i=t("./subtypes"),l=t("./colorscale_calc");e.exports=function(t,e){var n,s,c,u=a.getFromId(t,e.xaxis||"x"),f=a.getFromId(t,e.yaxis||"y"),d=u.makeCalcdata(e,"x"),h=f.makeCalcdata(e,"y"),p=Math.min(d.length,h.length);u._minDtick=0,f._minDtick=0,d.length>p&&d.splice(p,d.length-p),h.length>p&&h.splice(p,h.length-p);var g={padded:!0},m={padded:!0};if(i.hasMarkers(e)){if(n=e.marker,s=n.size,Array.isArray(s)){var v={type:"linear"};a.setConvert(v),s=v.makeCalcdata(e.marker,"size"),s.length>p&&s.splice(p,s.length-p)}var y,x=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/x),3)}:function(t){return Math.max((t||0)/x,3)},g.ppad=m.ppad=Array.isArray(s)?s.map(y):y(s)}l(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?e.error_y.visible||-1===["tonexty","tozeroy"].indexOf(e.fill)&&(i.hasMarkers(e)||i.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?-1!==["tonextx","tozerox"].indexOf(e.fill)&&(m.padded=!1):m.tozero=!0,a.expand(u,d,g),a.expand(f,h,m);var b=new Array(p);for(c=0;p>c;c++)b[c]=r(d[c])&&r(h[c])?{x:d[c],y:h[c]}:{x:!1,y:!1};return void 0!==typeof s&&o.mergeArray(s,b,"ms"),t.firstscatter=!1,b}},{"../../lib":103,"../../plots/cartesian/axes":124,"./colorscale_calc":241,"./subtypes":256,"fast-isnumeric":17}],239:[function(t,e,n){"use strict";e.exports=function(t){var e,n,r,a,o;for(e=0;e=0;a--)if(o=t[a],"scatter"===o.type&&o.xaxis===n.xaxis&&o.yaxis===n.yaxis){o.opacity=void 0;break}}},{}],240:[function(t,e,n){"use strict";var r=t("d3"),a=t("fast-isnumeric"),o=t("../../lib"),i=t("../../plots/plots"),l=t("../../components/colorscale/get_scale"),s=t("../../components/colorbar/draw");e.exports=function(t,e){var n=e[0].trace,c=n.marker,u="cb"+n.uid;if(t._fullLayout._infolayer.selectAll("."+u).remove(),void 0===c||!c.showscale)return void i.autoMargin(t,u);var f=l(c.colorscale),d=c.color,h=c.cmin,p=c.cmax;a(h)||(h=o.aggNums(Math.min,null,d)),a(p)||(p=o.aggNums(Math.max,null,d));var g=e[0].t.cb=s(t,u);g.fillcolor(r.scale.linear().domain(f.map(function(t){return h+t[0]*(p-h)})).range(f.map(function(t){return t[1]}))).filllevels({start:h,end:p,size:(p-h)/254}).options(c.colorbar)()}},{"../../components/colorbar/draw":28,"../../components/colorscale/get_scale":37,"../../lib":103,"../../plots/plots":144,d3:14,"fast-isnumeric":17}],241:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/calc"),o=t("./subtypes");e.exports=function(t){o.hasLines(t)&&r(t,"line")&&a(t,t.line.color,"line","c"),o.hasMarkers(t)&&(r(t,"marker")&&a(t,t.marker.color,"marker","c"),r(t,"marker.line")&&a(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":32,"../../components/colorscale/has_colorscale":38,"./subtypes":256}],242:[function(t,e,n){"use strict";e.exports={PTS_LINESONLY:20}},{}],243:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes"),o=t("./constants"),i=t("./subtypes"),l=t("./xy_defaults"),s=t("./marker_defaults"),c=t("./line_defaults"),u=t("./line_shape_defaults"),f=t("./text_defaults"),d=t("./fillcolor_defaults"),h=t("../../components/errorbars/defaults");e.exports=function(t,e,n,p){function g(n,o){return r.coerce(t,e,a,n,o)}var m=l(t,e,g),v=mB!=P>=B&&(C=z[T-1][0],E=z[T][0],S=C+(E-C)*(B-O)/(P-O),R=Math.min(R,S),j=Math.max(j,S));R=Math.max(R,0),j=Math.min(j,d._length);var H=s.defaultLine;return s.opacity(f.fillcolor)?H=f.fillcolor:s.opacity((f.line||{}).color)&&(H=f.line.color),r.extendFlat(t,{distance:o.MAXDIST+10,x0:R,x1:j,y0:B,y1:B,color:H}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":25,"../../components/errorbars":54,"../../lib":103,"../../plots/cartesian/constants":129,"../../plots/cartesian/graph_interact":131,"./get_trace_color":245}],247:[function(t,e,n){"use strict";var r={},a=t("./subtypes");r.hasLines=a.hasLines,r.hasMarkers=a.hasMarkers,r.hasText=a.hasText,r.isBubble=a.isBubble,r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.cleanData=t("./clean_data"),r.calc=t("./calc"),r.arraysToCalcdata=t("./arrays_to_calcdata"),r.plot=t("./plot"),r.colorbar=t("./colorbar"),r.style=t("./style"),r.hoverPoints=t("./hover"),r.selectPoints=t("./select"),r.moduleType="trace",r.name="scatter",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],r.meta={},e.exports=r},{"../../plots/cartesian":132,"./arrays_to_calcdata":236,"./attributes":237,"./calc":238,"./clean_data":239,"./colorbar":240,"./defaults":243,"./hover":246,"./plot":253,"./select":254,"./style":255,"./subtypes":256}],248:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults");e.exports=function(t,e,n,o,i){var l=(t.marker||{}).color;if(i("line.color",n),r(t,"line"))a(t,e,o,i,{prefix:"line.",cLetter:"c"});else{var s=(Array.isArray(l)?!1:l)||n;i("line.color",s)}i("line.width"),i("line.dash")}},{"../../components/colorscale/defaults":35,"../../components/colorscale/has_colorscale":38}],249:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/axes");e.exports=function(t,e){function n(e){var n=w.c2p(t[e].x),r=k.c2p(t[e].y);return n===z||r===z?!1:[n,r]}function a(t){var e=t[0]/w._length,n=t[1]/k._length;return(1+10*Math.max(0,-e,e-1,-n,n-1))*A}function o(t,e){var n=t[0]-e[0],r=t[1]-e[1];return Math.sqrt(n*n+r*r)}var i,l,s,c,u,f,d,h,p,g,m,v,y,x,b,_,w=e.xaxis,k=e.yaxis,M=e.connectGaps,A=e.baseTolerance,T=e.linear,L=[],z=r.BADNUM,S=.2,C=new Array(t.length),E=0;for(i=0;ia(f))break;s=f,y=g[0]*p[0]+g[1]*p[1],y>m?(m=y,c=f,h=!1):v>y&&(v=y,u=f,h=!0)}if(h?(C[E++]=c,s!==u&&(C[E++]=u)):(u!==l&&(C[E++]=u),s!==c&&(C[E++]=c)),C[E++]=s,i>=t.length||!f)break;C[E++]=f,l=f}}else C[E++]=c}L.push(C.slice(0,E))}return L}},{"../../plots/cartesian/axes":124}],250:[function(t,e,n){"use strict";e.exports=function(t,e,n){var r=n("line.shape");"spline"===r&&n("line.smoothing")}},{}],251:[function(t,e,n){"use strict";var r=t("fast-isnumeric");e.exports=function(t){var e=t.marker,n=e.sizeref||1,a=e.sizemin||0,o="area"===e.sizemode?function(t){return Math.sqrt(t/n)}:function(t){return t/n};return function(t){var e=o(t/2);return r(e)&&e>0?Math.max(e,a):0}}},{"fast-isnumeric":17}],252:[function(t,e,n){"use strict";var r=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults"),i=t("./subtypes");e.exports=function(t,e,n,l,s){var c,u=i.isBubble(t),f=(t.line||{}).color;f&&(n=f),s("marker.symbol"),s("marker.opacity",u?.7:1),s("marker.size"),s("marker.color",n),a(t,"marker")&&o(t,e,l,s,{prefix:"marker.",cLetter:"c"}),c=f&&!Array.isArray(f)&&e.marker.color!==f?f:u?r.background:r.defaultLine,s("marker.line.color",c),a(t,"marker.line")&&o(t,e,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",u?1:0),u&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode"))}},{"../../components/color":25,"../../components/colorscale/defaults":35,"../../components/colorscale/has_colorscale":38,"./subtypes":256}],253:[function(t,e,n){"use strict";function r(t,e,n){var r=e.x(),o=e.y(),i=a.extent(r.range.map(r.l2c)),l=a.extent(o.range.map(o.l2c));n.forEach(function(t,e){var r=t[0].trace;if(c.hasMarkers(r)){var a=r.marker.maxdisplayed;if(0!==a){var o=t.filter(function(t){return t.x>=i[0]&&t.x<=i[1]&&t.y>=l[0]&&t.y<=l[1]}),s=Math.ceil(o.length/a),u=0;n.forEach(function(t,n){var r=t[0].trace;c.hasMarkers(r)&&r.marker.maxdisplayed>0&&e>n&&u++});var f=Math.round(u*s/3+Math.floor(u/3)*s/7.1);t.forEach(function(t){delete t.vis}),o.forEach(function(t,e){0===Math.round((e+f)%s)&&(t.vis=!0)})}}})}var a=t("d3"),o=t("../../lib"),i=t("../../components/drawing"),l=t("../../components/errorbars"),s=t("../../lib/polygon").tester,c=t("./subtypes"),u=t("./arrays_to_calcdata"),f=t("./line_points");e.exports=function(t,e,n){function d(t){return t.filter(function(t){return t.vis})}r(t,e,n);var h=e.x(),p=e.y(),g=e.plot.select(".scatterlayer").selectAll("g.trace.scatter").data(n);g.enter().append("g").attr("class","trace scatter").style("stroke-miterlimit",2),g.call(l.plot,e);var m,v,y,x,b="",_=[];g.each(function(t){var e=t[0].trace,n=e.line,r=a.select(this);if(e.visible===!0&&(v=e.fill.charAt(e.fill.length-1),"x"!==v&&"y"!==v&&(v=""),t[0].node3=r,u(t),c.hasLines(e)||"none"!==e.fill)){var o,l,d,g,w,k="",M="";m="tozero"===e.fill.substr(0,6)||"toself"===e.fill||"to"===e.fill.substr(0,2)&&!b?r.append("path").classed("js-fill",!0):null,x&&(y=x.datum(t)),x=r.append("path").classed("js-fill",!0),-1!==["hv","vh","hvh","vhv"].indexOf(n.shape)?(d=i.steps(n.shape),g=i.steps(n.shape.split("").reverse().join(""))):d=g="spline"===n.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?i.smoothclosed(t.slice(1),n.smoothing):i.smoothopen(t,n.smoothing)}:function(t){return"M"+t.join("L")},w=function(t){return g(t.reverse())};var A,T=f(t,{xaxis:h,yaxis:p,connectGaps:e.connectgaps,baseTolerance:Math.max(n.width||1,3)/4,linear:"linear"===n.shape}),L=e._polygons=new Array(T.length);for(A=0;A1&&r.append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").attr("d",o)}m?z&&C&&(v?("y"===v?z[1]=C[1]=p.c2p(0,!0):"x"===v&&(z[0]=C[0]=h.c2p(0,!0)),m.attr("d",k+"L"+C+"L"+z+"Z")):m.attr("d",k+"Z")):"tonext"===e.fill.substr(0,6)&&k&&b&&("tonext"===e.fill?y.attr("d",k+"Z"+b+"Z"):y.attr("d",k+"L"+b.substr(1)+"Z"),e._polygons=e._polygons.concat(_)),b=M,_=L}}}),g.selectAll("path:not([d])").remove(),g.append("g").attr("class","points").each(function(t){var e=t[0].trace,n=a.select(this),r=c.hasMarkers(e),l=c.hasText(e);!r&&!l||e.visible!==!0?n.remove():(r&&n.selectAll("path.point").data(e.marker.maxdisplayed?d:o.identity).enter().append("path").classed("point",!0).call(i.translatePoints,h,p),l&&n.selectAll("g").data(e.marker.maxdisplayed?d:o.identity).enter().append("g").append("text").call(i.translatePoints,h,p))})}},{"../../components/drawing":48,"../../components/errorbars":54,"../../lib":103,"../../lib/polygon":109,"./arrays_to_calcdata":236,"./line_points":249,"./subtypes":256,d3:14}],254:[function(t,e,n){"use strict";var r=t("./subtypes"),a=.2;e.exports=function(t,e){var n,o,i,l,s=t.cd,c=t.xaxis,u=t.yaxis,f=[],d=s[0].trace,h=d.index,p=d.marker,g=!r.hasMarkers(d)&&!r.hasText(d);if(d.visible===!0&&!g){var m=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(n=0;nn;n++)y=e.a[n],x=e.b[n],b=e.c[n],r(y)&&r(x)&&r(b)?(y=+y,x=+x,b=+b,_=m/(y+x+b),1!==_&&(y*=_,x*=_,b*=_),k=y,w=b-x,A[n]={x:w,y:k,a:y,b:x,c:b}):A[n]={x:!1,y:!1};var T,L;if(i.hasMarkers(e)&&(T=e.marker,L=T.size,Array.isArray(L))){var z={type:"linear"};a.setConvert(z),L=z.makeCalcdata(e.marker,"size"),L.length>M&&L.splice(M,L.length-M)}return l(e),void 0!==typeof L&&o.mergeArray(L,A,"ms"),A}},{"../../lib":103,"../../plots/cartesian/axes":124,"../scatter/colorscale_calc":241,"../scatter/subtypes":256,"fast-isnumeric":17}],261:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../scatter/constants"),o=t("../scatter/subtypes"),i=t("../scatter/marker_defaults"),l=t("../scatter/line_defaults"),s=t("../scatter/line_shape_defaults"),c=t("../scatter/text_defaults"),u=t("../scatter/fillcolor_defaults"),f=t("./attributes");e.exports=function(t,e,n,d){function h(n,a){return r.coerce(t,e,f,n,a)}var p,g=h("a"),m=h("b"),v=h("c");if(g?(p=g.length,m?(p=Math.min(p,m.length),v&&(p=Math.min(p,v.length))):p=v?Math.min(p,v.length):0):m&&v&&(p=Math.min(m.length,v.length)),!p)return void(e.visible=!1);g&&p"),l}}},{"../../plots/cartesian/axes":124,"../scatter/hover":246}],263:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.colorbar=t("../scatter/colorbar"),r.calc=t("./calc"),r.plot=t("./plot"),r.style=t("./style"),r.hoverPoints=t("./hover"),r.selectPoints=t("./select"),r.moduleType="trace",r.name="scatterternary",r.basePlotModule=t("../../plots/ternary"),r.categories=["ternary","symbols","markerColorscale","showLegend"],r.meta={},e.exports=r},{"../../plots/ternary":151,"../scatter/colorbar":240,"./attributes":259,"./calc":260,"./defaults":261,"./hover":262,"./plot":264,"./select":265,"./style":266}],264:[function(t,e,n){"use strict";var r=t("../scatter/plot");e.exports=function(t,e){var n=t.plotContainer;n.select(".scatterlayer").selectAll("*").remove();for(var a={x:function(){return t.xaxis},y:function(){return t.yaxis},plot:n},o=new Array(e.length),i=t.graphDiv.calcdata,l=0;la;a++)o[a]=e.d2c(o[a]),i[a]=n.d2c(i[a]);var f,d,h,p=r.distinctVals(o),g=p.vals,m=r.distinctVals(i),v=m.vals,y=r.init2dArray(v.length,g.length);for(u&&(h=r.init2dArray(v.length,g.length)),a=0;c>a;a++)f=r.findBin(o[a]+p.minDiff/2,g),d=r.findBin(i[a]+m.minDiff/2,v),y[d][f]=l[a],u&&(h[d][f]=s[a]);t.x=g,t.y=v,t.z=y,u&&(t.text=h)}},{"../../lib":103}],201:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./has_columns"),o=t("./xyz_defaults"),i=t("../../components/colorscale/defaults"),l=t("./attributes");e.exports=function(t,e,n,s){function c(n,a){return r.coerce(t,e,l,n,a)}var u=o(t,e,c);return u?(c("text"),c("zsmooth"),c("connectgaps",a(e)&&e.zsmooth!==!1),void i(t,e,s,c,{prefix:"",cLetter:"z"})):void(e.visible=!1)}},{"../../components/colorscale/defaults":35,"../../lib":103,"./attributes":197,"./has_columns":202,"./xyz_defaults":208}],202:[function(t,e,n){"use strict";e.exports=function(t){return!Array.isArray(t.z[0])}},{}],203:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/graph_interact"),a=t("../../lib"),o=t("../../plots/cartesian/constants").MAXDIST;e.exports=function(t,e,n,i,l){if(!(t.distanceu||u>=y[0].length||0>f||f>y.length)return}else{if(r.inbox(e-m[0],e-m[m.length-1])>o||r.inbox(n-v[0],n-v[v.length-1])>o)return;if(l){var k;for(b=[2*m[0]-m[1]],k=1;k0;)_=m.c2p(C[A]),A--;for(b>_&&(w=_,_=b,b=w,I=!0),A=0;void 0===k&&A0;)M=v.c2p(E[A]),A--;if(k>M&&(w=k,k=M,M=w,R=!0),O&&(C=n[0].xfill,E=n[0].yfill),"fast"!==P){var j="best"===P?0:.5;b=Math.max(-j*m._length,b),_=Math.min((1+j)*m._length,_),k=Math.max(-j*v._length,k),M=Math.min((1+j)*v._length,M)}var F=Math.round(_-b),q=Math.round(M-k),B=0>=F||0>=q,H=e.plot.select(".imagelayer").selectAll("g.hm."+x).data(B?[]:[0]);if(H.enter().append("g").classed("hm",!0).classed(x,!0),H.exit().remove(),!B){var V,Z;"fast"===P?(V=D,Z=N):(V=F,Z=q);var U=document.createElement("canvas");U.width=V,U.height=Z;var Y,X,G=U.getContext("2d"),$=a.scale.linear().domain(S.map(function(t){return t[0]})).range(S.map(function(t){var e=o(t[1]).toRgb();return[e.r,e.g,e.b,e.a]})).clamp(!0);"fast"===P?(Y=I?function(t){return D-1-t}:i.identity,X=R?function(t){return N-1-t}:i.identity):(Y=function(t){return i.constrain(Math.round(m.c2p(C[t])-b),0,F)},X=function(t){return i.constrain(Math.round(v.c2p(E[t])-k),0,q)});var Q,W,J,K,tt,et,nt=X(0),rt=[nt,nt],at=I?0:1,ot=R?0:1,it=0,lt=0,st=0,ct=0;if(P){var ut=0,ft=new Uint8Array(F*q*4);if("best"===P){var dt,ht,pt,gt=new Array(C.length),mt=new Array(E.length),vt=new Array(F);for(A=0;AA;A++)vt[A]=r(A,gt);for(W=0;q>W;W++)for(dt=r(W,mt),ht=T[dt.bin0],pt=T[dt.bin1],A=0;F>A;A++,ut+=4)et=h(ht,pt,vt[A],dt),d(ft,ut,et)}else for(W=0;N>W;W++)for(tt=T[W],rt=X(W),A=0;F>A;A++)et=f(tt[A],1),ut=4*(rt*F+Y(A)),d(ft,ut,et);var yt=G.createImageData(F,q);yt.data.set(ft),G.putImageData(yt,0,0)}else for(W=0;N>W;W++)if(tt=T[W],rt.reverse(),rt[ot]=X(W+1),rt[0]!==rt[1]&&void 0!==rt[0]&&void 0!==rt[1])for(J=Y(0),Q=[J,J],A=0;D>A;A++)Q.reverse(),Q[at]=Y(A+1),Q[0]!==Q[1]&&void 0!==Q[0]&&void 0!==Q[1]&&(K=tt[A],et=f(K,(Q[1]-Q[0])*(rt[1]-rt[0])),G.fillStyle="rgba("+et.join(",")+")",G.fillRect(Q[0],rt[0],Q[1]-Q[0],rt[1]-rt[0]));lt=Math.round(lt/it),st=Math.round(st/it),ct=Math.round(ct/it);var xt=o("rgb("+lt+","+st+","+ct+")");t._hmpixcount=(t._hmpixcount||0)+it,t._hmlumcount=(t._hmlumcount||0)+it*xt.getLuminance();var bt=H.selectAll("image").data(n);bt.enter().append("svg:image").attr({xmlns:c.svg,preserveAspectRatio:"none"}),bt.attr({height:q,width:F,x:b,y:k,"xlink:href":U.toDataURL("image/png")}),bt.exit().remove()}}var a=t("d3"),o=t("tinycolor2"),i=t("../../lib"),l=t("../../plots/plots"),s=t("../../components/colorscale/get_scale"),c=t("../../constants/xmlns_namespaces"),u=t("./max_row_length");e.exports=function(t,e,n){for(var a=0;a0&&(r=!0);for(var l=0;lv&&p.splice(v,p.length-v),m.length>v&&m.splice(v,m.length-v),!e.autobinx&&"xbins"in e||(e.xbins=a.autoBin(p,h,e.nbinsx,"2d"),"histogram2dcontour"===e.type&&(e.xbins.start-=e.xbins.size,e.xbins.end+=e.xbins.size),e._input.xbins=e.xbins),!e.autobiny&&"ybins"in e||(e.ybins=a.autoBin(m,g,e.nbinsy,"2d"),"histogram2dcontour"===e.type&&(e.ybins.start-=e.ybins.size,e.ybins.end+=e.ybins.size),e._input.ybins=e.ybins),f=[];var y,x,b=[],_=[],w="string"==typeof e.xbins.size?[]:e.xbins,k="string"==typeof e.xbins.size?[]:e.ybins,M=0,A=[],T=e.histnorm,L=e.histfunc,z=-1!==T.indexOf("density"),S="max"===L||"min"===L,C=S?null:0,E=o.count,O=i[T],P=!1,N=[],D=[],I="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";I&&"count"!==L&&(P="avg"===L,E=o[L]);var R=e.xbins,j=R.end+(R.start-a.tickIncrement(R.start,R.size))/1e6;for(d=R.start;j>d;d=a.tickIncrement(d,R.size))b.push(C),Array.isArray(w)&&w.push(d),P&&_.push(0);Array.isArray(w)&&w.push(d);var F=b.length;for(n=e.xbins.start,s=(d-n)/F,n+=s/2,R=e.ybins,j=R.end+(R.start-a.tickIncrement(R.start,R.size))/1e6,d=R.start;j>d;d=a.tickIncrement(d,R.size))f.push(b.concat()),Array.isArray(k)&&k.push(d),P&&A.push(_.concat());Array.isArray(k)&&k.push(d);var q=f.length;for(c=e.ybins.start,u=(d-c)/q,c+=u/2,z&&(N=b.map(function(t,e){return Array.isArray(w)?1/(w[e+1]-w[e]):1/s}),D=f.map(function(t,e){return Array.isArray(k)?1/(k[e+1]-k[e]):1/u})),d=0;v>d;d++)y=r.findBin(p[d],w),x=r.findBin(m[d],k),y>=0&&F>y&&x>=0&&q>x&&(M+=E(y,d,f[x],I,A[x]));if(P)for(x=0;q>x;x++)M+=l(f[x],A[x]);if(O)for(x=0;q>x;x++)O(f[x],M,N,D[x]);return{x:p,x0:n,dx:s,y:m,y0:c,dy:u,z:f}}},{"../../lib":103,"../../plots/cartesian/axes":124,"../histogram/average":218,"../histogram/bin_functions":220,"../histogram/norm_functions":224}],211:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./sample_defaults"),o=t("../../components/colorscale/defaults"),i=t("./attributes");e.exports=function(t,e,n){function l(n,a){return r.coerce(t,e,i,n,a)}a(t,e,l),l("zsmooth"),o(t,e,n,l,{prefix:"",cLetter:"z"})}},{"../../components/colorscale/defaults":35,"../../lib":103,"./attributes":209,"./sample_defaults":213}],212:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.calc=t("../heatmap/calc"),r.plot=t("../heatmap/plot"),r.colorbar=t("../heatmap/colorbar"),r.style=t("../heatmap/style"),r.hoverPoints=t("../heatmap/hover"),r.moduleType="trace",r.name="histogram2d",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","2dMap","histogram"],r.meta={},e.exports=r},{"../../plots/cartesian":132,"../heatmap/calc":198,"../heatmap/colorbar":199,"../heatmap/hover":203,"../heatmap/plot":206,"../heatmap/style":207,"./attributes":209,"./defaults":211}],213:[function(t,e,n){"use strict";var r=t("../histogram/bin_defaults");e.exports=function(t,e,n){var a=n("x"),o=n("y");if(!(a&&a.length&&o&&o.length))return void(e.visible=!1);var i=n("z")||n("marker.color");i&&n("histfunc");var l=["x","y"];r(t,e,n,l)}},{"../histogram/bin_defaults":219}],214:[function(t,e,n){"use strict";var r=t("../histogram2d/attributes"),a=t("../contour/attributes"),o=t("../../components/colorscale/attributes"),i=t("../../lib/extend").extendFlat;e.exports=i({},{x:r.x,y:r.y,z:r.z,marker:r.marker,histnorm:r.histnorm,histfunc:r.histfunc,autobinx:r.autobinx,nbinsx:r.nbinsx,xbins:r.xbins,autobiny:r.autobiny,nbinsy:r.nbinsy,ybins:r.ybins,autocontour:a.autocontour,ncontours:a.ncontours,contours:a.contours,line:a.line,_nestedModules:{colorbar:"Colorbar"}},o)},{"../../components/colorscale/attributes":31,"../../lib/extend":101,"../contour/attributes":187,"../histogram2d/attributes":209}],215:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../histogram2d/sample_defaults"),o=t("../contour/style_defaults"),i=t("./attributes");e.exports=function(t,e,n,l){function s(n,a){return r.coerce(t,e,i,n,a)}a(t,e,s);var c=r.coerce2(t,e,i,"contours.start"),u=r.coerce2(t,e,i,"contours.end"),f=s("autocontour",!(c&&u));s(f?"ncontours":"contours.size"),o(t,e,s,l)}},{"../../lib":103,"../contour/style_defaults":196,"../histogram2d/sample_defaults":213,"./attributes":214}],216:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.calc=t("../contour/calc"),r.plot=t("../contour/plot"),r.style=t("../contour/style"),r.colorbar=t("../contour/colorbar"),r.hoverPoints=t("../contour/hover"),r.moduleType="trace",r.name="histogram2dcontour",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","2dMap","contour","histogram"],r.meta={},e.exports=r},{"../../plots/cartesian":132,"../contour/calc":188,"../contour/colorbar":189,"../contour/hover":191,"../contour/plot":194,"../contour/style":195,"./attributes":214,"./defaults":215}],217:[function(t,e,n){"use strict";function r(t){return{start:{valType:"number",dflt:null},end:{valType:"number",dflt:null},size:{valType:"any",dflt:1}}}var a=t("../bar/attributes");e.exports={x:{valType:"data_array"},y:{valType:"data_array"},text:a.text,orientation:a.orientation,histfunc:{valType:"enumerated",values:["count","sum","avg","min","max"],dflt:"count"},histnorm:{valType:"enumerated",values:["","percent","probability","density","probability density"],dflt:""},autobinx:{valType:"boolean",dflt:!0},nbinsx:{valType:"integer",min:0,dflt:0},xbins:r("x"),autobiny:{valType:"boolean",dflt:!0},nbinsy:{valType:"integer",min:0,dflt:0},ybins:r("y"),marker:a.marker,_nestedModules:{error_y:"ErrorBars",error_x:"ErrorBars","marker.colorbar":"Colorbar"},_deprecated:{bardir:a._deprecated.bardir}}},{"../bar/attributes":166}],218:[function(t,e,n){"use strict";e.exports=function(t,e){for(var n=t.length,r=0,a=0;n>a;a++)e[a]?(t[a]/=e[a],r+=t[a]):t[a]=null;return r}},{}],219:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){return n("histnorm"),r.forEach(function(t){var e=n(t+"bins.start"),r=n(t+"bins.end"),a=n("autobin"+t,!(e&&r));n(a?"nbins"+t:t+"bins.size")}),e}},{}],220:[function(t,e,n){"use strict";var r=t("fast-isnumeric");e.exports={count:function(t,e,n){return n[t]++,1},sum:function(t,e,n,a){var o=a[e];return r(o)?(o=Number(o),n[t]+=o,o):0},avg:function(t,e,n,a,o){var i=a[e];return r(i)&&(i=Number(i),n[t]+=i,o[t]++),0},min:function(t,e,n,a){var o=a[e];if(r(o)){if(o=Number(o),!r(n[t]))return n[t]=o,o;if(n[t]>o)return n[t]=o,o-n[t]}return 0},max:function(t,e,n,a){var o=a[e];if(r(o)){if(o=Number(o),!r(n[t]))return n[t]=o,o;if(n[t]n&&c.length<5e3;)g=o.tickIncrement(n,x.size),c.push((n+g)/2),u.push(S),b&&_.push(n),L&&w.push(1/(g-n)),O&&k.push(0),n=g;var P=u.length;for(n=0;n=0&&P>v&&(M+=C(v,n,u,y,k));O&&(M=s(u,k)),E&&E(u,M,w);var N=Math.min(c.length,u.length),D=[],I=0,R=N-1;for(n=0;N>n;n++)if(u[n]){I=n;break}for(n=N-1;n>I;n--)if(u[n]){R=n;break}for(n=I;R>=n;n++)r(c[n])&&r(u[n])&&D.push({p:c[n],s:u[n],b:0});return D}}},{"../../lib":103,"../../plots/cartesian/axes":124,"./average":218,"./bin_functions":220,"./norm_functions":224,"fast-isnumeric":17}],222:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../../components/color"),o=t("./bin_defaults"),i=t("../bar/style_defaults"),l=t("../../components/errorbars/defaults"),s=t("./attributes");e.exports=function(t,e,n,c){function u(n,a){return r.coerce(t,e,s,n,a)}var f=u("x"),d=u("y");u("text");var h=u("orientation",d&&!f?"h":"v"),p=e["v"===h?"x":"y"];if(!p||!p.length)return void(e.visible=!1);var g=e["h"===h?"x":"y"];g&&u("histfunc");var m="h"===h?["y"]:["x"];o(t,e,u,m),i(t,e,u,n,c),l(t,e,a.defaultLine,{axis:"y"}),l(t,e,a.defaultLine,{axis:"x",inherit:"y"})}},{"../../components/color":25,"../../components/errorbars/defaults":53,"../../lib":103,"../bar/style_defaults":176,"./attributes":217,"./bin_defaults":219}],223:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.layoutAttributes=t("../bar/layout_attributes"),r.supplyDefaults=t("./defaults"),r.supplyLayoutDefaults=t("../bar/layout_defaults"),r.calc=t("./calc"),r.setPositions=t("../bar/set_positions"),r.plot=t("../bar/plot"),r.style=t("../bar/style"),r.colorbar=t("../scatter/colorbar"),r.hoverPoints=t("../bar/hover"),r.moduleType="trace",r.name="histogram",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","bar","histogram","oriented","errorBarsOK","showLegend"],r.meta={},e.exports=r},{"../../plots/cartesian":132,"../bar/hover":169,"../bar/layout_attributes":171,"../bar/layout_defaults":172,"../bar/plot":173,"../bar/set_positions":174,"../bar/style":175,"../scatter/colorbar":240,"./attributes":217,"./calc":221,"./defaults":222}],224:[function(t,e,n){"use strict";e.exports={percent:function(t,e){for(var n=t.length,r=100/e,a=0;n>a;a++)t[a]*=r},probability:function(t,e){for(var n=t.length,r=0;n>r;r++)t[r]/=e},density:function(t,e,n,r){var a=t.length;r=r||1;for(var o=0;a>o;o++)t[o]*=n[o]*r},"probability density":function(t,e,n,r){var a=t.length;r&&(e/=r);for(var o=0;a>o;o++)t[o]*=n[o]/e}}},{}],225:[function(t,e,n){"use strict";var r=t("../../components/color/attributes"),a=t("../../plots/font_attributes"),o=t("../../plots/attributes"),i=t("../../lib/extend").extendFlat;e.exports={labels:{valType:"data_array"},label0:{valType:"number",dflt:0},dlabel:{valType:"number",dflt:1},values:{valType:"data_array"},marker:{colors:{valType:"data_array"},line:{color:{valType:"color",dflt:r.defaultLine,arrayOk:!0},width:{valType:"number",min:0,dflt:0,arrayOk:!0}}},text:{valType:"data_array"},scalegroup:{valType:"string",dflt:""},textinfo:{valType:"flaglist",flags:["label","text","value","percent"],extras:["none"]},hoverinfo:i({},o.hoverinfo,{flags:["label","text","value","percent","name"]}),textposition:{valType:"enumerated",values:["inside","outside","auto","none"],dflt:"auto",arrayOk:!0},textfont:i({},a,{}),insidetextfont:i({},a,{}),outsidetextfont:i({},a,{}),domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},hole:{valType:"number",min:0,max:1,dflt:0},sort:{valType:"boolean",dflt:!0},direction:{valType:"enumerated",values:["clockwise","counterclockwise"],dflt:"counterclockwise"},rotation:{valType:"number",min:-360,max:360,dflt:0},pull:{valType:"number",min:0,max:1,dflt:0,arrayOk:!0}}},{"../../components/color/attributes":24,"../../lib/extend":101,"../../plots/attributes":122,"../../plots/font_attributes":142}],226:[function(t,e,n){"use strict";function r(t,e){for(var n=[],r=0;rs||(c=p[n],void 0!==c&&""!==c||(c=n),c=String(c),void 0===y[c]&&(y[c]=!0,u=o(e.marker.colors[n]),u.isValid()?(u=i.addOpacity(u,u.getAlpha()),v[c]||(v[c]=u)):v[c]?u=v[c]:(u=!1,x=!0),f=-1!==_.indexOf(c),f||(b+=s),g.push({v:s,label:c,color:u,i:n,hidden:f}))));if(e.sort&&g.sort(function(t,e){return e.v-t.v}),x)for(n=0;n")}return g};var s},{"../../components/color":25,"./helpers":229,"fast-isnumeric":17,tinycolor2:20}],228:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes");e.exports=function(t,e,n,o){function i(n,o){return r.coerce(t,e,a,n,o)}var l=r.coerceFont,s=i("values");if(!Array.isArray(s)||!s.length)return void(e.visible=!1);var c=i("labels");Array.isArray(c)||(i("label0"),i("dlabel"));var u=i("marker.line.width");u&&i("marker.line.color");var f=i("marker.colors");Array.isArray(f)||(e.marker.colors=[]),i("scalegroup");var d=i("text"),h=i("textinfo",Array.isArray(d)?"text+percent":"percent");if(i("hoverinfo",1===o._dataLength?"label+text+value+percent":void 0),h&&"none"!==h){var p=i("textposition"),g=Array.isArray(p)||"auto"===p,m=g||"inside"===p,v=g||"outside"===p;if(m||v){var y=l(i,"textfont",o.font);m&&l(i,"insidetextfont",y),v&&l(i,"outsidetextfont",y)}}i("domain.x"),i("domain.y"),i("hole"),i("sort"),i("direction"),i("rotation"),i("pull")}},{"../../lib":103,"./attributes":225}],229:[function(t,e,n){"use strict";var r=t("../../lib");n.formatPiePercent=function(t,e){var n=(100*t).toPrecision(3);return-1!==n.lastIndexOf(".")&&(n=n.replace(/[.]?0+$/,"")),r.numSeparate(n,e)+"%"},n.formatPieValue=function(t,e){var n=t.toPrecision(10);return-1!==n.lastIndexOf(".")&&(n=n.replace(/[.]?0+$/,"")),r.numSeparate(n,e)}},{"../../lib":103}],230:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.supplyLayoutDefaults=t("./layout_defaults"),r.layoutAttributes=t("./layout_attributes"),r.calc=t("./calc"),r.plot=t("./plot"),r.style=t("./style"),r.styleOne=t("./style_one"),r.moduleType="trace",r.name="pie",r.basePlotModule=t("./base_plot"),r.categories=["pie","showLegend"],r.meta={},e.exports=r},{"./attributes":225,"./base_plot":226,"./calc":227,"./defaults":228,"./layout_attributes":231,"./layout_defaults":232,"./plot":233,"./style":234,"./style_one":235}],231:[function(t,e,n){"use strict";e.exports={hiddenlabels:{valType:"data_array"}}},{}],232:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e){function n(n,o){return r.coerce(t,e,a,n,o)}n("hiddenlabels")}},{"../../lib":103,"./layout_attributes":231}],233:[function(t,e,n){"use strict";function r(t,e,n){var r=Math.sqrt(t.width*t.width+t.height*t.height),o=t.width/t.height,i=Math.PI*Math.min(e.v/n.vTotal,.5),l=1-n.trace.hole,s=a(e,n),c={scale:s*n.r*2/r,rCenter:1-s,rotate:0};if(c.scale>=1)return c;var u=o+1/(2*Math.tan(i)),f=n.r*Math.min(1/(Math.sqrt(u*u+.5)+u),l/(Math.sqrt(o*o+l/2)+o)),d={scale:2*f/t.height,rCenter:Math.cos(f/n.r)-f*o/n.r,rotate:(180/Math.PI*e.midangle+720)%180-90},h=1/o,p=h+1/(2*Math.tan(i)),g=n.r*Math.min(1/(Math.sqrt(p*p+.5)+p),l/(Math.sqrt(h*h+l/2)+h)),m={scale:2*g/t.width,rCenter:Math.cos(g/n.r)-g/o/n.r,rotate:(180/Math.PI*e.midangle+810)%180-90},v=m.scale>d.scale?m:d;return c.scale<1&&v.scale>c.scale?v:c}function a(t,e){if(t.v===e.vTotal&&!e.trace.hole)return 1;var n=Math.PI*Math.min(t.v/e.vTotal,.5);return Math.min(1/(1+1/Math.sin(n)),(1-e.trace.hole)/2)}function o(t,e){var n=e.pxmid[0],r=e.pxmid[1],a=t.width/2,o=t.height/2;return 0>n&&(a*=-1),0>r&&(o*=-1),{scale:1,rCenter:1,rotate:0,x:a+Math.abs(o)*(a>0?1:-1)/2,y:o/(1+n*n/(r*r)),outside:!0}}function i(t,e){function n(t,e){return t.pxmid[1]-e.pxmid[1]}function r(t,e){return e.pxmid[1]-t.pxmid[1]}function a(t,n){n||(n={});var r,a,o,l,d,h,g=n.labelExtraY+(i?n.yLabelMax:n.yLabelMin),m=i?t.yLabelMin:t.yLabelMax,v=i?t.yLabelMax:t.yLabelMin,y=t.cyFinal+c(t.px0[1],t.px1[1]),x=g-m;if(x*f>0&&(t.labelExtraY=x),Array.isArray(e.pull))for(a=0;a=e.pull[o.i]||((t.pxmid[1]-o.pxmid[1])*f>0?(l=o.cyFinal+c(o.px0[1],o.px1[1]),x=l-m-t.labelExtraY,x*f>0&&(t.labelExtraY+=x)):(v+t.labelExtraY-y)*f>0&&(r=3*u*Math.abs(a-p.indexOf(t)),d=o.cxFinal+s(o.px0[0],o.px1[0]),h=d+r-(t.cxFinal+t.pxmid[0])-t.labelExtraX,h*u>0&&(t.labelExtraX+=h)))}var o,i,l,s,c,u,f,d,h,p,g,m,v;for(i=0;2>i;i++)for(l=i?n:r,c=i?Math.max:Math.min,f=i?1:-1,o=0;2>o;o++){for(s=o?Math.max:Math.min,u=o?1:-1,d=t[i][o],d.sort(l),h=t[1-i][o],p=h.concat(d),m=[],g=0;gu&&(u=l.pull[o]);i.r=Math.min(n/c(l.tilt,Math.sin(s),l.depth),r/c(l.tilt,Math.cos(s),l.depth))/(2+2*u),i.cx=e.l+e.w*(l.domain.x[1]+l.domain.x[0])/2,i.cy=e.t+e.h*(2-l.domain.y[1]-l.domain.y[0])/2,l.scalegroup&&-1===h.indexOf(l.scalegroup)&&h.push(l.scalegroup)}for(o=0;of.vTotal/2?1:0)}function c(t,e,n){if(!t)return 1;var r=Math.sin(t*Math.PI/180);return Math.max(.01,n*r*Math.abs(e)+2*Math.sqrt(1-r*r*e*e))}var u=t("d3"),f=t("../../plots/cartesian/graph_interact"),d=t("../../components/color"),h=t("../../components/drawing"),p=t("../../lib/svg_text_utils"),g=t("./helpers");e.exports=function(t,e){var n=t._fullLayout;l(e,n._size);var c=n._pielayer.selectAll("g.trace").data(e);c.enter().append("g").attr({"stroke-linejoin":"round","class":"trace"}),c.exit().remove(),c.order(),c.each(function(e){var l=u.select(this),c=e[0],m=c.trace,v=0,y=(m.depth||0)*c.r*Math.sin(v)/2,x=m.tiltaxis||0,b=x*Math.PI/180,_=[y*Math.sin(b),y*Math.cos(b)],w=c.r*Math.cos(v),k=l.selectAll("g.part").data(m.tilt?["top","sides"]:["top"]);k.enter().append("g").attr("class",function(t){return t+" part"}),k.exit().remove(),k.order(),s(e),l.selectAll(".top").each(function(){var l=u.select(this).selectAll("g.slice").data(e);l.enter().append("g").classed("slice",!0),l.exit().remove();var s=[[[],[]],[[],[]]],v=!1;l.each(function(i){function l(e){var r=t._fullLayout,o=t._fullData[m.index],l=o.hoverinfo;if("all"===l&&(l="label+text+value+percent+name"),!t._dragging&&r.hovermode!==!1&&"none"!==l&&l){var s=a(i,c),u=k+i.pxmid[0]*(1-s),d=M+i.pxmid[1]*(1-s),h=n.separators,p=[];-1!==l.indexOf("label")&&p.push(i.label),o.text&&o.text[i.i]&&-1!==l.indexOf("text")&&p.push(o.text[i.i]),-1!==l.indexOf("value")&&p.push(g.formatPieValue(i.v,h)),-1!==l.indexOf("percent")&&p.push(g.formatPiePercent(i.v/c.vTotal,h)),f.loneHover({x0:u-s*c.r,x1:u+s*c.r,y:d,text:p.join("
"),name:-1!==l.indexOf("name")?o.name:void 0,color:i.color,idealAlign:i.pxmid[0]<0?"left":"right"},{container:r._hoverlayer.node(),outerContainer:r._paper.node()}),f.hover(t,e,"pie"),L=!0}}function d(e){t.emit("plotly_unhover",{points:[e]}),L&&(f.loneUnhover(n._hoverlayer.node()),L=!1)}function y(){t._hoverdata=[i],i.curveNumber=e[0].trace.index,t._hoverdata.trace=e[0].trace,f.click(t,{target:!0})}function b(t,e,n,r){return"a"+r*c.r+","+r*w+" "+x+" "+i.largeArc+(n?" 1 ":" 0 ")+r*(e[0]-t[0])+","+r*(e[1]-t[1])}if(i.hidden)return void u.select(this).selectAll("path,g").remove();s[i.pxmid[1]<0?0:1][i.pxmid[0]<0?0:1].push(i);var k=c.cx+_[0],M=c.cy+_[1],A=u.select(this),T=A.selectAll("path.surface").data([i]),L=!1;if(T.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),A.select("path.textline").remove(),A.on("mouseover",l).on("mouseout",d).on("click",y).on("contextmenu",y),m.pull){var z=+(Array.isArray(m.pull)?m.pull[i.i]:m.pull)||0;z>0&&(k+=z*i.pxmid[0],M+=z*i.pxmid[1])}i.cxFinal=k,i.cyFinal=M;var S=m.hole;if(i.v===c.vTotal){var C="M"+(k+i.px0[0])+","+(M+i.px0[1])+b(i.px0,i.pxmid,!0,1)+b(i.pxmid,i.px0,!0,1)+"Z";S?T.attr("d","M"+(k+S*i.px0[0])+","+(M+S*i.px0[1])+b(i.px0,i.pxmid,!1,S)+b(i.pxmid,i.px0,!1,S)+"Z"+C):T.attr("d",C)}else{var E=b(i.px0,i.px1,!0,1);if(S){var O=1-S;T.attr("d","M"+(k+S*i.px1[0])+","+(M+S*i.px1[1])+b(i.px1,i.px0,!1,S)+"l"+O*i.px0[0]+","+O*i.px0[1]+E+"Z")}else T.attr("d","M"+k+","+M+"l"+i.px0[0]+","+i.px0[1]+E+"Z")}var P=Array.isArray(m.textposition)?m.textposition[i.i]:m.textposition,N=A.selectAll("g.slicetext").data(i.text&&"none"!==P?[0]:[]);N.enter().append("g").classed("slicetext",!0),N.exit().remove(),N.each(function(){var t=u.select(this).selectAll("text").data([0]);t.enter().append("text").attr("data-notex",1),t.exit().remove(),t.text(i.text).attr({"class":"slicetext",transform:"","data-bb":"","text-anchor":"middle",x:0,y:0}).call(h.font,"outside"===P?m.outsidetextfont:m.insidetextfont).call(p.convertToTspans),t.selectAll("tspan.line").attr({x:0,y:0});var e,n=h.bBox(t.node());"outside"===P?e=o(n,i):(e=r(n,i,c),"auto"===P&&e.scale<1&&(t.call(h.font,m.outsidetextfont),m.outsidetextfont.family===m.insidetextfont.family&&m.outsidetextfont.size===m.insidetextfont.size||(t.attr({"data-bb":""}),n=h.bBox(t.node())),e=o(n,i)));var a=k+i.pxmid[0]*e.rCenter+(e.x||0),l=M+i.pxmid[1]*e.rCenter+(e.y||0);e.outside&&(i.yLabelMin=l-n.height/2, +i.yLabelMid=l,i.yLabelMax=l+n.height/2,i.labelExtraX=0,i.labelExtraY=0,v=!0),t.attr("transform","translate("+a+","+l+")"+(e.scale<1?"scale("+e.scale+")":"")+(e.rotate?"rotate("+e.rotate+")":"")+"translate("+-(n.left+n.right)/2+","+-(n.top+n.bottom)/2+")")})}),v&&i(s,m),l.each(function(t){if(t.labelExtraX||t.labelExtraY){var e=u.select(this),n=e.select("g.slicetext text");n.attr("transform","translate("+t.labelExtraX+","+t.labelExtraY+")"+n.attr("transform"));var r=t.cxFinal+t.pxmid[0],a=t.cyFinal+t.pxmid[1],o="M"+r+","+a,i=(t.yLabelMax-t.yLabelMin)*(t.pxmid[0]<0?-1:1)/4;if(t.labelExtraX){var l=t.labelExtraX*t.pxmid[1]/t.pxmid[0],s=t.yLabelMid+t.labelExtraY-(t.cyFinal+t.pxmid[1]);o+=Math.abs(l)>Math.abs(s)?"l"+s*t.pxmid[0]/t.pxmid[1]+","+s+"H"+(r+t.labelExtraX+i):"l"+t.labelExtraX+","+l+"v"+(s-l)+"h"+i}else o+="V"+(t.yLabelMid+t.labelExtraY)+"h"+i;e.append("path").classed("textline",!0).call(d.stroke,m.outsidetextfont.color).attr({"stroke-width":Math.min(2,m.outsidetextfont.size/8),d:o,fill:"none"})}})})}),setTimeout(function(){c.selectAll("tspan").each(function(){var t=u.select(this);t.attr("dy")&&t.attr("dy",t.attr("dy"))})},0)}},{"../../components/color":25,"../../components/drawing":48,"../../lib/svg_text_utils":114,"../../plots/cartesian/graph_interact":131,"./helpers":229,d3:14}],234:[function(t,e,n){"use strict";var r=t("d3"),a=t("./style_one");e.exports=function(t){t._fullLayout._pielayer.selectAll(".trace").each(function(t){var e=t[0],n=e.trace,o=r.select(this);o.style({opacity:n.opacity}),o.selectAll(".top path.surface").each(function(t){r.select(this).call(a,t,n)})})}},{"./style_one":235,d3:14}],235:[function(t,e,n){"use strict";var r=t("../../components/color");e.exports=function(t,e,n){var a=n.marker.line.color;Array.isArray(a)&&(a=a[e.i]||r.defaultLine);var o=n.marker.line.width||0;Array.isArray(o)&&(o=o[e.i]||0),t.style({"stroke-width":o,fill:e.color}).call(r.stroke,a)}},{"../../components/color":25}],236:[function(t,e,n){"use strict";var r=t("../../lib");e.exports=function(t){var e=t[0].trace,n=e.marker;if(r.mergeArray(e.text,t,"tx"),r.mergeArray(e.textposition,t,"tp"),e.textfont&&(r.mergeArray(e.textfont.size,t,"ts"),r.mergeArray(e.textfont.color,t,"tc"),r.mergeArray(e.textfont.family,t,"tf")),n&&n.line){var a=n.line;r.mergeArray(n.opacity,t,"mo"),r.mergeArray(n.symbol,t,"mx"),r.mergeArray(n.color,t,"mc"),r.mergeArray(a.color,t,"mlc"),r.mergeArray(a.width,t,"mlw")}}},{"../../lib":103}],237:[function(t,e,n){"use strict";var r=t("../../components/colorscale/color_attributes"),a=t("../../components/drawing"),o=(t("./constants"),t("../../lib/extend").extendFlat);e.exports={x:{valType:"data_array"},x0:{valType:"any",dflt:0},dx:{valType:"number",dflt:1},y:{valType:"data_array"},y0:{valType:"any",dflt:0},dy:{valType:"number",dflt:1},text:{valType:"string",dflt:"",arrayOk:!0},mode:{valType:"flaglist",flags:["lines","markers","text"],extras:["none"]},hoveron:{valType:"flaglist",flags:["points","fills"]},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2},shape:{valType:"enumerated",values:["linear","spline","hv","vh","hvh","vhv"],dflt:"linear"},smoothing:{valType:"number",min:0,max:1.3,dflt:1},dash:{valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"}},connectgaps:{valType:"boolean",dflt:!1},fill:{valType:"enumerated",values:["none","tozeroy","tozerox","tonexty","tonextx","toself","tonext"],dflt:"none"},fillcolor:{valType:"color"},marker:o({},{symbol:{valType:"enumerated",values:a.symbolList,dflt:"circle",arrayOk:!0},opacity:{valType:"number",min:0,max:1,arrayOk:!0},size:{valType:"number",min:0,dflt:6,arrayOk:!0},maxdisplayed:{valType:"number",min:0,dflt:0},sizeref:{valType:"number",dflt:1},sizemin:{valType:"number",min:0,dflt:0},sizemode:{valType:"enumerated",values:["diameter","area"],dflt:"diameter"},showscale:{valType:"boolean",dflt:!1},line:o({},{width:{valType:"number",min:0,arrayOk:!0}},r("marker.line"))},r("marker")),textposition:{valType:"enumerated",values:["top left","top center","top right","middle left","middle center","middle right","bottom left","bottom center","bottom right"],dflt:"middle center",arrayOk:!0},textfont:{family:{valType:"string",noBlank:!0,strict:!0,arrayOk:!0},size:{valType:"number",min:1,arrayOk:!0},color:{valType:"color",arrayOk:!0}},r:{valType:"data_array"},t:{valType:"data_array"},_nestedModules:{error_y:"ErrorBars",error_x:"ErrorBars","marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":33,"../../components/drawing":48,"../../lib/extend":101,"./constants":242}],238:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../../plots/cartesian/axes"),o=t("../../lib"),i=t("./subtypes"),l=t("./colorscale_calc");e.exports=function(t,e){var n,s,c,u=a.getFromId(t,e.xaxis||"x"),f=a.getFromId(t,e.yaxis||"y"),d=u.makeCalcdata(e,"x"),h=f.makeCalcdata(e,"y"),p=Math.min(d.length,h.length);u._minDtick=0,f._minDtick=0,d.length>p&&d.splice(p,d.length-p),h.length>p&&h.splice(p,h.length-p);var g={padded:!0},m={padded:!0};if(i.hasMarkers(e)){if(n=e.marker,s=n.size,Array.isArray(s)){var v={type:"linear"};a.setConvert(v),s=v.makeCalcdata(e.marker,"size"),s.length>p&&s.splice(p,s.length-p)}var y,x=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/x),3)}:function(t){return Math.max((t||0)/x,3)},g.ppad=m.ppad=Array.isArray(s)?s.map(y):y(s)}l(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?e.error_y.visible||-1===["tonexty","tozeroy"].indexOf(e.fill)&&(i.hasMarkers(e)||i.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||d[0]===d[p-1]&&h[0]===h[p-1]?-1!==["tonextx","tozerox"].indexOf(e.fill)&&(m.padded=!1):m.tozero=!0,a.expand(u,d,g),a.expand(f,h,m);var b=new Array(p);for(c=0;p>c;c++)b[c]=r(d[c])&&r(h[c])?{x:d[c],y:h[c]}:{x:!1,y:!1};return void 0!==typeof s&&o.mergeArray(s,b,"ms"),t.firstscatter=!1,b}},{"../../lib":103,"../../plots/cartesian/axes":124,"./colorscale_calc":241,"./subtypes":256,"fast-isnumeric":17}],239:[function(t,e,n){"use strict";e.exports=function(t){var e,n,r,a,o;for(e=0;e=0;a--)if(o=t[a],"scatter"===o.type&&o.xaxis===n.xaxis&&o.yaxis===n.yaxis){o.opacity=void 0;break}}},{}],240:[function(t,e,n){"use strict";var r=t("d3"),a=t("fast-isnumeric"),o=t("../../lib"),i=t("../../plots/plots"),l=t("../../components/colorscale/get_scale"),s=t("../../components/colorbar/draw");e.exports=function(t,e){var n=e[0].trace,c=n.marker,u="cb"+n.uid;if(t._fullLayout._infolayer.selectAll("."+u).remove(),void 0===c||!c.showscale)return void i.autoMargin(t,u);var f=l(c.colorscale),d=c.color,h=c.cmin,p=c.cmax;a(h)||(h=o.aggNums(Math.min,null,d)),a(p)||(p=o.aggNums(Math.max,null,d));var g=e[0].t.cb=s(t,u);g.fillcolor(r.scale.linear().domain(f.map(function(t){return h+t[0]*(p-h)})).range(f.map(function(t){return t[1]}))).filllevels({start:h,end:p,size:(p-h)/254}).options(c.colorbar)()}},{"../../components/colorbar/draw":28,"../../components/colorscale/get_scale":37,"../../lib":103,"../../plots/plots":144,d3:14,"fast-isnumeric":17}],241:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/calc"),o=t("./subtypes");e.exports=function(t){o.hasLines(t)&&r(t,"line")&&a(t,t.line.color,"line","c"),o.hasMarkers(t)&&(r(t,"marker")&&a(t,t.marker.color,"marker","c"),r(t,"marker.line")&&a(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":32,"../../components/colorscale/has_colorscale":38,"./subtypes":256}],242:[function(t,e,n){"use strict";e.exports={PTS_LINESONLY:20}},{}],243:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("./attributes"),o=t("./constants"),i=t("./subtypes"),l=t("./xy_defaults"),s=t("./marker_defaults"),c=t("./line_defaults"),u=t("./line_shape_defaults"),f=t("./text_defaults"),d=t("./fillcolor_defaults"),h=t("../../components/errorbars/defaults");e.exports=function(t,e,n,p){function g(n,o){return r.coerce(t,e,a,n,o)}var m=l(t,e,g),v=mB!=P>=B&&(C=z[T-1][0],E=z[T][0],S=C+(E-C)*(B-O)/(P-O),R=Math.min(R,S),j=Math.max(j,S));R=Math.max(R,0),j=Math.min(j,d._length);var H=s.defaultLine;return s.opacity(f.fillcolor)?H=f.fillcolor:s.opacity((f.line||{}).color)&&(H=f.line.color),r.extendFlat(t,{distance:o.MAXDIST+10,x0:R,x1:j,y0:B,y1:B,color:H}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":25,"../../components/errorbars":54,"../../lib":103,"../../plots/cartesian/constants":129,"../../plots/cartesian/graph_interact":131,"./get_trace_color":245}],247:[function(t,e,n){"use strict";var r={},a=t("./subtypes");r.hasLines=a.hasLines,r.hasMarkers=a.hasMarkers,r.hasText=a.hasText,r.isBubble=a.isBubble,r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.cleanData=t("./clean_data"),r.calc=t("./calc"),r.arraysToCalcdata=t("./arrays_to_calcdata"),r.plot=t("./plot"),r.colorbar=t("./colorbar"),r.style=t("./style"),r.hoverPoints=t("./hover"),r.selectPoints=t("./select"),r.moduleType="trace",r.name="scatter",r.basePlotModule=t("../../plots/cartesian"),r.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],r.meta={},e.exports=r},{"../../plots/cartesian":132,"./arrays_to_calcdata":236,"./attributes":237,"./calc":238,"./clean_data":239,"./colorbar":240,"./defaults":243,"./hover":246,"./plot":253,"./select":254,"./style":255,"./subtypes":256}],248:[function(t,e,n){"use strict";var r=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults");e.exports=function(t,e,n,o,i){var l=(t.marker||{}).color;if(i("line.color",n),r(t,"line"))a(t,e,o,i,{prefix:"line.",cLetter:"c"});else{var s=(Array.isArray(l)?!1:l)||n;i("line.color",s)}i("line.width"),i("line.dash")}},{"../../components/colorscale/defaults":35,"../../components/colorscale/has_colorscale":38}],249:[function(t,e,n){"use strict";var r=t("../../plots/cartesian/axes");e.exports=function(t,e){function n(e){var n=w.c2p(t[e].x),r=k.c2p(t[e].y);return n===z||r===z?!1:[n,r]}function a(t){var e=t[0]/w._length,n=t[1]/k._length;return(1+10*Math.max(0,-e,e-1,-n,n-1))*A}function o(t,e){var n=t[0]-e[0],r=t[1]-e[1];return Math.sqrt(n*n+r*r)}var i,l,s,c,u,f,d,h,p,g,m,v,y,x,b,_,w=e.xaxis,k=e.yaxis,M=e.connectGaps,A=e.baseTolerance,T=e.linear,L=[],z=r.BADNUM,S=.2,C=new Array(t.length),E=0;for(i=0;ia(f))break;s=f,y=g[0]*p[0]+g[1]*p[1],y>m?(m=y,c=f,h=!1):v>y&&(v=y,u=f,h=!0)}if(h?(C[E++]=c,s!==u&&(C[E++]=u)):(u!==l&&(C[E++]=u),s!==c&&(C[E++]=c)),C[E++]=s,i>=t.length||!f)break;C[E++]=f,l=f}}else C[E++]=c}L.push(C.slice(0,E))}return L}},{"../../plots/cartesian/axes":124}],250:[function(t,e,n){"use strict";e.exports=function(t,e,n){var r=n("line.shape");"spline"===r&&n("line.smoothing")}},{}],251:[function(t,e,n){"use strict";var r=t("fast-isnumeric");e.exports=function(t){var e=t.marker,n=e.sizeref||1,a=e.sizemin||0,o="area"===e.sizemode?function(t){return Math.sqrt(t/n)}:function(t){return t/n};return function(t){var e=o(t/2);return r(e)&&e>0?Math.max(e,a):0}}},{"fast-isnumeric":17}],252:[function(t,e,n){"use strict";var r=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults"),i=t("./subtypes");e.exports=function(t,e,n,l,s){var c,u=i.isBubble(t),f=(t.line||{}).color;f&&(n=f),s("marker.symbol"),s("marker.opacity",u?.7:1),s("marker.size"),s("marker.color",n),a(t,"marker")&&o(t,e,l,s,{prefix:"marker.",cLetter:"c"}),c=f&&!Array.isArray(f)&&e.marker.color!==f?f:u?r.background:r.defaultLine,s("marker.line.color",c),a(t,"marker.line")&&o(t,e,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",u?1:0),u&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode"))}},{"../../components/color":25,"../../components/colorscale/defaults":35,"../../components/colorscale/has_colorscale":38,"./subtypes":256}],253:[function(t,e,n){"use strict";function r(t,e,n){var r=e.x(),o=e.y(),i=a.extent(r.range.map(r.l2c)),l=a.extent(o.range.map(o.l2c));n.forEach(function(t,e){var r=t[0].trace;if(c.hasMarkers(r)){var a=r.marker.maxdisplayed;if(0!==a){var o=t.filter(function(t){return t.x>=i[0]&&t.x<=i[1]&&t.y>=l[0]&&t.y<=l[1]}),s=Math.ceil(o.length/a),u=0;n.forEach(function(t,n){var r=t[0].trace;c.hasMarkers(r)&&r.marker.maxdisplayed>0&&e>n&&u++});var f=Math.round(u*s/3+Math.floor(u/3)*s/7.1);t.forEach(function(t){delete t.vis}),o.forEach(function(t,e){0===Math.round((e+f)%s)&&(t.vis=!0)})}}})}var a=t("d3"),o=t("../../lib"),i=t("../../components/drawing"),l=t("../../components/errorbars"),s=t("../../lib/polygon").tester,c=t("./subtypes"),u=t("./arrays_to_calcdata"),f=t("./line_points");e.exports=function(t,e,n){function d(t){return t.filter(function(t){return t.vis})}r(t,e,n);var h=e.x(),p=e.y(),g=e.plot.select(".scatterlayer").selectAll("g.trace.scatter").data(n);g.enter().append("g").attr("class","trace scatter").style("stroke-miterlimit",2),g.call(l.plot,e);var m,v,y,x,b="",_=[];g.each(function(t){var e=t[0].trace,n=e.line,r=a.select(this);if(e.visible===!0&&(v=e.fill.charAt(e.fill.length-1),"x"!==v&&"y"!==v&&(v=""),t[0].node3=r,u(t),c.hasLines(e)||"none"!==e.fill)){var o,l,d,g,w,k="",M="";m="tozero"===e.fill.substr(0,6)||"toself"===e.fill||"to"===e.fill.substr(0,2)&&!b?r.append("path").classed("js-fill",!0):null,x&&(y=x.datum(t)),x=r.append("path").classed("js-fill",!0),-1!==["hv","vh","hvh","vhv"].indexOf(n.shape)?(d=i.steps(n.shape),g=i.steps(n.shape.split("").reverse().join(""))):d=g="spline"===n.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?i.smoothclosed(t.slice(1),n.smoothing):i.smoothopen(t,n.smoothing)}:function(t){return"M"+t.join("L")},w=function(t){return g(t.reverse())};var A,T=f(t,{xaxis:h,yaxis:p,connectGaps:e.connectgaps,baseTolerance:Math.max(n.width||1,3)/4,linear:"linear"===n.shape}),L=e._polygons=new Array(T.length);for(A=0;A1&&r.append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").attr("d",o)}m?z&&C&&(v?("y"===v?z[1]=C[1]=p.c2p(0,!0):"x"===v&&(z[0]=C[0]=h.c2p(0,!0)),m.attr("d",k+"L"+C+"L"+z+"Z")):m.attr("d",k+"Z")):"tonext"===e.fill.substr(0,6)&&k&&b&&("tonext"===e.fill?y.attr("d",k+"Z"+b+"Z"):y.attr("d",k+"L"+b.substr(1)+"Z"),e._polygons=e._polygons.concat(_)),b=M,_=L}}}),g.selectAll("path:not([d])").remove(),g.append("g").attr("class","points").each(function(t){var e=t[0].trace,n=a.select(this),r=c.hasMarkers(e),l=c.hasText(e);!r&&!l||e.visible!==!0?n.remove():(r&&n.selectAll("path.point").data(e.marker.maxdisplayed?d:o.identity).enter().append("path").classed("point",!0).call(i.translatePoints,h,p),l&&n.selectAll("g").data(e.marker.maxdisplayed?d:o.identity).enter().append("g").append("text").call(i.translatePoints,h,p))})}},{"../../components/drawing":48,"../../components/errorbars":54,"../../lib":103,"../../lib/polygon":109,"./arrays_to_calcdata":236,"./line_points":249,"./subtypes":256,d3:14}],254:[function(t,e,n){"use strict";var r=t("./subtypes"),a=.2;e.exports=function(t,e){var n,o,i,l,s=t.cd,c=t.xaxis,u=t.yaxis,f=[],d=s[0].trace,h=d.index,p=d.marker,g=!r.hasMarkers(d)&&!r.hasText(d);if(d.visible===!0&&!g){var m=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(n=0;nn;n++)y=e.a[n],x=e.b[n],b=e.c[n],r(y)&&r(x)&&r(b)?(y=+y,x=+x,b=+b,_=m/(y+x+b),1!==_&&(y*=_,x*=_,b*=_),k=y,w=b-x,A[n]={x:w,y:k,a:y,b:x,c:b}):A[n]={x:!1,y:!1};var T,L;if(i.hasMarkers(e)&&(T=e.marker,L=T.size,Array.isArray(L))){var z={type:"linear"};a.setConvert(z),L=z.makeCalcdata(e.marker,"size"),L.length>M&&L.splice(M,L.length-M)}return l(e),void 0!==typeof L&&o.mergeArray(L,A,"ms"),A}},{"../../lib":103,"../../plots/cartesian/axes":124,"../scatter/colorscale_calc":241,"../scatter/subtypes":256,"fast-isnumeric":17}],261:[function(t,e,n){"use strict";var r=t("../../lib"),a=t("../scatter/constants"),o=t("../scatter/subtypes"),i=t("../scatter/marker_defaults"),l=t("../scatter/line_defaults"),s=t("../scatter/line_shape_defaults"),c=t("../scatter/text_defaults"),u=t("../scatter/fillcolor_defaults"),f=t("./attributes");e.exports=function(t,e,n,d){function h(n,a){return r.coerce(t,e,f,n,a)}var p,g=h("a"),m=h("b"),v=h("c");if(g?(p=g.length,m?(p=Math.min(p,m.length),v&&(p=Math.min(p,v.length))):p=v?Math.min(p,v.length):0):m&&v&&(p=Math.min(m.length,v.length)),!p)return void(e.visible=!1);g&&p"),l}}},{"../../plots/cartesian/axes":124,"../scatter/hover":246}],263:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.colorbar=t("../scatter/colorbar"),r.calc=t("./calc"),r.plot=t("./plot"),r.style=t("./style"),r.hoverPoints=t("./hover"),r.selectPoints=t("./select"),r.moduleType="trace",r.name="scatterternary",r.basePlotModule=t("../../plots/ternary"),r.categories=["ternary","symbols","markerColorscale","showLegend"],r.meta={},e.exports=r},{"../../plots/ternary":151,"../scatter/colorbar":240,"./attributes":259,"./calc":260,"./defaults":261,"./hover":262,"./plot":264,"./select":265,"./style":266}],264:[function(t,e,n){"use strict";var r=t("../scatter/plot");e.exports=function(t,e){var n=t.plotContainer;n.select(".scatterlayer").selectAll("*").remove();for(var a={x:function(){return t.xaxis},y:function(){return t.yaxis},plot:n},o=new Array(e.length),i=t.graphDiv.calcdata,l=0;l0?(n=2*Math.sqrt(r+1),t[3]=.25*n,t[0]=(e[6]-e[9])/n,t[1]=(e[8]-e[2])/n,t[2]=(e[1]-e[4])/n):e[0]>e[5]&e[0]>e[10]?(n=2*Math.sqrt(1+e[0]-e[5]-e[10]),t[3]=(e[6]-e[9])/n,t[0]=.25*n,t[1]=(e[1]+e[4])/n,t[2]=(e[8]+e[2])/n):e[5]>e[10]?(n=2*Math.sqrt(1+e[5]-e[0]-e[10]),t[3]=(e[8]-e[2])/n,t[0]=(e[1]+e[4])/n,t[1]=.25*n,t[2]=(e[6]+e[9])/n):(n=2*Math.sqrt(1+e[10]-e[0]-e[5]),t[3]=(e[1]-e[4])/n,t[0]=(e[8]+e[2])/n,t[1]=(e[6]+e[9])/n,t[2]=.25*n),t},i.fromRotationTranslationScale=function(t,e,r,n){var i=e[0],o=e[1],a=e[2],s=e[3],l=i+i,u=o+o,c=a+a,h=i*l,f=i*u,p=i*c,d=o*u,m=o*c,g=a*c,v=s*l,y=s*u,x=s*c,b=n[0],_=n[1],w=n[2];return t[0]=(1-(d+g))*b,t[1]=(f+x)*b,t[2]=(p-y)*b,t[3]=0,t[4]=(f-x)*_,t[5]=(1-(h+g))*_,t[6]=(m+v)*_,t[7]=0,t[8]=(p+y)*w,t[9]=(m-v)*w,t[10]=(1-(h+d))*w,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t},i.fromRotationTranslationScaleOrigin=function(t,e,r,n,i){var o=e[0],a=e[1],s=e[2],l=e[3],u=o+o,c=a+a,h=s+s,f=o*u,p=o*c,d=o*h,m=a*c,g=a*h,v=s*h,y=l*u,x=l*c,b=l*h,_=n[0],w=n[1],M=n[2],A=i[0],k=i[1],T=i[2];return t[0]=(1-(m+v))*_,t[1]=(p+b)*_,t[2]=(d-x)*_,t[3]=0,t[4]=(p-b)*w,t[5]=(1-(f+v))*w,t[6]=(g+y)*w,t[7]=0,t[8]=(d+x)*M,t[9]=(g-y)*M,t[10]=(1-(f+m))*M,t[11]=0,t[12]=r[0]+A-(t[0]*A+t[4]*k+t[8]*T),t[13]=r[1]+k-(t[1]*A+t[5]*k+t[9]*T),t[14]=r[2]+T-(t[2]*A+t[6]*k+t[10]*T),t[15]=1,t},i.fromQuat=function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r+r,s=n+n,l=i+i,u=r*a,c=n*a,h=n*s,f=i*a,p=i*s,d=i*l,m=o*a,g=o*s,v=o*l;return t[0]=1-h-d,t[1]=c+v,t[2]=f-g,t[3]=0,t[4]=c-v,t[5]=1-u-d,t[6]=p+m,t[7]=0,t[8]=f+g,t[9]=p-m,t[10]=1-u-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},i.frustum=function(t,e,r,n,i,o,a){var s=1/(r-e),l=1/(i-n),u=1/(o-a);return t[0]=2*o*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*o*l,t[6]=0,t[7]=0,t[8]=(r+e)*s,t[9]=(i+n)*l,t[10]=(a+o)*u,t[11]=-1,t[12]=0,t[13]=0,t[14]=a*o*2*u,t[15]=0,t},i.perspective=function(t,e,r,n,i){var o=1/Math.tan(e/2),a=1/(n-i);return t[0]=o/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(i+n)*a,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*i*n*a,t[15]=0,t},i.perspectiveFromFieldOfView=function(t,e,r,n){var i=Math.tan(e.upDegrees*Math.PI/180),o=Math.tan(e.downDegrees*Math.PI/180),a=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),l=2/(a+s),u=2/(i+o);return t[0]=l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=u,t[6]=0,t[7]=0,t[8]=-((a-s)*l*.5),t[9]=(i-o)*u*.5,t[10]=n/(r-n),t[11]=-1,t[12]=0,t[13]=0,t[14]=n*r/(r-n),t[15]=0,t},i.ortho=function(t,e,r,n,i,o,a){var s=1/(e-r),l=1/(n-i),u=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(e+r)*s,t[13]=(i+n)*l,t[14]=(a+o)*u,t[15]=1,t},i.lookAt=function(t,e,r,o){var a,s,l,u,c,h,f,p,d,m,g=e[0],v=e[1],y=e[2],x=o[0],b=o[1],_=o[2],w=r[0],M=r[1],A=r[2];return Math.abs(g-w)l?(o.cross(t,e,i),o.length(t)<1e-6&&o.cross(t,r,i),o.normalize(t,t),s.setAxisAngle(n,t,Math.PI),n):l>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(o.cross(t,i,a),n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=1+l,s.normalize(n,n))}}(),s.setAxes=function(){var t=i.create();return function(e,r,n,i){return t[0]=n[0],t[3]=n[1],t[6]=n[2],t[1]=i[0],t[4]=i[1],t[7]=i[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],s.normalize(e,s.fromMat3(e,t))}}(),s.clone=a.clone,s.fromValues=a.fromValues,s.copy=a.copy,s.set=a.set,s.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},s.setAxisAngle=function(t,e,r){r=.5*r;var n=Math.sin(r);return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(r),t},s.getAxisAngle=function(t,e){var r=2*Math.acos(e[3]),n=Math.sin(r/2);return 0!=n?(t[0]=e[0]/n,t[1]=e[1]/n,t[2]=e[2]/n):(t[0]=1,t[1]=0,t[2]=0),r},s.add=a.add,s.multiply=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=r[0],l=r[1],u=r[2],c=r[3];return t[0]=n*c+a*s+i*u-o*l,t[1]=i*c+a*l+o*s-n*u,t[2]=o*c+a*u+n*l-i*s,t[3]=a*c-n*s-i*l-o*u,t},s.mul=s.multiply,s.scale=a.scale,s.rotateX=function(t,e,r){r*=.5;var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l+a*s,t[1]=i*l+o*s,t[2]=o*l-i*s,t[3]=a*l-n*s,t},s.rotateY=function(t,e,r){r*=.5;var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l-o*s,t[1]=i*l+a*s,t[2]=o*l+n*s,t[3]=a*l-i*s,t},s.rotateZ=function(t,e,r){r*=.5;var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l+i*s,t[1]=i*l-n*s,t[2]=o*l+a*s,t[3]=a*l-o*s,t},s.calculateW=function(t,e){var r=e[0],n=e[1],i=e[2];return t[0]=r,t[1]=n,t[2]=i,t[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i)),t},s.dot=a.dot,s.lerp=a.lerp,s.slerp=function(t,e,r,n){var i,o,a,s,l,u=e[0],c=e[1],h=e[2],f=e[3],p=r[0],d=r[1],m=r[2],g=r[3];return o=u*p+c*d+h*m+f*g,0>o&&(o=-o,p=-p,d=-d,m=-m,g=-g),1-o>1e-6?(i=Math.acos(o),a=Math.sin(i),s=Math.sin((1-n)*i)/a,l=Math.sin(n*i)/a):(s=1-n,l=n),t[0]=s*u+l*p,t[1]=s*c+l*d,t[2]=s*h+l*m,t[3]=s*f+l*g,t},s.sqlerp=function(){var t=s.create(),e=s.create();return function(r,n,i,o,a,l){return s.slerp(t,n,a,l),s.slerp(e,i,o,l),s.slerp(r,t,e,2*l*(1-l)),r}}(),s.invert=function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r*r+n*n+i*i+o*o,s=a?1/a:0;return t[0]=-r*s,t[1]=-n*s,t[2]=-i*s,t[3]=o*s,t},s.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},s.length=a.length,s.len=s.length,s.squaredLength=a.squaredLength,s.sqrLen=s.squaredLength,s.normalize=a.normalize,s.fromMat3=function(t,e){var r,n=e[0]+e[4]+e[8];if(n>0)r=Math.sqrt(n+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[3*i+i]&&(i=2);var o=(i+1)%3,a=(i+2)%3;r=Math.sqrt(e[3*i+i]-e[3*o+o]-e[3*a+a]+1),t[i]=.5*r,r=.5/r,t[3]=(e[3*o+a]-e[3*a+o])*r,t[o]=(e[3*o+i]+e[3*i+o])*r,t[a]=(e[3*a+i]+e[3*i+a])*r}return t},s.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},s.exactEquals=a.exactEquals,s.equals=a.equals,e.exports=s},{"./common.js":156,"./mat3.js":159,"./vec3.js":163,"./vec4.js":164}],162:[function(t,e,r){var n=t("./common.js"),i={};i.create=function(){var t=new n.ARRAY_TYPE(2);return t[0]=0,t[1]=0,t},i.clone=function(t){var e=new n.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e},i.fromValues=function(t,e){var r=new n.ARRAY_TYPE(2);return r[0]=t,r[1]=e,r},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t},i.set=function(t,e,r){return t[0]=e,t[1]=r,t},i.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t},i.subtract=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t},i.sub=i.subtract,i.multiply=function(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t},i.mul=i.multiply,i.divide=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t},i.min=function(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t},i.max=function(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t},i.scale=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t},i.scaleAndAdd=function(t,e,r,n){ return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t},i.distance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1];return Math.sqrt(r*r+n*n)},i.dist=i.distance,i.squaredDistance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1];return r*r+n*n},i.sqrDist=i.squaredDistance,i.length=function(t){var e=t[0],r=t[1];return Math.sqrt(e*e+r*r)},i.len=i.length,i.squaredLength=function(t){var e=t[0],r=t[1];return e*e+r*r},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t},i.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t},i.normalize=function(t,e){var r=e[0],n=e[1],i=r*r+n*n;return i>0&&(i=1/Math.sqrt(i),t[0]=e[0]*i,t[1]=e[1]*i),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},i.cross=function(t,e,r){var n=e[0]*r[1]-e[1]*r[0];return t[0]=t[1]=0,t[2]=n,t},i.lerp=function(t,e,r,n){var i=e[0],o=e[1];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t},i.random=function(t,e){e=e||1;var r=2*n.RANDOM()*Math.PI;return t[0]=Math.cos(r)*e,t[1]=Math.sin(r)*e,t},i.transformMat2=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i,t[1]=r[1]*n+r[3]*i,t},i.transformMat2d=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i+r[4],t[1]=r[1]*n+r[3]*i+r[5],t},i.transformMat3=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[3]*i+r[6],t[1]=r[1]*n+r[4]*i+r[7],t},i.transformMat4=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[4]*i+r[12],t[1]=r[1]*n+r[5]*i+r[13],t},i.forEach=function(){var t=i.create();return function(e,r,n,i,o,a){var s,l;for(r||(r=2),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;l>s;s+=r)t[0]=e[s],t[1]=e[s+1],o(t,t,a),e[s]=t[0],e[s+1]=t[1];return e}}(),i.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]},i.equals=function(t,e){var r=t[0],i=t[1],o=e[0],a=e[1];return Math.abs(r-o)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(i-a)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(a))},e.exports=i},{"./common.js":156}],163:[function(t,e,r){var n=t("./common.js"),i={};i.create=function(){var t=new n.ARRAY_TYPE(3);return t[0]=0,t[1]=0,t[2]=0,t},i.clone=function(t){var e=new n.ARRAY_TYPE(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},i.fromValues=function(t,e,r){var i=new n.ARRAY_TYPE(3);return i[0]=t,i[1]=e,i[2]=r,i},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},i.set=function(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t},i.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t},i.subtract=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t},i.sub=i.subtract,i.multiply=function(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t},i.mul=i.multiply,i.divide=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t},i.min=function(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t},i.max=function(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t},i.scale=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t},i.scaleAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t},i.distance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2];return Math.sqrt(r*r+n*n+i*i)},i.dist=i.distance,i.squaredDistance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2];return r*r+n*n+i*i},i.sqrDist=i.squaredDistance,i.length=function(t){var e=t[0],r=t[1],n=t[2];return Math.sqrt(e*e+r*r+n*n)},i.len=i.length,i.squaredLength=function(t){var e=t[0],r=t[1],n=t[2];return e*e+r*r+n*n},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t},i.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t},i.normalize=function(t,e){var r=e[0],n=e[1],i=e[2],o=r*r+n*n+i*i;return o>0&&(o=1/Math.sqrt(o),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},i.cross=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[0],s=r[1],l=r[2];return t[0]=i*l-o*s,t[1]=o*a-n*l,t[2]=n*s-i*a,t},i.lerp=function(t,e,r,n){var i=e[0],o=e[1],a=e[2];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t[2]=a+n*(r[2]-a),t},i.hermite=function(t,e,r,n,i,o){var a=o*o,s=a*(2*o-3)+1,l=a*(o-2)+o,u=a*(o-1),c=a*(3-2*o);return t[0]=e[0]*s+r[0]*l+n[0]*u+i[0]*c,t[1]=e[1]*s+r[1]*l+n[1]*u+i[1]*c,t[2]=e[2]*s+r[2]*l+n[2]*u+i[2]*c,t},i.bezier=function(t,e,r,n,i,o){var a=1-o,s=a*a,l=o*o,u=s*a,c=3*o*s,h=3*l*a,f=l*o;return t[0]=e[0]*u+r[0]*c+n[0]*h+i[0]*f,t[1]=e[1]*u+r[1]*c+n[1]*h+i[1]*f,t[2]=e[2]*u+r[2]*c+n[2]*h+i[2]*f,t},i.random=function(t,e){e=e||1;var r=2*n.RANDOM()*Math.PI,i=2*n.RANDOM()-1,o=Math.sqrt(1-i*i)*e;return t[0]=Math.cos(r)*o,t[1]=Math.sin(r)*o,t[2]=i*e,t},i.transformMat4=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[3]*n+r[7]*i+r[11]*o+r[15];return a=a||1,t[0]=(r[0]*n+r[4]*i+r[8]*o+r[12])/a,t[1]=(r[1]*n+r[5]*i+r[9]*o+r[13])/a,t[2]=(r[2]*n+r[6]*i+r[10]*o+r[14])/a,t},i.transformMat3=function(t,e,r){var n=e[0],i=e[1],o=e[2];return t[0]=n*r[0]+i*r[3]+o*r[6],t[1]=n*r[1]+i*r[4]+o*r[7],t[2]=n*r[2]+i*r[5]+o*r[8],t},i.transformQuat=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*o-l*i,h=u*i+l*n-a*o,f=u*o+a*i-s*n,p=-a*n-s*i-l*o;return t[0]=c*u+p*-a+h*-l-f*-s,t[1]=h*u+p*-s+f*-a-c*-l,t[2]=f*u+p*-l+c*-s-h*-a,t},i.rotateX=function(t,e,r,n){var i=[],o=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[0],o[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),o[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t},i.rotateY=function(t,e,r,n){var i=[],o=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),o[1]=i[1],o[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t},i.rotateZ=function(t,e,r,n){var i=[],o=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),o[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),o[2]=i[2],t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t},i.forEach=function(){var t=i.create();return function(e,r,n,i,o,a){var s,l;for(r||(r=3),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;l>s;s+=r)t[0]=e[s],t[1]=e[s+1],t[2]=e[s+2],o(t,t,a),e[s]=t[0],e[s+1]=t[1],e[s+2]=t[2];return e}}(),i.angle=function(t,e){var r=i.fromValues(t[0],t[1],t[2]),n=i.fromValues(e[0],e[1],e[2]);i.normalize(r,r),i.normalize(n,n);var o=i.dot(r,n);return o>1?0:Math.acos(o)},i.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]},i.equals=function(t,e){var r=t[0],i=t[1],o=t[2],a=e[0],s=e[1],l=e[2];return Math.abs(r-a)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(i-s)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(o-l)<=n.EPSILON*Math.max(1,Math.abs(o),Math.abs(l))},e.exports=i},{"./common.js":156}],164:[function(t,e,r){var n=t("./common.js"),i={};i.create=function(){var t=new n.ARRAY_TYPE(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},i.clone=function(t){var e=new n.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},i.fromValues=function(t,e,r,i){var o=new n.ARRAY_TYPE(4);return o[0]=t,o[1]=e,o[2]=r,o[3]=i,o},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},i.set=function(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t},i.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t},i.subtract=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t},i.sub=i.subtract,i.multiply=function(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t[3]=e[3]*r[3],t},i.mul=i.multiply,i.divide=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t[3]=e[3]/r[3],t},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t},i.min=function(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t[3]=Math.min(e[3],r[3]),t},i.max=function(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t[3]=Math.max(e[3],r[3]),t},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t},i.scale=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t},i.scaleAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t},i.distance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return Math.sqrt(r*r+n*n+i*i+o*o)},i.dist=i.distance,i.squaredDistance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return r*r+n*n+i*i+o*o},i.sqrDist=i.squaredDistance,i.length=function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.sqrt(e*e+r*r+n*n+i*i)},i.len=i.length,i.squaredLength=function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},i.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t},i.normalize=function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r*r+n*n+i*i+o*o;return a>0&&(a=1/Math.sqrt(a),t[0]=r*a,t[1]=n*a,t[2]=i*a,t[3]=o*a),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},i.lerp=function(t,e,r,n){var i=e[0],o=e[1],a=e[2],s=e[3];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t[2]=a+n*(r[2]-a),t[3]=s+n*(r[3]-s),t},i.random=function(t,e){return e=e||1,t[0]=n.RANDOM(),t[1]=n.RANDOM(),t[2]=n.RANDOM(),t[3]=n.RANDOM(),i.normalize(t,t),i.scale(t,t,e),t},i.transformMat4=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*a,t},i.transformQuat=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*o-l*i,h=u*i+l*n-a*o,f=u*o+a*i-s*n,p=-a*n-s*i-l*o;return t[0]=c*u+p*-a+h*-l-f*-s,t[1]=h*u+p*-s+f*-a-c*-l,t[2]=f*u+p*-l+c*-s-h*-a,t[3]=e[3],t},i.forEach=function(){var t=i.create();return function(e,r,n,i,o,a){var s,l;for(r||(r=4),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;l>s;s+=r)t[0]=e[s],t[1]=e[s+1],t[2]=e[s+2],t[3]=e[s+3],o(t,t,a),e[s]=t[0],e[s+1]=t[1],e[s+2]=t[2],e[s+3]=t[3];return e}}(),i.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},i.equals=function(t,e){var r=t[0],i=t[1],o=t[2],a=t[3],s=e[0],l=e[1],u=e[2],c=e[3];return Math.abs(r-s)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(i-l)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(o-u)<=n.EPSILON*Math.max(1,Math.abs(o),Math.abs(u))&&Math.abs(a-c)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(c))},e.exports=i},{"./common.js":156}],165:[function(t,e,r){"use strict";function n(t,e){for(var r=[0,0,0,0],n=0;4>n;++n)for(var i=0;4>i;++i)r[i]+=t[4*n+i]*e[n];return r}function i(t,e,r,i,o){for(var a=n(i,n(r,n(e,[t[0],t[1],t[2],1]))),s=0;3>s;++s)a[s]/=a[3];return[.5*o[0]*(1+a[0]),.5*o[1]*(1-a[1])]}function o(t,e){if(2===t.length){for(var r=0,n=0,i=0;2>i;++i)r+=Math.pow(e[i]-t[0][i],2),n+=Math.pow(e[i]-t[1][i],2);return r=Math.sqrt(r),n=Math.sqrt(n),1e-6>r+n?[1,0]:[n/(r+n),r/(n+r)]}if(3===t.length){var o=[0,0];return u(t[0],t[1],t[2],e,o),l(t,o)}return[]}function a(t,e){for(var r=[0,0,0],n=0;na;++a)r[a]+=o*i[a];return r}function s(t,e,r,n,s,l){if(1===t.length)return[0,t[0].slice()];for(var u=new Array(t.length),c=0;cd;++d)p+=Math.pow(u[c][d]-e[d],2);f>p&&(f=p,h=c)}for(var m=o(u,e),g=0,c=0;3>c;++c){if(m[c]<-.001||m[c]>1.0001)return null;g+=m[c]}return Math.abs(g-1)>.001?null:[h,a(t,m),m]}var l=t("barycentric"),u=t("polytope-closest-point/lib/closest_point_2d.js");e.exports=s},{barycentric:31,"polytope-closest-point/lib/closest_point_2d.js":416}],166:[function(t,e,r){var n="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, normal;\nattribute vec4 color;\nattribute vec2 uv;\n\nuniform mat4 model\n , view\n , projection;\nuniform vec3 eyePosition\n , lightPosition;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n vec4 m_position = model * vec4(position, 1.0);\n vec4 t_position = view * m_position;\n gl_Position = projection * t_position;\n f_color = color;\n f_normal = normal;\n f_data = position;\n f_eyeDirection = eyePosition - position;\n f_lightDirection = lightPosition - position;\n f_uv = uv;\n}",i="precision mediump float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution_2_0(float x, float roughness) {\n float NdotH = max(x, 0.0001);\n float cos2Alpha = NdotH * NdotH;\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\n float roughness2 = roughness * roughness;\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\n return exp(tan2Alpha / roughness2) / denom;\n}\n\n\n\nfloat cookTorranceSpecular_1_1(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness,\n float fresnel) {\n\n float VdotN = max(dot(viewDirection, surfaceNormal), 0.0);\n float LdotN = max(dot(lightDirection, surfaceNormal), 0.0);\n\n //Half angle vector\n vec3 H = normalize(lightDirection + viewDirection);\n\n //Geometric term\n float NdotH = max(dot(surfaceNormal, H), 0.0);\n float VdotH = max(dot(viewDirection, H), 0.000001);\n float LdotH = max(dot(lightDirection, H), 0.000001);\n float G1 = (2.0 * NdotH * VdotN) / VdotH;\n float G2 = (2.0 * NdotH * LdotN) / LdotH;\n float G = min(1.0, min(G1, G2));\n \n //Distribution term\n float D = beckmannDistribution_2_0(NdotH, roughness);\n\n //Fresnel term\n float F = pow(1.0 - VdotN, fresnel);\n\n //Multiply terms and done\n return G * F * D / max(3.14159265 * VdotN, 0.000001);\n}\n\n\n\nuniform vec3 clipBounds[2];\nuniform float roughness\n , fresnel\n , kambient\n , kdiffuse\n , kspecular\n , opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(f_data, clipBounds[0])) || \n any(greaterThan(f_data, clipBounds[1]))) {\n discard;\n }\n\n vec3 N = normalize(f_normal);\n vec3 L = normalize(f_lightDirection);\n vec3 V = normalize(f_eyeDirection);\n \n if(!gl_FrontFacing) {\n N = -N;\n }\n\n float specular = cookTorranceSpecular_1_1(L, V, N, roughness, fresnel);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n vec4 surfaceColor = f_color * texture2D(texture, f_uv);\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = litColor * opacity;\n}",o="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 uv;\n\nuniform mat4 model, view, projection;\n\nvarying vec4 f_color;\nvarying vec3 f_data;\nvarying vec2 f_uv;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n f_color = color;\n f_data = position;\n f_uv = uv;\n}",a="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform sampler2D texture;\nuniform float opacity;\n\nvarying vec4 f_color;\nvarying vec3 f_data;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(f_data, clipBounds[0])) || \n any(greaterThan(f_data, clipBounds[1]))) {\n discard;\n }\n\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}",s="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 uv;\nattribute float pointSize;\n\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1]))) {\n gl_Position = vec4(0,0,0,0);\n } else {\n gl_Position = projection * view * model * vec4(position, 1.0);\n }\n gl_PointSize = pointSize;\n f_color = color;\n f_uv = uv;\n}",l="precision mediump float;\n#define GLSLIFY 1\n\nuniform sampler2D texture;\nuniform float opacity;\n\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n vec2 pointR = gl_PointCoord.xy - vec2(0.5,0.5);\n if(dot(pointR, pointR) > 0.25) {\n discard;\n }\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}",u="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n f_id = id;\n f_position = position;\n}",c="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(f_position, clipBounds[0])) || \n any(greaterThan(f_position, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId, f_id.xyz);\n}",h="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute float pointSize;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1]))) {\n gl_Position = vec4(0,0,0,0);\n } else {\n gl_Position = projection * view * model * vec4(position, 1.0);\n gl_PointSize = pointSize;\n }\n f_id = id;\n f_position = position;\n}",f="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\n\nuniform mat4 model, view, projection;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n}",p="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 contourColor;\n\nvoid main() {\n gl_FragColor = vec4(contourColor,1);\n}\n";r.meshShader={vertex:n,fragment:i,attributes:[{name:"position",type:"vec3"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.wireShader={vertex:o,fragment:a,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.pointShader={vertex:s,fragment:l,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]},r.pickShader={vertex:u,fragment:c,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]},r.pointPickShader={vertex:h,fragment:c,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]},r.contourShader={vertex:f,fragment:p,attributes:[{name:"position",type:"vec3"}]}},{}],167:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a,s,l,u,c,h,f,p,d,m,g,v,y,x,b,_,w,M,A,k,T){this.gl=t,this.cells=[],this.positions=[],this.intensity=[],this.texture=e,this.dirty=!0,this.triShader=r,this.lineShader=n,this.pointShader=i,this.pickShader=o,this.pointPickShader=a,this.contourShader=s,this.trianglePositions=l,this.triangleColors=c,this.triangleNormals=f,this.triangleUVs=h,this.triangleIds=u,this.triangleVAO=p,this.triangleCount=0,this.lineWidth=1,this.edgePositions=d,this.edgeColors=g,this.edgeUVs=v,this.edgeIds=m,this.edgeVAO=y,this.edgeCount=0,this.pointPositions=x,this.pointColors=_,this.pointUVs=w,this.pointSizes=M,this.pointIds=b,this.pointVAO=A,this.pointCount=0,this.contourLineWidth=1,this.contourPositions=k,this.contourVAO=T,this.contourCount=0,this.contourColor=[0,0,0],this.contourEnable=!0,this.pickId=1,this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.lightPosition=[1e5,1e5,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.opacity=1,this._model=D,this._view=D,this._projection=D,this._resolution=[1,1]}function i(t){for(var e=A({colormap:t,nshades:256,format:"rgba"}),r=new Uint8Array(1024),n=0;256>n;++n){for(var i=e[n],o=0;3>o;++o)r[4*n+o]=i[o];r[4*n+3]=255*i[3]}return M(r,[256,256,4],[4,0,1])}function o(t,e,r){for(var n=new Array(e),i=0;e>i;++i)n[i]=0;for(var o=t.length,i=0;o>i;++i)for(var a=t[i],s=0;sn;++n)r[n]=t[n][2];return r}function s(t){var e=g(t,L);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e.attributes.normal.location=4,e}function l(t){var e=g(t,z);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e}function u(t){var e=g(t,I);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e.attributes.pointSize.location=4,e}function c(t){var e=g(t,P);return e.attributes.position.location=0,e.attributes.id.location=1,e}function h(t){var e=g(t,C);return e.attributes.position.location=0,e.attributes.id.location=1,e.attributes.pointSize.location=4,e}function f(t){var e=g(t,R);return e.attributes.position.location=0,e}function p(t){var e=t.gl,r=s(e),i=l(e),o=u(e),a=c(e),p=h(e),d=f(e),m=x(e,M(new Uint8Array([255,255,255,255]),[1,1,4]));m.generateMipmap(),m.minFilter=e.LINEAR_MIPMAP_LINEAR,m.magFilter=e.LINEAR;var g=v(e),b=v(e),_=v(e),w=v(e),A=v(e),k=y(e,[{buffer:g,type:e.FLOAT,size:3},{buffer:A,type:e.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:b,type:e.FLOAT,size:4},{buffer:_,type:e.FLOAT,size:2},{buffer:w,type:e.FLOAT,size:3}]),T=v(e),E=v(e),S=v(e),L=v(e),z=y(e,[{buffer:T,type:e.FLOAT,size:3},{buffer:L,type:e.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:E,type:e.FLOAT,size:4},{buffer:S,type:e.FLOAT,size:2}]),I=v(e),P=v(e),C=v(e),R=v(e),D=v(e),O=y(e,[{buffer:I,type:e.FLOAT,size:3},{buffer:D,type:e.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:P,type:e.FLOAT,size:4},{buffer:C,type:e.FLOAT,size:2},{buffer:R,type:e.FLOAT,size:1}]),j=v(e),F=y(e,[{buffer:j,type:e.FLOAT,size:3}]),N=new n(e,m,r,i,o,a,p,d,g,A,b,_,w,k,T,L,E,S,z,I,D,P,C,R,O,j,F);return N.update(t),N}var d=1e-6,m=1e-6,g=t("gl-shader"),v=t("gl-buffer"),y=t("gl-vao"),x=t("gl-texture2d"),b=t("normals"),_=t("gl-mat4/multiply"),w=t("gl-mat4/invert"),M=t("ndarray"),A=t("colormap"),k=t("simplicial-complex-contour"),T=t("typedarray-pool"),E=t("./lib/shaders"),S=t("./lib/closest-point"),L=E.meshShader,z=E.wireShader,I=E.pointShader,P=E.pickShader,C=E.pointPickShader,R=E.contourShader,D=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],O=n.prototype;O.isOpaque=function(){return this.opacity>=1},O.isTransparent=function(){return this.opacity<1},O.pickSlots=1,O.setPickBase=function(t){this.pickId=t},O.highlight=function(t){if(!t||!this.contourEnable)return void(this.contourCount=0);for(var e=k(this.cells,this.intensity,t.intensity),r=e.cells,n=e.vertexIds,i=e.vertexWeights,o=r.length,a=T.mallocFloat32(6*o),s=0,l=0;o>l;++l)for(var u=r[l],c=0;2>c;++c){var h=u[0];2===u.length&&(h=u[c]);for(var f=n[h][0],p=n[h][1],d=i[h],m=1-d,g=this.positions[f],v=this.positions[p],y=0;3>y;++y)a[s++]=d*g[y]+m*v[y]}this.contourCount=s/3|0,this.contourPositions.update(a.subarray(0,s)),T.free(a)},O.update=function(t){t=t||{};var e=this.gl;this.dirty=!0,"contourEnable"in t&&(this.contourEnable=t.contourEnable),"contourColor"in t&&(this.contourColor=t.contourColor),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"lightPosition"in t&&(this.lightPosition=t.lightPosition),"opacity"in t&&(this.opacity=t.opacity),"ambient"in t&&(this.ambientLight=t.ambient),"diffuse"in t&&(this.diffuseLight=t.diffuse),"specular"in t&&(this.specularLight=t.specular),"roughness"in t&&(this.roughness=t.roughness),"fresnel"in t&&(this.fresnel=t.fresnel),t.texture?(this.texture.dispose(),this.texture=x(e,t.texture)):t.colormap&&(this.texture.shape=[256,256],this.texture.minFilter=e.LINEAR_MIPMAP_LINEAR,this.texture.magFilter=e.LINEAR,this.texture.setPixels(i(t.colormap)),this.texture.generateMipmap());var r=t.cells,n=t.positions;if(n&&r){var s=[],l=[],u=[],c=[],h=[],f=[],p=[],g=[],v=[],y=[],_=[],w=[],M=[],A=[];this.cells=r,this.positions=n;var k=t.vertexNormals,T=t.cellNormals,E=void 0===t.vertexNormalsEpsilon?d:t.vertexNormalsEpsilon,S=void 0===t.faceNormalsEpsilon?m:t.faceNormalsEpsilon;t.useFacetNormals&&!T&&(T=b.faceNormals(r,n,S)),T||k||(k=b.vertexNormals(r,n,E));var L=t.vertexColors,z=t.cellColors,I=t.meshColor||[1,1,1,1],P=t.vertexUVs,C=t.vertexIntensity,R=t.cellUVs,D=t.cellIntensity,O=1/0,j=-(1/0);if(!P&&!R)if(C)for(var F=0;Fq;++q)!isNaN(V[q])&&isFinite(V[q])&&(this.bounds[0][q]=Math.min(this.bounds[0][q],V[q]),this.bounds[1][q]=Math.max(this.bounds[1][q],V[q]));var G=0,H=0,X=0;t:for(var F=0;Fq;++q)if(isNaN(V[q])||!isFinite(V[q]))continue t;y.push(V[0],V[1],V[2]);var Z;Z=L?L[W]:z?z[F]:I,3===Z.length?_.push(Z[0],Z[1],Z[2],1):_.push(Z[0],Z[1],Z[2],Z[3]);var Q;Q=P?P[W]:C?[(C[W]-O)/(j-O),0]:R?R[F]:D?[(D[F]-O)/(j-O),0]:[(V[2]-O)/(j-O),0],w.push(Q[0],Q[1]),B?M.push(B[W]):M.push(U),A.push(F),X+=1;break;case 2:for(var q=0;2>q;++q)for(var W=Y[q],V=n[W],K=0;3>K;++K)if(isNaN(V[K])||!isFinite(V[K]))continue t;for(var q=0;2>q;++q){var W=Y[q],V=n[W];f.push(V[0],V[1],V[2]);var Z;Z=L?L[W]:z?z[F]:I,3===Z.length?p.push(Z[0],Z[1],Z[2],1):p.push(Z[0],Z[1],Z[2],Z[3]);var Q;Q=P?P[W]:C?[(C[W]-O)/(j-O),0]:R?R[F]:D?[(D[F]-O)/(j-O),0]:[(V[2]-O)/(j-O),0],g.push(Q[0],Q[1]),v.push(F)}H+=1;break;case 3:for(var q=0;3>q;++q)for(var W=Y[q],V=n[W],K=0;3>K;++K)if(isNaN(V[K])||!isFinite(V[K]))continue t;for(var q=0;3>q;++q){var W=Y[q],V=n[W];s.push(V[0],V[1],V[2]);var Z;Z=L?L[W]:z?z[F]:I,3===Z.length?l.push(Z[0],Z[1],Z[2],1):l.push(Z[0],Z[1],Z[2],Z[3]);var Q;Q=P?P[W]:C?[(C[W]-O)/(j-O),0]:R?R[F]:D?[(D[F]-O)/(j-O),0]:[(V[2]-O)/(j-O),0],c.push(Q[0],Q[1]);var $;$=k?k[W]:T[F],u.push($[0],$[1],$[2]),h.push(F)}G+=1}}this.pointCount=X,this.edgeCount=H,this.triangleCount=G,this.pointPositions.update(y),this.pointColors.update(_),this.pointUVs.update(w),this.pointSizes.update(M),this.pointIds.update(new Uint32Array(A)),this.edgePositions.update(f),this.edgeColors.update(p),this.edgeUVs.update(g),this.edgeIds.update(new Uint32Array(v)),this.trianglePositions.update(s),this.triangleColors.update(l),this.triangleUVs.update(c),this.triangleNormals.update(u),this.triangleIds.update(new Uint32Array(h))}},O.drawTransparent=O.draw=function(t){t=t||{};for(var e=this.gl,r=t.model||D,n=t.view||D,i=t.projection||D,o=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],a=0;3>a;++a)o[0][a]=Math.max(o[0][a],this.clipBounds[0][a]),o[1][a]=Math.min(o[1][a],this.clipBounds[1][a]);var s={model:r,view:n,projection:i,clipBounds:o,kambient:this.ambientLight,kdiffuse:this.diffuseLight,kspecular:this.specularLight,roughness:this.roughness,fresnel:this.fresnel,eyePosition:[0,0,0],lightPosition:[0,0,0],opacity:this.opacity,contourColor:this.contourColor,texture:0};this.texture.bind(0);var l=new Array(16);_(l,s.view,s.model),_(l,s.projection,l),w(l,l);for(var a=0;3>a;++a)s.eyePosition[a]=l[12+a]/l[15];for(var u=l[15],a=0;3>a;++a)u+=this.lightPosition[a]*l[4*a+3];for(var a=0;3>a;++a){for(var c=l[12+a],h=0;3>h;++h)c+=l[4*h+a]*this.lightPosition[h];s.lightPosition[a]=c/u}if(this.triangleCount>0){var f=this.triShader;f.bind(),f.uniforms=s,this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()}if(this.edgeCount>0&&this.lineWidth>0){var f=this.lineShader;f.bind(),f.uniforms=s,this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()}if(this.pointCount>0){var f=this.pointShader;f.bind(),f.uniforms=s,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind()}if(this.contourEnable&&this.contourCount>0&&this.contourLineWidth>0){var f=this.contourShader;f.bind(),f.uniforms=s,this.contourVAO.bind(),e.drawArrays(e.LINES,0,this.contourCount),this.contourVAO.unbind()}},O.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||D,n=t.view||D,i=t.projection||D,o=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],a=0;3>a;++a)o[0][a]=Math.max(o[0][a],this.clipBounds[0][a]),o[1][a]=Math.min(o[1][a],this.clipBounds[1][a]);this._model=[].slice.call(r),this._view=[].slice.call(n),this._projection=[].slice.call(i),this._resolution=[e.drawingBufferWidth,e.drawingBufferHeight];var s={model:r,view:n,projection:i,clipBounds:o,pickId:this.pickId/255},l=this.pickShader;if(l.bind(),l.uniforms=s,this.triangleCount>0&&(this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()),this.edgeCount>0&&(this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()),this.pointCount>0){var l=this.pointPickShader;l.bind(),l.uniforms=s,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind()}},O.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;for(var e=t.value[0]+256*t.value[1]+65536*t.value[2],r=this.cells[e],n=this.positions,i=new Array(r.length),o=0;om;++m){var g=l[m],v=l[m+2],y=v-g,x=.5*(u[m+2]+u[m]),b=u[m+2]-u[m];e[m]=2*y/b,t[m]=2*(g-x)/b}o.bind(),i.bind(),o.attributes.dataCoord.pointer(),o.uniforms.dataShift=t,o.uniforms.dataScale=e;for(var _=0,m=0;2>m;++m){r[0]=r[1]=0,r[m]=1,o.uniforms.dataAxis=r,o.uniforms.lineWidth=h[m]/(c[m+2]-c[m])*d,o.uniforms.color=f[m];var w=6*a[m].length;p[m]&&w&&s.drawArrays(s.TRIANGLES,_,w),_+=w}}}(),c.drawTickMarks=function(){var t=[0,0],e=[0,0],r=[1,0],n=[0,1],o=[0,0],a=[0,0];return function(){for(var s=this.plot,u=this.vbo,c=this.tickShader,h=this.ticks,f=s.gl,p=s._tickBounds,d=s.dataBox,m=s.viewBox,g=s.pixelRatio,v=s.screenBox,y=v[2]-v[0],x=v[3]-v[1],b=m[2]-m[0],_=m[3]-m[1],w=0;2>w;++w){var M=p[w],A=p[w+2],k=A-M,T=.5*(d[w+2]+d[w]),E=d[w+2]-d[w];e[w]=2*k/E,t[w]=2*(M-T)/E}e[0]*=b/y,t[0]*=b/y,e[1]*=_/x,t[1]*=_/x,c.bind(),u.bind(),c.attributes.dataCoord.pointer();var S=c.uniforms;S.dataShift=t,S.dataScale=e;var L=s.tickMarkLength,z=s.tickMarkWidth,I=s.tickMarkColor,P=0,C=6*h[0].length,R=Math.min(l.ge(h[0],(d[0]-p[0])/(p[2]-p[0]),i),h[0].length),D=Math.min(l.gt(h[0],(d[2]-p[0])/(p[2]-p[0]),i),h[0].length),O=P+6*R,j=6*Math.max(0,D-R),F=Math.min(l.ge(h[1],(d[1]-p[1])/(p[3]-p[1]),i),h[1].length),N=Math.min(l.gt(h[1],(d[3]-p[1])/(p[3]-p[1]),i),h[1].length),B=C+6*F,U=6*Math.max(0,N-F);o[0]=2*(m[0]-L[1])/y-1,o[1]=(m[3]+m[1])/x-1,a[0]=L[1]*g/y,a[1]=z[1]*g/x,U&&(S.color=I[1],S.tickScale=a,S.dataAxis=n,S.screenOffset=o,f.drawArrays(f.TRIANGLES,B,U)),o[0]=(m[2]+m[0])/y-1,o[1]=2*(m[1]-L[0])/x-1,a[0]=z[0]*g/y,a[1]=L[0]*g/x,j&&(S.color=I[0],S.tickScale=a,S.dataAxis=r,S.screenOffset=o,f.drawArrays(f.TRIANGLES,O,j)),o[0]=2*(m[2]+L[3])/y-1,o[1]=(m[3]+m[1])/x-1,a[0]=L[3]*g/y,a[1]=z[3]*g/x,U&&(S.color=I[3],S.tickScale=a,S.dataAxis=n,S.screenOffset=o,f.drawArrays(f.TRIANGLES,B,U)),o[0]=(m[2]+m[0])/y-1,o[1]=2*(m[3]+L[2])/x-1,a[0]=z[2]*g/y,a[1]=L[2]*g/x,j&&(S.color=I[2],S.tickScale=a,S.dataAxis=r,S.screenOffset=o,f.drawArrays(f.TRIANGLES,O,j))}}(),c.update=function(){var t=[1,1,-1,-1,1,-1],e=[1,-1,1,1,-1,-1];return function(r){for(var n=r.ticks,i=r.bounds,o=new Float32Array(18*(n[0].length+n[1].length)),a=(this.plot.zeroLineEnable,0),s=[[],[]],l=0;2>l;++l)for(var u=s[l],c=n[l],h=i[l],f=i[l+2],p=0;pm;++m)o[a++]=d,o[a++]=t[m],o[a++]=e[m]}this.ticks=s,this.vbo.update(o)}}(),c.dispose=function(){this.vbo.dispose(),this.shader.dispose(),this.tickShader.dispose()}},{"./shaders":171,"binary-search-bounds":173,"gl-buffer":122,"gl-shader":191}],170:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.vbo=e,this.shader=r}function i(t){var e=t.gl,r=o(e,[-1,-1,-1,1,1,-1,1,1]),i=a(e,s.lineVert,s.lineFrag),l=new n(t,r,i);return l}e.exports=i;var o=t("gl-buffer"),a=t("gl-shader"),s=t("./shaders"),l=n.prototype;l.bind=function(){var t=this.shader;this.vbo.bind(),this.shader.bind(),t.attributes.coord.pointer(),t.uniforms.screenBox=this.plot.screenBox},l.drawLine=function(){var t=[0,0],e=[0,0];return function(r,n,i,o,a,s){var l=this.plot,u=this.shader,c=l.gl;t[0]=r,t[1]=n,e[0]=i,e[1]=o,u.uniforms.start=t,u.uniforms.end=e,u.uniforms.width=a*l.pixelRatio,u.uniforms.color=s,c.drawArrays(c.TRIANGLE_STRIP,0,4)}}(),l.dispose=function(){this.vbo.dispose(),this.shader.dispose()}},{"./shaders":171,"gl-buffer":122,"gl-shader":191}],171:[function(t,e,r){"use strict";var n="precision lowp float;\n#define GLSLIFY 1\nuniform vec4 color;\nvoid main() {\n gl_FragColor = vec4(color.xyz * color.w, color.w);\n}\n";e.exports={lineVert:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 coord;\n\nuniform vec4 screenBox;\nuniform vec2 start, end;\nuniform float width;\n\nvec2 perp(vec2 v) {\n return vec2(v.y, -v.x);\n}\n\nvec2 screen(vec2 v) {\n return 2.0 * (v - screenBox.xy) / (screenBox.zw - screenBox.xy) - 1.0;\n}\n\nvoid main() {\n vec2 delta = normalize(perp(start - end));\n vec2 offset = mix(start, end, 0.5 * (coord.y+1.0));\n gl_Position = vec4(screen(offset + 0.5 * width * delta * coord.x), 0, 1);\n}\n",lineFrag:n,textVert:"#define GLSLIFY 1\nattribute vec3 textCoordinate;\n\nuniform vec2 dataScale, dataShift, dataAxis, screenOffset, textScale;\nuniform float angle;\n\nvoid main() {\n float dataOffset = textCoordinate.z;\n vec2 glyphOffset = textCoordinate.xy;\n mat2 glyphMatrix = mat2(cos(angle), sin(angle), -sin(angle), cos(angle));\n vec2 screenCoordinate = dataAxis * (dataScale * dataOffset + dataShift) +\n glyphMatrix * glyphOffset * textScale + screenOffset;\n gl_Position = vec4(screenCoordinate, 0, 1);\n}\n",textFrag:n,gridVert:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 dataCoord;\n\nuniform vec2 dataAxis, dataShift, dataScale;\nuniform float lineWidth;\n\nvoid main() {\n vec2 pos = dataAxis * (dataScale * dataCoord.x + dataShift);\n pos += 10.0 * dataCoord.y * vec2(dataAxis.y, -dataAxis.x) + dataCoord.z * lineWidth;\n gl_Position = vec4(pos, 0, 1);\n}\n",gridFrag:n,boxVert:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 coord;\n\nuniform vec4 screenBox;\nuniform vec2 lo, hi;\n\nvec2 screen(vec2 v) {\n return 2.0 * (v - screenBox.xy) / (screenBox.zw - screenBox.xy) - 1.0;\n}\n\nvoid main() {\n gl_Position = vec4(screen(mix(lo, hi, coord)), 0, 1);\n}\n",tickVert:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 dataCoord;\n\nuniform vec2 dataAxis, dataShift, dataScale, screenOffset, tickScale;\n\nvoid main() {\n vec2 pos = dataAxis * (dataScale * dataCoord.x + dataShift);\n gl_Position = vec4(pos + tickScale*dataCoord.yz + screenOffset, 0, 1);\n}\n"}},{}],172:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.vbo=e,this.shader=r,this.tickOffset=[[],[]],this.tickX=[[],[]],this.labelOffset=[0,0],this.labelCount=[0,0]}function i(t){var e=t.gl,r=o(e),i=a(e,u.textVert,u.textFrag),s=new n(t,r,i);return s}e.exports=i;var o=t("gl-buffer"),a=t("gl-shader"),s=t("text-cache"),l=t("binary-search-bounds"),u=t("./shaders"),c=n.prototype;c.drawTicks=function(){var t=[0,0],e=[0,0],r=[0,0];return function(n){var i=this.plot,o=this.shader,a=this.tickX[n],s=this.tickOffset[n],u=i.gl,c=i.viewBox,h=i.dataBox,f=i.screenBox,p=i.pixelRatio,d=i.tickEnable,m=i.tickPad,g=i.tickColor,v=i.tickAngle,y=(i.tickMarkLength,i.labelEnable),x=i.labelPad,b=i.labelColor,_=i.labelAngle,w=this.labelOffset[n],M=this.labelCount[n],A=l.lt(a,h[n]),k=l.le(a,h[n+2]);t[0]=t[1]=0,t[n]=1,e[n]=(c[2+n]+c[n])/(f[2+n]-f[n])-1;var T=2/f[2+(1^n)]-f[1^n];e[1^n]=T*c[1^n]-1,d[n]&&(e[1^n]-=T*p*m[n],k>A&&s[k]>s[A]&&(o.uniforms.dataAxis=t,o.uniforms.screenOffset=e,o.uniforms.color=g[n],o.uniforms.angle=v[n],u.drawArrays(u.TRIANGLES,s[A],s[k]-s[A]))),y[n]&&M&&(e[1^n]-=T*p*x[n],o.uniforms.dataAxis=r,o.uniforms.screenOffset=e,o.uniforms.color=b[n],o.uniforms.angle=_[n],u.drawArrays(u.TRIANGLES,w,M)),e[1^n]=T*c[2+(1^n)]-1,d[n+2]&&(e[1^n]+=T*p*m[n+2],k>A&&s[k]>s[A]&&(o.uniforms.dataAxis=t,o.uniforms.screenOffset=e,o.uniforms.color=g[n+2],o.uniforms.angle=v[n+2],u.drawArrays(u.TRIANGLES,s[A],s[k]-s[A]))),y[n+2]&&M&&(e[1^n]+=T*p*x[n+2],o.uniforms.dataAxis=r,o.uniforms.screenOffset=e,o.uniforms.color=b[n+2],o.uniforms.angle=_[n+2],u.drawArrays(u.TRIANGLES,w,M))}}(),c.drawTitle=function(){var t=[0,0],e=[0,0];return function(){var r=this.plot,n=this.shader,i=r.gl,o=r.screenBox,a=r.titleCenter,s=r.titleAngle,l=r.titleColor,a=r.titleCenter,u=r.pixelRatio;if(this.titleCount){for(var c=0;2>c;++c)e[c]=2*(a[c]*u-o[c])/(o[2+c]-o[c])-1;n.bind(),n.uniforms.dataAxis=t,n.uniforms.screenOffset=e,n.uniforms.angle=s,n.uniforms.color=l,i.drawArrays(i.TRIANGLES,this.titleOffset,this.titleCount)}}}(),c.bind=function(){var t=[0,0],e=[0,0],r=[0,0];return function(){var n=this.plot,i=this.shader,o=n._tickBounds,a=n.dataBox,s=n.screenBox,l=n.viewBox;i.bind();for(var u=0;2>u;++u){var c=o[u],h=o[u+2],f=h-c,p=.5*(a[u+2]+a[u]),d=a[u+2]-a[u],m=l[u],g=l[u+2],v=g-m,y=s[u],x=s[u+2],b=x-y;e[u]=2*f/d*v/b,t[u]=2*(c-p)/d*v/b}r[1]=2*n.pixelRatio/(s[3]-s[1]),r[0]=r[1]*(s[3]-s[1])/(s[2]-s[0]),i.uniforms.dataScale=e,i.uniforms.dataShift=t,i.uniforms.textScale=r,this.vbo.bind(),i.attributes.textCoordinate.pointer()}}(),c.update=function(t){for(var e=[],r=t.ticks,n=t.bounds,i=0;2>i;++i){for(var o=[Math.floor(e.length/3)],a=[-(1/0)],l=r[i],u=0;ui;++i){this.labelOffset[i]=Math.floor(e.length/3);for(var m=s(t.labelFont[i],t.labels[i]).data,d=t.labelSize[i],u=0;ud;++d)if(h[d]&&n[d]<=0&&n[d+2]>=0){var m=e[d]-n[d]*(e[d+2]-e[d])/(n[d+2]-n[d]);0===d?a.drawLine(m,e[1],m,e[3],p[d],f[d]):a.drawLine(e[0],m,e[2],m,p[d],f[d])}}for(var d=0;dd;++d)s.drawTicks(d);this.titleEnable&&s.drawTitle();for(var x=this.overlays,d=0;du;++u){var c=s[u].slice(0);0!==c.length&&(c.sort(o),l[u]=Math.min(l[u],c[0].x),l[u+2]=Math.max(l[u+2],c[c.length-1].x))}this.grid.update({bounds:l,ticks:s}),this.text.update({bounds:l,ticks:s,labels:t.labels||["x","y"],labelSize:t.labelSize||[12,12],labelFont:t.labelFont||["sans-serif","sans-serif"],title:t.title||"",titleSize:t.titleSize||18,titleFont:t.titleFont||"sans-serif"}),this.setDirty()},f.dispose=function(){this.box.dispose(),this.grid.dispose(),this.text.dispose(),this.line.dispose();for(var t=this.objects.length-1;t>=0;--t)this.objects[t].dispose();this.objects.length=0;for(var t=this.overlays.length-1;t>=0;--t)this.overlays[t].dispose();this.overlays.length=0,this.gl=null},f.addObject=function(t){this.objects.indexOf(t)<0&&(this.objects.push(t),this.setDirty())},f.removeObject=function(t){for(var e=this.objects,r=0;re){var r=Math.round(Math.pow(10,-e));return Math.ceil(t*r)/r}if(e>0){var r=Math.round(Math.pow(10,e));return Math.ceil(t/r)*r}return Math.ceil(t)}function a(t){return"boolean"==typeof t?t:!0}function s(t){function e(){if(!_&&G.autoResize){var t=w.parentNode,e=1,r=1;t&&t!==document.body?(e=t.clientWidth,r=t.clientHeight):(e=window.innerWidth,r=window.innerHeight);var n=0|Math.ceil(e*G.pixelRatio),i=0|Math.ceil(r*G.pixelRatio);if(n!==w.width||i!==w.height){w.width=n,w.height=i;var o=w.style;o.position=o.position||"absolute",o.left="0px",o.top="0px",o.width=e+"px",o.height=r+"px",F=!0}}}function r(){for(var t=R.length,e=j.length,r=0;e>r;++r)O[r]=0;t:for(var r=0;t>r;++r){var n=R[r],i=n.pickSlots;if(i){for(var o=0;e>o;++o)if(O[o]+i<255){D[r]=o,n.setPickBase(O[o]+1),O[o]+=i;continue t}var a=f(A,q);D[r]=e,j.push(a),O.push(i),n.setPickBase(1),e+=1}else D[r]=-1}for(;e>0&&0===O[e-1];)O.pop(),j.pop().dispose()}function s(){return G.contextLost?!0:void(A.isContextLost()&&(G.contextLost=!0,G.mouseListener.enabled=!1,G.selection.object=null,G.oncontextloss&&G.oncontextloss()))}function y(){if(!s()){A.colorMask(!0,!0,!0,!0),A.depthMask(!0),A.disable(A.BLEND),A.enable(A.DEPTH_TEST);for(var t=R.length,e=j.length,r=0;e>r;++r){var n=j[r];n.shape=H,n.begin();for(var i=0;t>i;++i)if(D[i]===r){var o=R[i];o.drawPick&&(o.pixelRatio=1,o.drawPick(V))}n.end()}}}function x(){if(!s()){e();var t=G.camera.tick();V.view=G.camera.matrix,F=F||t,N=N||t,I.pixelRatio=G.pixelRatio,C.pixelRatio=G.pixelRatio;var r=R.length,n=W[0],i=W[1];n[0]=n[1]=n[2]=1/0,i[0]=i[1]=i[2]=-(1/0);for(var a=0;r>a;++a){var l=R[a];l.pixelRatio=G.pixelRatio,l.axes=G.axes,F=F||!!l.dirty,N=N||!!l.dirty;var u=l.bounds;if(u)for(var h=u[0],f=u[1],p=0;3>p;++p)n[p]=Math.min(n[p],h[p]),i[p]=Math.max(i[p],f[p])}var m=G.bounds;if(G.autoBounds)for(var p=0;3>p;++p){if(i[p]p;++p)x=x||Z[0][p]!==m[0][p]||Z[1][p]!==m[1][p],Z[0][p]=m[0][p],Z[1][p]=m[1][p];if(x){for(var b=[0,0,0],a=0;3>a;++a)b[a]=o((m[1][a]-m[0][a])/10);I.autoTicks?I.update({bounds:m,tickSpacing:b}):I.update({bounds:m})}N=N||x,F=F||x;var _=A.drawingBufferWidth,w=A.drawingBufferHeight;q[0]=_,q[1]=w,H[0]=0|Math.max(_/G.pixelRatio,1),H[1]=0|Math.max(w/G.pixelRatio,1),g(B,G.fovy,_/w,G.zNear,G.zFar);for(var a=0;16>a;++a)U[a]=0;U[15]=1;for(var M=0,a=0;3>a;++a)M=Math.max(M,m[1][a]-m[0][a]);for(var a=0;3>a;++a)G.autoScale?U[5*a]=G.aspect[a]/(m[1][a]-m[0][a]):U[5*a]=1/M,G.autoCenter&&(U[12+a]=.5*-U[5*a]*(m[0][a]+m[1][a]));for(var a=0;r>a;++a){var l=R[a];l.axesBounds=m,G.clipToBounds&&(l.clipBounds=m)}if(T.object&&(G.snapToData?C.position=T.dataCoordinate:C.position=T.dataPosition,C.bounds=m),N&&(N=!1,y()),F){G.axesPixels=c(G.axes,V,_,w),G.onrender&&G.onrender(),A.bindFramebuffer(A.FRAMEBUFFER,null),A.viewport(0,0,_,w);var k=G.clearColor;A.clearColor(k[0],k[1],k[2],k[3]),A.clear(A.COLOR_BUFFER_BIT|A.DEPTH_BUFFER_BIT),A.depthMask(!0),A.colorMask(!0,!0,!0,!0),A.enable(A.DEPTH_TEST),A.depthFunc(A.LEQUAL),A.disable(A.BLEND),A.disable(A.CULL_FACE);var L=!1;I.enable&&(L=L||I.isTransparent(),I.draw(V)),C.axes=I,T.object&&C.draw(V),A.disable(A.CULL_FACE);for(var a=0;r>a;++a){var l=R[a];l.axes=I,l.pixelRatio=G.pixelRatio,l.isOpaque&&l.isOpaque()&&l.draw(V),l.isTransparent&&l.isTransparent()&&(L=!0)}if(L){E.shape=q,E.bind(),A.clear(A.DEPTH_BUFFER_BIT),A.colorMask(!1,!1,!1,!1),A.depthMask(!0),A.depthFunc(A.LESS),I.enable&&I.isTransparent()&&I.drawTransparent(V);for(var a=0;r>a;++a){var l=R[a];l.isOpaque&&l.isOpaque()&&l.draw(V)}A.enable(A.BLEND),A.blendEquation(A.FUNC_ADD),A.blendFunc(A.ONE,A.ONE_MINUS_SRC_ALPHA),A.colorMask(!0,!0,!0,!0),A.depthMask(!1),A.clearColor(0,0,0,0),A.clear(A.COLOR_BUFFER_BIT),I.isTransparent()&&I.drawTransparent(V);for(var a=0;r>a;++a){var l=R[a];l.isTransparent&&l.isTransparent()&&l.drawTransparent(V)}A.bindFramebuffer(A.FRAMEBUFFER,null),A.blendFunc(A.ONE,A.ONE_MINUS_SRC_ALPHA),A.disable(A.DEPTH_TEST),S.bind(),E.color[0].bind(0),S.uniforms.accumBuffer=0,d(A),A.disable(A.BLEND)}F=!1;for(var a=0;r>a;++a)R[a].dirty=!1}}}function b(){_||G.contextLost||(requestAnimationFrame(b),x())}t=t||{};var _=!1,w=(t.pixelRatio||parseFloat(window.devicePixelRatio),t.canvas);if(!w)if(w=document.createElement("canvas"),t.container){var M=t.container;M.appendChild(w)}else document.body.appendChild(w);var A=t.gl;if(A||(A=i(w,t.glOptions||{premultipliedAlpha:!0,antialias:!0})),!A)throw new Error("webgl not supported");var k=t.bounds||[[-10,-10,-10],[10,10,10]],T=new n,E=p(A,[A.drawingBufferWidth,A.drawingBufferHeight],{preferFloat:!0}),S=v(A),L=t.camera||{eye:[2,0,0],center:[0,0,0],up:[0,1,0],zoomMin:.1,zoomMax:100,mode:"turntable"},z=t.axes||{},I=u(A,z);I.enable=!z.disable;var P=t.spikes||{},C=h(A,P),R=[],D=[],O=[],j=[],F=!0,N=!0,B=new Array(16),U=new Array(16),V={view:null,projection:B,model:U},N=!0,q=[A.drawingBufferWidth,A.drawingBufferHeight],G={gl:A,contextLost:!1,pixelRatio:t.pixelRatio||parseFloat(window.devicePixelRatio),canvas:w,selection:T,camera:l(w,L),axes:I,axesPixels:null,spikes:C,bounds:k,objects:R,shape:q,aspect:t.aspectRatio||[1,1,1],pickRadius:t.pickRadius||10,zNear:t.zNear||.01,zFar:t.zFar||1e3,fovy:t.fovy||Math.PI/4,clearColor:t.clearColor||[0,0,0,0],autoResize:a(t.autoResize),autoBounds:a(t.autoBounds),autoScale:!!t.autoScale,autoCenter:a(t.autoCenter),clipToBounds:a(t.clipToBounds),snapToData:!!t.snapToData,onselect:t.onselect||null,onrender:t.onrender||null,onclick:t.onclick||null,cameraParams:V,oncontextloss:null,mouseListener:null},H=[A.drawingBufferWidth/G.pixelRatio|0,A.drawingBufferHeight/G.pixelRatio|0];G.autoResize&&e(),window.addEventListener("resize",e),G.update=function(t){_||(t=t||{},F=!0,N=!0)},G.add=function(t){_||(t.axes=I,R.push(t),D.push(-1),F=!0,N=!0,r())},G.remove=function(t){if(!_){var e=R.indexOf(t);0>e||(R.splice(e,1),D.pop(),F=!0,N=!0,r())}},G.dispose=function(){if(!_&&(_=!0,window.removeEventListener("resize",e),w.removeEventListener("webglcontextlost",s),G.mouseListener.enabled=!1,!G.contextLost)){I.dispose(),C.dispose();for(var t=0;ts;++s){var l=j[s].query(e,H[1]-r-1,G.pickRadius);if(l){if(l.distance>T.distance)continue;for(var u=0;i>u;++u){var c=R[u];if(D[u]===s){var h=c.pick(l);h&&(T.buttons=t,T.screen=l.coord,T.distance=l.distance,T.object=c,T.index=h.distance,T.dataPosition=h.position,T.dataCoordinate=h.dataCoordinate,T.data=h,a=!0)}}}}}o&&o!==T.object&&(o.highlight&&o.highlight(null),F=!0),T.object&&(T.object.highlight&&T.object.highlight(T.data),F=!0),a=a||T.object!==o,a&&G.onselect&&G.onselect(T),1&t&&!(1&Y)&&G.onclick&&G.onclick(T),Y=t}}),w.addEventListener("webglcontextlost",s);var W=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],Z=[W[0].slice(),W[1].slice()];return b(),G.redraw=function(){_||(F=!0,x())},G}e.exports=s;var l=t("3d-view-controls"),u=t("gl-axes3d"),c=t("gl-axes3d/properties"),h=t("gl-spikes3d"),f=t("gl-select-static"),p=t("gl-fbo"),d=t("a-big-triangle"),m=t("mouse-change"),g=t("gl-mat4/perspective"),v=t("./lib/shader")},{"./lib/shader":175,"3d-view-controls":21,"a-big-triangle":23,"gl-axes3d":114,"gl-axes3d/properties":121,"gl-fbo":129,"gl-mat4/perspective":146,"gl-select-static":190,"gl-spikes3d":200,"mouse-change":385}],177:[function(t,e,r){function n(t,e,r,n){var i,o,a,s,l,u=e[0],c=e[1],h=e[2],f=e[3],p=r[0],d=r[1],m=r[2],g=r[3];return o=u*p+c*d+h*m+f*g,0>o&&(o=-o,p=-p,d=-d,m=-m,g=-g),1-o>1e-6?(i=Math.acos(o),a=Math.sin(i),s=Math.sin((1-n)*i)/a,l=Math.sin(n*i)/a):(s=1-n,l=n),t[0]=s*u+l*p,t[1]=s*c+l*d,t[2]=s*h+l*m,t[3]=s*f+l*g,t}e.exports=n},{}],178:[function(t,e,r){"use strict";e.exports={vertex:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec2 offset;\nattribute vec4 color;\n\nuniform mat3 viewTransform;\nuniform vec2 pixelScale;\n\nvarying vec4 fragColor;\n\nvec4 computePosition_1_0(vec2 position, vec2 offset, mat3 view, vec2 scale) {\n vec3 xposition = view * vec3(position, 1.0);\n return vec4(\n xposition.xy + scale * offset * xposition.z,\n 0,\n xposition.z);\n}\n\n\n\n\nvoid main() {\n fragColor = color;\n\n gl_Position = computePosition_1_0(\n position,\n offset,\n viewTransform,\n pixelScale);\n}\n",fragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = vec4(fragColor.rgb * fragColor.a, fragColor.a);\n}\n",pickVertex:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec2 offset;\nattribute vec4 id;\n\nuniform mat3 viewTransform;\nuniform vec2 pixelScale;\nuniform vec4 pickOffset;\n\nvarying vec4 fragColor;\n\nvec4 computePosition_1_0(vec2 position, vec2 offset, mat3 view, vec2 scale) {\n vec3 xposition = view * vec3(position, 1.0);\n return vec4(\n xposition.xy + scale * offset * xposition.z,\n 0,\n xposition.z);\n}\n\n\n\n\nvoid main() {\n vec4 fragId = id + pickOffset;\n\n fragId.y += floor(fragId.x / 256.0);\n fragId.x -= floor(fragId.x / 256.0) * 256.0;\n\n fragId.z += floor(fragId.y / 256.0);\n fragId.y -= floor(fragId.y / 256.0) * 256.0;\n\n fragId.w += floor(fragId.z / 256.0);\n fragId.z -= floor(fragId.z / 256.0) * 256.0;\n\n fragColor = fragId / 255.0;\n\n gl_Position = computePosition_1_0(\n position,\n offset,\n viewTransform,\n pixelScale);\n}\n",pickFragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = fragColor;\n}\n"}},{}],179:[function(t,e,r){"use strict";function n(t){if(t in f)return f[t];var e=c(t,{polygons:!0,font:"sans-serif",textAlign:"left",textBaseline:"alphabetic"}),r=[],n=[];e.forEach(function(t){t.forEach(function(t){for(var e=0;ea;++a)i[a]=Math.min(i[a],r[o+a]),i[2+a]=Math.max(i[2+a],r[o+a]);return f[t]={coords:r,normals:n,bounds:i}}function i(t,e,r,n,i,o,a){this.plot=t,this.shader=e,this.pickShader=r,this.positionBuffer=n,this.offsetBuffer=i,this.colorBuffer=o,this.idBuffer=a,this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.numPoints=0,this.numVertices=0,this.pickOffset=0,this.points=null}function o(t,e){var r=t.gl,n=a(r,h.vertex,h.fragment),o=a(r,h.pickVertex,h.pickFragment),l=s(r),u=s(r),c=s(r),f=s(r),p=new i(t,n,o,l,u,c,f);return p.update(e),t.addObject(p),p}e.exports=o;var a=t("gl-shader"),s=t("gl-buffer"),l=t("text-cache"),u=t("typedarray-pool"),c=t("vectorize-text"),h=t("./lib/shaders"),f={},p=i.prototype;!function(){function t(){var t=this.plot,n=this.bounds,i=t.viewBox,o=t.dataBox,a=t.pixelRatio,s=n[2]-n[0],l=n[3]-n[1],u=o[2]-o[0],c=o[3]-o[1];e[0]=2*s/u,e[4]=2*l/c,e[6]=2*(n[0]-o[0])/u-1,e[7]=2*(n[1]-o[1])/c-1;var h=i[2]-i[0],f=i[3]-i[1];r[0]=2*a/h,r[1]=2*a/f}var e=[1,0,0,0,1,0,0,0,1],r=[1,1];p.draw=function(){var n=this.plot,i=this.shader,o=this.numVertices;if(o){var a=n.gl;t.call(this),i.bind(),i.uniforms.pixelScale=r,i.uniforms.viewTransform=e,this.positionBuffer.bind(),i.attributes.position.pointer(),this.offsetBuffer.bind(),i.attributes.offset.pointer(),this.colorBuffer.bind(),i.attributes.color.pointer(a.UNSIGNED_BYTE,!0),a.drawArrays(a.TRIANGLES,0,o)}};var n=[0,0,0,0];p.drawPick=function(i){var o=this.plot,a=this.pickShader,s=this.numVertices,l=o.gl;if(this.pickOffset=i,!s)return i;for(var u=0;4>u;++u)n[u]=i>>8*u&255;return t.call(this),a.bind(),a.uniforms.pixelScale=r,a.uniforms.viewTransform=e,a.uniforms.pickOffset=n,this.positionBuffer.bind(),a.attributes.position.pointer(),this.offsetBuffer.bind(),a.attributes.offset.pointer(),this.idBuffer.bind(),a.attributes.id.pointer(l.UNSIGNED_BYTE,!1),l.drawArrays(l.TRIANGLES,0,s),i+this.numPoints}}(),p.pick=function(t,e,r){var n=this.pickOffset,i=this.numPoints;if(n>r||r>=n+i)return null;var o=r-n,a=this.points;return{object:this,pointId:o,dataCoord:[a[2*o],a[2*o+1]]}},p.update=function(t){t=t||{};var e=t.positions||[],r=t.colors||[],i=t.glyphs||[],o=t.sizes||[],a=t.borderWidths||[],s=t.borderColors||[]; -this.points=e;for(var c=this.bounds=[1/0,1/0,-(1/0),-(1/0)],h=0,f=0;f>1;for(var p=0;2>p;++p)c[p]=Math.min(c[p],e[2*f+p]),c[2+p]=Math.max(c[2+p],e[2*f+p])}c[0]===c[2]&&(c[2]+=1),c[3]===c[1]&&(c[3]+=1);for(var d=1/(c[2]-c[0]),m=1/(c[3]-c[1]),g=c[0],v=c[1],y=u.mallocFloat32(2*h),x=u.mallocFloat32(2*h),b=u.mallocUint8(4*h),_=u.mallocUint32(h),w=0,f=0;f=o?i(0,o-1,t,e,r,n):h(0,o-1,t,e,r,n)}function i(t,e,r,n,i,o){for(var a=t+1;e>=a;++a){for(var s=r[a],l=n[2*a],u=n[2*a+1],c=i[a],h=o[a],f=a;f>t;){var p=r[f-1],d=n[2*(f-1)];if((p-s||l-d)>=0)break;r[f]=p,n[2*f]=d,n[2*f+1]=n[2*f-1],i[f]=i[f-1],o[f]=o[f-1],f-=1}r[f]=s,n[2*f]=l,n[2*f+1]=u,i[f]=c,o[f]=h}}function o(t,e,r,n,i,o){var a=r[t],s=n[2*t],l=n[2*t+1],u=i[t],c=o[t];r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],o[t]=o[e],r[e]=a,n[2*e]=s,n[2*e+1]=l,i[e]=u,o[e]=c}function a(t,e,r,n,i,o){r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],o[t]=o[e]}function s(t,e,r,n,i,o,a){var s=n[t],l=i[2*t],u=i[2*t+1],c=o[t],h=a[t];n[t]=n[e],i[2*t]=i[2*e],i[2*t+1]=i[2*e+1],o[t]=o[e],a[t]=a[e],n[e]=n[r],i[2*e]=i[2*r],i[2*e+1]=i[2*r+1],o[e]=o[r],a[e]=a[r],n[r]=s,i[2*r]=l,i[2*r+1]=u,o[r]=c,a[r]=h}function l(t,e,r,n,i,o,a,s,l,u,c){s[t]=s[e],l[2*t]=l[2*e],l[2*t+1]=l[2*e+1],u[t]=u[e],c[t]=c[e],s[e]=r,l[2*e]=n,l[2*e+1]=i,u[e]=o,c[e]=a}function u(t,e,r,n,i){return(r[t]-r[e]||n[2*e]-n[2*t]||i[t]-i[e])<0}function c(t,e,r,n,i,o,a,s){return(e-o[t]||a[2*t]-r||i-s[t])<0}function h(t,e,r,n,p,d){var m=(e-t+1)/6|0,g=t+m,v=e-m,y=t+e>>1,x=y-m,b=y+m,_=g,w=x,M=y,A=b,k=v,T=t+1,E=e-1,S=0;u(_,w,r,n,p,d)&&(S=_,_=w,w=S),u(A,k,r,n,p,d)&&(S=A,A=k,k=S),u(_,M,r,n,p,d)&&(S=_,_=M,M=S),u(w,M,r,n,p,d)&&(S=w,w=M,M=S),u(_,A,r,n,p,d)&&(S=_,_=A,A=S),u(M,A,r,n,p,d)&&(S=M,M=A,A=S),u(w,k,r,n,p,d)&&(S=w,w=k,k=S),u(w,M,r,n,p,d)&&(S=w,w=M,M=S),u(A,k,r,n,p,d)&&(S=A,A=k,k=S);var L=r[w],z=n[2*w],I=n[2*w+1],P=p[w],C=d[w],R=r[A],D=n[2*A],O=n[2*A+1],j=p[A],F=d[A],N=_,B=M,U=k,V=g,q=y,G=v,H=r[N],X=r[B],Y=r[U];r[V]=H,r[q]=X,r[G]=Y;for(var W=0;2>W;++W){var Z=n[2*N+W],Q=n[2*B+W],K=n[2*U+W];n[2*V+W]=Z,n[2*q+W]=Q,n[2*G+W]=K}var $=p[N],J=p[B],tt=p[U];p[V]=$,p[q]=J,p[G]=tt;var et=d[N],rt=d[B],nt=d[U];d[V]=et,d[q]=rt,d[G]=nt,a(x,t,r,n,p,d),a(b,e,r,n,p,d);for(var it=T;E>=it;++it)if(c(it,L,z,I,P,r,n,p))it!==T&&o(it,T,r,n,p,d),++T;else if(!c(it,R,D,O,j,r,n,p))for(;;){if(c(E,R,D,O,j,r,n,p)){c(E,L,z,I,P,r,n,p)?(s(it,T,E,r,n,p,d),++T,--E):(o(it,E,r,n,p,d),--E);break}if(--E=T-2-t?i(t,T-2,r,n,p,d):h(t,T-2,r,n,p,d),f>=e-(E+2)?i(E+2,e,r,n,p,d):h(E+2,e,r,n,p,d),f>=E-T?i(T,E,r,n,p,d):h(T,E,r,n,p,d)}e.exports=n;var f=32},{}],183:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a,s){for(var l=r,u=r;n>u;++u){var c=t[2*u],h=t[2*u+1],f=e[u];c>=i&&a>=c&&h>=o&&s>=h&&(u===l?l+=1:(t[2*u]=t[2*l],t[2*u+1]=t[2*l+1],e[u]=e[l],t[2*l]=c,t[2*l+1]=h,e[l]=f,l+=1))}return l}function i(t,e,r){this.pixelSize=t,this.offset=e,this.count=r}function o(t,e,r,o){function l(i,o,a,s,u,c){var h=.5*a,f=s+1,p=u-s;r[_]=p,b[_++]=c;for(var d=0;2>d;++d)for(var m=0;2>m;++m){var g=i+d*h,v=o+m*h,y=n(t,e,f,u,g,v,g+h,v+h);if(y!==f){if(y-f>=Math.max(.9*p,32)){var x=u+s>>>1;l(g,v,h,f,x,c+1),f=x}l(g,v,h,f,y,c+1),f=y}}}var u=t.length>>>1;if(1>u)return[];for(var c=1/0,h=1/0,f=-(1/0),p=-(1/0),d=0;u>d;++d){var m=t[2*d],g=t[2*d+1];c=Math.min(c,m),f=Math.max(f,m),h=Math.min(h,g),p=Math.max(p,g),e[d]=d}c===f&&(f+=1+Math.abs(f)),h===p&&(p+=1+Math.abs(f));var v=1/(f-c),y=1/(p-h),x=Math.max(f-c,p-h);o=o||[0,0,0,0],o[0]=c,o[1]=h,o[2]=f,o[3]=p;var b=a.mallocInt32(u),_=0;l(c,h,x,0,u,0),s(b,t,e,r,u);for(var w=[],M=0,A=u,_=u-1;_>=0;--_){t[2*_]=(t[2*_]-c)*v,t[2*_+1]=(t[2*_+1]-h)*y;var k=b[_];k!==M&&(w.push(new i(x*Math.pow(.5,k),_+1,A-(_+1))),A=_+1,M=k)}return w.push(new i(x*Math.pow(.5,k+1),0,A)),a.free(b),w}var a=t("typedarray-pool"),s=t("./lib/sort");e.exports=o},{"./lib/sort":182,"typedarray-pool":468}],184:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){this.plot=t,this.offsetBuffer=e,this.pickBuffer=r,this.weightBuffer=n,this.shader=i,this.pickShader=o,this.scales=[],this.size=12,this.borderSize=1,this.pointCount=0,this.color=[1,0,0,1],this.borderColor=[0,0,0,1],this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.pickOffset=0,this.points=null,this.xCoords=null}function i(t,e){var r=t.gl,i=a(r),s=a(r),l=a(r),u=o(r,c.pointVertex,c.pointFragment),h=o(r,c.pickVertex,c.pickFragment),f=new n(t,i,s,l,u,h);return f.update(e),t.addObject(f),f}var o=t("gl-shader"),a=t("gl-buffer"),s=t("binary-search-bounds"),l=t("snap-points-2d"),u=t("typedarray-pool"),c=t("./lib/shader");e.exports=i;var h=n.prototype;h.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.offsetBuffer.dispose(),this.pickBuffer.dispose(),this.xCoords&&u.free(this.xCoords),this.plot.removeObject(this)},h.update=function(t){function e(e,r){return e in t?t[e]:r}t=t||{},this.size=e("size",12),this.color=e("color",[1,0,0,1]).slice(),this.borderSize=e("borderSize",1),this.borderColor=e("borderColor",[0,0,0,1]).slice(),this.xCoords&&u.free(this.xCoords);var r=t.positions,n=u.mallocFloat32(r.length),i=u.mallocInt32(r.length>>>1);n.set(r);var o=u.mallocFloat32(r.length);this.points=r,this.scales=l(n,i,o,this.bounds),this.offsetBuffer.update(n),this.pickBuffer.update(i),this.weightBuffer.update(o);for(var a=u.mallocFloat32(r.length>>>1),s=0,c=0;s>>1,this.pickOffset=0},h.drawPick=function(){var t=[1,0,0,0,1,0,0,0,1],e=[0,0,0,0];return function(r){var n=this.plot,i=this.pickShader,o=this.scales,a=this.offsetBuffer,l=this.pickBuffer,u=this.bounds,c=this.size,h=this.borderSize,f=n.gl,p=n.pickPixelRatio,d=n.viewBox,m=n.dataBox;if(0===this.pointCount)return r;var g=u[2]-u[0],v=u[3]-u[1],y=m[2]-m[0],x=m[3]-m[1],b=(d[2]-d[0])*p/n.pixelRatio,_=(d[3]-d[1])*p/n.pixelRatio,w=Math.min(y/b,x/_);t[0]=2*g/y,t[4]=2*v/x,t[6]=2*(u[0]-m[0])/y-1,t[7]=2*(u[1]-m[1])/x-1,this.pickOffset=r,e[0]=255&r,e[1]=r>>8&255,e[2]=r>>16&255,e[3]=r>>24&255,i.bind(),i.uniforms.matrix=t,i.uniforms.color=this.color,i.uniforms.borderColor=this.borderColor,i.uniforms.pointSize=p*(c+h),i.uniforms.pickOffset=e,0===this.borderSize?i.uniforms.centerFraction=2:i.uniforms.centerFraction=c/(c+h+1.25),a.bind(),i.attributes.position.pointer(),l.bind(),i.attributes.pickId.pointer(f.UNSIGNED_BYTE);for(var M=this.xCoords,A=(m[0]-u[0]-w*c*p)/g,k=(m[2]-u[0]+w*c*p)/g,T=o.length-1;T>=0;--T){var E=o[T];if(!(E.pixelSize1)){var S=E.offset,L=E.count+S,z=s.ge(M,A,S,L-1),I=s.lt(M,k,z,L-1)+1;I>z&&f.drawArrays(f.POINTS,z,I-z)}}return r+this.pointCount}}(),h.draw=function(){var t=[1,0,0,0,1,0,0,0,1];return function(){var e=this.plot,r=this.shader,n=this.scales,i=this.offsetBuffer,o=this.bounds,a=this.size,l=this.borderSize,u=e.gl,c=e.pixelRatio,h=e.viewBox,f=e.dataBox;if(0!==this.pointCount){var p=o[2]-o[0],d=o[3]-o[1],m=f[2]-f[0],g=f[3]-f[1],v=h[2]-h[0],y=h[3]-h[1],x=Math.min(m/v,g/y);t[0]=2*p/m,t[4]=2*d/g,t[6]=2*(o[0]-f[0])/m-1,t[7]=2*(o[1]-f[1])/g-1,r.bind(),r.uniforms.matrix=t,r.uniforms.color=this.color,r.uniforms.borderColor=this.borderColor,r.uniforms.pointSize=c*(a+l),r.uniforms.useWeight=1,0===this.borderSize?r.uniforms.centerFraction=2:r.uniforms.centerFraction=a/(a+l+1.25),i.bind(),r.attributes.position.pointer(),this.weightBuffer.bind(),r.attributes.weight.pointer();for(var b=this.xCoords,_=(f[0]-o[0]-x*a*c)/p,w=(f[2]-o[0]+x*a*c)/p,M=!0,A=n.length-1;A>=0;--A){var k=n[A];if(!(k.pixelSize1)){var T=k.offset,E=k.count+T,S=s.ge(b,_,T,E-1),L=s.lt(b,w,S,E-1)+1;L>S&&u.drawArrays(u.POINTS,S,L-S),M&&(M=!1,r.uniforms.useWeight=0)}}}}}(),h.pick=function(t,e,r){var n=this.pickOffset,i=this.pointCount;if(n>r||r>=n+i)return null;var o=r-n,a=this.points;return{object:this,pointId:o,dataCoord:[a[2*o],a[2*o+1]]}}},{"./lib/shader":180,"binary-search-bounds":181,"gl-buffer":122,"gl-shader":191,"snap-points-2d":183,"typedarray-pool":468}],185:[function(t,e,r){"use strict";function n(t,e){var r=o[e];if(r||(r=o[e]={}),t in r)return r[t];for(var n=i(t,{textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),a=i(t,{triangles:!0,textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),s=[[1/0,1/0],[-(1/0),-(1/0)]],l=0;lc;++c)s[0][c]=Math.min(s[0][c],u[c]),s[1][c]=Math.max(s[1][c],u[c]);return r[t]=[a,n,s]}var i=t("vectorize-text");e.exports=n;var o={}},{"vectorize-text":480}],186:[function(t,e,r){function n(t,e){var r=i(t,e),n=r.attributes;return n.position.location=0,n.color.location=1,n.glyph.location=2,n.id.location=3,r}var i=t("gl-shader"),o="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 glyph;\nattribute vec4 id;\n\n\nuniform vec4 highlightId;\nuniform float highlightScale;\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1])) ) {\n gl_Position = vec4(0,0,0,0);\n } else {\n float scale = 1.0;\n if(distance(highlightId, id) < 0.0001) {\n scale = highlightScale;\n }\n\n vec4 worldPosition = model * vec4(position, 1);\n vec4 viewPosition = view * worldPosition;\n viewPosition = viewPosition / viewPosition.w;\n vec4 clipPosition = projection * (viewPosition + scale * vec4(glyph.x, -glyph.y, 0, 0));\n \n gl_Position = clipPosition;\n interpColor = color;\n pickId = id;\n dataCoordinate = position;\n }\n}",a="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 glyph;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform vec2 screenSize;\nuniform vec3 clipBounds[2];\nuniform float highlightScale, pixelRatio;\nuniform vec4 highlightId;\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || any(greaterThan(position, clipBounds[1]))) {\n gl_Position = vec4(0,0,0,0);\n } else {\n float scale = pixelRatio;\n if(distance(highlightId.bgr, id.bgr) < 0.001) {\n scale *= highlightScale;\n }\n\n vec4 worldPosition = model * vec4(position, 1.0);\n vec4 viewPosition = view * worldPosition;\n vec4 clipPosition = projection * viewPosition;\n clipPosition /= clipPosition.w;\n \n gl_Position = clipPosition + vec4(screenSize * scale * vec2(glyph.x, -glyph.y), 0.0, 0.0);\n interpColor = color;\n pickId = id;\n dataCoordinate = position;\n }\n}",s="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 glyph;\nattribute vec4 id;\n\nuniform float highlightScale;\nuniform vec4 highlightId;\nuniform vec3 axes[2];\nuniform mat4 model, view, projection;\nuniform vec2 screenSize;\nuniform vec3 clipBounds[2];\nuniform float scale, pixelRatio;\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) ||\n any(greaterThan(position, clipBounds[1])) ) {\n gl_Position = vec4(0,0,0,0);\n } else {\n float lscale = pixelRatio * scale;\n if(distance(highlightId, id) < 0.0001) {\n lscale *= highlightScale;\n }\n\n vec4 clipCenter = projection * view * model * vec4(position, 1);\n vec3 dataPosition = position + 0.5*lscale*(axes[0] * glyph.x + axes[1] * glyph.y) * clipCenter.w * screenSize.y;\n vec4 clipPosition = projection * view * model * vec4(dataPosition, 1);\n\n gl_Position = clipPosition;\n interpColor = color;\n pickId = id;\n dataCoordinate = dataPosition;\n }\n}\n",l="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 fragClipBounds[2];\nuniform float opacity;\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if(any(lessThan(dataCoordinate, fragClipBounds[0])) ||\n any(greaterThan(dataCoordinate, fragClipBounds[1])) ) {\n discard;\n } else {\n gl_FragColor = interpColor * opacity;\n }\n}\n",u="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 fragClipBounds[2];\nuniform float pickGroup;\n\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if(any(lessThan(dataCoordinate, fragClipBounds[0])) || \n any(greaterThan(dataCoordinate, fragClipBounds[1])) ) {\n discard;\n } else {\n gl_FragColor = vec4(pickGroup, pickId.bgr);\n }\n}",c=[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"glyph",type:"vec2"},{name:"id",type:"vec4"}],h={vertex:o,fragment:l,attributes:c},f={vertex:a,fragment:l,attributes:c},p={vertex:s,fragment:l,attributes:c},d={vertex:o,fragment:u,attributes:c},m={vertex:a,fragment:u,attributes:c},g={vertex:s,fragment:u,attributes:c};r.createPerspective=function(t){return n(t,h)},r.createOrtho=function(t){return n(t,f)},r.createProject=function(t){return n(t,p)},r.createPickPerspective=function(t){return n(t,d)},r.createPickOrtho=function(t){return n(t,m)},r.createPickProject=function(t){return n(t,g)}},{"gl-shader":191}],187:[function(t,e,r){"use strict";function n(t,e){var r=t[0],n=t[1],i=t[2],o=t[3];return t[0]=e[0]*r+e[4]*n+e[8]*i+e[12]*o,t[1]=e[1]*r+e[5]*n+e[9]*i+e[13]*o,t[2]=e[2]*r+e[6]*n+e[10]*i+e[14]*o,t[3]=e[3]*r+e[7]*n+e[11]*i+e[15]*o,t}function i(t,e,r,i){return n(i,i,r),n(i,i,e),n(i,i,t)}function o(t,e){this.index=t,this.dataCoordinate=this.position=e}function a(t,e,r,n,i,a,s,l,u,c,h,f){this.gl=t,this.pixelRatio=1,this.shader=e,this.orthoShader=r,this.projectShader=n,this.pointBuffer=i,this.colorBuffer=a,this.glyphBuffer=s,this.idBuffer=l,this.vao=u,this.vertexCount=0,this.lineVertexCount=0,this.opacity=1,this.lineWidth=0,this.projectScale=[2/3,2/3,2/3],this.projectOpacity=[1,1,1],this.pickId=0,this.pickPerspectiveShader=c,this.pickOrthoShader=h,this.pickProjectShader=f,this.points=[],this._selectResult=new o(0,[0,0,0]),this.useOrtho=!0,this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.axesProject=[!0,!0,!0],this.axesBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.highlightId=[1,1,1,1],this.highlightScale=2,this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.dirty=!0}function s(t){return t[0]=t[1]=t[2]=0,t}function l(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=1,t}function u(t,e,r,n){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[r]=n,t}function c(t){for(var e=L,r=0;2>r;++r)for(var n=0;3>n;++n)e[r][n]=Math.max(Math.min(t[r][n],1e8),-1e8);return e}function h(t,e,r,n,o){var a,h=e.axesProject,f=e.gl,p=t.uniforms,d=r.model||b,m=r.view||b,g=r.projection||b,y=e.axesBounds,x=c(e.clipBounds);a=e.axes?e.axes.lastCubeProps.axis:[1,1,1],w[0]=2/f.drawingBufferWidth,w[1]=2/f.drawingBufferHeight,t.bind(),p.view=m,p.projection=g,p.screenSize=w,p.highlightId=e.highlightId,p.highlightScale=e.highlightScale,p.clipBounds=x,p.pickGroup=e.pickId/255,p.pixelRatio=e.pixelRatio;for(var _=0;3>_;++_)if(h[_]&&e.projectOpacity[_]<1===n){p.scale=e.projectScale[_],p.opacity=e.projectOpacity[_];for(var L=E,z=0;16>z;++z)L[z]=0;for(var z=0;4>z;++z)L[5*z]=1;L[5*_]=0,a[_]<0?L[12+_]=y[0][_]:L[12+_]=y[1][_],v(L,d,L),p.model=L;var I=(_+1)%3,P=(_+2)%3,C=s(M),R=s(A);C[I]=1,R[P]=1;var D=i(g,m,d,l(k,C)),O=i(g,m,d,l(T,R));if(Math.abs(D[1])>Math.abs(O[1])){var j=D;D=O,O=j,j=C,C=R,R=j;var F=I;I=P,P=F}D[0]<0&&(C[I]=-1),O[1]>0&&(R[P]=-1);for(var N=0,B=0,z=0;4>z;++z)N+=Math.pow(d[4*I+z],2),B+=Math.pow(d[4*P+z],2);C[I]/=Math.sqrt(N),R[P]/=Math.sqrt(B),p.axes[0]=C,p.axes[1]=R,p.fragClipBounds[0]=u(S,x[0],_,-1e8),p.fragClipBounds[1]=u(S,x[1],_,1e8),e.vao.draw(f.TRIANGLES,e.vertexCount),e.lineWidth>0&&(f.lineWidth(e.lineWidth),e.vao.draw(f.LINES,e.lineVertexCount,e.vertexCount))}}function f(t,e,r,n,i,o){var a=r.gl;if(r.vao.bind(),i===r.opacity<1||o){t.bind();var s=t.uniforms;s.model=n.model||b,s.view=n.view||b,s.projection=n.projection||b,w[0]=2/a.drawingBufferWidth,w[1]=2/a.drawingBufferHeight,s.screenSize=w,s.highlightId=r.highlightId,s.highlightScale=r.highlightScale,s.fragClipBounds=P,s.clipBounds=r.axes.bounds,s.opacity=r.opacity,s.pickGroup=r.pickId/255,s.pixelRatio=r.pixelRatio,r.vao.draw(a.TRIANGLES,r.vertexCount),r.lineWidth>0&&(a.lineWidth(r.lineWidth),r.vao.draw(a.LINES,r.lineVertexCount,r.vertexCount))}h(e,r,n,i,o),r.vao.unbind()}function p(t){var e=t.gl,r=y.createPerspective(e),n=y.createOrtho(e),i=y.createProject(e),o=y.createPickPerspective(e),s=y.createPickOrtho(e),l=y.createPickProject(e),u=d(e),c=d(e),h=d(e),f=d(e),p=m(e,[{buffer:u,size:3,type:e.FLOAT},{buffer:c,size:4,type:e.FLOAT},{buffer:h,size:2,type:e.FLOAT},{buffer:f,size:4,type:e.UNSIGNED_BYTE,normalized:!0}]),g=new a(e,r,n,i,u,c,h,f,p,o,s,l);return g.update(t),g}var d=t("gl-buffer"),m=t("gl-vao"),g=t("typedarray-pool"),v=t("gl-mat4/multiply"),y=t("./lib/shaders"),x=t("./lib/glyphs"),b=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];e.exports=p;var _=a.prototype;_.pickSlots=1,_.setPickBase=function(t){this.pickId=t},_.isTransparent=function(){if(this.opacity<1)return!0;for(var t=0;3>t;++t)if(this.axesProject[t]&&this.projectOpacity[t]<1)return!0;return!1},_.isOpaque=function(){if(this.opacity>=1)return!0;for(var t=0;3>t;++t)if(this.axesProject[t]&&this.projectOpacity[t]>=1)return!0;return!1};var w=[0,0],M=[0,0,0],A=[0,0,0],k=[0,0,0,1],T=[0,0,0,1],E=b.slice(),S=[0,0,0],L=[[0,0,0],[0,0,0]],z=[-1e8,-1e8,-1e8],I=[1e8,1e8,1e8],P=[z,I];_.draw=function(t){var e=this.useOrtho?this.orthoShader:this.shader;f(e,this.projectShader,this,t,!1,!1)},_.drawTransparent=function(t){var e=this.useOrtho?this.orthoShader:this.shader;f(e,this.projectShader,this,t,!0,!1)},_.drawPick=function(t){var e=this.useOrtho?this.pickOrthoShader:this.pickPerspectiveShader;f(e,this.pickProjectShader,this,t,!1,!0)},_.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=t.value[2]+(t.value[1]<<8)+(t.value[0]<<16);if(e>=this.pointCount||0>e)return null;var r=this.points[e],n=this._selectResult;n.index=e;for(var i=0;3>i;++i)n.position[i]=n.dataCoordinate[i]=r[i];return n},_.highlight=function(t){if(t){var e=t.index,r=255&e,n=e>>8&255,i=e>>16&255;this.highlightId=[r/255,n/255,i/255,0]}else this.highlightId=[1,1,1,1]},_.update=function(t){if(t=t||{},"perspective"in t&&(this.useOrtho=!t.perspective),"orthographic"in t&&(this.useOrtho=!!t.orthographic),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"project"in t)if(Array.isArray(t.project))this.axesProject=t.project;else{var e=!!t.project;this.axesProject=[e,e,e]}if("projectScale"in t)if(Array.isArray(t.projectScale))this.projectScale=t.projectScale.slice();else{var r=+t.projectScale;this.projectScale=[r,r,r]}if("projectOpacity"in t)if(Array.isArray(t.projectOpacity))this.projectOpacity=t.projectOpacity.slice();else{var r=+t.projectOpacity;this.projectOpacity=[r,r,r]}"opacity"in t&&(this.opacity=t.opacity),this.dirty=!0;var n=t.position;if(n){var i=t.font||"normal",o=t.alignment||[0,0],a=[1/0,1/0,1/0],s=[-(1/0),-(1/0),-(1/0)],l=t.glyph,u=t.color,c=t.size,h=t.angle,f=t.lineColor,p=0,d=0,m=0,v=n.length;t:for(var y=0;v>y;++y){for(var b=n[y],_=0;3>_;++_)if(isNaN(b[_])||!isFinite(b[_]))continue t;var w;w=Array.isArray(l)?x(l[y],i):l?x(l,i):x("\u25cf",i);var M=w[0],A=w[1],k=w[2];d+=3*M.cells.length,m+=2*A.edges.length}var T=d+m,E=g.mallocFloat(3*T),S=g.mallocFloat(4*T),L=g.mallocFloat(2*T),z=g.mallocUint32(T),I=[0,o[1]],P=0,C=d,R=[0,0,0,1],D=[0,0,0,1],O=Array.isArray(u)&&Array.isArray(u[0]),j=Array.isArray(f)&&Array.isArray(f[0]);t:for(var y=0;v>y;++y){for(var b=n[y],_=0;3>_;++_){if(isNaN(b[_])||!isFinite(b[_])){p+=1;continue t}s[_]=Math.max(s[_],b[_]),a[_]=Math.min(a[_],b[_])}var w;w=Array.isArray(l)?x(l[y],i):l?x(l,i):x("\u25cf",i);var M=w[0],A=w[1],k=w[2];if(Array.isArray(u)){var F;if(F=O?u[y]:u,3===F.length){for(var _=0;3>_;++_)R[_]=F[_];R[3]=1}else if(4===F.length)for(var _=0;4>_;++_)R[_]=F[_]}else R[0]=R[1]=R[2]=0,R[3]=1;if(Array.isArray(f)){var F;if(F=j?f[y]:f,3===F.length){for(var _=0;3>_;++_)D[_]=F[_];D[_]=1}else if(4===F.length)for(var _=0;4>_;++_)D[_]=F[_]}else D[0]=D[1]=D[2]=0,D[3]=1;var N=.5;Array.isArray(c)?N=+c[y]:c?N=+c:this.useOrtho&&(N=12);var B=0;Array.isArray(h)?B=+h[y]:h&&(B=+h);for(var U=Math.cos(B),V=Math.sin(B),b=n[y],_=0;3>_;++_)s[_]=Math.max(s[_],b[_]),a[_]=Math.min(a[_],b[_]);o[0]<0?I[0]=o[0]*(1+k[1][0]):o[0]>0&&(I[0]=-o[0]*(1+k[0][0]));for(var q=M.cells,G=M.positions,_=0;_X;++X){for(var Y=0;3>Y;++Y)E[3*P+Y]=b[Y];for(var Y=0;4>Y;++Y)S[4*P+Y]=R[Y];z[P]=p;var W=G[H[X]];L[2*P]=N*(U*W[0]-V*W[1]+I[0]),L[2*P+1]=N*(V*W[0]+U*W[1]+I[1]),P+=1}for(var q=A.edges,G=A.positions,_=0;_X;++X){for(var Y=0;3>Y;++Y)E[3*C+Y]=b[Y];for(var Y=0;4>Y;++Y)S[4*C+Y]=D[Y];z[C]=p;var W=G[H[X]];L[2*C]=N*(U*W[0]-V*W[1]+I[0]),L[2*C+1]=N*(V*W[0]+U*W[1]+I[1]),C+=1}p+=1}this.vertexCount=d,this.lineVertexCount=m,this.pointBuffer.update(E),this.colorBuffer.update(S),this.glyphBuffer.update(L),this.idBuffer.update(new Uint32Array(z)),g.free(E),g.free(S),g.free(L),g.free(z),this.bounds=[a,s],this.points=n,this.pointCount=n.length}},_.dispose=function(){this.shader.dispose(),this.orthoShader.dispose(),this.pickPerspectiveShader.dispose(),this.pickOrthoShader.dispose(),this.vao.dispose(),this.pointBuffer.dispose(),this.colorBuffer.dispose(),this.glyphBuffer.dispose(),this.idBuffer.dispose()}},{"./lib/glyphs":185,"./lib/shaders":186,"gl-buffer":122,"gl-mat4/multiply":145,"gl-vao":207,"typedarray-pool":468}],188:[function(t,e,r){"use strict";r.boxVertex="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 vertex;\n\nuniform vec2 cornerA, cornerB;\n\nvoid main() {\n gl_Position = vec4(mix(cornerA, cornerB, vertex), 0, 1);\n}\n",r.boxFragment="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = color;\n}\n"},{}],189:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.boxBuffer=e,this.boxShader=r,this.enabled=!0,this.selectBox=[1/0,1/0,-(1/0),-(1/0)],this.borderColor=[0,0,0,1],this.innerFill=!1,this.innerColor=[0,0,0,.25],this.outerFill=!0,this.outerColor=[0,0,0,.5],this.borderWidth=10}function i(t,e){var r=t.gl,i=a(r,[0,0,0,1,1,0,1,1]),l=o(r,s.boxVertex,s.boxFragment),u=new n(t,i,l);return u.update(e),t.addOverlay(u),u}var o=t("gl-shader"),a=t("gl-buffer"),s=t("./lib/shaders");e.exports=i;var l=n.prototype;l.draw=function(){if(this.enabled){var t=this.plot,e=this.selectBox,r=this.borderWidth,n=(this.innerFill,this.innerColor),i=(this.outerFill,this.outerColor),o=this.borderColor,a=t.box,s=t.screenBox,l=t.dataBox,u=t.viewBox,c=t.pixelRatio,h=(e[0]-l[0])*(u[2]-u[0])/(l[2]-l[0])+u[0],f=(e[1]-l[1])*(u[3]-u[1])/(l[3]-l[1])+u[1],p=(e[2]-l[0])*(u[2]-u[0])/(l[2]-l[0])+u[0],d=(e[3]-l[1])*(u[3]-u[1])/(l[3]-l[1])+u[1];if(h=Math.max(h,u[0]),f=Math.max(f,u[1]),p=Math.min(p,u[2]),d=Math.min(d,u[3]),!(h>p||f>d)){a.bind();var m=s[2]-s[0],g=s[3]-s[1];if(this.outerFill&&(a.drawBox(0,0,m,f,i),a.drawBox(0,f,h,d,i),a.drawBox(0,d,m,g,i),a.drawBox(p,f,m,d,i)),this.innerFill&&a.drawBox(h,f,p,d,n),r>0){var v=r*c;a.drawBox(h-v,f-v,p+v,f+v,o),a.drawBox(h-v,d-v,p+v,d+v,o),a.drawBox(h-v,f-v,h+v,d+v,o),a.drawBox(p-v,f-v,p+v,d+v,o)}}}},l.update=function(t){t=t||{},this.innerFill=!!t.innerFill,this.outerFill=!!t.outerFill,this.innerColor=(t.innerColor||[0,0,0,.5]).slice(),this.outerColor=(t.outerColor||[0,0,0,.5]).slice(),this.borderColor=(t.borderColor||[0,0,0,1]).slice(),this.borderWidth=t.borderWidth||0,this.selectBox=(t.selectBox||this.selectBox).slice()},l.dispose=function(){this.boxBuffer.dispose(),this.boxShader.dispose(),this.plot.removeOverlay(this)}},{"./lib/shaders":188,"gl-buffer":122,"gl-shader":191}],190:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.coord=[t,e],this.id=r,this.value=n,this.distance=i}function i(t,e,r){this.gl=t,this.fbo=e,this.buffer=r,this._readTimeout=null;var n=this;this._readCallback=function(){n.gl&&(e.bind(),t.readPixels(0,0,e.shape[0],e.shape[1],t.RGBA,t.UNSIGNED_BYTE,n.buffer),n._readTimeout=null)}}function o(t,e){var r=a(t,e),n=s.mallocUint8(e[0]*e[1]*4);return new i(t,r,n)}e.exports=o;var a=t("gl-fbo"),s=t("typedarray-pool"),l=t("ndarray"),u=t("bit-twiddle").nextPow2,c=t("cwise/lib/wrapper")({args:["array",{offset:[0,0,1],array:0},{offset:[0,0,2],array:0},{offset:[0,0,3],array:0},"scalar","scalar","index"],pre:{body:"{this_closestD2=1e8,this_closestX=-1,this_closestY=-1}",args:[],thisVars:["this_closestD2","this_closestX","this_closestY"],localVars:[]},body:{body:"{if(255>_inline_31_arg0_||255>_inline_31_arg1_||255>_inline_31_arg2_||255>_inline_31_arg3_){var _inline_31_l=_inline_31_arg4_-_inline_31_arg6_[0],_inline_31_a=_inline_31_arg5_-_inline_31_arg6_[1],_inline_31_f=_inline_31_l*_inline_31_l+_inline_31_a*_inline_31_a;_inline_31_fthis.buffer.length){s.free(this.buffer);for(var n=this.buffer=s.mallocUint8(u(r*e*4)),i=0;r*e*4>i;++i)n[i]=255}return t}}}),h.begin=function(){var t=this.gl;this.shape;t&&(this.fbo.bind(),t.clearColor(1,1,1,1),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT))},h.end=function(){var t=this.gl;t&&(t.bindFramebuffer(t.FRAMEBUFFER,null),this._readTimeout||clearTimeout(this._readTimeout),this._readTimeout=setTimeout(this._readCallback,1))},h.query=function(t,e,r){if(!this.gl)return null;var i=this.fbo.shape.slice();t=0|t,e=0|e,"number"!=typeof r&&(r=1);var o=0|Math.min(Math.max(t-r,0),i[0]),a=0|Math.min(Math.max(t+r,0),i[0]),s=0|Math.min(Math.max(e-r,0),i[1]),u=0|Math.min(Math.max(e+r,0),i[1]);if(o>=a||s>=u)return null;var h=[a-o,u-s],f=l(this.buffer,[h[0],h[1],4],[4,4*i[0],1],4*(o+i[0]*s)),p=c(f.hi(h[0],h[1],1),r,r),d=p[0],m=p[1];if(0>d||Math.pow(this.radius,2)=0){for(var A=0|M.type.charAt(M.type.length-1),k=new Array(A),T=0;A>T;++T)k[T]=_.length,b.push(M.name+"["+T+"]"),"number"==typeof M.location?_.push(M.location+T):Array.isArray(M.location)&&M.location.length===A&&"number"==typeof M.location[T]?_.push(0|M.location[T]):_.push(-1);x.push({name:M.name,type:M.type, +this.points=e;for(var c=this.bounds=[1/0,1/0,-(1/0),-(1/0)],h=0,f=0;f>1;for(var p=0;2>p;++p)c[p]=Math.min(c[p],e[2*f+p]),c[2+p]=Math.max(c[2+p],e[2*f+p])}c[0]===c[2]&&(c[2]+=1),c[3]===c[1]&&(c[3]+=1);for(var d=1/(c[2]-c[0]),m=1/(c[3]-c[1]),g=c[0],v=c[1],y=u.mallocFloat32(2*h),x=u.mallocFloat32(2*h),b=u.mallocUint8(4*h),_=u.mallocUint32(h),w=0,f=0;f=o?i(0,o-1,t,e,r,n):h(0,o-1,t,e,r,n)}function i(t,e,r,n,i,o){for(var a=t+1;e>=a;++a){for(var s=r[a],l=n[2*a],u=n[2*a+1],c=i[a],h=o[a],f=a;f>t;){var p=r[f-1],d=n[2*(f-1)];if((p-s||l-d)>=0)break;r[f]=p,n[2*f]=d,n[2*f+1]=n[2*f-1],i[f]=i[f-1],o[f]=o[f-1],f-=1}r[f]=s,n[2*f]=l,n[2*f+1]=u,i[f]=c,o[f]=h}}function o(t,e,r,n,i,o){var a=r[t],s=n[2*t],l=n[2*t+1],u=i[t],c=o[t];r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],o[t]=o[e],r[e]=a,n[2*e]=s,n[2*e+1]=l,i[e]=u,o[e]=c}function a(t,e,r,n,i,o){r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],o[t]=o[e]}function s(t,e,r,n,i,o,a){var s=n[t],l=i[2*t],u=i[2*t+1],c=o[t],h=a[t];n[t]=n[e],i[2*t]=i[2*e],i[2*t+1]=i[2*e+1],o[t]=o[e],a[t]=a[e],n[e]=n[r],i[2*e]=i[2*r],i[2*e+1]=i[2*r+1],o[e]=o[r],a[e]=a[r],n[r]=s,i[2*r]=l,i[2*r+1]=u,o[r]=c,a[r]=h}function l(t,e,r,n,i,o,a,s,l,u,c){s[t]=s[e],l[2*t]=l[2*e],l[2*t+1]=l[2*e+1],u[t]=u[e],c[t]=c[e],s[e]=r,l[2*e]=n,l[2*e+1]=i,u[e]=o,c[e]=a}function u(t,e,r,n,i){return(r[t]-r[e]||n[2*e]-n[2*t]||i[t]-i[e])<0}function c(t,e,r,n,i,o,a,s){return(e-o[t]||a[2*t]-r||i-s[t])<0}function h(t,e,r,n,p,d){var m=(e-t+1)/6|0,g=t+m,v=e-m,y=t+e>>1,x=y-m,b=y+m,_=g,w=x,M=y,A=b,k=v,T=t+1,E=e-1,S=0;u(_,w,r,n,p,d)&&(S=_,_=w,w=S),u(A,k,r,n,p,d)&&(S=A,A=k,k=S),u(_,M,r,n,p,d)&&(S=_,_=M,M=S),u(w,M,r,n,p,d)&&(S=w,w=M,M=S),u(_,A,r,n,p,d)&&(S=_,_=A,A=S),u(M,A,r,n,p,d)&&(S=M,M=A,A=S),u(w,k,r,n,p,d)&&(S=w,w=k,k=S),u(w,M,r,n,p,d)&&(S=w,w=M,M=S),u(A,k,r,n,p,d)&&(S=A,A=k,k=S);var L=r[w],z=n[2*w],I=n[2*w+1],P=p[w],C=d[w],R=r[A],D=n[2*A],O=n[2*A+1],j=p[A],F=d[A],N=_,B=M,U=k,V=g,q=y,G=v,H=r[N],X=r[B],Y=r[U];r[V]=H,r[q]=X,r[G]=Y;for(var W=0;2>W;++W){var Z=n[2*N+W],Q=n[2*B+W],K=n[2*U+W];n[2*V+W]=Z,n[2*q+W]=Q,n[2*G+W]=K}var $=p[N],J=p[B],tt=p[U];p[V]=$,p[q]=J,p[G]=tt;var et=d[N],rt=d[B],nt=d[U];d[V]=et,d[q]=rt,d[G]=nt,a(x,t,r,n,p,d),a(b,e,r,n,p,d);for(var it=T;E>=it;++it)if(c(it,L,z,I,P,r,n,p))it!==T&&o(it,T,r,n,p,d),++T;else if(!c(it,R,D,O,j,r,n,p))for(;;){if(c(E,R,D,O,j,r,n,p)){c(E,L,z,I,P,r,n,p)?(s(it,T,E,r,n,p,d),++T,--E):(o(it,E,r,n,p,d),--E);break}if(--E=T-2-t?i(t,T-2,r,n,p,d):h(t,T-2,r,n,p,d),f>=e-(E+2)?i(E+2,e,r,n,p,d):h(E+2,e,r,n,p,d),f>=E-T?i(T,E,r,n,p,d):h(T,E,r,n,p,d)}e.exports=n;var f=32},{}],183:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a,s){for(var l=r,u=r;n>u;++u){var c=t[2*u],h=t[2*u+1],f=e[u];c>=i&&a>=c&&h>=o&&s>=h&&(u===l?l+=1:(t[2*u]=t[2*l],t[2*u+1]=t[2*l+1],e[u]=e[l],t[2*l]=c,t[2*l+1]=h,e[l]=f,l+=1))}return l}function i(t,e,r){this.pixelSize=t,this.offset=e,this.count=r}function o(t,e,r,o){function l(i,o,a,s,u,c){var h=.5*a,f=s+1,p=u-s;r[_]=p,b[_++]=c;for(var d=0;2>d;++d)for(var m=0;2>m;++m){var g=i+d*h,v=o+m*h,y=n(t,e,f,u,g,v,g+h,v+h);if(y!==f){if(y-f>=Math.max(.9*p,32)){var x=u+s>>>1;l(g,v,h,f,x,c+1),f=x}l(g,v,h,f,y,c+1),f=y}}}var u=t.length>>>1;if(1>u)return[];for(var c=1/0,h=1/0,f=-(1/0),p=-(1/0),d=0;u>d;++d){var m=t[2*d],g=t[2*d+1];c=Math.min(c,m),f=Math.max(f,m),h=Math.min(h,g),p=Math.max(p,g),e[d]=d}c===f&&(f+=1+Math.abs(f)),h===p&&(p+=1+Math.abs(f));var v=1/(f-c),y=1/(p-h),x=Math.max(f-c,p-h);o=o||[0,0,0,0],o[0]=c,o[1]=h,o[2]=f,o[3]=p;var b=a.mallocInt32(u),_=0;l(c,h,x,0,u,0),s(b,t,e,r,u);for(var w=[],M=0,A=u,_=u-1;_>=0;--_){t[2*_]=(t[2*_]-c)*v,t[2*_+1]=(t[2*_+1]-h)*y;var k=b[_];k!==M&&(w.push(new i(x*Math.pow(.5,k),_+1,A-(_+1))),A=_+1,M=k)}return w.push(new i(x*Math.pow(.5,k+1),0,A)),a.free(b),w}var a=t("typedarray-pool"),s=t("./lib/sort");e.exports=o},{"./lib/sort":182,"typedarray-pool":468}],184:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){this.plot=t,this.offsetBuffer=e,this.pickBuffer=r,this.weightBuffer=n,this.shader=i,this.pickShader=o,this.scales=[],this.size=12,this.borderSize=1,this.pointCount=0,this.color=[1,0,0,1],this.borderColor=[0,0,0,1],this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.pickOffset=0,this.points=null,this.xCoords=null}function i(t,e){var r=t.gl,i=a(r),s=a(r),l=a(r),u=o(r,c.pointVertex,c.pointFragment),h=o(r,c.pickVertex,c.pickFragment),f=new n(t,i,s,l,u,h);return f.update(e),t.addObject(f),f}var o=t("gl-shader"),a=t("gl-buffer"),s=t("binary-search-bounds"),l=t("snap-points-2d"),u=t("typedarray-pool"),c=t("./lib/shader");e.exports=i;var h=n.prototype;h.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.offsetBuffer.dispose(),this.pickBuffer.dispose(),this.xCoords&&u.free(this.xCoords),this.plot.removeObject(this)},h.update=function(t){function e(e,r){return e in t?t[e]:r}t=t||{},this.size=e("size",12),this.color=e("color",[1,0,0,1]).slice(),this.borderSize=e("borderSize",1),this.borderColor=e("borderColor",[0,0,0,1]).slice(),this.xCoords&&u.free(this.xCoords);var r=t.positions,n=u.mallocFloat32(r.length),i=u.mallocInt32(r.length>>>1);n.set(r);var o=u.mallocFloat32(r.length);this.points=r,this.scales=l(n,i,o,this.bounds),this.offsetBuffer.update(n),this.pickBuffer.update(i),this.weightBuffer.update(o);for(var a=u.mallocFloat32(r.length>>>1),s=0,c=0;s>>1,this.pickOffset=0},h.drawPick=function(){var t=[1,0,0,0,1,0,0,0,1],e=[0,0,0,0];return function(r){var n=this.plot,i=this.pickShader,o=this.scales,a=this.offsetBuffer,l=this.pickBuffer,u=this.bounds,c=this.size,h=this.borderSize,f=n.gl,p=n.pickPixelRatio,d=n.viewBox,m=n.dataBox;if(0===this.pointCount)return r;var g=u[2]-u[0],v=u[3]-u[1],y=m[2]-m[0],x=m[3]-m[1],b=(d[2]-d[0])*p/n.pixelRatio,_=(d[3]-d[1])*p/n.pixelRatio,w=Math.min(y/b,x/_);t[0]=2*g/y,t[4]=2*v/x,t[6]=2*(u[0]-m[0])/y-1,t[7]=2*(u[1]-m[1])/x-1,this.pickOffset=r,e[0]=255&r,e[1]=r>>8&255,e[2]=r>>16&255,e[3]=r>>24&255,i.bind(),i.uniforms.matrix=t,i.uniforms.color=this.color,i.uniforms.borderColor=this.borderColor,i.uniforms.pointSize=p*(c+h),i.uniforms.pickOffset=e,0===this.borderSize?i.uniforms.centerFraction=2:i.uniforms.centerFraction=c/(c+h+1.25),a.bind(),i.attributes.position.pointer(),l.bind(),i.attributes.pickId.pointer(f.UNSIGNED_BYTE);for(var M=this.xCoords,A=(m[0]-u[0]-w*c*p)/g,k=(m[2]-u[0]+w*c*p)/g,T=o.length-1;T>=0;--T){var E=o[T];if(!(E.pixelSize1)){var S=E.offset,L=E.count+S,z=s.ge(M,A,S,L-1),I=s.lt(M,k,z,L-1)+1;I>z&&f.drawArrays(f.POINTS,z,I-z)}}return r+this.pointCount}}(),h.draw=function(){var t=[1,0,0,0,1,0,0,0,1];return function(){var e=this.plot,r=this.shader,n=this.scales,i=this.offsetBuffer,o=this.bounds,a=this.size,l=this.borderSize,u=e.gl,c=e.pixelRatio,h=e.viewBox,f=e.dataBox;if(0!==this.pointCount){var p=o[2]-o[0],d=o[3]-o[1],m=f[2]-f[0],g=f[3]-f[1],v=h[2]-h[0],y=h[3]-h[1],x=Math.min(m/v,g/y);t[0]=2*p/m,t[4]=2*d/g,t[6]=2*(o[0]-f[0])/m-1,t[7]=2*(o[1]-f[1])/g-1,r.bind(),r.uniforms.matrix=t,r.uniforms.color=this.color,r.uniforms.borderColor=this.borderColor,r.uniforms.pointSize=c*(a+l),r.uniforms.useWeight=1,0===this.borderSize?r.uniforms.centerFraction=2:r.uniforms.centerFraction=a/(a+l+1.25),i.bind(),r.attributes.position.pointer(),this.weightBuffer.bind(),r.attributes.weight.pointer();for(var b=this.xCoords,_=(f[0]-o[0]-x*a*c)/p,w=(f[2]-o[0]+x*a*c)/p,M=!0,A=n.length-1;A>=0;--A){var k=n[A];if(!(k.pixelSize1)){var T=k.offset,E=k.count+T,S=s.ge(b,_,T,E-1),L=s.lt(b,w,S,E-1)+1;L>S&&u.drawArrays(u.POINTS,S,L-S),M&&(M=!1,r.uniforms.useWeight=0)}}}}}(),h.pick=function(t,e,r){var n=this.pickOffset,i=this.pointCount;if(n>r||r>=n+i)return null;var o=r-n,a=this.points;return{object:this,pointId:o,dataCoord:[a[2*o],a[2*o+1]]}}},{"./lib/shader":180,"binary-search-bounds":181,"gl-buffer":122,"gl-shader":191,"snap-points-2d":183,"typedarray-pool":468}],185:[function(t,e,r){"use strict";function n(t,e){var r=o[e];if(r||(r=o[e]={}),t in r)return r[t];for(var n=i(t,{textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),a=i(t,{triangles:!0,textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),s=[[1/0,1/0],[-(1/0),-(1/0)]],l=0;lc;++c)s[0][c]=Math.min(s[0][c],u[c]),s[1][c]=Math.max(s[1][c],u[c]);return r[t]=[a,n,s]}var i=t("vectorize-text");e.exports=n;var o={}},{"vectorize-text":480}],186:[function(t,e,r){function n(t,e){var r=i(t,e),n=r.attributes;return n.position.location=0,n.color.location=1,n.glyph.location=2,n.id.location=3,r}var i=t("gl-shader"),o="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 glyph;\nattribute vec4 id;\n\n\nuniform vec4 highlightId;\nuniform float highlightScale;\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1])) ) {\n gl_Position = vec4(0,0,0,0);\n } else {\n float scale = 1.0;\n if(distance(highlightId, id) < 0.0001) {\n scale = highlightScale;\n }\n\n vec4 worldPosition = model * vec4(position, 1);\n vec4 viewPosition = view * worldPosition;\n viewPosition = viewPosition / viewPosition.w;\n vec4 clipPosition = projection * (viewPosition + scale * vec4(glyph.x, -glyph.y, 0, 0));\n \n gl_Position = clipPosition;\n interpColor = color;\n pickId = id;\n dataCoordinate = position;\n }\n}",a="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 glyph;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform vec2 screenSize;\nuniform vec3 clipBounds[2];\nuniform float highlightScale, pixelRatio;\nuniform vec4 highlightId;\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || any(greaterThan(position, clipBounds[1]))) {\n gl_Position = vec4(0,0,0,0);\n } else {\n float scale = pixelRatio;\n if(distance(highlightId.bgr, id.bgr) < 0.001) {\n scale *= highlightScale;\n }\n\n vec4 worldPosition = model * vec4(position, 1.0);\n vec4 viewPosition = view * worldPosition;\n vec4 clipPosition = projection * viewPosition;\n clipPosition /= clipPosition.w;\n \n gl_Position = clipPosition + vec4(screenSize * scale * vec2(glyph.x, -glyph.y), 0.0, 0.0);\n interpColor = color;\n pickId = id;\n dataCoordinate = position;\n }\n}",s="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 glyph;\nattribute vec4 id;\n\nuniform float highlightScale;\nuniform vec4 highlightId;\nuniform vec3 axes[2];\nuniform mat4 model, view, projection;\nuniform vec2 screenSize;\nuniform vec3 clipBounds[2];\nuniform float scale, pixelRatio;\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) ||\n any(greaterThan(position, clipBounds[1])) ) {\n gl_Position = vec4(0,0,0,0);\n } else {\n float lscale = pixelRatio * scale;\n if(distance(highlightId, id) < 0.0001) {\n lscale *= highlightScale;\n }\n\n vec4 clipCenter = projection * view * model * vec4(position, 1);\n vec3 dataPosition = position + 0.5*lscale*(axes[0] * glyph.x + axes[1] * glyph.y) * clipCenter.w * screenSize.y;\n vec4 clipPosition = projection * view * model * vec4(dataPosition, 1);\n\n gl_Position = clipPosition;\n interpColor = color;\n pickId = id;\n dataCoordinate = dataPosition;\n }\n}\n",l="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 fragClipBounds[2];\nuniform float opacity;\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if(any(lessThan(dataCoordinate, fragClipBounds[0])) ||\n any(greaterThan(dataCoordinate, fragClipBounds[1])) ) {\n discard;\n } else {\n gl_FragColor = interpColor * opacity;\n }\n}\n",u="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 fragClipBounds[2];\nuniform float pickGroup;\n\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if(any(lessThan(dataCoordinate, fragClipBounds[0])) || \n any(greaterThan(dataCoordinate, fragClipBounds[1])) ) {\n discard;\n } else {\n gl_FragColor = vec4(pickGroup, pickId.bgr);\n }\n}",c=[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"glyph",type:"vec2"},{name:"id",type:"vec4"}],h={vertex:o,fragment:l,attributes:c},f={vertex:a,fragment:l,attributes:c},p={vertex:s,fragment:l,attributes:c},d={vertex:o,fragment:u,attributes:c},m={vertex:a,fragment:u,attributes:c},g={vertex:s,fragment:u,attributes:c};r.createPerspective=function(t){return n(t,h)},r.createOrtho=function(t){return n(t,f)},r.createProject=function(t){return n(t,p)},r.createPickPerspective=function(t){return n(t,d)},r.createPickOrtho=function(t){return n(t,m)},r.createPickProject=function(t){return n(t,g)}},{"gl-shader":191}],187:[function(t,e,r){"use strict";function n(t,e){var r=t[0],n=t[1],i=t[2],o=t[3];return t[0]=e[0]*r+e[4]*n+e[8]*i+e[12]*o,t[1]=e[1]*r+e[5]*n+e[9]*i+e[13]*o,t[2]=e[2]*r+e[6]*n+e[10]*i+e[14]*o,t[3]=e[3]*r+e[7]*n+e[11]*i+e[15]*o,t}function i(t,e,r,i){return n(i,i,r),n(i,i,e),n(i,i,t)}function o(t,e){this.index=t,this.dataCoordinate=this.position=e}function a(t,e,r,n,i,a,s,l,u,c,h,f){this.gl=t,this.pixelRatio=1,this.shader=e,this.orthoShader=r,this.projectShader=n,this.pointBuffer=i,this.colorBuffer=a,this.glyphBuffer=s,this.idBuffer=l,this.vao=u,this.vertexCount=0,this.lineVertexCount=0,this.opacity=1,this.lineWidth=0,this.projectScale=[2/3,2/3,2/3],this.projectOpacity=[1,1,1],this.pickId=0,this.pickPerspectiveShader=c,this.pickOrthoShader=h,this.pickProjectShader=f,this.points=[],this._selectResult=new o(0,[0,0,0]),this.useOrtho=!0,this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.axesProject=[!0,!0,!0],this.axesBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.highlightId=[1,1,1,1],this.highlightScale=2,this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.dirty=!0}function s(t){return t[0]=t[1]=t[2]=0,t}function l(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=1,t}function u(t,e,r,n){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[r]=n,t}function c(t){for(var e=L,r=0;2>r;++r)for(var n=0;3>n;++n)e[r][n]=Math.max(Math.min(t[r][n],1e8),-1e8);return e}function h(t,e,r,n,o){var a,h=e.axesProject,f=e.gl,p=t.uniforms,d=r.model||b,m=r.view||b,g=r.projection||b,y=e.axesBounds,x=c(e.clipBounds);a=e.axes?e.axes.lastCubeProps.axis:[1,1,1],w[0]=2/f.drawingBufferWidth,w[1]=2/f.drawingBufferHeight,t.bind(),p.view=m,p.projection=g,p.screenSize=w,p.highlightId=e.highlightId,p.highlightScale=e.highlightScale,p.clipBounds=x,p.pickGroup=e.pickId/255,p.pixelRatio=e.pixelRatio;for(var _=0;3>_;++_)if(h[_]&&e.projectOpacity[_]<1===n){p.scale=e.projectScale[_],p.opacity=e.projectOpacity[_];for(var L=E,z=0;16>z;++z)L[z]=0;for(var z=0;4>z;++z)L[5*z]=1;L[5*_]=0,a[_]<0?L[12+_]=y[0][_]:L[12+_]=y[1][_],v(L,d,L),p.model=L;var I=(_+1)%3,P=(_+2)%3,C=s(M),R=s(A);C[I]=1,R[P]=1;var D=i(g,m,d,l(k,C)),O=i(g,m,d,l(T,R));if(Math.abs(D[1])>Math.abs(O[1])){var j=D;D=O,O=j,j=C,C=R,R=j;var F=I;I=P,P=F}D[0]<0&&(C[I]=-1),O[1]>0&&(R[P]=-1);for(var N=0,B=0,z=0;4>z;++z)N+=Math.pow(d[4*I+z],2),B+=Math.pow(d[4*P+z],2);C[I]/=Math.sqrt(N),R[P]/=Math.sqrt(B),p.axes[0]=C,p.axes[1]=R,p.fragClipBounds[0]=u(S,x[0],_,-1e8),p.fragClipBounds[1]=u(S,x[1],_,1e8),e.vao.draw(f.TRIANGLES,e.vertexCount),e.lineWidth>0&&(f.lineWidth(e.lineWidth),e.vao.draw(f.LINES,e.lineVertexCount,e.vertexCount))}}function f(t,e,r,n,i,o){var a=r.gl;if(r.vao.bind(),i===r.opacity<1||o){t.bind();var s=t.uniforms;s.model=n.model||b,s.view=n.view||b,s.projection=n.projection||b,w[0]=2/a.drawingBufferWidth,w[1]=2/a.drawingBufferHeight,s.screenSize=w,s.highlightId=r.highlightId,s.highlightScale=r.highlightScale,s.fragClipBounds=P,s.clipBounds=r.axes.bounds,s.opacity=r.opacity,s.pickGroup=r.pickId/255,s.pixelRatio=r.pixelRatio,r.vao.draw(a.TRIANGLES,r.vertexCount),r.lineWidth>0&&(a.lineWidth(r.lineWidth),r.vao.draw(a.LINES,r.lineVertexCount,r.vertexCount))}h(e,r,n,i,o),r.vao.unbind()}function p(t){var e=t.gl,r=y.createPerspective(e),n=y.createOrtho(e),i=y.createProject(e),o=y.createPickPerspective(e),s=y.createPickOrtho(e),l=y.createPickProject(e),u=d(e),c=d(e),h=d(e),f=d(e),p=m(e,[{buffer:u,size:3,type:e.FLOAT},{buffer:c,size:4,type:e.FLOAT},{buffer:h,size:2,type:e.FLOAT},{buffer:f,size:4,type:e.UNSIGNED_BYTE,normalized:!0}]),g=new a(e,r,n,i,u,c,h,f,p,o,s,l);return g.update(t),g}var d=t("gl-buffer"),m=t("gl-vao"),g=t("typedarray-pool"),v=t("gl-mat4/multiply"),y=t("./lib/shaders"),x=t("./lib/glyphs"),b=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];e.exports=p;var _=a.prototype;_.pickSlots=1,_.setPickBase=function(t){this.pickId=t},_.isTransparent=function(){if(this.opacity<1)return!0;for(var t=0;3>t;++t)if(this.axesProject[t]&&this.projectOpacity[t]<1)return!0;return!1},_.isOpaque=function(){if(this.opacity>=1)return!0;for(var t=0;3>t;++t)if(this.axesProject[t]&&this.projectOpacity[t]>=1)return!0;return!1};var w=[0,0],M=[0,0,0],A=[0,0,0],k=[0,0,0,1],T=[0,0,0,1],E=b.slice(),S=[0,0,0],L=[[0,0,0],[0,0,0]],z=[-1e8,-1e8,-1e8],I=[1e8,1e8,1e8],P=[z,I];_.draw=function(t){var e=this.useOrtho?this.orthoShader:this.shader;f(e,this.projectShader,this,t,!1,!1)},_.drawTransparent=function(t){var e=this.useOrtho?this.orthoShader:this.shader;f(e,this.projectShader,this,t,!0,!1)},_.drawPick=function(t){var e=this.useOrtho?this.pickOrthoShader:this.pickPerspectiveShader;f(e,this.pickProjectShader,this,t,!1,!0)},_.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=t.value[2]+(t.value[1]<<8)+(t.value[0]<<16);if(e>=this.pointCount||0>e)return null;var r=this.points[e],n=this._selectResult;n.index=e;for(var i=0;3>i;++i)n.position[i]=n.dataCoordinate[i]=r[i];return n},_.highlight=function(t){if(t){var e=t.index,r=255&e,n=e>>8&255,i=e>>16&255;this.highlightId=[r/255,n/255,i/255,0]}else this.highlightId=[1,1,1,1]},_.update=function(t){if(t=t||{},"perspective"in t&&(this.useOrtho=!t.perspective),"orthographic"in t&&(this.useOrtho=!!t.orthographic),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"project"in t)if(Array.isArray(t.project))this.axesProject=t.project;else{var e=!!t.project;this.axesProject=[e,e,e]}if("projectScale"in t)if(Array.isArray(t.projectScale))this.projectScale=t.projectScale.slice();else{var r=+t.projectScale;this.projectScale=[r,r,r]}if("projectOpacity"in t)if(Array.isArray(t.projectOpacity))this.projectOpacity=t.projectOpacity.slice();else{var r=+t.projectOpacity;this.projectOpacity=[r,r,r]}"opacity"in t&&(this.opacity=t.opacity),this.dirty=!0;var n=t.position;if(n){var i=t.font||"normal",o=t.alignment||[0,0],a=[1/0,1/0,1/0],s=[-(1/0),-(1/0),-(1/0)],l=t.glyph,u=t.color,c=t.size,h=t.angle,f=t.lineColor,p=0,d=0,m=0,v=n.length;t:for(var y=0;v>y;++y){for(var b=n[y],_=0;3>_;++_)if(isNaN(b[_])||!isFinite(b[_]))continue t;var w;w=Array.isArray(l)?x(l[y],i):l?x(l,i):x("\u25cf",i);var M=w[0],A=w[1],k=w[2];d+=3*M.cells.length,m+=2*A.edges.length}var T=d+m,E=g.mallocFloat(3*T),S=g.mallocFloat(4*T),L=g.mallocFloat(2*T),z=g.mallocUint32(T),I=[0,o[1]],P=0,C=d,R=[0,0,0,1],D=[0,0,0,1],O=Array.isArray(u)&&Array.isArray(u[0]),j=Array.isArray(f)&&Array.isArray(f[0]);t:for(var y=0;v>y;++y){for(var b=n[y],_=0;3>_;++_){if(isNaN(b[_])||!isFinite(b[_])){p+=1;continue t}s[_]=Math.max(s[_],b[_]),a[_]=Math.min(a[_],b[_])}var w;w=Array.isArray(l)?x(l[y],i):l?x(l,i):x("\u25cf",i);var M=w[0],A=w[1],k=w[2];if(Array.isArray(u)){var F;if(F=O?u[y]:u,3===F.length){for(var _=0;3>_;++_)R[_]=F[_];R[3]=1}else if(4===F.length)for(var _=0;4>_;++_)R[_]=F[_]}else R[0]=R[1]=R[2]=0,R[3]=1;if(Array.isArray(f)){var F;if(F=j?f[y]:f,3===F.length){for(var _=0;3>_;++_)D[_]=F[_];D[_]=1}else if(4===F.length)for(var _=0;4>_;++_)D[_]=F[_]}else D[0]=D[1]=D[2]=0,D[3]=1;var N=.5;Array.isArray(c)?N=+c[y]:c?N=+c:this.useOrtho&&(N=12);var B=0;Array.isArray(h)?B=+h[y]:h&&(B=+h);for(var U=Math.cos(B),V=Math.sin(B),b=n[y],_=0;3>_;++_)s[_]=Math.max(s[_],b[_]),a[_]=Math.min(a[_],b[_]);o[0]<0?I[0]=o[0]*(1+k[1][0]):o[0]>0&&(I[0]=-o[0]*(1+k[0][0]));for(var q=M.cells,G=M.positions,_=0;_X;++X){for(var Y=0;3>Y;++Y)E[3*P+Y]=b[Y];for(var Y=0;4>Y;++Y)S[4*P+Y]=R[Y];z[P]=p;var W=G[H[X]];L[2*P]=N*(U*W[0]-V*W[1]+I[0]),L[2*P+1]=N*(V*W[0]+U*W[1]+I[1]),P+=1}for(var q=A.edges,G=A.positions,_=0;_X;++X){for(var Y=0;3>Y;++Y)E[3*C+Y]=b[Y];for(var Y=0;4>Y;++Y)S[4*C+Y]=D[Y];z[C]=p;var W=G[H[X]];L[2*C]=N*(U*W[0]-V*W[1]+I[0]),L[2*C+1]=N*(V*W[0]+U*W[1]+I[1]),C+=1}p+=1}this.vertexCount=d,this.lineVertexCount=m,this.pointBuffer.update(E),this.colorBuffer.update(S),this.glyphBuffer.update(L),this.idBuffer.update(new Uint32Array(z)),g.free(E),g.free(S),g.free(L),g.free(z),this.bounds=[a,s],this.points=n,this.pointCount=n.length}},_.dispose=function(){this.shader.dispose(),this.orthoShader.dispose(),this.pickPerspectiveShader.dispose(),this.pickOrthoShader.dispose(),this.vao.dispose(),this.pointBuffer.dispose(),this.colorBuffer.dispose(),this.glyphBuffer.dispose(),this.idBuffer.dispose()}},{"./lib/glyphs":185,"./lib/shaders":186,"gl-buffer":122,"gl-mat4/multiply":145,"gl-vao":207,"typedarray-pool":468}],188:[function(t,e,r){"use strict";r.boxVertex="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 vertex;\n\nuniform vec2 cornerA, cornerB;\n\nvoid main() {\n gl_Position = vec4(mix(cornerA, cornerB, vertex), 0, 1);\n}\n",r.boxFragment="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = color;\n}\n"},{}],189:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.boxBuffer=e,this.boxShader=r,this.enabled=!0,this.selectBox=[1/0,1/0,-(1/0),-(1/0)],this.borderColor=[0,0,0,1],this.innerFill=!1,this.innerColor=[0,0,0,.25],this.outerFill=!0,this.outerColor=[0,0,0,.5],this.borderWidth=10}function i(t,e){var r=t.gl,i=a(r,[0,0,0,1,1,0,1,1]),l=o(r,s.boxVertex,s.boxFragment),u=new n(t,i,l);return u.update(e),t.addOverlay(u),u}var o=t("gl-shader"),a=t("gl-buffer"),s=t("./lib/shaders");e.exports=i;var l=n.prototype;l.draw=function(){if(this.enabled){var t=this.plot,e=this.selectBox,r=this.borderWidth,n=(this.innerFill,this.innerColor),i=(this.outerFill,this.outerColor),o=this.borderColor,a=t.box,s=t.screenBox,l=t.dataBox,u=t.viewBox,c=t.pixelRatio,h=(e[0]-l[0])*(u[2]-u[0])/(l[2]-l[0])+u[0],f=(e[1]-l[1])*(u[3]-u[1])/(l[3]-l[1])+u[1],p=(e[2]-l[0])*(u[2]-u[0])/(l[2]-l[0])+u[0],d=(e[3]-l[1])*(u[3]-u[1])/(l[3]-l[1])+u[1];if(h=Math.max(h,u[0]),f=Math.max(f,u[1]),p=Math.min(p,u[2]),d=Math.min(d,u[3]),!(h>p||f>d)){a.bind();var m=s[2]-s[0],g=s[3]-s[1];if(this.outerFill&&(a.drawBox(0,0,m,f,i),a.drawBox(0,f,h,d,i),a.drawBox(0,d,m,g,i),a.drawBox(p,f,m,d,i)),this.innerFill&&a.drawBox(h,f,p,d,n),r>0){var v=r*c;a.drawBox(h-v,f-v,p+v,f+v,o),a.drawBox(h-v,d-v,p+v,d+v,o),a.drawBox(h-v,f-v,h+v,d+v,o),a.drawBox(p-v,f-v,p+v,d+v,o)}}}},l.update=function(t){t=t||{},this.innerFill=!!t.innerFill,this.outerFill=!!t.outerFill,this.innerColor=(t.innerColor||[0,0,0,.5]).slice(),this.outerColor=(t.outerColor||[0,0,0,.5]).slice(),this.borderColor=(t.borderColor||[0,0,0,1]).slice(),this.borderWidth=t.borderWidth||0,this.selectBox=(t.selectBox||this.selectBox).slice()},l.dispose=function(){this.boxBuffer.dispose(),this.boxShader.dispose(),this.plot.removeOverlay(this)}},{"./lib/shaders":188,"gl-buffer":122,"gl-shader":191}],190:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.coord=[t,e],this.id=r,this.value=n,this.distance=i}function i(t,e,r){this.gl=t,this.fbo=e,this.buffer=r,this._readTimeout=null;var n=this;this._readCallback=function(){n.gl&&(e.bind(),t.readPixels(0,0,e.shape[0],e.shape[1],t.RGBA,t.UNSIGNED_BYTE,n.buffer),n._readTimeout=null)}}function o(t,e){var r=a(t,e),n=s.mallocUint8(e[0]*e[1]*4);return new i(t,r,n)}e.exports=o;var a=t("gl-fbo"),s=t("typedarray-pool"),l=t("ndarray"),u=t("bit-twiddle").nextPow2,c=t("cwise/lib/wrapper")({args:["array",{offset:[0,0,1],array:0},{offset:[0,0,2],array:0},{offset:[0,0,3],array:0},"scalar","scalar","index"],pre:{body:"{this_closestD2=1e8,this_closestX=-1,this_closestY=-1}",args:[],thisVars:["this_closestD2","this_closestX","this_closestY"],localVars:[]},body:{body:"{if(255>_inline_34_arg0_||255>_inline_34_arg1_||255>_inline_34_arg2_||255>_inline_34_arg3_){var _inline_34_l=_inline_34_arg4_-_inline_34_arg6_[0],_inline_34_a=_inline_34_arg5_-_inline_34_arg6_[1],_inline_34_f=_inline_34_l*_inline_34_l+_inline_34_a*_inline_34_a;_inline_34_fthis.buffer.length){s.free(this.buffer);for(var n=this.buffer=s.mallocUint8(u(r*e*4)),i=0;r*e*4>i;++i)n[i]=255}return t}}}),h.begin=function(){var t=this.gl;this.shape;t&&(this.fbo.bind(),t.clearColor(1,1,1,1),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT))},h.end=function(){var t=this.gl;t&&(t.bindFramebuffer(t.FRAMEBUFFER,null),this._readTimeout||clearTimeout(this._readTimeout),this._readTimeout=setTimeout(this._readCallback,1))},h.query=function(t,e,r){if(!this.gl)return null;var i=this.fbo.shape.slice();t=0|t,e=0|e,"number"!=typeof r&&(r=1);var o=0|Math.min(Math.max(t-r,0),i[0]),a=0|Math.min(Math.max(t+r,0),i[0]),s=0|Math.min(Math.max(e-r,0),i[1]),u=0|Math.min(Math.max(e+r,0),i[1]);if(o>=a||s>=u)return null;var h=[a-o,u-s],f=l(this.buffer,[h[0],h[1],4],[4,4*i[0],1],4*(o+i[0]*s)),p=c(f.hi(h[0],h[1],1),r,r),d=p[0],m=p[1];if(0>d||Math.pow(this.radius,2)=0){for(var A=0|M.type.charAt(M.type.length-1),k=new Array(A),T=0;A>T;++T)k[T]=_.length,b.push(M.name+"["+T+"]"),"number"==typeof M.location?_.push(M.location+T):Array.isArray(M.location)&&M.location.length===A&&"number"==typeof M.location[T]?_.push(0|M.location[T]):_.push(-1);x.push({name:M.name,type:M.type, locations:k})}else x.push({name:M.name,type:M.type,locations:[_.length]}),b.push(M.name),"number"==typeof M.location?_.push(0|M.location):_.push(-1)}for(var E=0,w=0;w<_.length;++w)if(_[w]<0){for(;_.indexOf(E)>=0;)E+=1;_[w]=E}var S=new Array(r.length);o(),p._relink=o,p.types={uniforms:l(r),attributes:l(n)},p.attributes=s(d,p,x,_),Object.defineProperty(p,"uniforms",a(d,p,r,S))},e.exports=o},{"./lib/GLError":192,"./lib/create-attributes":193,"./lib/create-uniforms":194,"./lib/reflect":195,"./lib/runtime-reflect":196,"./lib/shader-cache":197}],192:[function(t,e,r){function n(t,e,r){this.shortMessage=e||"",this.longMessage=r||"",this.rawError=t||"",this.message="gl-shader: "+(e||t||"")+(r?"\n"+r:""),this.stack=(new Error).stack}n.prototype=new Error,n.prototype.name="GLError",n.prototype.constructor=n,e.exports=n},{}],193:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=i,this._constFunc=o}function i(t,e,r,i,o,a,s){for(var l=["gl","v"],u=[],c=0;o>c;++c)l.push("x"+c),u.push("x"+c);l.push("if(x0.length===void 0){return gl.vertexAttrib"+o+"f(v,"+u.join()+")}else{return gl.vertexAttrib"+o+"fv(v,x0)}");var h=Function.apply(null,l),f=new n(t,e,r,i,o,h);Object.defineProperty(a,s,{set:function(e){return t.disableVertexAttribArray(i[r]),h(t,i[r],e),e},get:function(){return f},enumerable:!0})}function o(t,e,r,n,o,a,s){for(var l=new Array(o),u=new Array(o),c=0;o>c;++c)i(t,e,r[c],n,o,l,c),u[c]=l[c];Object.defineProperty(l,"location",{set:function(t){if(Array.isArray(t))for(var e=0;o>e;++e)u[e].location=t[e];else for(var e=0;o>e;++e)u[e].location=t+e;return t},get:function(){for(var t=new Array(o),e=0;o>e;++e)t[e]=n[r[e]];return t},enumerable:!0}),l.pointer=function(e,i,a,s){e=e||t.FLOAT,i=!!i,a=a||o*o,s=s||0;for(var l=0;o>l;++l){var u=n[r[l]];t.vertexAttribPointer(u,o,e,i,a,s+l*o),t.enableVertexAttribArray(u)}};var h=new Array(o),f=t["vertexAttrib"+o+"fv"];Object.defineProperty(a,s,{set:function(e){for(var i=0;o>i;++i){var a=n[r[i]];if(t.disableVertexAttribArray(a),Array.isArray(e[0]))f.call(t,a,e[i]);else{for(var s=0;o>s;++s)h[s]=e[o*i+s];f.call(t,a,h)}}return e},get:function(){return l},enumerable:!0})}function a(t,e,r,n){for(var a={},l=0,u=r.length;u>l;++l){var c=r[l],h=c.name,f=c.type,p=c.locations;switch(f){case"bool":case"int":case"float":i(t,e,p[0],n,1,a,h);break;default:if(f.indexOf("vec")>=0){var d=f.charCodeAt(f.length-1)-48;if(2>d||d>4)throw new s("","Invalid data type for attribute "+h+": "+f);i(t,e,p[0],n,d,a,h)}else{if(!(f.indexOf("mat")>=0))throw new s("","Unknown data type for attribute "+h+": "+f);var d=f.charCodeAt(f.length-1)-48;if(2>d||d>4)throw new s("","Invalid data type for attribute "+h+": "+f);o(t,e,p,n,d,a,h)}}}return a}e.exports=a;var s=t("./GLError"),l=n.prototype;l.pointer=function(t,e,r,n){var i=this,o=i._gl,a=i._locations[i._index];o.vertexAttribPointer(a,i._dimension,t||o.FLOAT,!!e,r||0,n||0),o.enableVertexAttribArray(a)},l.set=function(t,e,r,n){return this._constFunc(this._locations[this._index],t,e,r,n)},Object.defineProperty(l,"location",{get:function(){return this._locations[this._index]},set:function(t){return t!==this._locations[this._index]&&(this._locations[this._index]=0|t,this._wrapper.program=null),0|t}})},{"./GLError":192}],194:[function(t,e,r){"use strict";function n(t){var e=new Function("y","return function(){return y}");return e(t)}function i(t,e){for(var r=new Array(t),n=0;t>n;++n)r[n]=e;return r}function o(t,e,r,o){function l(r){var n=new Function("gl","wrapper","locations","return function(){return gl.getUniform(wrapper.program,locations["+r+"])}");return n(t,e,o)}function u(t,e,r){switch(r){case"bool":case"int":case"sampler2D":case"samplerCube":return"gl.uniform1i(locations["+e+"],obj"+t+")";case"float":return"gl.uniform1f(locations["+e+"],obj"+t+")";default:var n=r.indexOf("vec");if(!(n>=0&&1>=n&&r.length===4+n)){if(0===r.indexOf("mat")&&4===r.length){var i=r.charCodeAt(r.length-1)-48;if(2>i||i>4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+r);return"gl.uniformMatrix"+i+"fv(locations["+e+"],false,obj"+t+")"}throw new s("","Unknown uniform data type for "+name+": "+r)}var i=r.charCodeAt(r.length-1)-48;if(2>i||i>4)throw new s("","Invalid data type");switch(r.charAt(0)){case"b":case"i":return"gl.uniform"+i+"iv(locations["+e+"],obj"+t+")";case"v":return"gl.uniform"+i+"fv(locations["+e+"],obj"+t+")";default:throw new s("","Unrecognized data type for vector "+name+": "+r)}}}function c(t,e){if("object"!=typeof e)return[[t,e]];var r=[];for(var n in e){var i=e[n],o=t;o+=parseInt(n)+""===n?"["+n+"]":"."+n,"object"==typeof i?r.push.apply(r,c(o,i)):r.push([o,i])}return r}function h(e){for(var n=["return function updateProperty(obj){"],i=c("",e),a=0;a=0&&1>=e&&t.length===4+e){var r=t.charCodeAt(t.length-1)-48;if(2>r||r>4)throw new s("","Invalid data type");return"b"===t.charAt(0)?i(r,!1):i(r,0)}if(0===t.indexOf("mat")&&4===t.length){var r=t.charCodeAt(t.length-1)-48;if(2>r||r>4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+t);return i(r*r,0)}throw new s("","Unknown uniform data type for "+name+": "+t)}}function p(t,e,i){if("object"==typeof i){var a=d(i);Object.defineProperty(t,e,{get:n(a),set:h(i),enumerable:!0,configurable:!1})}else o[i]?Object.defineProperty(t,e,{get:l(i),set:h(i),enumerable:!0,configurable:!1}):t[e]=f(r[i].type)}function d(t){var e;if(Array.isArray(t)){e=new Array(t.length);for(var r=0;r1){l[0]in a||(a[l[0]]=[]),a=a[l[0]];for(var u=1;uo;++o){var a=t.getActiveUniform(e,o);if(a){var s=n(t,a.type);if(a.size>1)for(var l=0;lo;++o){var a=t.getActiveAttrib(e,o);a&&i.push({name:a.name,type:n(t,a.type)})}return i}r.uniforms=i,r.attributes=o;var a={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube"},s=null},{}],197:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a){this.id=t,this.src=e,this.type=r,this.shader=n,this.count=o,this.programs=[],this.cache=a}function i(t){this.gl=t,this.shaders=[{},{}],this.programs={}}function o(t,e,r){var n=t.createShader(e);if(t.shaderSource(n,r),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS)){var i=t.getShaderInfoLog(n);try{var o=h(i,r,e)}catch(a){throw console.warn("Failed to format compiler error: "+a),new c(i,"Error compiling shader:\n"+i)}throw new c(i,o.short,o.long)}return n}function a(t,e,r,n,i){var o=t.createProgram();t.attachShader(o,e),t.attachShader(o,r);for(var a=0;an;++n){var o=t.programs[r[n]];o&&(delete t.programs[n],e.deleteProgram(o))}e.deleteShader(this.shader),delete t.shaders[this.type===e.FRAGMENT_SHADER|0][this.src]}};var m=i.prototype;m.getShaderReference=function(t,e){var r=this.gl,i=this.shaders[t===r.FRAGMENT_SHADER|0],a=i[e];if(a&&r.isShader(a.shader))a.count+=1;else{var s=o(r,t,e);a=i[e]=new n(d++,e,t,s,[],1,this)}return a},m.getProgram=function(t,e,r,n){var i=[t.id,e.id,r.join(":"),n.join(":")].join("@"),o=this.programs[i];return o&&this.gl.isProgram(o)||(this.programs[i]=o=a(this.gl,t.shader,e.shader,r,n),t.programs.push(i),e.programs.push(i)),o}},{"./GLError":192,"gl-format-compiler-error":130,"weakmap-shim":488}],198:[function(t,e,r){"use strict";function n(t){this.plot=t,this.enable=[!0,!0,!1,!1],this.width=[1,1,1,1],this.color=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.center=[1/0,1/0]}function i(t,e){var r=new n(t);return r.update(e),t.addOverlay(r),r}e.exports=i;var o=n.prototype;o.update=function(t){t=t||{},this.enable=(t.enable||[!0,!0,!1,!1]).slice(),this.width=(t.width||[1,1,1,1]).slice(),this.color=(t.color||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]).map(function(t){return t.slice()}),this.center=(t.center||[1/0,1/0]).slice(),this.plot.setOverlayDirty()},o.draw=function(){var t=this.enable,e=this.width,r=this.color,n=this.center,i=this.plot,o=i.line,a=i.dataBox,s=i.viewBox;if(o.bind(),a[0]<=n[0]&&n[0]<=a[2]&&a[1]<=n[1]&&n[1]<=a[3]){var l=s[0]+(n[0]-a[0])/(a[2]-a[0])*(s[2]-s[0]),u=s[1]+(n[1]-a[1])/(a[3]-a[1])*(s[3]-s[1]);t[0]&&o.drawLine(l,u,s[0],u,e[0],r[0]),t[1]&&o.drawLine(l,u,l,s[1],e[1],r[1]),t[2]&&o.drawLine(l,u,s[2],u,e[2],r[2]),t[3]&&o.drawLine(l,u,l,s[3],e[3],r[3])}},o.dispose=function(){this.plot.removeOverlay(this)}},{}],199:[function(t,e,r){"use strict";var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, color;\nattribute float weight;\n\nuniform mat4 model, view, projection;\nuniform vec3 coordinates[3];\nuniform vec4 colors[3];\nuniform vec2 screenShape;\nuniform float lineWidth;\n\nvarying vec4 fragColor;\n\nvoid main() {\n vec3 vertexPosition = mix(coordinates[0],\n mix(coordinates[2], coordinates[1], 0.5 * (position + 1.0)), abs(position));\n\n vec4 clipPos = projection * view * model * vec4(vertexPosition, 1.0);\n vec2 clipOffset = (projection * view * model * vec4(color, 0.0)).xy;\n vec2 delta = weight * clipOffset * screenShape;\n vec2 lineOffset = normalize(vec2(delta.y, -delta.x)) / screenShape;\n\n gl_Position = vec4(clipPos.xy + clipPos.w * 0.5 * lineWidth * lineOffset, clipPos.z, clipPos.w);\n fragColor = color.x * colors[0] + color.y * colors[1] + color.z * colors[2];\n}\n",o="precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nvoid main() {\n gl_FragColor = fragColor;\n}";e.exports=function(t){return n(t,i,o,null,[{name:"position",type:"vec3"},{name:"color",type:"vec3"},{name:"weight",type:"float"}])}},{"gl-shader":191}],200:[function(t,e,r){"use strict";function n(t,e,r,n){this.gl=t,this.buffer=e,this.vao=r,this.shader=n,this.pixelRatio=1,this.bounds=[[-1e3,-1e3,-1e3],[1e3,1e3,1e3]],this.position=[0,0,0],this.lineWidth=[2,2,2],this.colors=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.enabled=[!0,!0,!0],this.drawSides=[!0,!0,!0],this.axes=null}function i(t,e){function r(t,e,r,n,o,a){var s=[t,e,r,0,0,0,1];s[n+3]=1,s[n]=o,i.push.apply(i,s),s[6]=-1,i.push.apply(i,s),s[n]=a,i.push.apply(i,s),i.push.apply(i,s),s[6]=1,i.push.apply(i,s),s[n]=o,i.push.apply(i,s)}var i=[];r(0,0,0,0,0,1),r(0,0,0,1,0,1),r(0,0,0,2,0,1),r(1,0,0,1,-1,1),r(1,0,0,2,-1,1),r(0,1,0,0,-1,1),r(0,1,0,2,-1,1),r(0,0,1,0,-1,1),r(0,0,1,1,-1,1);var l=o(t,i),u=a(t,[{type:t.FLOAT,buffer:l,size:3,offset:0,stride:28},{type:t.FLOAT,buffer:l,size:3,offset:12,stride:28},{type:t.FLOAT,buffer:l,size:1,offset:24,stride:28}]),c=s(t);c.attributes.position.location=0,c.attributes.color.location=1,c.attributes.weight.location=2;var h=new n(t,l,u,c);return h.update(e),h}var o=t("gl-buffer"),a=t("gl-vao"),s=t("./shaders/index");e.exports=i;var l=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],u=n.prototype,c=[0,0,0],h=[0,0,0],f=[0,0];u.isTransparent=function(){return!1},u.drawTransparent=function(t){},u.draw=function(t){var e=this.gl,r=this.vao,n=this.shader;r.bind(),n.bind();var i,o=t.model||l,a=t.view||l,s=t.projection||l;this.axes&&(i=this.axes.lastCubeProps.axis);for(var u=c,p=h,d=0;3>d;++d)i&&i[d]<0?(u[d]=this.bounds[0][d],p[d]=this.bounds[1][d]):(u[d]=this.bounds[1][d],p[d]=this.bounds[0][d]);f[0]=e.drawingBufferWidth,f[1]=e.drawingBufferHeight,n.uniforms.model=o,n.uniforms.view=a,n.uniforms.projection=s,n.uniforms.coordinates=[this.position,u,p],n.uniforms.colors=this.colors,n.uniforms.screenShape=f;for(var d=0;3>d;++d)n.uniforms.lineWidth=this.lineWidth[d]*this.pixelRatio,this.enabled[d]&&(r.draw(e.TRIANGLES,6,6*d),this.drawSides[d]&&r.draw(e.TRIANGLES,12,18+12*d));r.unbind()},u.update=function(t){t&&("bounds"in t&&(this.bounds=t.bounds),"position"in t&&(this.position=t.position),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"colors"in t&&(this.colors=t.colors),"enabled"in t&&(this.enabled=t.enabled),"drawSides"in t&&(this.drawSides=t.drawSides))},u.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders/index":199,"gl-buffer":122,"gl-vao":207}],201:[function(t,e,r){var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec4 uv;\nattribute vec3 f;\nattribute vec3 normal;\n\nuniform mat4 model, view, projection, inverseModel;\nuniform vec3 lightPosition, eyePosition;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\n\nvoid main() {\n worldCoordinate = vec3(uv.zw, f.x);\n vec4 worldPosition = model * vec4(worldCoordinate, 1.0);\n vec4 clipPosition = projection * view * worldPosition;\n gl_Position = clipPosition;\n kill = f.y;\n value = f.z;\n planeCoordinate = uv.xy;\n\n //Lighting geometry parameters\n vec4 cameraCoordinate = view * worldPosition;\n cameraCoordinate.xyz /= cameraCoordinate.w;\n lightDirection = lightPosition - cameraCoordinate.xyz;\n eyeDirection = eyePosition - cameraCoordinate.xyz;\n surfaceNormal = normalize((vec4(normal,0) * inverseModel).xyz);\n}\n",o="precision mediump float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution_2_0(float x, float roughness) {\n float NdotH = max(x, 0.0001);\n float cos2Alpha = NdotH * NdotH;\n float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha;\n float roughness2 = roughness * roughness;\n float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha;\n return exp(tan2Alpha / roughness2) / denom;\n}\n\n\n\nfloat beckmannSpecular_1_1(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness) {\n return beckmannDistribution_2_0(dot(surfaceNormal, normalize(lightDirection + viewDirection)), roughness);\n}\n\n\n\nuniform vec3 lowerBound, upperBound;\nuniform float contourTint;\nuniform vec4 contourColor;\nuniform sampler2D colormap;\nuniform vec3 clipBounds[2];\nuniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\n\nvoid main() {\n if(kill > 0.0 ||\n any(lessThan(worldCoordinate, clipBounds[0])) || any(greaterThan(worldCoordinate, clipBounds[1]))) {\n discard;\n }\n\n vec3 N = normalize(surfaceNormal);\n vec3 V = normalize(eyeDirection);\n vec3 L = normalize(lightDirection);\n\n if(gl_FrontFacing) {\n N = -N;\n }\n\n float specular = beckmannSpecular_1_1(L, V, N, roughness);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n vec4 surfaceColor = texture2D(colormap, vec2(value, value));\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = mix(litColor, contourColor, contourTint) * opacity;\n}\n",a="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec4 uv;\nattribute float f;\n\nuniform mat3 permutation;\nuniform mat4 model, view, projection;\nuniform float height, zOffset;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\n\nvoid main() {\n vec3 dataCoordinate = permutation * vec3(uv.xy, height);\n vec4 worldPosition = model * vec4(dataCoordinate, 1.0);\n\n vec4 clipPosition = projection * view * worldPosition;\n clipPosition.z = clipPosition.z + zOffset;\n\n gl_Position = clipPosition;\n value = f;\n kill = -1.0;\n worldCoordinate = dataCoordinate;\n planeCoordinate = uv.zw;\n\n //Don't do lighting for contours\n surfaceNormal = vec3(1,0,0);\n eyeDirection = vec3(0,1,0);\n lightDirection = vec3(0,0,1);\n}\n",s="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec2 shape;\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 surfaceNormal;\n\nvec2 splitFloat(float v) {\n float vh = 255.0 * v;\n float upper = floor(vh);\n float lower = fract(vh);\n return vec2(upper / 255.0, floor(lower * 16.0) / 16.0);\n}\n\nvoid main() {\n if(kill > 0.0 ||\n any(lessThan(worldCoordinate, clipBounds[0])) || any(greaterThan(worldCoordinate, clipBounds[1]))) {\n discard;\n }\n vec2 ux = splitFloat(planeCoordinate.x / shape.x);\n vec2 uy = splitFloat(planeCoordinate.y / shape.y);\n gl_FragColor = vec4(pickId, ux.x, uy.x, ux.y + (uy.y/16.0));\n}\n";r.createShader=function(t){var e=n(t,i,o,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e.attributes.normal.location=2,e},r.createPickShader=function(t){var e=n(t,i,s,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e.attributes.normal.location=2,e},r.createContourShader=function(t){var e=n(t,a,o,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e},r.createPickContourShader=function(t){var e=n(t,a,s,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e}},{"gl-shader":191}],202:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.position=t,this.index=e,this.uv=r,this.level=n,this.dataCoordinate=i}function i(t){var e=b([y({colormap:t,nshades:O,format:"rgba"}).map(function(t){return[t[0],t[1],t[2],255*t[3]]})]);return x.divseq(e,255),e}function o(t,e,r,i,o,a,s,l,u,c,h,f,p,d){this.gl=t,this.shape=e,this.bounds=r,this.intensityBounds=[],this._shader=i,this._pickShader=o,this._coordinateBuffer=a,this._vao=s,this._colorMap=l,this._contourShader=u,this._contourPickShader=c,this._contourBuffer=h,this._contourVAO=f,this._contourOffsets=[[],[],[]],this._contourCounts=[[],[],[]],this._vertexCount=0,this._pickResult=new n([0,0,0],[0,0],[0,0],[0,0,0],[0,0,0]),this._dynamicBuffer=p,this._dynamicVAO=d,this._dynamicOffsets=[0,0,0],this._dynamicCounts=[0,0,0],this.contourWidth=[1,1,1],this.contourLevels=[[1],[1],[1]],this.contourTint=[0,0,0],this.contourColor=[[.5,.5,.5,1],[.5,.5,.5,1],[.5,.5,.5,1]],this.showContour=!0,this.showSurface=!0,this.enableHighlight=[!0,!0,!0],this.highlightColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.highlightTint=[1,1,1],this.highlightLevel=[-1,-1,-1],this.enableDynamic=[!0,!0,!0],this.dynamicLevel=[NaN,NaN,NaN],this.dynamicColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.dynamicTint=[1,1,1],this.dynamicWidth=[1,1,1],this.axesBounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.surfaceProject=[!1,!1,!1],this.contourProject=[[!1,!1,!1],[!1,!1,!1],[!1,!1,!1]],this.colorBounds=[!1,!1],this._field=[_(v.mallocFloat(1024),[0,0]),_(v.mallocFloat(1024),[0,0]),_(v.mallocFloat(1024),[0,0])],this.pickId=1,this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.snapToData=!1,this.opacity=1,this.lightPosition=[10,1e4,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.dirty=!0}function a(t,e){var r,n,i,o=e.axes&&e.axes.lastCubeProps.axis||F,a=e.showSurface,s=e.showContour;for(r=0;3>r;++r)for(a=a||e.surfaceProject[r],n=0;3>n;++n)s=s||e.contourProject[r][n];for(r=0;3>r;++r){var l=N.projections[r];for(n=0;16>n;++n)l[n]=0;for(n=0;4>n;++n)l[5*n]=1;l[5*r]=0,l[12+r]=e.axesBounds[+(o[r]>0)][r],M(l,t.model,l);var u=N.clipBounds[r];for(i=0;2>i;++i)for(n=0;3>n;++n)u[i][n]=t.clipBounds[i][n];u[0][r]=-1e8,u[1][r]=1e8}return N.showSurface=a,N.showContour=s,N}function s(t,e){t=t||{};var r=this.gl;r.disable(r.CULL_FACE),this._colorMap.bind(0);var n=B;n.model=t.model||C,n.view=t.view||C,n.projection=t.projection||C,n.lowerBound=[this.bounds[0][0],this.bounds[0][1],this.colorBounds[0]||this.bounds[0][2]],n.upperBound=[this.bounds[1][0],this.bounds[1][1],this.colorBounds[1]||this.bounds[1][2]],n.contourColor=this.contourColor[0],n.inverseModel=A(n.inverseModel,n.model);for(var i=0;2>i;++i)for(var o=n.clipBounds[i],s=0;3>s;++s)o[s]=Math.min(Math.max(this.clipBounds[i][s],-1e8),1e8);n.kambient=this.ambientLight,n.kdiffuse=this.diffuseLight,n.kspecular=this.specularLight,n.roughness=this.roughness,n.fresnel=this.fresnel,n.opacity=this.opacity,n.height=0,n.permutation=V;var l=U;for(M(l,n.view,n.model),M(l,n.projection,l),A(l,l),i=0;3>i;++i)n.eyePosition[i]=l[12+i]/l[15];var u=l[15];for(i=0;3>i;++i)u+=this.lightPosition[i]*l[4*i+3];for(i=0;3>i;++i){var c=l[12+i];for(s=0;3>s;++s)c+=l[4*s+i]*this.lightPosition[s];n.lightPosition[i]=c/u}var h=a(n,this);if(h.showSurface&&e===this.opacity<1){for(this._shader.bind(),this._shader.uniforms=n,this._vao.bind(),this.showSurface&&this._vertexCount&&this._vao.draw(r.TRIANGLES,this._vertexCount),i=0;3>i;++i)this.surfaceProject[i]&&this.vertexCount&&(this._shader.uniforms.model=h.projections[i],this._shader.uniforms.clipBounds=h.clipBounds[i],this._vao.draw(r.TRIANGLES,this._vertexCount));this._vao.unbind()}if(h.showContour&&!e){var f=this._contourShader;n.kambient=1,n.kdiffuse=0,n.kspecular=0,n.opacity=1,f.bind(),f.uniforms=n;var p=this._contourVAO;for(p.bind(),i=0;3>i;++i)for(f.uniforms.permutation=D[i],r.lineWidth(this.contourWidth[i]),s=0;si;++i)for(f.uniforms.model=h.projections[i],f.uniforms.clipBounds=h.clipBounds[i],s=0;3>s;++s)if(this.contourProject[i][s]){f.uniforms.permutation=D[s],r.lineWidth(this.contourWidth[s]);for(var d=0;di;++i)if(0!==this._dynamicCounts[i])for(f.uniforms.model=n.model,f.uniforms.clipBounds=n.clipBounds,f.uniforms.permutation=D[i],r.lineWidth(this.dynamicWidth[i]),f.uniforms.contourColor=this.dynamicColor[i],f.uniforms.contourTint=this.dynamicTint[i],f.uniforms.height=this.dynamicLevel[i],p.draw(r.LINES,this._dynamicCounts[i],this._dynamicOffsets[i]),s=0;3>s;++s)this.contourProject[s][i]&&(f.uniforms.model=h.projections[s],f.uniforms.clipBounds=h.clipBounds[s],p.draw(r.LINES,this._dynamicCounts[i],this._dynamicOffsets[i]));p.unbind()}}function l(t,e){var r=e.shape.slice(),n=t.shape.slice();x.assign(t.lo(1,1).hi(r[0],r[1]),e),x.assign(t.lo(1).hi(r[0],1),e.hi(r[0],1)),x.assign(t.lo(1,n[1]-1).hi(r[0],1),e.lo(0,r[1]-1).hi(r[0],1)),x.assign(t.lo(0,1).hi(1,r[1]),e.hi(1)),x.assign(t.lo(n[0]-1,1).hi(1,r[1]),e.lo(r[0]-1)),t.set(0,0,e.get(0,0)),t.set(0,n[1]-1,e.get(0,r[1]-1)),t.set(n[0]-1,0,e.get(r[0]-1,0)),t.set(n[0]-1,n[1]-1,e.get(r[0]-1,r[1]-1))}function u(t,e){return Array.isArray(t)?[e(t[0]),e(t[1]),e(t[2])]:[e(t),e(t),e(t)]}function c(t){return Array.isArray(t)?3===t.length?[t[0],t[1],t[2],1]:[t[0],t[1],t[2],t[3]]:[0,0,0,1]}function h(t){if(Array.isArray(t)){if(Array.isArray(t))return[c(t[0]),c(t[1]),c(t[2])];var e=c(t);return[e.slice(),e.slice(),e.slice()]}}function f(t){var e=t.gl,r=S(e),n=z(e),i=L(e),a=I(e),s=d(e),l=m(e,[{buffer:s,size:4,stride:P,offset:0},{buffer:s,size:3,stride:P,offset:16},{buffer:s,size:3,stride:P,offset:28}]),u=d(e),c=m(e,[{buffer:u,size:4,stride:20,offset:0},{buffer:u,size:1,stride:20,offset:16}]),h=d(e),f=m(e,[{buffer:h,size:2,type:e.FLOAT}]),p=g(e,1,O,e.RGBA,e.UNSIGNED_BYTE);p.minFilter=e.LINEAR,p.magFilter=e.LINEAR;var v=new o(e,[0,0],[[0,0,0],[0,0,0]],r,n,s,l,p,i,a,u,c,h,f),y={levels:[[],[],[]]};for(var x in t)y[x]=t[x];return y.colormap=y.colormap||"jet",v.update(y),v}e.exports=f;var p=t("bit-twiddle"),d=t("gl-buffer"),m=t("gl-vao"),g=t("gl-texture2d"),v=t("typedarray-pool"),y=t("colormap"),x=t("ndarray-ops"),b=t("ndarray-pack"),_=t("ndarray"),w=t("surface-nets"),M=t("gl-mat4/multiply"),A=t("gl-mat4/invert"),k=t("binary-search-bounds"),T=t("ndarray-gradient"),E=t("./lib/shaders"),S=E.createShader,L=E.createContourShader,z=E.createPickShader,I=E.createPickContourShader,P=40,C=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],R=[[0,0],[0,1],[1,0],[1,1],[1,0],[0,1]],D=[[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0]];!function(){for(var t=0;3>t;++t){var e=D[t],r=(t+1)%3,n=(t+2)%3;e[r+0]=1,e[n+3]=1,e[t+6]=1}}();var O=265,j=o.prototype;j.isTransparent=function(){return this.opacity<1},j.isOpaque=function(){if(this.opacity>=1)return!0;for(var t=0;3>t;++t)if(this._contourCounts[t].length>0||this._dynamicCounts[t]>0)return!0;return!1},j.pickSlots=1,j.setPickBase=function(t){this.pickId=t};var F=[0,0,0],N={showSurface:!1,showContour:!1,projections:[C.slice(),C.slice(),C.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]},B={model:C,view:C,projection:C,inverseModel:C.slice(),lowerBound:[0,0,0],upperBound:[0,0,0],colorMap:0,clipBounds:[[0,0,0],[0,0,0]],height:0,contourTint:0,contourColor:[0,0,0,1],permutation:[1,0,0,0,1,0,0,0,1],zOffset:-1e-4,kambient:1,kdiffuse:1,kspecular:1,lightPosition:[1e3,1e3,1e3],eyePosition:[0,0,0],roughness:1,fresnel:1,opacity:1},U=C.slice(),V=[1,0,0,0,1,0,0,0,1];j.draw=function(t){return s.call(this,t,!1)},j.drawTransparent=function(t){return s.call(this,t,!0)};var q={model:C,view:C,projection:C,inverseModel:C,clipBounds:[[0,0,0],[0,0,0]],height:0,shape:[0,0],pickId:0,lowerBound:[0,0,0],upperBound:[0,0,0],zOffset:0,permutation:[1,0,0,0,1,0,0,0,1],lightPosition:[0,0,0],eyePosition:[0,0,0]};j.drawPick=function(t){t=t||{};var e=this.gl;e.disable(e.CULL_FACE);var r=q;r.model=t.model||C,r.view=t.view||C,r.projection=t.projection||C,r.shape=this._field[2].shape,r.pickId=this.pickId/255,r.lowerBound=this.bounds[0],r.upperBound=this.bounds[1],r.permutation=V;for(var n=0;2>n;++n)for(var i=r.clipBounds[n],o=0;3>o;++o)i[o]=Math.min(Math.max(this.clipBounds[n][o],-1e8),1e8);var s=a(r,this);if(s.showSurface){for(this._pickShader.bind(),this._pickShader.uniforms=r,this._vao.bind(),this._vao.draw(e.TRIANGLES,this._vertexCount),n=0;3>n;++n)this.surfaceProject[n]&&(this._pickShader.uniforms.model=s.projections[n],this._pickShader.uniforms.clipBounds=s.clipBounds[n],this._vao.draw(e.TRIANGLES,this._vertexCount));this._vao.unbind()}if(s.showContour){var l=this._contourPickShader;l.bind(),l.uniforms=r;var u=this._contourVAO;for(u.bind(),o=0;3>o;++o)for(e.lineWidth(this.contourWidth[o]),l.uniforms.permutation=D[o],n=0;nn;++n)for(l.uniforms.model=s.projections[n],l.uniforms.clipBounds=s.clipBounds[n],o=0;3>o;++o)if(this.contourProject[n][o]){l.uniforms.permutation=D[o],e.lineWidth(this.contourWidth[o]);for(var c=0;c>4)/16)/255,i=Math.floor(n),o=n-i,a=e[1]*(t.value[1]+(15&t.value[2])/16)/255,s=Math.floor(a),l=a-s;i+=1,s+=1;var u=r.position;u[0]=u[1]=u[2]=0;for(var c=0;2>c;++c)for(var h=c?o:1-o,f=0;2>f;++f)for(var p=f?l:1-l,d=i+c,m=s+f,g=h*p,v=0;3>v;++v)u[v]+=this._field[v].get(d,m)*g;for(var y=this._pickResult.level,x=0;3>x;++x)if(y[x]=k.le(this.contourLevels[x],u[x]),y[x]<0)this.contourLevels[x].length>0&&(y[x]=0);else if(y[x]Math.abs(_-u[x])&&(y[x]+=1)}for(r.index[0]=.5>o?i:i+1,r.index[1]=.5>l?s:s+1,r.uv[0]=n/e[0],r.uv[1]=a/e[1],v=0;3>v;++v)r.dataCoordinate[v]=this._field[v].get(r.index[0],r.index[1]);return r},j.update=function(t){t=t||{},this.dirty=!0,"contourWidth"in t&&(this.contourWidth=u(t.contourWidth,Number)),"showContour"in t&&(this.showContour=u(t.showContour,Boolean)),"showSurface"in t&&(this.showSurface=!!t.showSurface),"contourTint"in t&&(this.contourTint=u(t.contourTint,Boolean)),"contourColor"in t&&(this.contourColor=h(t.contourColor)),"contourProject"in t&&(this.contourProject=u(t.contourProject,function(t){return u(t,Boolean)})),"surfaceProject"in t&&(this.surfaceProject=t.surfaceProject),"dynamicColor"in t&&(this.dynamicColor=h(t.dynamicColor)),"dynamicTint"in t&&(this.dynamicTint=u(t.dynamicTint,Number)),"dynamicWidth"in t&&(this.dynamicWidth=u(t.dynamicWidth,Number)),"opacity"in t&&(this.opacity=t.opacity),"colorBounds"in t&&(this.colorBounds=t.colorBounds);var e=t.field||t.coords&&t.coords[2]||null,r=!1;if(e||(e=this._field[2].shape[0]||this._field[2].shape[2]?this._field[2].lo(1,1).hi(this._field[2].shape[0]-2,this._field[2].shape[1]-2):this._field[2].hi(0,0)),"field"in t||"coords"in t){var n=(e.shape[0]+2)*(e.shape[1]+2);n>this._field[2].data.length&&(v.freeFloat(this._field[2].data),this._field[2].data=v.mallocFloat(p.nextPow2(n))),this._field[2]=_(this._field[2].data,[e.shape[0]+2,e.shape[1]+2]),l(this._field[2],e),this.shape=e.shape.slice();for(var o=this.shape,a=0;2>a;++a)this._field[2].size>this._field[a].data.length&&(v.freeFloat(this._field[a].data),this._field[a].data=v.mallocFloat(this._field[2].size)),this._field[a]=_(this._field[a].data,[o[0]+2,o[1]+2]);if(t.coords){var s=t.coords;if(!Array.isArray(s)||3!==s.length)throw new Error("gl-surface: invalid coordinates for x/y");for(a=0;2>a;++a){var c=s[a];for(y=0;2>y;++y)if(c.shape[y]!==o[y])throw new Error("gl-surface: coords have incorrect shape");l(this._field[a],c)}}else if(t.ticks){var f=t.ticks;if(!Array.isArray(f)||2!==f.length)throw new Error("gl-surface: invalid ticks");for(a=0;2>a;++a){var d=f[a];if((Array.isArray(d)||d.length)&&(d=_(d)),d.shape[0]!==o[a])throw new Error("gl-surface: invalid tick length"); var m=_(d.data,o);m.stride[a]=d.stride[0],m.stride[1^a]=0,l(this._field[a],m)}}else{for(a=0;2>a;++a){var g=[0,0];g[a]=1,this._field[a]=_(this._field[a].data,[o[0]+2,o[1]+2],g,0)}this._field[0].set(0,0,0);for(var y=0;ya;++a)T(b.pick(a),x[a],"mirror");var M=_(v.mallocFloat(3*x[2].size),[o[0]+2,o[1]+2,3]);for(a=0;aD?(D=Math.max(Math.abs(I),Math.abs(P),Math.abs(C)),1e-8>D?(C=1,P=I=0,D=1):D=1/D):D=1/Math.sqrt(D),M.set(a,y,0,I*D),M.set(a,y,1,P*D),M.set(a,y,2,C*D)}v.free(b.data);var O=[1/0,1/0,1/0],j=[-(1/0),-(1/0),-(1/0)],F=1/0,N=-(1/0),B=(o[0]-1)*(o[1]-1)*6,U=v.mallocFloat(p.nextPow2(10*B)),V=0,q=0;for(a=0;aG;++G)for(var H=0;2>H;++H)for(var X=0;3>X;++X){var Y=this._field[X].get(1+a+G,1+y+H);if(isNaN(Y)||!isFinite(Y))continue t}for(X=0;6>X;++X){var W=a+R[X][0],Z=y+R[X][1],Q=this._field[0].get(W+1,Z+1),K=this._field[1].get(W+1,Z+1);Y=this._field[2].get(W+1,Z+1);var $=Y;I=M.get(W+1,Z+1,0),P=M.get(W+1,Z+1,1),C=M.get(W+1,Z+1,2),t.intensity&&($=t.intensity.get(W,Z)),U[V++]=W,U[V++]=Z,U[V++]=Q,U[V++]=K,U[V++]=Y,U[V++]=0,U[V++]=$,U[V++]=I,U[V++]=P,U[V++]=C,O[0]=Math.min(O[0],Q),O[1]=Math.min(O[1],K),O[2]=Math.min(O[2],Y),F=Math.min(F,$),j[0]=Math.max(j[0],Q),j[1]=Math.max(j[1],K),j[2]=Math.max(j[2],Y),N=Math.max(N,$),q+=1}}for(t.intensityBounds&&(F=+t.intensityBounds[0],N=+t.intensityBounds[1]),a=6;V>a;a+=10)U[a]=(U[a]-F)/(N-F);this._vertexCount=q,this._coordinateBuffer.update(U.subarray(0,V)),v.freeFloat(U),v.free(M.data),this.bounds=[O,j],this.intensity=t.intensity||this._field[2],this.intensityBounds[0]===F&&this.intensityBounds[1]===N||(r=!0),this.intensityBounds=[F,N]}if("levels"in t){var J=t.levels;for(J=Array.isArray(J[0])?J.slice():[[],[],J],a=0;3>a;++a)J[a]=J[a].slice(),J.sort(function(t,e){return t-e});t:for(a=0;3>a;++a){if(J[a].length!==this.contourLevels[a].length){r=!0;break}for(y=0;yet;++et){J=this.contourLevels[et];var rt=[],nt=[],it=[0,0,0];for(a=0;aX;++X){var st=ot.positions[at[X]],lt=st[0],ut=0|Math.floor(lt),ct=lt-ut,ht=st[1],ft=0|Math.floor(ht),pt=ht-ft,dt=!1;e:for(var mt=0;3>mt;++mt){it[mt]=0;var gt=(et+mt+1)%3;for(G=0;2>G;++G){var vt=G?ct:1-ct;for(W=0|Math.min(Math.max(ut+G,0),o[0]),H=0;2>H;++H){var yt=H?pt:1-pt;if(Z=0|Math.min(Math.max(ft+H,0),o[1]),Y=2>mt?this._field[gt].get(W,Z):(this.intensity.get(W,Z)-this.intensityBounds[0])/(this.intensityBounds[1]-this.intensityBounds[0]),!isFinite(Y)||isNaN(Y)){dt=!0;break e}var xt=vt*yt;it[mt]+=xt*Y}}}if(dt){if(X>0){for(var bt=0;5>bt;++bt)tt.pop();q-=1}continue t}tt.push(it[0],it[1],st[0],st[1],it[2]),q+=1}}nt.push(q)}this._contourOffsets[et]=rt,this._contourCounts[et]=nt}var _t=v.mallocFloat(tt.length);for(a=0;at;++t)v.freeFloat(this._field[t].data)},j.highlight=function(t){if(!t)return this._dynamicCounts=[0,0,0],this.dyanamicLevel=[NaN,NaN,NaN],void(this.highlightLevel=[-1,-1,-1]);for(var e=0;3>e;++e)this.enableHighlight[e]?this.highlightLevel[e]=t.level[e]:this.highlightLevel[e]=-1;var r;if(r=this.snapToData?t.dataCoordinate:t.position,this.enableDynamic[0]&&r[0]!==this.dynamicLevel[0]||this.enableDynamic[1]&&r[1]!==this.dynamicLevel[1]||this.enableDynamic[2]&&r[2]!==this.dynamicLevel[2]){for(var n=0,i=this.shape,o=v.mallocFloat(12*i[0]*i[1]),a=0;3>a;++a)if(this.enableDynamic[a]){this.dynamicLevel[a]=r[a];var s=(a+1)%3,l=(a+2)%3,u=this._field[a],c=this._field[s],h=this._field[l],f=(this.intensity,w(u,r[a])),p=f.cells,d=f.positions;for(this._dynamicOffsets[a]=n,e=0;eg;++g){var y=d[m[g]],x=+y[0],b=0|x,_=0|Math.min(b+1,i[0]),M=x-b,A=1-M,k=+y[1],T=0|k,E=0|Math.min(T+1,i[1]),S=k-T,L=1-S,z=A*L,I=A*S,P=M*L,C=M*S,R=z*c.get(b,T)+I*c.get(b,E)+P*c.get(_,T)+C*c.get(_,E),D=z*h.get(b,T)+I*h.get(b,E)+P*h.get(_,T)+C*h.get(_,E);if(isNaN(R)||isNaN(D)){g&&(n-=1);break}o[2*n+0]=R,o[2*n+1]=D,n+=1}this._dynamicCounts[a]=n-this._dynamicOffsets[a]}else this.dynamicLevel[a]=NaN,this._dynamicCounts[a]=0;this._dynamicBuffer.update(o.subarray(0,2*n)),v.freeFloat(o)}}},{"./lib/shaders":201,"binary-search-bounds":49,"bit-twiddle":50,colormap:75,"gl-buffer":122,"gl-mat4/invert":143,"gl-mat4/multiply":145,"gl-texture2d":203,"gl-vao":207,ndarray:399,"ndarray-gradient":390,"ndarray-ops":393,"ndarray-pack":394,"surface-nets":459,"typedarray-pool":468}],203:[function(t,e,r){"use strict";function n(t){g=[t.LINEAR,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_NEAREST],v=[t.NEAREST,t.LINEAR,t.NEAREST_MIPMAP_NEAREST,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_LINEAR],y=[t.REPEAT,t.CLAMP_TO_EDGE,t.MIRRORED_REPEAT]}function i(t,e,r){var n=t.gl,i=n.getParameter(n.MAX_TEXTURE_SIZE);if(0>e||e>i||0>r||r>i)throw new Error("gl-texture2d: Invalid texture size");return t._shape=[e,r],t.bind(),n.texImage2D(n.TEXTURE_2D,0,t.format,e,r,0,t.format,t.type,null),t._mipLevels=[0],t}function o(t,e,r,n,i,o){this.gl=t,this.handle=e,this.format=i,this.type=o,this._shape=[r,n],this._mipLevels=[0],this._magFilter=t.NEAREST,this._minFilter=t.NEAREST,this._wrapS=t.CLAMP_TO_EDGE,this._wrapT=t.CLAMP_TO_EDGE,this._anisoSamples=1;var a=this,s=[this._wrapS,this._wrapT];Object.defineProperties(s,[{get:function(){return a._wrapS},set:function(t){return a.wrapS=t}},{get:function(){return a._wrapT},set:function(t){return a.wrapT=t}}]),this._wrapVector=s;var l=[this._shape[0],this._shape[1]];Object.defineProperties(l,[{get:function(){return a._shape[0]},set:function(t){return a.width=t}},{get:function(){return a._shape[1]},set:function(t){return a.height=t}}]),this._shapeVector=l}function a(t,e){return 3===t.length?1===e[2]&&e[1]===t[0]*t[2]&&e[0]===t[2]:1===e[0]&&e[1]===t[0]}function s(t,e,r,n,i,o,s,l){var u=l.dtype,c=l.shape.slice();if(c.length<2||c.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var h=0,f=0,g=a(c,l.stride.slice());"float32"===u?h=t.FLOAT:"float64"===u?(h=t.FLOAT,g=!1,u="float32"):"uint8"===u?h=t.UNSIGNED_BYTE:(h=t.UNSIGNED_BYTE,g=!1,u="uint8");var v=1;if(2===c.length)f=t.LUMINANCE,c=[c[0],c[1],1],l=p(l.data,c,[l.stride[0],l.stride[1],1],l.offset);else{if(3!==c.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===c[2])f=t.ALPHA;else if(2===c[2])f=t.LUMINANCE_ALPHA;else if(3===c[2])f=t.RGB;else{if(4!==c[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");f=t.RGBA}v=c[2]}if(f!==t.LUMINANCE&&f!==t.ALPHA||i!==t.LUMINANCE&&i!==t.ALPHA||(f=i),f!==i)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var y=l.size,b=s.indexOf(n)<0;if(b&&s.push(n),h===o&&g)0===l.offset&&l.data.length===y?b?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,o,l.data):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,o,l.data):b?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,o,l.data.subarray(l.offset,l.offset+y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,o,l.data.subarray(l.offset,l.offset+y));else{var _;_=o===t.FLOAT?m.mallocFloat32(y):m.mallocUint8(y);var w=p(_,c,[c[2],c[2]*c[0],1]);h===t.FLOAT&&o===t.UNSIGNED_BYTE?x(w,l):d.assign(w,l),b?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,o,_.subarray(0,y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,o,_.subarray(0,y)),o===t.FLOAT?m.freeFloat32(_):m.freeUint8(_)}}function l(t){var e=t.createTexture();return t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),e}function u(t,e,r,n,i){var a=t.getParameter(t.MAX_TEXTURE_SIZE);if(0>e||e>a||0>r||r>a)throw new Error("gl-texture2d: Invalid texture shape");if(i===t.FLOAT&&!t.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var s=l(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new o(t,s,e,r,n,i)}function c(t,e,r,n){var i=l(t);return t.texImage2D(t.TEXTURE_2D,0,r,r,n,e),new o(t,i,0|e.width,0|e.height,r,n)}function h(t,e){var r=e.dtype,n=e.shape.slice(),i=t.getParameter(t.MAX_TEXTURE_SIZE);if(n[0]<0||n[0]>i||n[1]<0||n[1]>i)throw new Error("gl-texture2d: Invalid texture size");var s=a(n,e.stride.slice()),u=0;"float32"===r?u=t.FLOAT:"float64"===r?(u=t.FLOAT,s=!1,r="float32"):"uint8"===r?u=t.UNSIGNED_BYTE:(u=t.UNSIGNED_BYTE,s=!1,r="uint8");var c=0;if(2===n.length)c=t.LUMINANCE,n=[n[0],n[1],1],e=p(e.data,n,[e.stride[0],e.stride[1],1],e.offset);else{if(3!==n.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===n[2])c=t.ALPHA;else if(2===n[2])c=t.LUMINANCE_ALPHA;else if(3===n[2])c=t.RGB;else{if(4!==n[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");c=t.RGBA}}u!==t.FLOAT||t.getExtension("OES_texture_float")||(u=t.UNSIGNED_BYTE,s=!1);var h,f,g=e.size;if(s)h=0===e.offset&&e.data.length===g?e.data:e.data.subarray(e.offset,e.offset+g);else{var v=[n[2],n[2]*n[0],1];f=m.malloc(g,r);var y=p(f,n,v,0);"float32"!==r&&"float64"!==r||u!==t.UNSIGNED_BYTE?d.assign(y,e):x(y,e),h=f.subarray(0,g)}var b=l(t);return t.texImage2D(t.TEXTURE_2D,0,c,n[0],n[1],0,c,u,h),s||m.free(f),new o(t,b,n[0],n[1],c,u)}function f(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(g||n(t),"number"==typeof arguments[1])return u(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return u(t,0|arguments[1][0],0|arguments[1][1],arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var e=arguments[1];if(e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof HTMLVideoElement||e instanceof ImageData)return c(t,e,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return h(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}var p=t("ndarray"),d=t("ndarray-ops"),m=t("typedarray-pool");e.exports=f;var g=null,v=null,y=null,x=function(t,e){d.muls(t,e,255)},b=o.prototype;Object.defineProperties(b,{minFilter:{get:function(){return this._minFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&g.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),v.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,t),this._minFilter=t}},magFilter:{get:function(){return this._magFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&g.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),v.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,t),this._magFilter=t}},mipSamples:{get:function(){return this._anisoSamples},set:function(t){var e=this._anisoSamples;if(this._anisoSamples=0|Math.max(t,1),e!==this._anisoSamples){var r=gl.getExtension("EXT_texture_filter_anisotropic");r&&this.gl.texParameterf(this.gl.TEXTURE_2D,r.TEXTURE_MAX_ANISOTROPY_EXT,this._anisoSamples)}return this._anisoSamples}},wrapS:{get:function(){return this._wrapS},set:function(t){if(this.bind(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,t),this._wrapS=t}},wrapT:{get:function(){return this._wrapT},set:function(t){if(this.bind(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,t),this._wrapT=t}},wrap:{get:function(){return this._wrapVector},set:function(t){if(Array.isArray(t)||(t=[t,t]),2!==t.length)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var e=0;2>e;++e)if(y.indexOf(t[e])<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);this._wrapS=t[0],this._wrapT=t[1];var r=this.gl;return this.bind(),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,this._wrapS),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,this._wrapT),t}},shape:{get:function(){return this._shapeVector},set:function(t){if(Array.isArray(t)){if(2!==t.length)throw new Error("gl-texture2d: Invalid texture shape")}else t=[0|t,0|t];return i(this,0|t[0],0|t[1]),[0|t[0],0|t[1]]}},width:{get:function(){return this._shape[0]},set:function(t){return t=0|t,i(this,t,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t=0|t,i(this,this._shape[0],t),t}}}),b.bind=function(t){var e=this.gl;return void 0!==t&&e.activeTexture(e.TEXTURE0+(0|t)),e.bindTexture(e.TEXTURE_2D,this.handle),void 0!==t?0|t:e.getParameter(e.ACTIVE_TEXTURE)-e.TEXTURE0},b.dispose=function(){this.gl.deleteTexture(this.handle)},b.generateMipmap=function(){this.bind(),this.gl.generateMipmap(this.gl.TEXTURE_2D);for(var t=Math.min(this._shape[0],this._shape[1]),e=0;t>0;++e,t>>>=1)this._mipLevels.indexOf(e)<0&&this._mipLevels.push(e)},b.setPixels=function(t,e,r,n){var i=this.gl;if(this.bind(),Array.isArray(e)?(n=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),n=n||0,t instanceof HTMLCanvasElement||t instanceof ImageData||t instanceof HTMLImageElement||t instanceof HTMLVideoElement){var o=this._mipLevels.indexOf(n)<0;o?(i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,this.type,t),this._mipLevels.push(n)):i.texSubImage2D(i.TEXTURE_2D,n,e,r,this.format,this.type,t)}else{if(!(t.shape&&t.stride&&t.data))throw new Error("gl-texture2d: Unsupported data type");if(t.shape.length<2||e+t.shape[1]>this._shape[1]>>>n||r+t.shape[0]>this._shape[0]>>>n||0>e||0>r)throw new Error("gl-texture2d: Texture dimensions are out of bounds");s(i,e,r,n,this.format,this.type,this._mipLevels,t)}}},{ndarray:399,"ndarray-ops":393,"typedarray-pool":468}],204:[function(t,e,r){"use strict";function n(t,e,r){e?e.bind():t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null);var n=0|t.getParameter(t.MAX_VERTEX_ATTRIBS);if(r){if(r.length>n)throw new Error("gl-vao: Too many vertex attributes");for(var i=0;ii;++i)t.disableVertexAttribArray(i)}else{t.bindBuffer(t.ARRAY_BUFFER,null);for(var i=0;n>i;++i)t.disableVertexAttribArray(i)}}e.exports=n},{}],205:[function(t,e,r){"use strict";function n(t){this.gl=t,this._elements=null,this._attributes=null,this._elementsType=t.UNSIGNED_SHORT}function i(t){return new n(t)}var o=t("./do-bind.js");n.prototype.bind=function(){o(this.gl,this._elements,this._attributes)},n.prototype.update=function(t,e,r){this._elements=e,this._attributes=t,this._elementsType=r||this.gl.UNSIGNED_SHORT},n.prototype.dispose=function(){},n.prototype.unbind=function(){},n.prototype.draw=function(t,e,r){r=r||0;var n=this.gl;this._elements?n.drawElements(t,e,this._elementsType,r):n.drawArrays(t,r,e)},e.exports=i},{"./do-bind.js":204}],206:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){this.location=t,this.dimension=e,this.a=r,this.b=n,this.c=i,this.d=o}function i(t,e,r){this.gl=t,this._ext=e,this.handle=r,this._attribs=[],this._useElements=!1,this._elementsType=t.UNSIGNED_SHORT}function o(t,e){return new i(t,e,e.createVertexArrayOES())}var a=t("./do-bind.js");n.prototype.bind=function(t){switch(this.dimension){case 1:t.vertexAttrib1f(this.location,this.a);break;case 2:t.vertexAttrib2f(this.location,this.a,this.b);break;case 3:t.vertexAttrib3f(this.location,this.a,this.b,this.c);break;case 4:t.vertexAttrib4f(this.location,this.a,this.b,this.c,this.d)}},i.prototype.bind=function(){this._ext.bindVertexArrayOES(this.handle);for(var t=0;t0&&(o=1/Math.sqrt(o),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o),t}e.exports=n},{}],213:[function(t,e,r){function n(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*a,t}e.exports=n},{}],214:[function(t,e,r){function n(t,e,r,n){return i[0]=n,i[1]=r,i[2]=e,i[3]=t,o[0]}e.exports=n;var i=new Uint8Array(4),o=new Float32Array(i.buffer)},{}],215:[function(t,e,r){function n(t){for(var e=Array.isArray(t)?t:i(t),r=0;rF;){switch(e=F,B){case h:F=S();break;case f:F=E();break;case p:F=T();break;case d:F=L();break;case m:F=P();break;case w:F=I();break;case g:F=C();break;case c:F=R();break;case b:F=k();break;case u:F=A()}if(e!==F)switch(W[e]){case"\n":G=0,++q;break;default:++G}}return N+=F,W=W.slice(F),V}function n(t){return U.length&&e(U.join("")),B=_,e("(eof)"),V}function A(){return U=U.length?[]:U,"/"===O&&"*"===D?(H=N+F-1,B=h,O=D,F+1):"/"===O&&"/"===D?(H=N+F-1,B=f,O=D,F+1):"#"===D?(B=p,H=N+F,F):/\s/.test(D)?(B=b,H=N+F,F):(X=/\d/.test(D),Y=/[^\w_]/.test(D),H=N+F,B=X?m:Y?d:c,F)}function k(){return/[^\s]/g.test(D)?(e(U.join("")),B=u,F):(U.push(D),O=D,F+1)}function T(){return"\n"===D&&"\\"!==O?(e(U.join("")),B=u,F):(U.push(D),O=D,F+1)}function E(){return T()}function S(){return"/"===D&&"*"===O?(U.push(D),e(U.join("")),B=u,F+1):(U.push(D),O=D,F+1)}function L(){if("."===O&&/\d/.test(D))return B=g,F;if("/"===O&&"*"===D)return B=h,F;if("/"===O&&"/"===D)return B=f,F;if("."===D&&U.length){for(;z(U););return B=g,F}if(";"===D||")"===D||"("===D){if(U.length)for(;z(U););return e(D),B=u,F+1}var t=2===U.length&&"="!==D;if(/[\w_\d\s]/.test(D)||t){for(;z(U););return B=u,F}return U.push(D),O=D,F+1}function z(t){for(var r,n,i=0;;){if(r=o.indexOf(t.slice(0,t.length+i).join("")),n=o[r],-1===r){if(i--+t.length>0)continue;n=t.slice(0,1).join("")}return e(n),H+=n.length,U=U.slice(n.length),U.length}}function I(){return/[^a-fA-F0-9]/.test(D)?(e(U.join("")),B=u,F):(U.push(D),O=D,F+1)}function P(){return"."===D?(U.push(D),B=g,O=D,F+1):/[eE]/.test(D)?(U.push(D),B=g,O=D,F+1):"x"===D&&1===U.length&&"0"===U[0]?(B=w,U.push(D),O=D,F+1):/[^\d]/.test(D)?(e(U.join("")),B=u,F):(U.push(D),O=D,F+1)}function C(){return"f"===D&&(U.push(D),O=D,F+=1),/[eE]/.test(D)?(U.push(D),O=D,F+1):"-"===D&&/[eE]/.test(O)?(U.push(D),O=D,F+1):/[^\d]/.test(D)?(e(U.join("")),B=u,F):(U.push(D),O=D,F+1)}function R(){if(/[^\d\w_]/.test(D)){var t=U.join("");return B=Q.indexOf(t)>-1?x:Z.indexOf(t)>-1?y:v,e(U.join("")),B=u,F}return U.push(D),O=D,F+1}var D,O,j,F=0,N=0,B=u,U=[],V=[],q=1,G=0,H=0,X=!1,Y=!1,W="";t=t||{};var Z=a,Q=i;return"300 es"===t.version&&(Z=l,Q=s),function(t){return V=[],null!==t?r(t):n()}}e.exports=n;var i=t("./lib/literals"),o=t("./lib/operators"),a=t("./lib/builtins"),s=t("./lib/literals-300es"),l=t("./lib/builtins-300es"),u=999,c=9999,h=0,f=1,p=2,d=3,m=4,g=5,v=6,y=7,x=8,b=9,_=10,w=11,M=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":218,"./lib/builtins-300es":217,"./lib/literals":220,"./lib/literals-300es":219,"./lib/operators":221}],217:[function(t,e,r){var n=t("./builtins");n=n.slice().filter(function(t){return!/^(gl\_|texture)/.test(t)}),e.exports=n.concat(["gl_VertexID","gl_InstanceID","gl_Position","gl_PointSize","gl_FragCoord","gl_FrontFacing","gl_FragDepth","gl_PointCoord","gl_MaxVertexAttribs","gl_MaxVertexUniformVectors","gl_MaxVertexOutputVectors","gl_MaxFragmentInputVectors","gl_MaxVertexTextureImageUnits","gl_MaxCombinedTextureImageUnits","gl_MaxTextureImageUnits","gl_MaxFragmentUniformVectors","gl_MaxDrawBuffers","gl_MinProgramTexelOffset","gl_MaxProgramTexelOffset","gl_DepthRangeParameters","gl_DepthRange","trunc","round","roundEven","isnan","isinf","floatBitsToInt","floatBitsToUint","intBitsToFloat","uintBitsToFloat","packSnorm2x16","unpackSnorm2x16","packUnorm2x16","unpackUnorm2x16","packHalf2x16","unpackHalf2x16","outerProduct","transpose","determinant","inverse","texture","textureSize","textureProj","textureLod","textureOffset","texelFetch","texelFetchOffset","textureProjOffset","textureLodOffset","textureProjLod","textureProjLodOffset","textureGrad","textureGradOffset","textureProjGrad","textureProjGradOffset"])},{"./builtins":218}],218:[function(t,e,r){e.exports=["abs","acos","all","any","asin","atan","ceil","clamp","cos","cross","dFdx","dFdy","degrees","distance","dot","equal","exp","exp2","faceforward","floor","fract","gl_BackColor","gl_BackLightModelProduct","gl_BackLightProduct","gl_BackMaterial","gl_BackSecondaryColor","gl_ClipPlane","gl_ClipVertex","gl_Color","gl_DepthRange","gl_DepthRangeParameters","gl_EyePlaneQ","gl_EyePlaneR","gl_EyePlaneS","gl_EyePlaneT","gl_Fog","gl_FogCoord","gl_FogFragCoord","gl_FogParameters","gl_FragColor","gl_FragCoord","gl_FragData","gl_FragDepth","gl_FragDepthEXT","gl_FrontColor","gl_FrontFacing","gl_FrontLightModelProduct","gl_FrontLightProduct","gl_FrontMaterial","gl_FrontSecondaryColor","gl_LightModel","gl_LightModelParameters","gl_LightModelProducts","gl_LightProducts","gl_LightSource","gl_LightSourceParameters","gl_MaterialParameters","gl_MaxClipPlanes","gl_MaxCombinedTextureImageUnits","gl_MaxDrawBuffers","gl_MaxFragmentUniformComponents","gl_MaxLights","gl_MaxTextureCoords","gl_MaxTextureImageUnits","gl_MaxTextureUnits","gl_MaxVaryingFloats","gl_MaxVertexAttribs","gl_MaxVertexTextureImageUnits","gl_MaxVertexUniformComponents","gl_ModelViewMatrix","gl_ModelViewMatrixInverse","gl_ModelViewMatrixInverseTranspose","gl_ModelViewMatrixTranspose","gl_ModelViewProjectionMatrix","gl_ModelViewProjectionMatrixInverse","gl_ModelViewProjectionMatrixInverseTranspose","gl_ModelViewProjectionMatrixTranspose","gl_MultiTexCoord0","gl_MultiTexCoord1","gl_MultiTexCoord2","gl_MultiTexCoord3","gl_MultiTexCoord4","gl_MultiTexCoord5","gl_MultiTexCoord6","gl_MultiTexCoord7","gl_Normal","gl_NormalMatrix","gl_NormalScale","gl_ObjectPlaneQ","gl_ObjectPlaneR","gl_ObjectPlaneS","gl_ObjectPlaneT","gl_Point","gl_PointCoord","gl_PointParameters","gl_PointSize","gl_Position","gl_ProjectionMatrix","gl_ProjectionMatrixInverse","gl_ProjectionMatrixInverseTranspose","gl_ProjectionMatrixTranspose","gl_SecondaryColor","gl_TexCoord","gl_TextureEnvColor","gl_TextureMatrix","gl_TextureMatrixInverse","gl_TextureMatrixInverseTranspose","gl_TextureMatrixTranspose","gl_Vertex","greaterThan","greaterThanEqual","inversesqrt","length","lessThan","lessThanEqual","log","log2","matrixCompMult","max","min","mix","mod","normalize","not","notEqual","pow","radians","reflect","refract","sign","sin","smoothstep","sqrt","step","tan","texture2D","texture2DLod","texture2DProj","texture2DProjLod","textureCube","textureCubeLod","texture2DLodEXT","texture2DProjLodEXT","textureCubeLodEXT","texture2DGradEXT","texture2DProjGradEXT","textureCubeGradEXT"]},{}],219:[function(t,e,r){var n=t("./literals");e.exports=n.slice().concat(["layout","centroid","smooth","case","mat2x2","mat2x3","mat2x4","mat3x2","mat3x3","mat3x4","mat4x2","mat4x3","mat4x4","uint","uvec2","uvec3","uvec4","samplerCubeShadow","sampler2DArray","sampler2DArrayShadow","isampler2D","isampler3D","isamplerCube","isampler2DArray","usampler2D","usampler3D","usamplerCube","usampler2DArray","coherent","restrict","readonly","writeonly","resource","atomic_uint","noperspective","patch","sample","subroutine","common","partition","active","filter","image1D","image2D","image3D","imageCube","iimage1D","iimage2D","iimage3D","iimageCube","uimage1D","uimage2D","uimage3D","uimageCube","image1DArray","image2DArray","iimage1DArray","iimage2DArray","uimage1DArray","uimage2DArray","image1DShadow","image2DShadow","image1DArrayShadow","image2DArrayShadow","imageBuffer","iimageBuffer","uimageBuffer","sampler1DArray","sampler1DArrayShadow","isampler1D","isampler1DArray","usampler1D","usampler1DArray","isampler2DRect","usampler2DRect","samplerBuffer","isamplerBuffer","usamplerBuffer","sampler2DMS","isampler2DMS","usampler2DMS","sampler2DMSArray","isampler2DMSArray","usampler2DMSArray"])},{"./literals":220}],220:[function(t,e,r){e.exports=["precision","highp","mediump","lowp","attribute","const","uniform","varying","break","continue","do","for","while","if","else","in","out","inout","float","int","void","bool","true","false","discard","return","mat2","mat3","mat4","vec2","vec3","vec4","ivec2","ivec3","ivec4","bvec2","bvec3","bvec4","sampler1D","sampler2D","sampler3D","samplerCube","sampler1DShadow","sampler2DShadow","struct","asm","class","union","enum","typedef","template","this","packed","goto","switch","default","inline","noinline","volatile","public","static","extern","external","interface","long","short","double","half","fixed","unsigned","input","output","hvec2","hvec3","hvec4","dvec2","dvec3","dvec4","fvec2","fvec3","fvec4","sampler2DRect","sampler3DRect","sampler2DRectShadow","sizeof","cast","namespace","using"]},{}],221:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],222:[function(t,e,r){function n(t,e){var r=i(e),n=[];return n=n.concat(r(t)),n=n.concat(r(null))}var i=t("./index");e.exports=n},{"./index":216}],223:[function(t,e,r){"use strict";function n(t,e,r){var n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var o=new Int32Array(this.arrayBuffer);t=o[0],e=o[1],r=o[2],this.d=e+2*r;for(var a=0;a=t&&i>=e&&r>=o&&n>=o)return Array.prototype.slice.call(this.keys);var a=[],s={};return this._forEachCell(t,e,r,n,this._queryCell,a,s),a},n.prototype._queryCell=function(t,e,r,n,i,o,a){var s=this.cells[i];if(null!==s)for(var l=this.keys,u=this.bboxes,c=0;c=u[f+0]&&n>=u[f+1]?(a[h]=!0,o.push(l[h])):a[h]=!1}}},n.prototype._forEachCell=function(t,e,r,n,i,o,a){for(var s=this._convertToCellCoord(t),l=this._convertToCellCoord(e),u=this._convertToCellCoord(r),c=this._convertToCellCoord(n),h=s;u>=h;h++)for(var f=l;c>=f;f++){var p=this.d*f+h;if(i.call(this,t,e,r,n,p,o,a))return}},n.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},n.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=i+this.cells.length+1+1,r=0,n=0;n>1,c=-7,h=r?i-1:0,f=r?-1:1,p=t[e+h];for(h+=f,o=p&(1<<-c)-1,p>>=-c,c+=s;c>0;o=256*o+t[e+h],h+=f,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=256*a+t[e+h],h+=f,c-=8);if(0===o)o=1-u;else{if(o===l)return a?NaN:(p?-1:1)*(1/0);a+=Math.pow(2,n),o-=u}return(p?-1:1)*a*Math.pow(2,o-n)},r.write=function(t,e,r,n,i,o){var a,s,l,u=8*o-i-1,c=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,m=0>e||0===e&&0>1/e?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),e+=a+h>=1?f/l:f*Math.pow(2,1-h),e*l>=2&&(a++,l/=2),a+h>=c?(s=0,a=c):a+h>=1?(s=(e*l-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+p]=255&s,p+=d,s/=256,i-=8);for(a=a<0;t[r+p]=255&a,p+=d,a/=256,u-=8);t[r+p-d]|=128*m}},{}],225:[function(t,e,r){"use strict";function n(t,e,r){this.vertices=t,this.adjacent=e,this.boundary=r,this.lastVisited=-1}function i(t,e,r){this.vertices=t,this.cell=e,this.index=r}function o(t,e){return c(t.vertices,e.vertices)}function a(t){for(var e=["function orient(){var tuple=this.tuple;return test("],r=0;t>=r;++r)r>0&&e.push(","),e.push("tuple[",r,"]");e.push(")}return orient");var n=new Function("test",e.join("")),i=u[t+1];return i||(i=u),n(i)}function s(t,e,r){ this.dimension=t,this.vertices=e,this.simplices=r,this.interior=r.filter(function(t){return!t.boundary}),this.tuple=new Array(t+1);for(var n=0;t>=n;++n)this.tuple[n]=this.vertices[n];var i=h[t];i||(i=h[t]=a(t)),this.orient=i}function l(t,e){var r=t.length;if(0===r)throw new Error("Must have at least d+1 points");var i=t[0].length;if(i>=r)throw new Error("Must input at least d+1 points");var o=t.slice(0,i+1),a=u.apply(void 0,o);if(0===a)throw new Error("Input not in general position");for(var l=new Array(i+1),c=0;i>=c;++c)l[c]=c;0>a&&(l[0]=1,l[1]=0);for(var h=new n(l,new Array(i+1),!1),f=h.adjacent,p=new Array(i+2),c=0;i>=c;++c){for(var d=l.slice(),m=0;i>=m;++m)m===c&&(d[m]=-1);var g=d[0];d[0]=d[1],d[1]=g;var v=new n(d,new Array(i+1),!0);f[c]=v,p[c]=v}p[i+1]=h;for(var c=0;i>=c;++c)for(var d=f[c].vertices,y=f[c].adjacent,m=0;i>=m;++m){var x=d[m];if(0>x)y[m]=h;else for(var b=0;i>=b;++b)f[b].vertices.indexOf(x)<0&&(y[m]=f[b])}for(var _=new s(i,o,p),w=!!e,c=i+1;r>c;++c)_.insert(t[c],w);return _.boundary()}e.exports=l;var u=t("robust-orientation"),c=t("simplicial-complex").compareCells;n.prototype.flip=function(){var t=this.vertices[0];this.vertices[0]=this.vertices[1],this.vertices[1]=t;var e=this.adjacent[0];this.adjacent[0]=this.adjacent[1],this.adjacent[1]=e};var h=[],f=s.prototype;f.handleBoundaryDegeneracy=function(t,e){var r=this.dimension,n=this.vertices.length-1,i=this.tuple,o=this.vertices,a=[t];for(t.lastVisited=-n;a.length>0;){t=a.pop();for(var s=(t.vertices,t.adjacent),l=0;r>=l;++l){var u=s[l];if(u.boundary&&!(u.lastVisited<=-n)){for(var c=u.vertices,h=0;r>=h;++h){var f=c[h];0>f?i[h]=e:i[h]=o[f]}var p=this.orient();if(p>0)return u;u.lastVisited=-n,0===p&&a.push(u)}}}return null},f.walk=function(t,e){var r=this.vertices.length-1,n=this.dimension,i=this.vertices,o=this.tuple,a=e?this.interior.length*Math.random()|0:this.interior.length-1,s=this.interior[a];t:for(;!s.boundary;){for(var l=s.vertices,u=s.adjacent,c=0;n>=c;++c)o[c]=i[l[c]];s.lastVisited=r;for(var c=0;n>=c;++c){var h=u[c];if(!(h.lastVisited>=r)){var f=o[c];o[c]=t;var p=this.orient();if(o[c]=f,0>p){s=h;continue t}h.boundary?h.lastVisited=-r:h.lastVisited=r}}return}return s},f.addPeaks=function(t,e){var r=this.vertices.length-1,a=this.dimension,s=this.vertices,l=this.tuple,u=this.interior,c=this.simplices,h=[e];e.lastVisited=r,e.vertices[e.vertices.indexOf(-1)]=r,e.boundary=!1,u.push(e);for(var f=[];h.length>0;){var e=h.pop(),p=e.vertices,d=e.adjacent,m=p.indexOf(r);if(!(0>m))for(var g=0;a>=g;++g)if(g!==m){var v=d[g];if(v.boundary&&!(v.lastVisited>=r)){var y=v.vertices;if(v.lastVisited!==-r){for(var x=0,b=0;a>=b;++b)y[b]<0?(x=b,l[b]=t):l[b]=s[y[b]];var _=this.orient();if(_>0){y[x]=r,v.boundary=!1,u.push(v),h.push(v),v.lastVisited=r;continue}v.lastVisited=-r}var w=v.adjacent,M=p.slice(),A=d.slice(),k=new n(M,A,!0);c.push(k);var T=w.indexOf(e);if(!(0>T)){w[T]=k,A[m]=v,M[g]=-1,A[g]=e,d[g]=k,k.flip();for(var b=0;a>=b;++b){var E=M[b];if(!(0>E||E===r)){for(var S=new Array(a-1),L=0,z=0;a>=z;++z){var I=M[z];0>I||z===b||(S[L++]=I)}f.push(new i(S,k,b))}}}}}}f.sort(o);for(var g=0;g+1R||0>D||(P.cell.adjacent[P.index]=C.cell,C.cell.adjacent[C.index]=P.cell)}},f.insert=function(t,e){var r=this.vertices;r.push(t);var n=this.walk(t,e);if(n){for(var i=this.dimension,o=this.tuple,a=0;i>=a;++a){var s=n.vertices[a];0>s?o[a]=t:o[a]=r[s]}var l=this.orient(o);0>l||(0!==l||(n=this.handleBoundaryDegeneracy(n,t)))&&this.addPeaks(t,n)}},f.boundary=function(){for(var t=this.dimension,e=[],r=this.simplices,n=r.length,i=0;n>i;++i){var o=r[i];if(o.boundary){for(var a=new Array(t),s=o.vertices,l=0,u=0,c=0;t>=c;++c)s[c]>=0?a[l++]=s[c]:u=1&c;if(u===(1&t)){var h=a[0];a[0]=a[1],a[1]=h}e.push(a)}}return e}},{"robust-orientation":437,"simplicial-complex":448}],226:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],227:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.mid=t,this.left=e,this.right=r,this.leftPoints=n,this.rightPoints=i,this.count=(e?e.count:0)+(r?r.count:0)+n.length}function i(t,e){t.mid=e.mid,t.left=e.left,t.right=e.right,t.leftPoints=e.leftPoints,t.rightPoints=e.rightPoints,t.count=e.count}function o(t,e){var r=d(e);t.mid=r.mid,t.left=r.left,t.right=r.right,t.leftPoints=r.leftPoints,t.rightPoints=r.rightPoints,t.count=r.count}function a(t,e){var r=t.intervals([]);r.push(e),o(t,r)}function s(t,e){var r=t.intervals([]),n=r.indexOf(e);return 0>n?y:(r.splice(n,1),o(t,r),x)}function l(t,e,r){for(var n=0;n=0&&t[n][1]>=e;--n){var i=r(t[n]);if(i)return i}}function c(t,e){for(var r=0;r>1],o=[],a=[],s=[],r=0;r3*(e+1)?a(this,t):this.left.insert(t):this.left=d([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?a(this,t):this.right.insert(t):this.right=d([t]);else{var r=v.ge(this.leftPoints,t,f),n=v.ge(this.rightPoints,t,p);this.leftPoints.splice(r,0,t),this.rightPoints.splice(n,0,t)}},_.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1))return s(this,t);var n=this.left.remove(t);return n===b?(this.left=null,this.count-=1,x):(n===x&&(this.count-=1),n)}if(t[0]>this.mid){if(!this.right)return y;var o=this.left?this.left.count:0;if(4*o>3*(e-1))return s(this,t);var n=this.right.remove(t);return n===b?(this.right=null,this.count-=1,x):(n===x&&(this.count-=1),n)}if(1===this.count)return this.leftPoints[0]===t?b:y;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var a=this,l=this.left;l.right;)a=l,l=l.right;if(a===this)l.right=this.right;else{var u=this.left,n=this.right;a.count-=l.count,a.right=l.left,l.left=u,l.right=n}i(this,l),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?i(this,this.left):i(this,this.right);return x}for(var u=v.ge(this.leftPoints,t,f);uthis.mid){if(this.right){var r=this.right.queryPoint(t,e);if(r)return r}return u(this.rightPoints,t,e)}return c(this.leftPoints,e)},_.queryInterval=function(t,e,r){if(tthis.mid&&this.right){var n=this.right.queryInterval(t,e,r);if(n)return n}return ethis.mid?u(this.rightPoints,t,r):c(this.leftPoints,r)};var w=m.prototype;w.insert=function(t){this.root?this.root.insert(t):this.root=new n(t[0],null,null,[t],[t])},w.remove=function(t){if(this.root){var e=this.root.remove(t);return e===b&&(this.root=null),e!==y}return!1},w.queryPoint=function(t,e){return this.root?this.root.queryPoint(t,e):void 0},w.queryInterval=function(t,e,r){return e>=t&&this.root?this.root.queryInterval(t,e,r):void 0},Object.defineProperty(w,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(w,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":49}],228:[function(t,e,r){"use strict";function n(t,e){e=e||new Array(t.length);for(var r=0;rr;++r)e[r]=r;return e}e.exports=n},{}],230:[function(t,e,r){e.exports=function(t){return!(null==t||!(t._isBuffer||t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)))}},{}],231:[function(t,e,r){"use strict";function n(t,e,r,n,o){return new i(t,e,r,n,o)}function i(t,e,r,n,i){e=e||o,r=r||a,i=i||Array,this.nodeSize=n||64,this.points=t,this.ids=new i(t.length),this.coords=new i(2*t.length);for(var l=0;l=f-p)for(var d=p;f>=d;d++)s=e[2*d],l=e[2*d+1],s>=r&&i>=s&&l>=n&&o>=l&&c.push(t[d]);else{var m=Math.floor((p+f)/2);s=e[2*m],l=e[2*m+1],s>=r&&i>=s&&l>=n&&o>=l&&c.push(t[m]);var g=(h+1)%2;(0===h?s>=r:l>=n)&&(u.push(p),u.push(m-1),u.push(g)),(0===h?i>=s:o>=l)&&(u.push(m+1),u.push(f),u.push(g))}}return c}e.exports=n},{}],233:[function(t,e,r){"use strict";function n(t,e,r,o,a,s){if(!(r>=a-o)){var l=Math.floor((o+a)/2);i(t,e,l,o,a,s%2),n(t,e,r,o,l-1,s+1),n(t,e,r,l+1,a,s+1)}}function i(t,e,r,n,a,s){for(;a>n;){if(a-n>600){var l=a-n+1,u=r-n+1,c=Math.log(l),h=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*h*(l-h)/l)*(0>u-l/2?-1:1),p=Math.max(n,Math.floor(r-u*h/l+f)),d=Math.min(a,Math.floor(r+(l-u)*h/l+f));i(t,e,r,p,d,s)}var m=e[2*r+s],g=n,v=a;for(o(t,e,n,r),e[2*a+s]>m&&o(t,e,n,a);v>g;){for(o(t,e,g,v),g++,v--;e[2*g+s]m;)v--}e[2*n+s]===m?o(t,e,n,v):(v++,o(t,e,v,a)),r>=v&&(n=v+1),v>=r&&(a=v-1)}}function o(t,e,r,n){a(t,r,n),a(e,2*r,2*n),a(e,2*r+1,2*n+1)}function a(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}e.exports=n},{}],234:[function(t,e,r){"use strict";function n(t,e,r,n,o,a){for(var s=[0,t.length-1,0],l=[],u=o*o;s.length;){var c=s.pop(),h=s.pop(),f=s.pop();if(a>=h-f)for(var p=f;h>=p;p++)i(e[2*p],e[2*p+1],r,n)<=u&&l.push(t[p]);else{var d=Math.floor((f+h)/2),m=e[2*d],g=e[2*d+1];i(m,g,r,n)<=u&&l.push(t[d]);var v=(c+1)%2;(0===c?m>=r-o:g>=n-o)&&(s.push(f),s.push(d-1),s.push(v)),(0===c?r+o>=m:n+o>=g)&&(s.push(d+1),s.push(h),s.push(v))}}return l}function i(t,e,r,n){var i=t-r,o=e-n;return i*i+o*o}e.exports=n},{}],235:[function(t,e,r){"use strict";function n(t,e){var r;if(c(t)){var s,l="object"==typeof t.stops[0][0],u=l||void 0!==t.property,h=l||!u,f=t.type||e||"exponential";if("exponential"===f)s=a;else if("interval"===f)s=o;else{if("categorical"!==f)throw new Error('Unknown function type "'+f+'"');s=i}if(l){for(var p={},d=[],m=0;m=t.stops.length)break;if(e<=t.stops[n][0])break;n++}return 0===n?t.stops[n][1]:n===t.stops.length?t.stops[n-1][1]:s(e,r,t.stops[n-1][0],t.stops[n][0],t.stops[n-1][1],t.stops[n][1])}function s(t,e,r,n,i,o){return"function"==typeof i?function(){var a=i.apply(void 0,arguments),l=o.apply(void 0,arguments);return s(t,e,r,n,a,l)}:i.length?u(t,e,r,n,i,o):l(t,e,r,n,i,o)}function l(t,e,r,n,i,o){var a,s=n-r,l=t-r;return a=1===e?l/s:(Math.pow(e,l)-1)/(Math.pow(e,s)-1),i*(1-a)+o*a}function u(t,e,r,n,i,o){for(var a=[],s=0;s -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},linepattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_blur;\n\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_fade;\nuniform float u_opacity;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float x_a = mod(v_linesofar / u_pattern_size_a.x, 1.0);\n float x_b = mod(v_linesofar / u_pattern_size_b.x, 1.0);\n float y_a = 0.5 + (v_normal.y * v_linewidth.s / u_pattern_size_a.y);\n float y_b = 0.5 + (v_normal.y * v_linewidth.s / u_pattern_size_b.y);\n vec2 pos_a = mix(u_pattern_tl_a, u_pattern_br_a, vec2(x_a, y_a));\n vec2 pos_b = mix(u_pattern_tl_b, u_pattern_br_b, vec2(x_b, y_b));\n\n vec4 color = mix(texture2D(u_image, pos_a), texture2D(u_image, pos_b), u_fade);\n\n alpha *= u_opacity;\n\n gl_FragColor = color * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform mediump float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n v_linesofar = a_linesofar;\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},linesdfpattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\n\nuniform float u_blur;\nuniform sampler2D u_image;\nuniform float u_sdfgamma;\nuniform float u_mix;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float sdfdist_a = texture2D(u_image, v_tex_a).a;\n float sdfdist_b = texture2D(u_image, v_tex_b).a;\n float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix);\n alpha *= smoothstep(0.5 - u_sdfgamma, 0.5 + u_sdfgamma, sdfdist);\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform vec2 u_patternscale_a;\nuniform float u_tex_y_a;\nuniform vec2 u_patternscale_b;\nuniform float u_tex_y_b;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n\n v_tex_a = vec2(a_linesofar * u_patternscale_a.x, normal.y * u_patternscale_a.y + u_tex_y_a);\n v_tex_b = vec2(a_linesofar * u_patternscale_b.x, normal.y * u_patternscale_b.y + u_tex_y_b);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},outline:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n#pragma mapbox: define lowp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_pos;\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n gl_FragColor = outline_color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\n#pragma mapbox: define lowp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},outlinepattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n // find distance to outline for alpha interpolation\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n \n\n gl_FragColor = mix(color1, color2, u_mix) * alpha * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n", @@ -33,8 +33,8 @@ e.exports=n,n.prototype=i.inherit(l,{minzoom:0,maxzoom:22,tileSize:512,roundZoom },isPaintValueFeatureConstant:function(t){return"fill-outline-color"===t&&void 0===this.getPaintProperty("fill-outline-color")?o.prototype.isPaintValueFeatureConstant.call(this,"fill-color"):o.prototype.isPaintValueFeatureConstant.call(this,t)},isPaintValueZoomConstant:function(t){return"fill-outline-color"===t&&void 0===this.getPaintProperty("fill-outline-color")?o.prototype.isPaintValueZoomConstant.call(this,"fill-color"):o.prototype.isPaintValueZoomConstant.call(this,t)}}),e.exports=n},{"../../util/util":375,"../style_layer":314}],318:[function(t,e,r){"use strict";function n(){o.apply(this,arguments)}var i=t("../../util/util"),o=t("../style_layer");e.exports=n,n.prototype=i.inherit(o,{getPaintValue:function(t,e,r){var n=o.prototype.getPaintValue.apply(this,arguments);if(n&&"line-dasharray"===t){var i=Math.floor(e.zoom);this._flooredZoom!==i&&(this._flooredZoom=i,this._flooredLineWidth=this.getPaintValue("line-width",e,r)),n.fromScale*=this._flooredLineWidth,n.toScale*=this._flooredLineWidth}return n}})},{"../../util/util":375,"../style_layer":314}],319:[function(t,e,r){"use strict";function n(){o.apply(this,arguments)}var i=t("../../util/util"),o=t("../style_layer");e.exports=n,n.prototype=i.inherit(o,{})},{"../../util/util":375,"../style_layer":314}],320:[function(t,e,r){"use strict";function n(){o.apply(this,arguments)}var i=t("../../util/util"),o=t("../style_layer");e.exports=n,n.prototype=i.inherit(o,{isHidden:function(){if(o.prototype.isHidden.apply(this,arguments))return!0;var t=0===this.paint["text-opacity"]||!this.layout["text-field"],e=0===this.paint["icon-opacity"]||!this.layout["icon-image"];return!(!t||!e)},getLayoutValue:function(t,e,r){return("text-rotation-alignment"!==t||"line"!==this.getLayoutValue("symbol-placement",e,r)||this.getLayoutProperty("text-rotation-alignment"))&&("icon-rotation-alignment"!==t||"line"!==this.getLayoutValue("symbol-placement",e,r)||this.getLayoutProperty("icon-rotation-alignment"))?"text-pitch-alignment"!==t||this.getLayoutProperty("text-pitch-alignment")?o.prototype.getLayoutValue.apply(this,arguments):this.getLayoutValue("text-rotation-alignment"):"map"}})},{"../../util/util":375,"../style_layer":314}],321:[function(t,e,r){"use strict";e.exports=t("mapbox-gl-style-spec/reference/latest.min")},{"mapbox-gl-style-spec/reference/latest.min":258}],322:[function(t,e,r){"use strict";function n(t,e,r,n){this.declaration=e,this.startTime=this.endTime=(new Date).getTime(),"piecewise-constant"===t.function&&t.transition?this.interp=i:this.interp=a[t.type],this.oldTransition=r,this.duration=n.duration||0,this.delay=n.delay||0,this.instant()||(this.endTime=this.startTime+this.duration+this.delay,this.ease=o.easeCubicInOut),r&&r.endTime<=this.startTime&&delete r.oldTransition}function i(t,e,r){return void 0===(t&&t.to)||void 0===(e&&e.to)?void 0:{from:t.to,fromScale:t.toScale,to:e.to,toScale:e.toScale,t:r}}var o=t("../util/util"),a=t("../util/interpolate");e.exports=n,n.prototype.instant=function(){return!this.oldTransition||!this.interp||0===this.duration&&0===this.delay},n.prototype.calculate=function(t,e){var r=this.declaration.calculate(o.extend({},t,{duration:this.duration}),e);if(this.instant())return r;var n=t.time||Date.now();if(n-r/2;){if(a--,0>a)return!1;s-=t[a].dist(o),o=t[a]}s+=t[a].dist(t[a+1]),a++;for(var l=[],u=0;r/2>s;){var c=t[a-1],h=t[a],f=t[a+1];if(!f)return!1;var p=c.angleTo(h)-h.angleTo(f);for(p=Math.abs((p+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:s,angleDelta:p}),u+=p;s-l[0].distance>n;)u-=l.shift().angleDelta;if(u>i)return!1;a++,s+=h.dist(f)}return!0}e.exports=n},{}],326:[function(t,e,r){"use strict";function n(t,e,r,n,o){for(var a=[],s=0;s=n&&f.x>=n||(h.x>=n?h=new i(n,h.y+(f.y-h.y)*((n-h.x)/(f.x-h.x)))._round():f.x>=n&&(f=new i(n,h.y+(f.y-h.y)*((n-h.x)/(f.x-h.x)))._round()),h.y>=o&&f.y>=o||(h.y>=o?h=new i(h.x+(f.x-h.x)*((o-h.y)/(f.y-h.y)),o)._round():f.y>=o&&(f=new i(h.x+(f.x-h.x)*((o-h.y)/(f.y-h.y)),o)._round()),l&&h.equals(l[l.length-1])||(l=[h],a.push(l)),l.push(f)))))}return a}var i=t("point-geometry");e.exports=n},{"point-geometry":414}],327:[function(t,e,r){"use strict";var n=t("../util/struct_array"),i=t("../util/util"),o=t("point-geometry"),a=e.exports=new n({members:[{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Float32",name:"maxScale"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"},{type:"Int16",name:"bbox0"},{type:"Int16",name:"bbox1"},{type:"Int16",name:"bbox2"},{type:"Int16",name:"bbox3"},{type:"Float32",name:"placementScale"}]});i.extendAll(a.prototype.StructType.prototype,{get anchorPoint(){return new o(this.anchorPointX,this.anchorPointY)}})},{"../util/struct_array":373,"../util/util":375,"point-geometry":414}],328:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a,s,l,u,c){var h=a.top*s-l,f=a.bottom*s+l,p=a.left*s-l,d=a.right*s+l;if(this.boxStartIndex=t.length,u){var m=f-h,g=d-p;if(m>0)if(m=Math.max(10*s,m),c){var v=e[r.segment+1].sub(e[r.segment])._unit()._mult(g),y=[r.sub(v),r.add(v)];this._addLineCollisionBoxes(t,y,r,0,g,m,n,i,o)}else this._addLineCollisionBoxes(t,e,r,r.segment,g,m,n,i,o)}else t.emplaceBack(r.x,r.y,p,h,d,f,1/0,n,i,o,0,0,0,0,0);this.boxEndIndex=t.length}e.exports=n,n.prototype._addLineCollisionBoxes=function(t,e,r,n,i,o,a,s,l){var u=o/2,c=Math.floor(i/u),h=-o/2,f=this.boxes,p=r,d=n+1,m=h;do{if(d--,0>d)return f;m-=e[d].dist(p),p=e[d]}while(m>-i/2);for(var g=e[d].dist(e[d+1]),v=0;c>v;v++){for(var y=-i/2+v*u;y>m+g;){if(m+=g,d++,d+1>=e.length)return f;g=e[d].dist(e[d+1])}var x=y-m,b=e[d],_=e[d+1],w=_.sub(b)._unit()._mult(x)._add(b)._round(),M=Math.max(Math.abs(y-h)-u/2,0),A=i/2/M;t.emplaceBack(w.x,w.y,-o/2,-o/2,o/2,o/2,A,a,s,l,0,0,0,0,0)}return f}},{}],329:[function(t,e,r){"use strict";function n(t,e,r){if("object"==typeof t){var n=t;r=e,t=n.angle,e=n.pitch,this.grid=new a(n.grid),this.ignoredGrid=new a(n.ignoredGrid)}else this.grid=new a(o,12,6),this.ignoredGrid=new a(o,12,0);this.angle=t,this.pitch=e;var i=Math.sin(t),s=Math.cos(t);if(this.rotationMatrix=[s,-i,i,s],this.reverseRotationMatrix=[s,i,-i,s],this.yStretch=1/Math.cos(e/180*Math.PI),this.yStretch=Math.pow(this.yStretch,1.3),this.collisionBoxArray=r,0===r.length){r.emplaceBack();var l=32767;r.emplaceBack(0,0,0,-l,0,l,l,0,0,0,0,0,0,0,0,0),r.emplaceBack(o,0,0,-l,0,l,l,0,0,0,0,0,0,0,0,0),r.emplaceBack(0,0,-l,0,l,0,l,0,0,0,0,0,0,0,0,0),r.emplaceBack(0,o,-l,0,l,0,l,0,0,0,0,0,0,0,0,0)}this.tempCollisionBox=r.get(0),this.edges=[r.get(1),r.get(2),r.get(3),r.get(4)]}var i=t("point-geometry"),o=t("../data/bucket").EXTENT,a=t("grid-index");e.exports=n,n.prototype.serialize=function(){var t={angle:this.angle,pitch:this.pitch,grid:this.grid.toArrayBuffer(),ignoredGrid:this.ignoredGrid.toArrayBuffer()};return{data:t,transferables:[t.grid,t.ignoredGrid]}},n.prototype.minScale=.25,n.prototype.maxScale=2,n.prototype.placeCollisionFeature=function(t,e,r){for(var n=this.collisionBoxArray,o=this.minScale,a=this.rotationMatrix,s=this.yStretch,l=t.boxStartIndex;l=this.maxScale)return o}if(r){var _;if(this.angle){var w=this.reverseRotationMatrix,M=new i(u.x1,u.y1).matMult(w),A=new i(u.x2,u.y1).matMult(w),k=new i(u.x1,u.y2).matMult(w),T=new i(u.x2,u.y2).matMult(w);_=this.tempCollisionBox,_.anchorPointX=u.anchorPoint.x,_.anchorPointY=u.anchorPoint.y,_.x1=Math.min(M.x,A.x,k.x,T.x),_.y1=Math.min(M.y,A.x,k.x,T.x),_.x2=Math.max(M.x,A.x,k.x,T.x),_.y2=Math.max(M.y,A.x,k.x,T.x),_.maxScale=u.maxScale}else _=u;for(var E=0;E=this.maxScale)return o}}}return o},n.prototype.queryRenderedSymbols=function(t,e,r,n,o){var a={},s=[],l=this.collisionBoxArray,u=this.rotationMatrix,c=new i(t,e)._matMult(u),h=this.tempCollisionBox;h.anchorX=c.x,h.anchorY=c.y,h.x1=0,h.y1=0,h.x2=r-t,h.y2=n-e,h.maxScale=o,o=h.maxScale;for(var f=[c.x+h.x1/o,c.y+h.y1/o*this.yStretch,c.x+h.x2/o,c.y+h.y2/o*this.yStretch],p=this.grid.query(f[0],f[1],f[2],f[3]),d=this.ignoredGrid.query(f[0],f[1],f[2],f[3]),m=0;m=o&&(a[y][x]=!0,s.push(p[g]))}}return s},n.prototype.getPlacementScale=function(t,e,r,n,i){var o=e.x-n.x,a=e.y-n.y,s=(i.x1-r.x2)/o,l=(i.x2-r.x1)/o,u=(i.y1-r.y2)*this.yStretch/a,c=(i.y2-r.y1)*this.yStretch/a;(isNaN(s)||isNaN(l))&&(s=l=1),(isNaN(u)||isNaN(c))&&(u=c=1);var h=Math.min(Math.max(s,l),Math.max(u,c)),f=i.maxScale,p=r.maxScale;return h>f&&(h=f),h>p&&(h=p),h>t&&h>=i.placementScale&&(t=h),t},n.prototype.insertCollisionFeature=function(t,e,r){for(var n=r?this.ignoredGrid:this.grid,i=this.collisionBoxArray,o=t.boxStartIndex;oe-h*s&&(e=h*s+e/4);var p=2*a,d=f?e/2*l%e:(h/2+p)*s*l%e;return i(t,d,e,c,r,h*s,f,!1,u)}function i(t,e,r,n,l,u,c,h,f){for(var p=u/2,d=0,m=0;mv+r;){v+=r;var A=(v-g)/w,k=o(b.x,_.x,A),T=o(b.y,_.y,A);if(k>=0&&f>k&&T>=0&&f>T&&v-p>=0&&d>=v+p){var E=new a(k,T,M,x)._round();n&&!s(t,E,u,n,l)||y.push(E)}}g+=w}return h||y.length||c||(y=i(t,g/2,r,n,l,u,c,!0,f)),y}var o=t("../util/interpolate"),a=t("../symbol/anchor"),s=t("./check_max_angle");e.exports=n},{"../symbol/anchor":324,"../util/interpolate":369,"./check_max_angle":325}],331:[function(t,e,r){"use strict";function n(){this.width=s,this.height=s,this.bin=new i(this.width,this.height),this.index={},this.ids={},this.data=new Uint8Array(this.width*this.height)}var i=t("shelf-pack"),o=t("../util/util"),a=4,s=128,l=2048;e.exports=n,n.prototype.getGlyphs=function(){var t,e,r,n={};for(var i in this.ids)t=i.split("#"),e=t[0],r=t[1],n[e]||(n[e]=[]),n[e].push(r);return n},n.prototype.getRects=function(){var t,e,r,n={};for(var i in this.ids)t=i.split("#"),e=t[0],r=t[1],n[e]||(n[e]={}),n[e][r]=this.index[i];return n},n.prototype.addGlyph=function(t,e,r,n){if(!r)return null;var i=e+"#"+r.id;if(this.index[i])return this.ids[i].indexOf(t)<0&&this.ids[i].push(t),this.index[i];if(!r.bitmap)return null;var a=r.width+2*n,s=r.height+2*n,l=1,u=a+2*l,c=s+2*l;u+=4-u%4,c+=4-c%4;var h=this.bin.packOne(u,c);if(h||(this.resize(),h=this.bin.packOne(u,c)),!h)return o.warnOnce("glyph bitmap overflow"),null;this.index[i]=h,this.ids[i]=[t];for(var f=this.data,p=r.bitmap,d=0;s>d;d++)for(var m=this.width*(h.y+d+l)+h.x+l,g=a*d,v=0;a>v;v++)f[m+v]=p[g+v];return this.dirty=!0,h},n.prototype.resize=function(){var t=this.width,e=this.height;if(!(t>=l||e>=l)){this.texture&&(this.gl&&this.gl.deleteTexture(this.texture),this.texture=null),this.width*=a,this.height*=a,this.bin.resize(this.width,this.height);for(var r=new ArrayBuffer(this.width*this.height),n=0;e>n;n++){var i=new Uint8Array(this.data.buffer,e*n,t),o=new Uint8Array(r,e*n*a,t);o.set(i)}this.data=new Uint8Array(r)}},n.prototype.bind=function(t){this.gl=t,this.texture?t.bindTexture(t.TEXTURE_2D,this.texture):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,null))},n.prototype.updateTexture=function(t){this.bind(t),this.dirty&&(t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data),this.dirty=!1)}},{"../util/util":375,"shelf-pack":443}],332:[function(t,e,r){"use strict";function n(t){this.url=t&&a(t),this.atlases={},this.stacks={},this.loading={}}function i(t,e,r){var n=1;this.advance=t.advance,this.left=t.left-r-n,this.top=t.top+r+n,this.rect=e}function o(t,e,r,n){return n=n||"abc",r.replace("{s}",n[t.length%n.length]).replace("{fontstack}",t).replace("{range}",e)}var a=t("../util/mapbox").normalizeGlyphsURL,s=t("../util/ajax").getArrayBuffer,l=t("../util/glyphs"),u=t("../symbol/glyph_atlas"),c=t("pbf");e.exports=n,n.prototype.getSimpleGlyphs=function(t,e,r,n){void 0===this.stacks[t]&&(this.stacks[t]={}),void 0===this.atlases[t]&&(this.atlases[t]=new u);for(var o,a={},s=this.stacks[t],l=this.atlases[t],c=3,h={},f=0,p=0;p65535)return r("glyphs > 65535 not supported");void 0===this.loading[t]&&(this.loading[t]={});var n=this.loading[t];if(n[e])n[e].push(r);else{n[e]=[r];var i=256*e+"-"+(256*e+255),a=o(t,i,this.url);s(a,function(t,r){for(var i=!t&&new l(new c(new Uint8Array(r))),o=0;or&&(o=!o),o&&i++;var u=new s(e.x,e.y),c=n[i],h=1/0;r=Math.abs(r);for(var f=l;;){var p=u.dist(c),d=r/p,m=Math.atan2(c.y-u.y,c.x-u.x);if(o||(m+=Math.PI),t.push({anchorPoint:u,offset:a?Math.PI:0,minScale:d,maxScale:h,angle:(m+2*Math.PI)%(2*Math.PI)}),f>=d)break;for(u=c;u.equals(c);)if(i+=o?1:-1,c=n[i],!c)return d;var g=c.sub(u)._unit();u=u.sub(g._mult(p)),h=d}return f}var s=t("point-geometry");e.exports={getIconQuads:i,getGlyphQuads:o,SymbolQuad:n};var l=.5},{"point-geometry":414}],335:[function(t,e,r){"use strict";function n(t,e,r){for(var n=[],o=0,a=t.length;a>o;o++){var s=i(t[o].properties,e["text-field"]);if(s){s=s.toString();var l=e["text-transform"];"uppercase"===l?s=s.toLocaleUpperCase():"lowercase"===l&&(s=s.toLocaleLowerCase());for(var u=0;un&&null!==c){var b=v[c+1].x;g=Math.max(b,g);for(var _=c+1;y>=_;_++)v[_].y+=r,v[_].x-=b;if(a){var w=c;h[v[c].codePoint]&&w--,s(v,e,d,w,a)}d=c+1,c=null,p+=b,m++}f[x.codePoint]&&(c=y)}var M=v[v.length-1],A=M.x+e[M.codePoint].advance;g=Math.max(g,A);var k=(m+1)*r;s(v,e,d,v.length-1,a),l(v,a,i,o,g,r,m,u),t.top+=-o*k,t.bottom=t.top+k,t.left+=-i*g,t.right=t.left+g}function s(t,e,r,n,i){for(var o=e[t[n].codePoint].advance,a=(t[n].x+o)*i,s=r;n>=s;s++)t[s].x-=a}function l(t,e,r,n,i,o,a,s){for(var l=(e-r)*i+s[0],u=(-n*(a+1)+.5)*o+s[1],c=0;c=f;f++,p=((f+u)%u+n)*e+r,d+=o)for(h=-1;l>=h;h++)i[d+h]=t[p+(h+l)%l];else for(f=0;u>f;f++,p+=e,d+=o)for(h=0;l>h;h++)i[d+h]=t[p+h]}function o(t,e,r,n,i){this.rect=t,this.width=e,this.height=r,this.sdf=n,this.pixelRatio=i}var a=t("shelf-pack"),s=t("../util/browser"),l=t("../util/util");e.exports=n,n.prototype.allocateImage=function(t,e){t/=this.pixelRatio,e/=this.pixelRatio;var r=2,n=t+r+(4-(t+r)%4),i=e+r+(4-(e+r)%4),o=this.bin.packOne(n,i);return o?o:(l.warnOnce("SpriteAtlas out of space."),null)},n.prototype.getImage=function(t,e){if(this.images[t])return this.images[t];if(!this.sprite)return null;var r=this.sprite.getSpritePosition(t);if(!r.width||!r.height)return null;var n=this.allocateImage(r.width,r.height);if(!n)return null;var i=new o(n,r.width/r.pixelRatio,r.height/r.pixelRatio,r.sdf,r.pixelRatio/this.pixelRatio);return this.images[t]=i,this.copy(n,r,e),i},n.prototype.getPosition=function(t,e){var r=this.getImage(t,e),n=r&&r.rect;if(!n)return null;var i=r.width*r.pixelRatio,o=r.height*r.pixelRatio,a=1;return{size:[r.width,r.height],tl:[(n.x+a)/this.width,(n.y+a)/this.height],br:[(n.x+a+i)/this.width,(n.y+a+o)/this.height]}},n.prototype.allocate=function(){if(!this.data){var t=Math.floor(this.width*this.pixelRatio),e=Math.floor(this.height*this.pixelRatio);this.data=new Uint32Array(t*e);for(var r=0;r1?2:1,this.canvas&&(this.canvas.width=this.width*this.pixelRatio,this.canvas.height=this.height*this.pixelRatio)),this.sprite=t},n.prototype.addIcons=function(t,e){for(var r=0;r1||(w?(clearTimeout(w),w=null,v("dblclick",e)):w=setTimeout(p,300))}function c(t){y("touchmove",t)}function h(t){y("touchend",t)}function f(t){y("touchcancel",t)}function p(){w=null}function d(t){var e=n.mousePos(x,t);e.equals(_)&&v("click",t)}function m(t){v("dblclick",t),t.preventDefault()}function g(t){b=t,t.preventDefault()}function v(e,r){var i=n.mousePos(x,r);return t.fire(e,{lngLat:t.unproject(i),point:i,originalEvent:r})}function y(e,r){var o=n.touchPos(x,r),a=o.reduce(function(t,e,r,n){return t.add(e.div(n.length))},new i(0,0));return t.fire(e,{lngLat:t.unproject(a),point:a,lngLats:o.map(function(e){return t.unproject(e)},this),points:o,originalEvent:r})}var x=t.getCanvasContainer(),b=null,_=null,w=null;for(var M in o)t[M]=new o[M](t,e),e.interactive&&e[M]&&t[M].enable();x.addEventListener("mouseout",r,!1),x.addEventListener("mousedown",a,!1),x.addEventListener("mouseup",s,!1),x.addEventListener("mousemove",l,!1),x.addEventListener("touchstart",u,!1),x.addEventListener("touchend",h,!1),x.addEventListener("touchmove",c,!1),x.addEventListener("touchcancel",f,!1),x.addEventListener("click",d,!1),x.addEventListener("dblclick",m,!1),x.addEventListener("contextmenu",g,!1)}},{"../util/dom":361,"./handler/box_zoom":346,"./handler/dblclick_zoom":347,"./handler/drag_pan":348,"./handler/drag_rotate":349,"./handler/keyboard":350,"./handler/scroll_zoom":351,"./handler/touch_zoom_rotate":352,"point-geometry":414}],341:[function(t,e,r){"use strict";var n=t("../util/util"),i=t("../util/interpolate"),o=t("../util/browser"),a=t("../geo/lng_lat"),s=t("../geo/lng_lat_bounds"),l=t("point-geometry"),u=e.exports=function(){};n.extend(u.prototype,{getCenter:function(){return this.transform.center},setCenter:function(t,e){return this.jumpTo({center:t},e),this},panBy:function(t,e,r){return this.panTo(this.transform.center,n.extend({offset:l.convert(t).mult(-1)},e),r),this},panTo:function(t,e,r){return this.easeTo(n.extend({center:t},e),r)},getZoom:function(){return this.transform.zoom},setZoom:function(t,e){return this.jumpTo({zoom:t},e),this},zoomTo:function(t,e,r){return this.easeTo(n.extend({zoom:t},e),r)},zoomIn:function(t,e){return this.zoomTo(this.getZoom()+1,t,e),this},zoomOut:function(t,e){return this.zoomTo(this.getZoom()-1,t,e),this},getBearing:function(){return this.transform.bearing},setBearing:function(t,e){return this.jumpTo({bearing:t},e),this},rotateTo:function(t,e,r){return this.easeTo(n.extend({bearing:t},e),r)},resetNorth:function(t,e){return this.rotateTo(0,n.extend({duration:1e3},t),e),this},snapToNorth:function(t,e){return Math.abs(this.getBearing())180&&(c.center.lng>0&&m.lng<0?m.lng+=360:c.center.lng<0&&m.lng>0&&(m.lng-=360));var x=c.zoomScale(g-f),b=c.point,_="center"in t?c.project(m).sub(h.div(x)):b,w=c.worldSize,M=t.curve,A=Math.max(c.width,c.height),k=A/x,T=_.sub(b).mag();if("minZoom"in t){var E=n.clamp(Math.min(t.minZoom,f,g),c.minZoom,c.maxZoom),S=A/c.zoomScale(E-f);M=Math.sqrt(S/T*2)}var L=M*M,z=r(0),I=function(t){return s(z)/s(z+M*t)},P=function(t){return A*((s(z)*u(z+M*t)-o(z))/L)/T},C=(r(1)-z)/M;if(Math.abs(T)<1e-6){if(Math.abs(A-k)<1e-6)return this.easeTo(t);var R=A>k?-1:1;C=Math.abs(Math.log(k/A))/M,P=function(){return 0},I=function(t){return Math.exp(R*M*t)}}if("duration"in t)t.duration=+t.duration;else{var D="screenSpeed"in t?+t.screenSpeed/M:+t.speed;t.duration=1e3*C/D}return this.zooming=!0,p!==v&&(this.rotating=!0),d!==y&&(this.pitching=!0),this.fire("movestart",e),this.fire("zoomstart",e),this._ease(function(t){var r=t*C,n=P(r);c.zoom=f+c.scaleZoom(1/I(r)),c.center=c.unproject(b.add(_.sub(b).mult(n)),w),this.rotating&&(c.bearing=i(p,v,t)),this.pitching&&(c.pitch=i(d,y,t)),this.fire("move",e),this.fire("zoom",e),this.rotating&&this.fire("rotate",e),this.pitching&&this.fire("pitch",e)},function(){this.zooming=!1,this.rotating=!1,this.pitching=!1,this.fire("zoomend",e),this.fire("moveend",e)},t),this},isEasing:function(){return!!this._abortFn},stop:function(){return this._abortFn&&(this._abortFn(),this._finishEase()),this},_ease:function(t,e,r){this._finishFn=e,this._abortFn=o.timed(function(e){t.call(this,r.easing(e)),1===e&&this._finishEase()},r.animate===!1?0:r.duration,this)},_finishEase:function(){delete this._abortFn;var t=this._finishFn;delete this._finishFn,t.call(this)},_normalizeBearing:function(t,e){t=n.wrap(t,-180,180);var r=Math.abs(t-e);return Math.abs(t-360-e)=0)return!1;return!0}),e.join(" | ")},n.prototype=a.inherit(i,{options:{position:"bottom-right"},onAdd:function(t){var e="mapboxgl-ctrl-attrib",r=this._container=o.create("div",e,t.getContainer());return this._update(),t.on("source.load",this._update.bind(this)),t.on("source.change",this._update.bind(this)),t.on("source.remove",this._update.bind(this)),t.on("moveend",this._updateEditLink.bind(this)),r},_update:function(){this._map.style&&(this._container.innerHTML=n.createAttributionString(this._map.style.sources)),this._editLink=this._container.getElementsByClassName("mapbox-improve-map")[0],this._updateEditLink()},_updateEditLink:function(){if(this._editLink){var t=this._map.getCenter();this._editLink.href="https://www.mapbox.com/map-feedback/#/"+t.lng+"/"+t.lat+"/"+Math.round(this._map.getZoom()+1)}}})},{"../../util/dom":361,"../../util/util":375,"./control":343}],343:[function(t,e,r){"use strict";function n(){}var i=t("../../util/util"),o=t("../../util/evented");e.exports=n,n.prototype={addTo:function(t){this._map=t;var e=this._container=this.onAdd(t);if(this.options&&this.options.position){var r=this.options.position,n=t._controlCorners[r];e.className+=" mapboxgl-ctrl",-1!==r.indexOf("bottom")?n.insertBefore(e,n.firstChild):n.appendChild(e)}return this},remove:function(){return this._container.parentNode.removeChild(this._container),this.onRemove&&this.onRemove(this._map),this._map=null,this}},i.extend(n.prototype,o)},{"../../util/evented":367,"../../util/util":375}],344:[function(t,e,r){"use strict";function n(t){s.setOptions(this,t)}var i=t("./control"),o=t("../../util/browser"),a=t("../../util/dom"),s=t("../../util/util");e.exports=n;var l={enableHighAccuracy:!1,timeout:6e3};n.prototype=s.inherit(i,{options:{position:"top-right"},onAdd:function(t){var e="mapboxgl-ctrl",r=this._container=a.create("div",e+"-group",t.getContainer());return o.supportsGeolocation?(this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._geolocateButton=a.create("button",e+"-icon "+e+"-geolocate",this._container),this._geolocateButton.type="button",this._geolocateButton.addEventListener("click",this._onClickGeolocate.bind(this)),r):r},_onContextMenu:function(t){t.preventDefault()},_onClickGeolocate:function(){navigator.geolocation.getCurrentPosition(this._success.bind(this),this._error.bind(this),l),this._timeoutId=setTimeout(this._finish.bind(this),1e4)},_success:function(t){this._map.jumpTo({center:[t.coords.longitude,t.coords.latitude],zoom:17,bearing:0,pitch:0}),this.fire("geolocate",t),this._finish()},_error:function(t){this.fire("error",t),this._finish()},_finish:function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}})},{"../../util/browser":359,"../../util/dom":361,"../../util/util":375,"./control":343}],345:[function(t,e,r){"use strict";function n(t){s.setOptions(this,t)}function i(t){return new MouseEvent(t.type,{button:2,buttons:2,bubbles:!0,cancelable:!0,detail:t.detail,view:t.view,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY,movementX:t.movementX,movementY:t.movementY,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey})}var o=t("./control"),a=t("../../util/dom"),s=t("../../util/util");e.exports=n,n.prototype=s.inherit(o,{options:{position:"top-right"},onAdd:function(t){var e="mapboxgl-ctrl",r=this._container=a.create("div",e+"-group",t.getContainer());return this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._zoomInButton=this._createButton(e+"-icon "+e+"-zoom-in",t.zoomIn.bind(t)),this._zoomOutButton=this._createButton(e+"-icon "+e+"-zoom-out",t.zoomOut.bind(t)),this._compass=this._createButton(e+"-icon "+e+"-compass",t.resetNorth.bind(t)),this._compassArrow=a.create("div","arrow",this._compass),this._compass.addEventListener("mousedown",this._onCompassDown.bind(this)),this._onCompassMove=this._onCompassMove.bind(this),this._onCompassUp=this._onCompassUp.bind(this),t.on("rotate",this._rotateCompassArrow.bind(this)),this._rotateCompassArrow(),this._el=t.getCanvasContainer(),r},_onContextMenu:function(t){t.preventDefault()},_onCompassDown:function(t){0===t.button&&(a.disableDrag(),document.addEventListener("mousemove",this._onCompassMove),document.addEventListener("mouseup",this._onCompassUp),this._el.dispatchEvent(i(t)),t.stopPropagation())},_onCompassMove:function(t){0===t.button&&(this._el.dispatchEvent(i(t)),t.stopPropagation())},_onCompassUp:function(t){0===t.button&&(document.removeEventListener("mousemove",this._onCompassMove),document.removeEventListener("mouseup",this._onCompassUp),a.enableDrag(),this._el.dispatchEvent(i(t)),t.stopPropagation())},_createButton:function(t,e){var r=a.create("button",t,this._container);return r.type="button",r.addEventListener("click",function(){e()}),r},_rotateCompassArrow:function(){var t="rotate("+this._map.transform.angle*(180/Math.PI)+"deg)";this._compassArrow.style.transform=t}})},{"../../util/dom":361,"../../util/util":375,"./control":343}],346:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),a.bindHandlers(this)}var i=t("../../util/dom"),o=t("../../geo/lng_lat_bounds"),a=t("../../util/util");e.exports=n,n.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onMouseDown,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onMouseDown),this._enabled=!1)},_onMouseDown:function(t){t.shiftKey&&0===t.button&&(document.addEventListener("mousemove",this._onMouseMove,!1),document.addEventListener("keydown",this._onKeyDown,!1),document.addEventListener("mouseup",this._onMouseUp,!1),i.disableDrag(),this._startPos=i.mousePos(this._el,t),this._active=!0)},_onMouseMove:function(t){var e=this._startPos,r=i.mousePos(this._el,t);this._box||(this._box=i.create("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));var n=Math.min(e.x,r.x),o=Math.max(e.x,r.x),a=Math.min(e.y,r.y),s=Math.max(e.y,r.y);i.setTransform(this._box,"translate("+n+"px,"+a+"px)"),this._box.style.width=o-n+"px",this._box.style.height=s-a+"px"},_onMouseUp:function(t){if(0===t.button){var e=this._startPos,r=i.mousePos(this._el,t),n=new o(this._map.unproject(e),this._map.unproject(r));this._finish(),e.x===r.x&&e.y===r.y?this._fireEvent("boxzoomcancel",t):this._map.fitBounds(n,{linear:!0}).fire("boxzoomend",{originalEvent:t,boxZoomBounds:n})}},_onKeyDown:function(t){27===t.keyCode&&(this._finish(),this._fireEvent("boxzoomcancel",t))},_finish:function(){this._active=!1,document.removeEventListener("mousemove",this._onMouseMove,!1),document.removeEventListener("keydown",this._onKeyDown,!1),document.removeEventListener("mouseup",this._onMouseUp,!1),this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.parentNode.removeChild(this._box),this._box=null),i.enableDrag()},_fireEvent:function(t,e){return this._map.fire(t,{originalEvent:e})}}},{"../../geo/lng_lat_bounds":273,"../../util/dom":361,"../../util/util":375}],347:[function(t,e,r){"use strict";function n(t){this._map=t,this._onDblClick=this._onDblClick.bind(this)}e.exports=n,n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._map.on("dblclick",this._onDblClick),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._map.off("dblclick",this._onDblClick),this._enabled=!1)},_onDblClick:function(t){this._map.zoomTo(this._map.getZoom()+(t.originalEvent.shiftKey?-1:1),{around:t.lngLat},t)}}},{}],348:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),o.bindHandlers(this)}var i=t("../../util/dom"),o=t("../../util/util");e.exports=n;var a=.3,s=o.bezier(0,0,a,1),l=1400,u=2500;n.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onDown),this._el.addEventListener("touchstart",this._onDown),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onDown),this._el.removeEventListener("touchstart",this._onDown),this._enabled=!1)},_onDown:function(t){this._ignoreEvent(t)||this.isActive()||(t.touches?(document.addEventListener("touchmove",this._onMove),document.addEventListener("touchend",this._onTouchEnd)):(document.addEventListener("mousemove",this._onMove),document.addEventListener("mouseup",this._onMouseUp)),this._active=!1,this._startPos=this._pos=i.mousePos(this._el,t),this._inertia=[[Date.now(),this._pos]])},_onMove:function(t){if(!this._ignoreEvent(t)){this.isActive()||(this._active=!0,this._fireEvent("dragstart",t),this._fireEvent("movestart",t));var e=i.mousePos(this._el,t),r=this._map;r.stop(),this._drainInertiaBuffer(),this._inertia.push([Date.now(),e]),r.transform.setLocationAtPoint(r.transform.pointLocation(this._pos),e),this._fireEvent("drag",t),this._fireEvent("move",t),this._pos=e,t.preventDefault()}},_onUp:function(t){if(this.isActive()){this._active=!1,this._fireEvent("dragend",t),this._drainInertiaBuffer();var e=function(){this._fireEvent("moveend",t)}.bind(this),r=this._inertia;if(r.length<2)return void e();var n=r[r.length-1],i=r[0],o=n[1].sub(i[1]),c=(n[0]-i[0])/1e3;if(0===c||n[1].equals(i[1]))return void e();var h=o.mult(a/c),f=h.mag();f>l&&(f=l,h._unit()._mult(f));var p=f/(u*a),d=h.mult(-p/2);this._map.panBy(d,{duration:1e3*p,easing:s,noMoveStart:!0},{originalEvent:t})}},_onMouseUp:function(t){this._ignoreEvent(t)||(this._onUp(t),document.removeEventListener("mousemove",this._onMove),document.removeEventListener("mouseup",this._onMouseUp))},_onTouchEnd:function(t){this._ignoreEvent(t)||(this._onUp(t),document.removeEventListener("touchmove",this._onMove),document.removeEventListener("touchend",this._onTouchEnd))},_fireEvent:function(t,e){return this._map.fire(t,{originalEvent:e})},_ignoreEvent:function(t){var e=this._map;if(e.boxZoom&&e.boxZoom.isActive())return!0;if(e.dragRotate&&e.dragRotate.isActive())return!0;if(t.touches)return t.touches.length>1;if(t.ctrlKey)return!0;var r=1,n=0;return"mousemove"===t.type?t.buttons&0===r:t.button!==n},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),r=160;t.length>0&&e-t[0][0]>r;)t.shift()}}},{"../../util/dom":361,"../../util/util":375}],349:[function(t,e,r){"use strict";function n(t,e){this._map=t,this._el=t.getCanvasContainer(),this._bearingSnap=e.bearingSnap,a.bindHandlers(this)}var i=t("../../util/dom"),o=t("point-geometry"),a=t("../../util/util");e.exports=n;var s=.25,l=a.bezier(0,0,s,1),u=180,c=720;n.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onDown),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onDown),this._enabled=!1)},_onDown:function(t){if(!this._ignoreEvent(t)&&!this.isActive()){document.addEventListener("mousemove",this._onMove),document.addEventListener("mouseup",this._onUp),this._active=!1,this._inertia=[[Date.now(),this._map.getBearing()]],this._startPos=this._pos=i.mousePos(this._el,t),this._center=this._map.transform.centerPoint;var e=this._startPos.sub(this._center),r=e.mag();200>r&&(this._center=this._startPos.add(new o(-200,0)._rotate(e.angle()))),t.preventDefault()}},_onMove:function(t){if(!this._ignoreEvent(t)){this.isActive()||(this._active=!0,this._fireEvent("rotatestart",t),this._fireEvent("movestart",t));var e=this._map;e.stop();var r=this._pos,n=i.mousePos(this._el,t),o=this._center,a=r.sub(o).angleWith(n.sub(o))/Math.PI*180,s=e.getBearing()-a,l=this._inertia,u=l[l.length-1];this._drainInertiaBuffer(),l.push([Date.now(),e._normalizeBearing(s,u[1])]),e.transform.bearing=s,this._fireEvent("rotate",t),this._fireEvent("move",t),this._pos=n}},_onUp:function(t){if(!this._ignoreEvent(t)&&(document.removeEventListener("mousemove",this._onMove),document.removeEventListener("mouseup",this._onUp),this.isActive())){this._active=!1,this._fireEvent("rotateend",t),this._drainInertiaBuffer();var e=this._map,r=e.getBearing(),n=this._inertia,i=function(){Math.abs(r)p?-1:1,m=(a[0]-o[0])/1e3;if(0===p||0===m)return void i();var g=Math.abs(p*(s/m));g>u&&(g=u);var v=g/(c*s),y=d*g*(v/2);f+=y,Math.abs(e._normalizeBearing(f,0))1;var r=t.ctrlKey?1:2,n=t.ctrlKey?0:2;return"mousemove"===t.type?t.buttons&0===r:t.button!==n},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),r=160;t.length>0&&e-t[0][0]>r;)t.shift()}}},{"../../util/dom":361,"../../util/util":375,"point-geometry":414}],350:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),this._onKeyDown=this._onKeyDown.bind(this)}e.exports=n;var i=80,o=2,a=5;n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("keydown",this._onKeyDown,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("keydown",this._onKeyDown),this._enabled=!1)},_onKeyDown:function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e=this._map,r={originalEvent:t};if(!e.isEasing())switch(t.keyCode){case 61:case 107:case 171:case 187:e.zoomTo(Math.round(e.getZoom())+(t.shiftKey?2:1),r);break;case 189:case 109:case 173:e.zoomTo(Math.round(e.getZoom())-(t.shiftKey?2:1),r);break;case 37:t.shiftKey?e.easeTo({bearing:e.getBearing()-o},r):(t.preventDefault(),e.panBy([-i,0],r));break;case 39:t.shiftKey?e.easeTo({bearing:e.getBearing()+o},r):(t.preventDefault(),e.panBy([i,0],r));break;case 38:t.shiftKey?e.easeTo({pitch:e.getPitch()+a},r):(t.preventDefault(),e.panBy([0,-i],r));break;case 40:t.shiftKey?e.easeTo({pitch:Math.max(e.getPitch()-a,0)},r):(t.preventDefault(),e.panBy([0,i],r))}}}}},{}],351:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),a.bindHandlers(this)}var i=t("../../util/dom"),o=t("../../util/browser"),a=t("../../util/util");e.exports=n;var s="undefined"!=typeof navigator?navigator.userAgent.toLowerCase():"",l=-1!==s.indexOf("firefox"),u=-1!==s.indexOf("safari")&&-1===s.indexOf("chrom");n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("wheel",this._onWheel,!1),this._el.addEventListener("mousewheel",this._onWheel,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("wheel",this._onWheel),this._el.removeEventListener("mousewheel",this._onWheel),this._enabled=!1)},_onWheel:function(t){var e;"wheel"===t.type?(e=t.deltaY,l&&t.deltaMode===window.WheelEvent.DOM_DELTA_PIXEL&&(e/=o.devicePixelRatio),t.deltaMode===window.WheelEvent.DOM_DELTA_LINE&&(e*=40)):"mousewheel"===t.type&&(e=-t.wheelDeltaY,u&&(e/=3));var r=o.now(),n=r-(this._time||0);this._pos=i.mousePos(this._el,t),this._time=r,0!==e&&e%4.000244140625===0?(this._type="wheel",e=Math.floor(e/4)):0!==e&&Math.abs(e)<4?this._type="trackpad":n>400?(this._type=null,this._lastValue=e,this._timeout=setTimeout(this._onTimeout,40)):this._type||(this._type=Math.abs(n*e)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,e+=this._lastValue)),t.shiftKey&&e&&(e/=4),this._type&&this._zoom(-e,t),t.preventDefault()},_onTimeout:function(){this._type="wheel",this._zoom(-this._lastValue)},_zoom:function(t,e){if(0!==t){var r=this._map,n=2/(1+Math.exp(-Math.abs(t/100)));0>t&&0!==n&&(n=1/n);var i=r.ease?r.ease.to:r.transform.scale,o=r.transform.scaleZoom(i*n);r.zoomTo(o,{duration:0,around:r.unproject(this._pos),delayEndEvents:200},{originalEvent:e})}}}},{"../../util/browser":359,"../../util/dom":361,"../../util/util":375}],352:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),o.bindHandlers(this)}var i=t("../../util/dom"),o=t("../../util/util");e.exports=n;var a=.15,s=o.bezier(0,0,a,1),l=12,u=2.5,c=.15,h=4;n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("touchstart",this._onStart,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("touchstart",this._onStart),this._enabled=!1)},disableRotation:function(){this._rotationDisabled=!0},enableRotation:function(){this._rotationDisabled=!1},_onStart:function(t){if(2===t.touches.length){var e=i.mousePos(this._el,t.touches[0]),r=i.mousePos(this._el,t.touches[1]);this._startVec=e.sub(r),this._startScale=this._map.transform.scale,this._startBearing=this._map.transform.bearing,this._gestureIntent=void 0,this._inertia=[],document.addEventListener("touchmove",this._onMove,!1),document.addEventListener("touchend",this._onEnd,!1)}},_onMove:function(t){if(2===t.touches.length){var e=i.mousePos(this._el,t.touches[0]),r=i.mousePos(this._el,t.touches[1]),n=e.add(r).div(2),o=e.sub(r),a=o.mag()/this._startVec.mag(),s=this._rotationDisabled?0:180*o.angleWith(this._startVec)/Math.PI,l=this._map;if(this._gestureIntent){var u={duration:0,around:l.unproject(n)};"rotate"===this._gestureIntent&&(u.bearing=this._startBearing+s),"zoom"!==this._gestureIntent&&"rotate"!==this._gestureIntent||(u.zoom=l.transform.scaleZoom(this._startScale*a)),l.stop(),this._drainInertiaBuffer(),this._inertia.push([Date.now(),a,n]),l.easeTo(u,{originalEvent:t})}else{var f=Math.abs(1-a)>c,p=Math.abs(s)>h;p?this._gestureIntent="rotate":f&&(this._gestureIntent="zoom"),this._gestureIntent&&(this._startVec=o,this._startScale=l.transform.scale,this._startBearing=l.transform.bearing)}t.preventDefault()}},_onEnd:function(t){document.removeEventListener("touchmove",this._onMove),document.removeEventListener("touchend",this._onEnd),this._drainInertiaBuffer();var e=this._inertia,r=this._map;if(e.length<2)return void r.snapToNorth({},{originalEvent:t});var n=e[e.length-1],i=e[0],o=r.transform.scaleZoom(this._startScale*n[1]),c=r.transform.scaleZoom(this._startScale*i[1]),h=o-c,f=(n[0]-i[0])/1e3,p=n[2];if(0===f||o===c)return void r.snapToNorth({},{originalEvent:t});var d=h*a/f;Math.abs(d)>u&&(d=d>0?u:-u);var m=1e3*Math.abs(d/(l*a)),g=o+d*m/2e3;0>g&&(g=0),r.easeTo({zoom:g,duration:m,easing:s,around:r.unproject(p)},{originalEvent:t})},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now(),r=160;t.length>2&&e-t[0][0]>r;)t.shift()}}},{"../../util/dom":361,"../../util/util":375}],353:[function(t,e,r){"use strict";function n(){i.bindAll(["_onHashChange","_updateHash"],this)}e.exports=n;var i=t("../util/util");n.prototype={addTo:function(t){return this._map=t,window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},remove:function(){return window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),delete this._map,this},_onHashChange:function(){var t=location.hash.replace("#","").split("/");return t.length>=3?(this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:+(t[3]||0)}),!0):!1},_updateHash:function(){var t=this._map.getCenter(),e=this._map.getZoom(),r=this._map.getBearing(),n=Math.max(0,Math.ceil(Math.log(e)/Math.LN2)),i="#"+Math.round(100*e)/100+"/"+t.lat.toFixed(n)+"/"+t.lng.toFixed(n)+(r?"/"+Math.round(10*r)/10:"");window.history.replaceState("","",i)}}},{"../util/util":375}],354:[function(t,e,r){"use strict";function n(t){t.parentNode&&t.parentNode.removeChild(t)}var i=t("../util/canvas"),o=t("../util/util"),a=t("../util/browser"),s=t("../util/browser").window,l=t("../util/evented"),u=t("../util/dom"),c=t("../style/style"),h=t("../style/animation_loop"),f=t("../render/painter"),p=t("../geo/transform"),d=t("./hash"),m=t("./bind_handlers"),g=t("./camera"),v=t("../geo/lng_lat"),y=t("../geo/lng_lat_bounds"),x=t("point-geometry"),b=t("./control/attribution"),_=0,w=20,M={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:_,maxZoom:w,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,bearingSnap:7,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,workerCount:Math.max(a.hardwareConcurrency-1,1)},A=e.exports=function(t){if(t=o.extend({},M,t),t.workerCount<1)throw new Error("workerCount must an integer greater than or equal to 1.");this._interactive=t.interactive,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=t.preserveDrawingBuffer,this._trackResize=t.trackResize,this._workerCount=t.workerCount,this._bearingSnap=t.bearingSnap,"string"==typeof t.container?this._container=document.getElementById(t.container):this._container=t.container,this.animationLoop=new h,this.transform=new p(t.minZoom,t.maxZoom),t.maxBounds&&this.setMaxBounds(t.maxBounds),o.bindAll(["_forwardStyleEvent","_forwardSourceEvent","_forwardLayerEvent","_forwardTileEvent","_onStyleLoad","_onStyleChange","_onSourceAdd","_onSourceRemove","_onSourceUpdate","_onWindowOnline","_onWindowResize","_update","_render"],this),this._setupContainer(),this._setupPainter(),this.on("move",this._update.bind(this,!1)),this.on("zoom",this._update.bind(this,!0)),this.on("moveend",function(){this.animationLoop.set(300),this._rerender()}.bind(this)),"undefined"!=typeof s&&(s.addEventListener("online",this._onWindowOnline,!1),s.addEventListener("resize",this._onWindowResize,!1)),m(this,t),this._hash=t.hash&&(new d).addTo(this),this._hash&&this._hash._onHashChange()||this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}),this.stacks={},this._classes=[],this.resize(),t.classes&&this.setClasses(t.classes),t.style&&this.setStyle(t.style),t.attributionControl&&this.addControl(new b(t.attributionControl));var e=this.fire.bind(this,"error");this.on("style.error",e),this.on("source.error",e),this.on("tile.error",e),this.on("layer.error",e)};o.extend(A.prototype,l),o.extend(A.prototype,g.prototype),o.extend(A.prototype,{addControl:function(t){return t.addTo(this),this},addClass:function(t,e){return this._classes.indexOf(t)>=0||""===t?this:(this._classes.push(t),this._classOptions=e,this.style&&this.style.updateClasses(),this._update(!0))},removeClass:function(t,e){var r=this._classes.indexOf(t);return 0>r||""===t?this:(this._classes.splice(r,1),this._classOptions=e,this.style&&this.style.updateClasses(),this._update(!0))},setClasses:function(t,e){for(var r={},n=0;n=0},getClasses:function(){return this._classes},resize:function(){var t=0,e=0;return this._container&&(t=this._container.offsetWidth||400,e=this._container.offsetHeight||300),this._canvas.resize(t,e),this.transform.resize(t,e),this.painter.resize(t,e),this.fire("movestart").fire("move").fire("resize").fire("moveend")},getBounds:function(){var t=new y(this.transform.pointLocation(new x(0,0)),this.transform.pointLocation(this.transform.size));return(this.transform.angle||this.transform.pitch)&&(t.extend(this.transform.pointLocation(new x(this.transform.size.x,0))),t.extend(this.transform.pointLocation(new x(0,this.transform.size.y)))),t},setMaxBounds:function(t){if(t){var e=y.convert(t);this.transform.lngRange=[e.getWest(),e.getEast()],this.transform.latRange=[e.getSouth(),e.getNorth()],this.transform._constrain(),this._update()}else null!==t&&void 0!==t||(this.transform.lngRange=[],this.transform.latRange=[],this._update());return this},setMinZoom:function(t){if(t=null===t||void 0===t?_:t,t>=_&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom&&w>=t)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be between the current minZoom and "+w+", inclusive")},project:function(t){return this.transform.locationPoint(v.convert(t))},unproject:function(t){return this.transform.pointLocation(x.convert(t))},queryRenderedFeatures:function(){function t(t){return t instanceof x||Array.isArray(t)}var e,r={};return 2===arguments.length?(e=arguments[0],r=arguments[1]):1===arguments.length&&t(arguments[0])?e=arguments[0]:1===arguments.length&&(r=arguments[0]),this.style.queryRenderedFeatures(this._makeQueryGeometry(e),r,this.transform.zoom,this.transform.angle)},_makeQueryGeometry:function(t){void 0===t&&(t=[x.convert([0,0]),x.convert([this.transform.width,this.transform.height])]);var e,r=t instanceof x||"number"==typeof t[0];if(r){var n=x.convert(t);e=[n]}else{var i=[x.convert(t[0]),x.convert(t[1])];e=[i[0],new x(i[1].x,i[0].y),i[1],new x(i[0].x,i[1].y),i[0]]}return e=e.map(function(t){return this.transform.pointCoordinate(t)}.bind(this))},querySourceFeatures:function(t,e){return this.style.querySourceFeatures(t,e)},setStyle:function(t){return this.style&&(this.style.off("load",this._onStyleLoad).off("error",this._forwardStyleEvent).off("change",this._onStyleChange).off("source.add",this._onSourceAdd).off("source.remove",this._onSourceRemove).off("source.load",this._onSourceUpdate).off("source.error",this._forwardSourceEvent).off("source.change",this._onSourceUpdate).off("layer.add",this._forwardLayerEvent).off("layer.remove",this._forwardLayerEvent).off("layer.error",this._forwardLayerEvent).off("tile.add",this._forwardTileEvent).off("tile.remove",this._forwardTileEvent).off("tile.load",this._update).off("tile.error",this._forwardTileEvent).off("tile.stats",this._forwardTileEvent)._remove(),this.off("rotate",this.style._redoPlacement),this.off("pitch",this.style._redoPlacement)),t?(t instanceof c?this.style=t:this.style=new c(t,this.animationLoop,this._workerCount),this.style.on("load",this._onStyleLoad).on("error",this._forwardStyleEvent).on("change",this._onStyleChange).on("source.add",this._onSourceAdd).on("source.remove",this._onSourceRemove).on("source.load",this._onSourceUpdate).on("source.error",this._forwardSourceEvent).on("source.change",this._onSourceUpdate).on("layer.add",this._forwardLayerEvent).on("layer.remove",this._forwardLayerEvent).on("layer.error",this._forwardLayerEvent).on("tile.add",this._forwardTileEvent).on("tile.remove",this._forwardTileEvent).on("tile.load",this._update).on("tile.error",this._forwardTileEvent).on("tile.stats",this._forwardTileEvent),this.on("rotate",this.style._redoPlacement),this.on("pitch",this.style._redoPlacement),this):(this.style=null,this)},getStyle:function(){return this.style?this.style.serialize():void 0},addSource:function(t,e){return this.style.addSource(t,e),this._update(!0),this},addSourceType:function(t,e,r){return this.style.addSourceType(t,e,r)},removeSource:function(t){return this.style.removeSource(t),this._update(!0),this},getSource:function(t){return this.style.getSource(t)},addLayer:function(t,e){return this.style.addLayer(t,e),this._update(!0),this},removeLayer:function(t){return this.style.removeLayer(t),this._update(!0),this},getLayer:function(t){return this.style.getLayer(t)},setFilter:function(t,e){return this.style.setFilter(t,e),this._update(!0),this},setLayerZoomRange:function(t,e,r){return this.style.setLayerZoomRange(t,e,r),this._update(!0),this},getFilter:function(t){return this.style.getFilter(t)},setPaintProperty:function(t,e,r,n){return this.style.setPaintProperty(t,e,r,n),this._update(!0),this},getPaintProperty:function(t,e,r){return this.style.getPaintProperty(t,e,r)},setLayoutProperty:function(t,e,r){return this.style.setLayoutProperty(t,e,r),this._update(!0),this},getLayoutProperty:function(t,e){return this.style.getLayoutProperty(t,e)},getContainer:function(){return this._container},getCanvasContainer:function(){return this._canvasContainer},getCanvas:function(){return this._canvas.getElement()},_setupContainer:function(){var t=this._container;t.classList.add("mapboxgl-map");var e=this._canvasContainer=u.create("div","mapboxgl-canvas-container",t);this._interactive&&e.classList.add("mapboxgl-interactive"),this._canvas=new i(this,e);var r=this._controlContainer=u.create("div","mapboxgl-control-container",t),n=this._controlCorners={}; ["top-left","top-right","bottom-left","bottom-right"].forEach(function(t){n[t]=u.create("div","mapboxgl-ctrl-"+t,r)})},_setupPainter:function(){var t=this._canvas.getWebGLContext({failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer});return t?void(this.painter=new f(t,this.transform)):void this.fire("error",{error:new Error("Failed to initialize WebGL")})},_contextLost:function(t){t.preventDefault(),this._frameId&&a.cancelFrame(this._frameId),this.fire("webglcontextlost",{originalEvent:t})},_contextRestored:function(t){this._setupPainter(),this.resize(),this._update(),this.fire("webglcontextrestored",{originalEvent:t})},loaded:function(){return this._styleDirty||this._sourcesDirty?!1:!(!this.style||!this.style.loaded())},_update:function(t){return this.style?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this._rerender(),this):this},_render:function(){try{this.style&&this._styleDirty&&(this._styleDirty=!1,this.style.update(this._classes,this._classOptions),this._classOptions=null,this.style._recalculate(this.transform.zoom)),this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.painter.render(this.style,{debug:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,vertices:this.vertices,rotating:this.rotating,zooming:this.zooming}),this.fire("render"),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire("load")),this._frameId=null,this.animationLoop.stopped()||(this._styleDirty=!0),(this._sourcesDirty||this._repaint||this._styleDirty)&&this._rerender()}catch(t){this.fire("error",{error:t})}return this},remove:function(){this._hash&&this._hash.remove(),a.cancelFrame(this._frameId),this.setStyle(null),"undefined"!=typeof s&&s.removeEventListener("resize",this._onWindowResize,!1);var t=this.painter.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),n(this._canvasContainer),n(this._controlContainer),this._container.classList.remove("mapboxgl-map")},_rerender:function(){this.style&&!this._frameId&&(this._frameId=a.frame(this._render))},_forwardStyleEvent:function(t){this.fire("style."+t.type,o.extend({style:t.target},t))},_forwardSourceEvent:function(t){this.fire(t.type,o.extend({style:t.target},t))},_forwardLayerEvent:function(t){this.fire(t.type,o.extend({style:t.target},t))},_forwardTileEvent:function(t){this.fire(t.type,o.extend({style:t.target},t))},_onStyleLoad:function(t){this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this.style.update(this._classes,{transition:!1}),this._forwardStyleEvent(t)},_onStyleChange:function(t){this._update(!0),this._forwardStyleEvent(t)},_onSourceAdd:function(t){var e=t.source;e.onAdd&&e.onAdd(this),this._forwardSourceEvent(t)},_onSourceRemove:function(t){var e=t.source;e.onRemove&&e.onRemove(this),this._forwardSourceEvent(t)},_onSourceUpdate:function(t){this._update(),this._forwardSourceEvent(t)},_onWindowOnline:function(){this._update()},_onWindowResize:function(){this._trackResize&&this.stop().resize()._update()}}),o.extendAll(A.prototype,{_showTileBoundaries:!1,get showTileBoundaries(){return this._showTileBoundaries},set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())},_showCollisionBoxes:!1,get showCollisionBoxes(){return this._showCollisionBoxes},set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,this.style._redoPlacement())},_showOverdrawInspector:!1,get showOverdrawInspector(){return this._showOverdrawInspector},set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())},_repaint:!1,get repaint(){return this._repaint},set repaint(t){this._repaint=t,this._update()},_vertices:!1,get vertices(){return this._vertices},set vertices(t){this._vertices=t,this._update()}})},{"../geo/lng_lat":272,"../geo/lng_lat_bounds":273,"../geo/transform":274,"../render/painter":288,"../style/animation_loop":308,"../style/style":311,"../util/browser":359,"../util/canvas":360,"../util/dom":361,"../util/evented":367,"../util/util":375,"./bind_handlers":340,"./camera":341,"./control/attribution":342,"./hash":353,"point-geometry":414}],355:[function(t,e,r){"use strict";function n(t,e){t||(t=i.create("div")),t.classList.add("mapboxgl-marker"),this._el=t,this._offset=a.convert(e&&e.offset||[0,0]),this._update=this._update.bind(this)}e.exports=n;var i=t("../util/dom"),o=t("../geo/lng_lat"),a=t("point-geometry");n.prototype={addTo:function(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._el),t.on("move",this._update),this._update(),this},remove:function(){this._map&&(this._map.off("move",this._update),this._map=null);var t=this._el.parentNode;return t&&t.removeChild(this._el),this},getLngLat:function(){return this._lngLat},setLngLat:function(t){return this._lngLat=o.convert(t),this._update(),this},getElement:function(){return this._el},_update:function(){if(this._map){var t=this._map.project(this._lngLat)._add(this._offset);i.setTransform(this._el,"translate("+t.x+"px,"+t.y+"px)")}}}},{"../geo/lng_lat":272,"../util/dom":361,"point-geometry":414}],356:[function(t,e,r){"use strict";function n(t){i.setOptions(this,t),i.bindAll(["_update","_onClickClose"],this)}e.exports=n;var i=t("../util/util"),o=t("../util/evented"),a=t("../util/dom"),s=t("../geo/lng_lat");n.prototype=i.inherit(o,{options:{closeButton:!0,closeOnClick:!0},addTo:function(t){return this._map=t,this._map.on("move",this._update),this.options.closeOnClick&&this._map.on("click",this._onClickClose),this._update(),this},remove:function(){return this._content&&this._content.parentNode&&this._content.parentNode.removeChild(this._content),this._container&&(this._container.parentNode.removeChild(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("click",this._onClickClose),delete this._map),this.fire("close"),this},getLngLat:function(){return this._lngLat},setLngLat:function(t){return this._lngLat=s.convert(t),this._update(),this},setText:function(t){return this.setDOMContent(document.createTextNode(t))},setHTML:function(t){var e,r=document.createDocumentFragment(),n=document.createElement("body");for(n.innerHTML=t;;){if(e=n.firstChild,!e)break;r.appendChild(e)}return this.setDOMContent(r)},setDOMContent:function(t){return this._createContent(),this._content.appendChild(t),this._update(),this},_createContent:function(){this._content&&this._content.parentNode&&this._content.parentNode.removeChild(this._content),this._content=a.create("div","mapboxgl-popup-content",this._container),this.options.closeButton&&(this._closeButton=a.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClickClose))},_update:function(){if(this._map&&this._lngLat&&this._content){this._container||(this._container=a.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=a.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content));var t=this._map.project(this._lngLat).round(),e=this.options.anchor;if(!e){var r=this._container.offsetWidth,n=this._container.offsetHeight;e=t.ythis._map.transform.height-n?["bottom"]:[],t.xthis._map.transform.width-r/2&&e.push("right"),e=0===e.length?"bottom":e.join("-")}var i={top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"},o=this._container.classList;for(var s in i)o.remove("mapboxgl-popup-anchor-"+s);o.add("mapboxgl-popup-anchor-"+e),a.setTransform(this._container,i[e]+" translate("+t.x+"px,"+t.y+"px)")}},_onClickClose:function(){this.remove()}})},{"../geo/lng_lat":272,"../util/dom":361,"../util/evented":367,"../util/util":375}],357:[function(t,e,r){"use strict";function n(t,e){this.target=t,this.parent=e,this.callbacks={},this.callbackID=0,this.receive=this.receive.bind(this),this.target.addEventListener("message",this.receive,!1)}e.exports=n,n.prototype.receive=function(t){function e(t,e,r){this.postMessage({type:"",id:String(i),error:t?String(t):null,data:e},r)}var r,n=t.data,i=n.id;if(""===n.type)r=this.callbacks[n.id],delete this.callbacks[n.id],r&&r(n.error||null,n.data);else if("undefined"!=typeof n.id&&this.parent[n.type])this.parent[n.type](n.data,e.bind(this));else if("undefined"!=typeof n.id&&this.parent.workerSources){var o=n.type.split(".");this.parent.workerSources[o[0]][o[1]](n.data,e.bind(this))}else this.parent[n.type](n.data)},n.prototype.send=function(t,e,r,n){var i=null;r&&(this.callbacks[i=this.callbackID++]=r),this.postMessage({type:t,id:String(i),data:e},n)},n.prototype.postMessage=function(t,e){this.target.postMessage(t,e)}},{}],358:[function(t,e,r){"use strict";function n(t){var e=document.createElement("a");return e.href=t,e.protocol===document.location.protocol&&e.host===document.location.host}r.getJSON=function(t,e){var r=new XMLHttpRequest;return r.open("GET",t,!0),r.setRequestHeader("Accept","application/json"),r.onerror=function(t){e(t)},r.onload=function(){if(r.status>=200&&r.status<300&&r.response){var t;try{t=JSON.parse(r.response)}catch(n){return e(n)}e(null,t)}else e(new Error(r.statusText))},r.send(),r},r.getArrayBuffer=function(t,e){var r=new XMLHttpRequest;return r.open("GET",t,!0),r.responseType="arraybuffer",r.onerror=function(t){e(t)},r.onload=function(){r.status>=200&&r.status<300&&r.response?e(null,r.response):e(new Error(r.statusText))},r.send(),r},r.getImage=function(t,e){return r.getArrayBuffer(t,function(t,r){if(t)return e(t);var n=new Image;n.onload=function(){e(null,n),(window.URL||window.webkitURL).revokeObjectURL(n.src)};var i=new Blob([new Uint8Array(r)],{type:"image/png"});return n.src=(window.URL||window.webkitURL).createObjectURL(i),n.getData=function(){var t=document.createElement("canvas"),e=t.getContext("2d");return t.width=n.width,t.height=n.height,e.drawImage(n,0,0),e.getImageData(0,0,n.width,n.height).data},n})},r.getVideo=function(t,e){var r=document.createElement("video");r.onloadstart=function(){e(null,r)};for(var i=0;i=s+n?t.call(i,1):(t.call(i,(l-s)/n),r.frame(o)))}if(!n)return t.call(i,1),null;var a=!1,s=e.exports.now();return r.frame(o),function(){a=!0}},r.supported=t("mapbox-gl-supported"),r.hardwareConcurrency=navigator.hardwareConcurrency||4,Object.defineProperty(r,"devicePixelRatio",{get:function(){return window.devicePixelRatio}}),r.supportsWebp=!1;var o=document.createElement("img");o.onload=function(){r.supportsWebp=!0},o.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=",r.supportsGeolocation=!!navigator.geolocation},{"mapbox-gl-supported":260}],360:[function(t,e,r){"use strict";function n(t,e){this.canvas=document.createElement("canvas"),t&&e&&(this.canvas.style.position="absolute",this.canvas.classList.add("mapboxgl-canvas"),this.canvas.addEventListener("webglcontextlost",t._contextLost.bind(t),!1),this.canvas.addEventListener("webglcontextrestored",t._contextRestored.bind(t),!1),this.canvas.setAttribute("tabindex",0),e.appendChild(this.canvas))}var i=t("../util"),o=t("mapbox-gl-supported");e.exports=n,n.prototype.resize=function(t,e){var r=window.devicePixelRatio||1;this.canvas.width=r*t,this.canvas.height=r*e,this.canvas.style.width=t+"px",this.canvas.style.height=e+"px"},n.prototype.getWebGLContext=function(t){return t=i.extend({},t,o.webGLContextAttributes),this.canvas.getContext("webgl",t)||this.canvas.getContext("experimental-webgl",t)},n.prototype.getElement=function(){return this.canvas}},{"../util":375,"mapbox-gl-supported":260}],361:[function(t,e,r){"use strict";function n(t){for(var e=0;ei;a=i++)e=t[i],r=t[a],n+=(r.x-e.x)*(e.y+r.y);return n}var o=t("quickselect");e.exports=function(t,e){var r=t.length;if(1>=r)return[t];for(var a,s,l=[],u=0;r>u;u++){var c=i(t[u]);0!==c&&(t[u].area=Math.abs(c),void 0===s&&(s=0>c),s===0>c?(a&&l.push(a),a=[t[u]]):a.push(t[u]))}if(a&&l.push(a),e>1)for(var h=0;hr;r++){var n=new a,i=new o(n,e);i.name="Worker "+r,this.actors.push(i)}}var i=t("./util"),o=t("./actor"),a=t("./web_worker");e.exports=n,n.prototype={broadcast:function(t,e,r){r=r||function(){},i.asyncAll(this.actors,function(r,n){r.send(t,e,n)},r)},send:function(t,e,r,n,i){return("number"!=typeof n||isNaN(n))&&(n=this.currentActor=(this.currentActor+1)%this.actors.length),this.actors[n].send(t,e,r,i),n},remove:function(){for(var t=0;t=0&&this._events[t].splice(r,1),this._events[t].length||delete this._events[t]}else delete this._events[t];return this},once:function(t,e){var r=function(n){this.off(t,r),e.call(this,n)}.bind(this);return this.on(t,r),this},fire:function(t,e){if(!this.listens(t))return n.endsWith(t,"error")&&console.error(e&&e.error||e||"Empty error event"),this;e=n.extend({},e),n.extend(e,{type:t,target:this});for(var r=this._events[t].slice(),i=0;i=3)for(var l=0;l1){if(s(t,e))return!0;for(var n=0;n(e.y-t.y)*(r.x-t.x)}function u(t,e,r,n){return l(t,r,n)!==l(e,r,n)&&l(t,e,r)!==l(t,e,n)}function c(t,e,r){var n=r*r;if(1===e.length)return t.distSqr(e[0])i?t.distSqr(e):i>1?t.distSqr(r):t.distSqr(r.sub(e)._mult(i)._add(e))}function f(t,e){for(var r,n,i,o=!1,a=0;ae.y!=i.y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(o=!o)}return o}function p(t,e){for(var r=!1,n=0,i=t.length-1;ne.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(r=!r)}return r}e.exports={multiPolygonIntersectsBufferedMultiPoint:n,multiPolygonIntersectsMultiPolygon:i,multiPolygonIntersectsBufferedMultiLine:o}},{}],371:[function(t,e,r){"use strict";function n(t,e){this.max=t,this.onRemove=e,this.reset()}e.exports=n,n.prototype.reset=function(){for(var t in this.data)this.onRemove(this.data[t]);return this.data={},this.order=[],this},n.prototype.add=function(t,e){if(this.has(t))this.order.splice(this.order.indexOf(t),1),this.data[t]=e,this.order.push(t);else if(this.data[t]=e,this.order.push(t),this.order.length>this.max){var r=this.get(this.order[0]);r&&this.onRemove(r)}return this},n.prototype.has=function(t){return t in this.data},n.prototype.keys=function(){return this.order},n.prototype.get=function(t){if(!this.has(t))return null;var e=this.data[t];return delete this.data[t],this.order.splice(this.order.indexOf(t),1),e},n.prototype.setMaxSize=function(t){for(this.max=t;this.order.length>this.max;){var e=this.get(this.order[0]);e&&this.onRemove(e)}return this}},{}],372:[function(t,e,r){"use strict";function n(t,e,r){if(r=r||a.ACCESS_TOKEN,!r&&a.REQUIRE_ACCESS_TOKEN)throw new Error("An API access token is required to use Mapbox GL. See https://www.mapbox.com/developers/api/#access-tokens");if(t=t.replace(/^mapbox:\/\//,a.API_URL+e),t+=-1!==t.indexOf("?")?"&access_token=":"?access_token=",a.REQUIRE_ACCESS_TOKEN){if("s"===r[0])throw new Error("Use a public access token (pk.*) with Mapbox GL JS, not a secret access token (sk.*). See https://www.mapbox.com/developers/api/#access-tokens");t+=r}return t}function i(t){return t?"?"+t:""}function o(t){return t.access_token&&"tk."===t.access_token.slice(0,3)?u.extend({},t,{access_token:a.ACCESS_TOKEN}):t}var a=t("./config"),s=t("./browser"),l=t("url"),u=t("./util");e.exports.normalizeStyleURL=function(t,e){var r=l.parse(t);return"mapbox:"!==r.protocol?t:n("mapbox:/"+r.pathname+i(r.query),"/styles/v1/",e)},e.exports.normalizeSourceURL=function(t,e){var r=l.parse(t);return"mapbox:"!==r.protocol?t:n(t+".json","/v4/",e)+"&secure"},e.exports.normalizeGlyphsURL=function(t,e){var r=l.parse(t);if("mapbox:"!==r.protocol)return t;var o=r.pathname.split("/")[1];return n("mapbox://"+o+"/{fontstack}/{range}.pbf"+i(r.query),"/fonts/v1/",e)},e.exports.normalizeSpriteURL=function(t,e,r,o){var a=l.parse(t);return"mapbox:"!==a.protocol?(a.pathname+=e+r,l.format(a)):n("mapbox:/"+a.pathname+"/sprite"+e+r+i(a.query),"/styles/v1/",o)},e.exports.normalizeTileURL=function(t,e,r){var n=l.parse(t,!0);if(!e)return t;var i=l.parse(e);if("mapbox:"!==i.protocol)return t;var a=s.supportsWebp?".webp":"$1",u=s.devicePixelRatio>=2||512===r?"@2x":"";return l.format({protocol:n.protocol,hostname:n.hostname,pathname:n.pathname.replace(/(\.(?:png|jpg)\d*)/,u+a),query:o(n.query)})}},{"./browser":359,"./config":364,"./util":375,url:472}],373:[function(t,e,r){"use strict";function n(t){function e(){f.apply(this,arguments)}function r(){p.apply(this,arguments),this.members=e.prototype.members}var n=JSON.stringify(t);if(g[n])return g[n];void 0===t.alignment&&(t.alignment=1),e.prototype=Object.create(f.prototype);var s=0,u=0,v=["Uint8"];return e.prototype.members=t.members.map(function(r){r={name:r.name,type:r.type,components:r.components||1},d(r.name.length),d(r.type in m),v.indexOf(r.type)<0&&v.push(r.type);var n=a(r.type);u=Math.max(u,n),r.offset=s=o(s,Math.max(t.alignment,n));for(var i=0;ithis.capacity){this.capacity=Math.max(t,Math.floor(this.capacity*this.RESIZE_MULTIPLIER),this.DEFAULT_CAPACITY),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}},p.prototype._refreshViews=function(){for(var t=0;tn;n++){var i=this.get(n);r.push(i)}return r}},{assert:29}],374:[function(t,e,r){"use strict";function n(t,e){return e.replace(/{([^{}]+)}/g,function(e,r){return r in t?t[r]:""})}e.exports=n},{}],375:[function(t,e,r){"use strict";var n=t("unitbezier"),i=t("../geo/coordinate");r.easeCubicInOut=function(t){if(0>=t)return 0;if(t>=1)return 1;var e=t*t,r=e*t;return 4*(.5>t?r:3*(t-e)+r-.75)},r.bezier=function(t,e,r,i){var o=new n(t,e,r,i);return function(t){return o.solve(t)}},r.ease=r.bezier(.25,.1,.25,1),r.clamp=function(t,e,r){return Math.min(r,Math.max(e,t))},r.wrap=function(t,e,r){var n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i},r.coalesce=function(){for(var t=0;t=0)return!0;return!1};var a={};r.warnOnce=function(t){a[t]||("undefined"!=typeof console&&console.warn(t),a[t]=!0)}},{"../geo/coordinate":271,unitbezier:471}],376:[function(t,e,r){"use strict";function n(t,e,r,n){this._vectorTileFeature=t,t._z=e,t._x=r,t._y=n,this.properties=t.properties,null!=t.id&&(this.id=t.id)}e.exports=n,n.prototype={type:"Feature",get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry},set geometry(t){this._geometry=t},toJSON:function(){var t={};for(var e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&"toJSON"!==e&&(t[e]=this[e]);return t}}},{}],377:[function(t,e,r){e.exports={_args:[[{name:"mapbox-gl",raw:"mapbox-gl@^0.22.0",rawSpec:"^0.22.0",scope:null,spec:">=0.22.0 <0.23.0",type:"range"},"C:\\DEV\\plotly.js"]],_from:"mapbox-gl@>=0.22.0 <0.23.0",_id:"mapbox-gl@0.22.1",_inCache:!0,_installable:!0,_location:"/mapbox-gl",_nodeVersion:"4.4.5",_npmOperationalInternal:{host:"packages-12-west.internal.npmjs.com",tmp:"tmp/mapbox-gl-0.22.1.tgz_1471549891670_0.8762630566488951"},_npmUser:{email:"lucas@lucaswoj.com",name:"lucaswoj"},_npmVersion:"2.15.5",_phantomChildren:{},_requested:{name:"mapbox-gl",raw:"mapbox-gl@^0.22.0",rawSpec:"^0.22.0",scope:null,spec:">=0.22.0 <0.23.0",type:"range"},_requiredBy:["/"],_resolved:"https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-0.22.1.tgz",_shasum:"92a965547d4c2f24c22cbc487eeda48694cb627a",_shrinkwrap:null,_spec:"mapbox-gl@^0.22.0",_where:"C:\\DEV\\plotly.js",browser:{"./js/util/ajax.js":"./js/util/browser/ajax.js","./js/util/browser.js":"./js/util/browser/browser.js","./js/util/canvas.js":"./js/util/browser/canvas.js","./js/util/dom.js":"./js/util/browser/dom.js","./js/util/web_worker.js":"./js/util/browser/web_worker.js"},bugs:{url:"https://github.com/mapbox/mapbox-gl-js/issues"},dependencies:{csscolorparser:"^1.0.2",earcut:"^2.0.3","feature-filter":"^2.2.0","geojson-rewind":"^0.1.0","geojson-vt":"^2.4.0","gl-matrix":"^2.3.1","grid-index":"^1.0.0","mapbox-gl-function":"^1.2.1","mapbox-gl-shaders":"github:mapbox/mapbox-gl-shaders#de2ab007455aa2587c552694c68583f94c9f2747","mapbox-gl-style-spec":"github:mapbox/mapbox-gl-style-spec#83b1a3e5837d785af582efd5ed1a212f2df6a4ae","mapbox-gl-supported":"^1.2.0",pbf:"^1.3.2",pngjs:"^2.2.0","point-geometry":"^0.0.0",quickselect:"^1.0.0",request:"^2.39.0","resolve-url":"^0.2.1","shelf-pack":"^1.0.0",supercluster:"^2.0.1",unassertify:"^2.0.0",unitbezier:"^0.0.0","vector-tile":"^1.3.0","vt-pbf":"^2.0.2",webworkify:"^1.3.0","whoots-js":"^2.0.0"},description:"A WebGL interactive maps library",devDependencies:{"babel-preset-react":"^6.11.1",babelify:"^7.3.0",benchmark:"~2.1.0",browserify:"^13.0.0",clipboard:"^1.5.12","concat-stream":"1.5.1",coveralls:"^2.11.8",doctrine:"^1.2.1",documentation:"https://github.com/documentationjs/documentation/archive/bb41619c734e59ef3fbc3648610032efcfdaaace.tar.gz","documentation-theme-utils":"3.0.0",envify:"^3.4.0",eslint:"^2.5.3","eslint-config-mourner":"^2.0.0","eslint-plugin-html":"^1.5.1",gl:"^4.0.1",handlebars:"4.0.5","highlight.js":"9.3.0",istanbul:"^0.4.2","json-loader":"^0.5.4",lodash:"^4.13.1","mapbox-gl-test-suite":"github:mapbox/mapbox-gl-test-suite#7babab52fb02788ebbc38384139bf350e8e38552","memory-fs":"^0.3.0",minifyify:"^7.0.1","npm-run-all":"^3.0.0",nyc:"6.4.0",proxyquire:"^1.7.9",remark:"4.2.2","remark-html":"3.0.0",sinon:"^1.15.4", -st:"^1.2.0",tap:"^5.7.0","transform-loader":"^0.2.3","unist-util-visit":"1.1.0",vinyl:"1.1.1","vinyl-fs":"2.4.3",watchify:"^3.7.0",webpack:"^1.13.1","webworkify-webpack":"^1.1.3"},directories:{},dist:{shasum:"92a965547d4c2f24c22cbc487eeda48694cb627a",tarball:"https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-0.22.1.tgz"},engines:{node:">=4.0.0"},gitHead:"13a9015341f0602ccb55c98c53079838ad4b70b5",homepage:"https://github.com/mapbox/mapbox-gl-js#readme",license:"BSD-3-Clause",main:"js/mapbox-gl.js",maintainers:[{email:"aaronlidman@gmail.com",name:"aaronlidman"},{email:"aj.ashton@gmail.com",name:"ajashton"},{email:"ansis.brammanis@gmail.com",name:"ansis"},{email:"wb@bergwerk-gis.at",name:"bergwerkgis"},{email:"bryan@mapbox.com",name:"bhousel"},{email:"bobby@mapbox.com",name:"bsudekum"},{email:"camille@mapbox.com",name:"camilleanne"},{email:"damon@mapbox.com",name:"dnomadb"},{email:"dthompson@gmail.com",name:"dthompson"},{email:"emily@mapbox.com",name:"emilymcafee"},{email:"flippmoke@gmail.com",name:"flippmoke"},{email:"spam@freenerd.de",name:"freenerd"},{email:"carol@mapbox.com",name:"gretacb"},{email:"ian.villeda@gmail.com",name:"ian29"},{email:"ian@mapbox.com",name:"ianshward"},{email:"nicholas.ingalls@gmail.com",name:"ingalls"},{email:"john.firebaugh@gmail.com",name:"jfirebaugh"},{email:"jake@jakepruitt.com",name:"jrpruit1"},{email:"karen@mapbox.com",name:"karenzshea"},{email:"kkaefer@gmail.com",name:"kkaefer"},{email:"lauren@mapbox.com",name:"lbud"},{email:"lucas@lucaswoj.com",name:"lucaswoj"},{email:"alex@mapbox.com",name:"lxbarth"},{email:"lyzi@mapbox.com",name:"lyzidiamond"},{email:"accounts@mapbox.com",name:"mapbox-admin"},{email:"matt@mapbox.com",name:"mateov"},{email:"mcwhittemore@gmail.com",name:"mcwhittemore"},{email:"jeff@miccolis.net",name:"miccolis"},{email:"michael.patrick.morris@gmail.com",name:"mikemorris"},{email:"morgan.herlocker@gmail.com",name:"morganherlocker"},{email:"agafonkin@gmail.com",name:"mourner"},{email:"nicki@mapbox.com",name:"nickidlugash"},{email:"ryan.clark.j@gmail.com",name:"rclark"},{email:"saman@mapbox.com",name:"samanbb"},{email:"tlee@mapbox.com",name:"sbma44"},{email:"scothis@gmail.com",name:"scothis"},{email:"sean@mapbox.com",name:"sgillies"},{email:"dane@mapbox.com",name:"springmeyer"},{email:"patrick@mapbox.com",name:"themarex"},{email:"tom@macwright.org",name:"tmcw"},{email:"tristen.brown@gmail.com",name:"tristen"},{email:"will@mapbox.com",name:"willwhite"},{email:"young@mapbox.com",name:"yhahn"}],name:"mapbox-gl",optionalDependencies:{},readme:"ERROR: No README data found!",repository:{type:"git",url:"git://github.com/mapbox/mapbox-gl-js.git"},scripts:{build:"npm run build-docs # invoked by publisher when publishing docs on the mb-pages branch","build-dev":"browserify js/mapbox-gl.js --debug --standalone mapboxgl > dist/mapbox-gl-dev.js && tap --no-coverage test/build/dev.test.js","build-docs":"documentation build --github --format html -c documentation.yml --theme ./docs/_theme --output docs/api/","build-min":"browserify js/mapbox-gl.js --debug -t unassertify --plugin [minifyify --map mapbox-gl.js.map --output dist/mapbox-gl.js.map] --standalone mapboxgl > dist/mapbox-gl.js && tap --no-coverage test/build/min.test.js","build-token":"browserify debug/access-token-src.js --debug -t envify > debug/access-token.js",lint:"eslint --ignore-path .gitignore js test bench docs/_posts/examples/*.html","open-changed-examples":"git diff --name-only mb-pages HEAD -- docs/_posts/examples/*.html | awk '{print \"http://127.0.0.1:4000/mapbox-gl-js/example/\" substr($0,33,length($0)-37)}' | xargs open",start:"run-p build-token watch-dev watch-bench start-server","start-bench":"run-p build-token watch-bench start-server","start-debug":"run-p build-token watch-dev start-server","start-docs":"npm run build-min && npm run build-docs && jekyll serve -w","start-server":"st --no-cache --localhost --port 9966 --index index.html .",test:"npm run lint && tap --reporter dot test/js/*/*.js test/build/webpack.test.js","test-suite":"node test/render.test.js && node test/query.test.js","watch-bench":"node bench/download-data.js && watchify bench/index.js --plugin [minifyify --no-map] -t [babelify --presets react] -t unassertify -t envify -o bench/bench.js -v","watch-dev":"watchify js/mapbox-gl.js --debug --standalone mapboxgl -o dist/mapbox-gl-dev.js -v"},version:"0.22.1"}},{}],378:[function(t,e,r){"use strict";function n(t,e,r){for(var n=new Array(t),i=0;t>i;++i)n[i]=0,i===e&&(n[i]+=.5),i===r&&(n[i]+=.5);return n}function i(t,e){if(0===e||e===(1<=o;++o)if(e&1<=s;++s)~e&1<n;++n)r[n]=i(t,n);return r}e.exports=o;var a=t("convex-hull")},{"convex-hull":79}],379:[function(t,e,r){function n(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*a,t}function i(t,e){t[0][0]=e[0],t[0][1]=e[1],t[0][2]=e[2],t[1][0]=e[4],t[1][1]=e[5],t[1][2]=e[6],t[2][0]=e[8],t[2][1]=e[9],t[2][2]=e[10]}function o(t,e,r,n,i){t[0]=e[0]*n+r[0]*i,t[1]=e[1]*n+r[1]*i,t[2]=e[2]*n+r[2]*i}var a=t("./normalize"),s=t("gl-mat4/create"),l=t("gl-mat4/clone"),u=t("gl-mat4/determinant"),c=t("gl-mat4/invert"),h=t("gl-mat4/transpose"),f={length:t("gl-vec3/length"),normalize:t("gl-vec3/normalize"),dot:t("gl-vec3/dot"),cross:t("gl-vec3/cross")},p=s(),d=s(),m=[0,0,0,0],g=[[0,0,0],[0,0,0],[0,0,0]],v=[0,0,0];e.exports=function(t,e,r,s,y,x){if(e||(e=[0,0,0]),r||(r=[0,0,0]),s||(s=[0,0,0]),y||(y=[0,0,0,1]),x||(x=[0,0,0,1]),!a(p,t))return!1;if(l(d,p),d[3]=0,d[7]=0,d[11]=0,d[15]=1,Math.abs(u(d)<1e-8))return!1;var b=p[3],_=p[7],w=p[11],M=p[12],A=p[13],k=p[14],T=p[15];if(0!==b||0!==_||0!==w){m[0]=b,m[1]=_,m[2]=w,m[3]=T;var E=c(d,d);if(!E)return!1;h(d,d),n(y,m,d)}else y[0]=y[1]=y[2]=0,y[3]=1;if(e[0]=M,e[1]=A,e[2]=k,i(g,p),r[0]=f.length(g[0]),f.normalize(g[0],g[0]),s[0]=f.dot(g[0],g[1]),o(g[1],g[1],g[0],1,-s[0]),r[1]=f.length(g[1]),f.normalize(g[1],g[1]),s[0]/=r[1],s[1]=f.dot(g[0],g[2]),o(g[2],g[2],g[0],1,-s[1]),s[2]=f.dot(g[1],g[2]),o(g[2],g[2],g[1],1,-s[2]),r[2]=f.length(g[2]),f.normalize(g[2],g[2]),s[1]/=r[2],s[2]/=r[2],f.cross(v,g[1],g[2]),f.dot(g[0],v)<0)for(var S=0;3>S;S++)r[S]*=-1,g[S][0]*=-1,g[S][1]*=-1,g[S][2]*=-1;return x[0]=.5*Math.sqrt(Math.max(1+g[0][0]-g[1][1]-g[2][2],0)),x[1]=.5*Math.sqrt(Math.max(1-g[0][0]+g[1][1]-g[2][2],0)),x[2]=.5*Math.sqrt(Math.max(1-g[0][0]-g[1][1]+g[2][2],0)),x[3]=.5*Math.sqrt(Math.max(1+g[0][0]+g[1][1]+g[2][2],0)),g[2][1]>g[1][2]&&(x[0]=-x[0]),g[0][2]>g[2][0]&&(x[1]=-x[1]),g[1][0]>g[0][1]&&(x[2]=-x[2]),!0}},{"./normalize":380,"gl-mat4/clone":137,"gl-mat4/create":138,"gl-mat4/determinant":139,"gl-mat4/invert":143,"gl-mat4/transpose":153,"gl-vec3/cross":208,"gl-vec3/dot":209,"gl-vec3/length":210,"gl-vec3/normalize":212}],380:[function(t,e,r){e.exports=function(t,e){var r=e[15];if(0===r)return!1;for(var n=1/r,i=0;16>i;i++)t[i]=e[i]*n;return!0}},{}],381:[function(t,e,r){function n(t,e,r,n){if(0===c(e)||0===c(r))return!1;var i=u(e,f.translate,f.scale,f.skew,f.perspective,f.quaternion),o=u(r,p.translate,p.scale,p.skew,p.perspective,p.quaternion);return i&&o?(s(d.translate,f.translate,p.translate,n),s(d.skew,f.skew,p.skew,n),s(d.scale,f.scale,p.scale,n),s(d.perspective,f.perspective,p.perspective,n),h(d.quaternion,f.quaternion,p.quaternion,n),l(t,d.translate,d.scale,d.skew,d.perspective,d.quaternion),!0):!1}function i(){return{translate:o(),scale:o(1),skew:o(),perspective:a(),quaternion:a()}}function o(t){return[t||0,t||0,t||0]}function a(){return[0,0,0,1]}var s=t("gl-vec3/lerp"),l=t("mat4-recompose"),u=t("mat4-decompose"),c=t("gl-mat4/determinant"),h=t("quat-slerp"),f=i(),p=i(),d=i();e.exports=n},{"gl-mat4/determinant":139,"gl-vec3/lerp":211,"mat4-decompose":379,"mat4-recompose":382,"quat-slerp":419}],382:[function(t,e,r){var n={identity:t("gl-mat4/identity"),translate:t("gl-mat4/translate"),multiply:t("gl-mat4/multiply"),create:t("gl-mat4/create"),scale:t("gl-mat4/scale"),fromRotationTranslation:t("gl-mat4/fromRotationTranslation")},i=(n.create(),n.create());e.exports=function(t,e,r,o,a,s){return n.identity(t),n.fromRotationTranslation(t,s,e),t[3]=a[0],t[7]=a[1],t[11]=a[2],t[15]=a[3],n.identity(i),0!==o[2]&&(i[9]=o[2],n.multiply(t,t,i)),0!==o[1]&&(i[9]=0,i[8]=o[1],n.multiply(t,t,i)),0!==o[0]&&(i[8]=0,i[4]=o[0],n.multiply(t,t,i)),n.scale(t,t,r),t}},{"gl-mat4/create":138,"gl-mat4/fromRotationTranslation":141,"gl-mat4/identity":142,"gl-mat4/multiply":145,"gl-mat4/scale":151,"gl-mat4/translate":152}],383:[function(t,e,r){"use strict";function n(t){this._components=t.slice(),this._time=[0],this.prevMatrix=t.slice(),this.nextMatrix=t.slice(),this.computedMatrix=t.slice(),this.computedInverse=t.slice(),this.computedEye=[0,0,0],this.computedUp=[0,0,0],this.computedCenter=[0,0,0],this.computedRadius=[0],this._limits=[-(1/0),1/0]}function i(t){t=t||{};var e=t.matrix||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];return new n(e)}var o=t("binary-search-bounds"),a=t("mat4-interpolate"),s=t("gl-mat4/invert"),l=t("gl-mat4/rotateX"),u=t("gl-mat4/rotateY"),c=t("gl-mat4/rotateZ"),h=t("gl-mat4/lookAt"),f=t("gl-mat4/translate"),p=(t("gl-mat4/scale"),t("gl-vec3/normalize")),d=[0,0,0];e.exports=i;var m=n.prototype;m.recalcMatrix=function(t){var e=this._time,r=o.le(e,t),n=this.computedMatrix;if(!(0>r)){var i=this._components;if(r===e.length-1)for(var l=16*r,u=0;16>u;++u)n[u]=i[l++];else{for(var c=e[r+1]-e[r],l=16*r,h=this.prevMatrix,f=!0,u=0;16>u;++u)h[u]=i[l++];for(var d=this.nextMatrix,u=0;16>u;++u)d[u]=i[l++],f=f&&h[u]===d[u];if(1e-6>c||f)for(var u=0;16>u;++u)n[u]=h[u];else a(n,h,d,(t-e[r])/c)}var m=this.computedUp;m[0]=n[1],m[1]=n[5],m[2]=n[6],p(m,m);var g=this.computedInverse;s(g,n);var v=this.computedEye,y=g[15];v[0]=g[12]/y,v[1]=g[13]/y,v[2]=g[14]/y;for(var x=this.computedCenter,b=Math.exp(this.computedRadius[0]),u=0;3>u;++u)x[u]=v[u]-n[2+4*u]*b}},m.idle=function(t){if(!(tn;++n)e.push(e[r++]);this._time.push(t)}},m.flush=function(t){var e=o.gt(this._time,t)-2;0>e||(this._time.slice(0,e),this._components.slice(0,16*e))},m.lastT=function(){return this._time[this._time.length-1]},m.lookAt=function(t,e,r,n){this.recalcMatrix(t),e=e||this.computedEye,r=r||d,n=n||this.computedUp,this.setMatrix(t,h(this.computedMatrix,e,r,n));for(var i=0,o=0;3>o;++o)i+=Math.pow(r[o]-e[o],2);i=Math.log(Math.sqrt(i)),this.computedRadius[0]=i},m.rotate=function(t,e,r,n){this.recalcMatrix(t);var i=this.computedInverse;e&&u(i,i,e),r&&l(i,i,r),n&&c(i,i,n),this.setMatrix(t,s(this.computedMatrix,i))};var g=[0,0,0];m.pan=function(t,e,r,n){g[0]=-(e||0),g[1]=-(r||0),g[2]=-(n||0),this.recalcMatrix(t);var i=this.computedInverse;f(i,i,g),this.setMatrix(t,s(i,i))},m.translate=function(t,e,r,n){g[0]=e||0,g[1]=r||0,g[2]=n||0,this.recalcMatrix(t);var i=this.computedMatrix;f(i,i,g),this.setMatrix(t,i)},m.setMatrix=function(t,e){if(!(tr;++r)this._components.push(e[r])}},m.setDistance=function(t,e){this.computedRadius[0]=e},m.setDistanceLimits=function(t,e){var r=this._limits;r[0]=t,r[1]=e},m.getDistanceLimits=function(t){var e=this._limits;return t?(t[0]=e[0],t[1]=e[1],t):e}},{"binary-search-bounds":49,"gl-mat4/invert":143,"gl-mat4/lookAt":144,"gl-mat4/rotateX":148,"gl-mat4/rotateY":149,"gl-mat4/rotateZ":150,"gl-mat4/scale":151,"gl-mat4/translate":152,"gl-vec3/normalize":212,"mat4-interpolate":381}],384:[function(t,e,r){"use strict";function n(t){var e=t.length;if(3>e){for(var r=new Array(e),n=0;e>n;++n)r[n]=n;return 2===e&&t[0][0]===t[1][0]&&t[0][1]===t[1][1]?[0]:r}for(var o=new Array(e),n=0;e>n;++n)o[n]=n;o.sort(function(e,r){var n=t[e][0]-t[r][0];return n?n:t[e][1]-t[r][1]});for(var a=[o[0],o[1]],s=[o[0],o[1]],n=2;e>n;++n){for(var l=o[n],u=t[l],c=a.length;c>1&&i(t[a[c-2]],t[a[c-1]],u)<=0;)c-=1,a.pop();for(a.push(l),c=s.length;c>1&&i(t[s[c-2]],t[s[c-1]],u)>=0;)c-=1,s.pop();s.push(l)}for(var r=new Array(s.length+a.length-2),h=0,n=0,f=a.length;f>n;++n)r[h++]=a[n];for(var p=s.length-2;p>0;--p)r[h++]=s[p];return r}e.exports=n;var i=t("robust-orientation")[3]},{"robust-orientation":437}],385:[function(t,e,r){"use strict";function n(t,e){function r(t){var e=!1;return"altKey"in t&&(e=e||t.altKey!==m.alt,m.alt=!!t.altKey),"shiftKey"in t&&(e=e||t.shiftKey!==m.shift,m.shift=!!t.shiftKey),"ctrlKey"in t&&(e=e||t.ctrlKey!==m.control,m.control=!!t.ctrlKey),"metaKey"in t&&(e=e||t.metaKey!==m.meta,m.meta=!!t.metaKey),e}function n(t,n){var o=i.x(n),a=i.y(n);"buttons"in n&&(t=0|n.buttons),(t!==f||o!==p||a!==d||r(n))&&(f=0|t,p=o||0,d=a||0,e&&e(f,p,d,m))}function o(t){n(0,t)}function a(){(f||p||d||m.shift||m.alt||m.meta||m.control)&&(p=d=0,f=0,m.shift=m.alt=m.control=m.meta=!1,e&&e(0,0,0,m))}function s(t){r(t)&&e&&e(f,p,d,m)}function l(t){0===i.buttons(t)?n(0,t):n(f,t)}function u(t){n(f|i.buttons(t),t)}function c(t){n(f&~i.buttons(t),t)}function h(){g||(g=!0,t.addEventListener("mousemove",l),t.addEventListener("mousedown",u),t.addEventListener("mouseup",c),t.addEventListener("mouseleave",o),t.addEventListener("mouseenter",o),t.addEventListener("mouseout",o),t.addEventListener("mouseover",o),t.addEventListener("blur",a),t.addEventListener("keyup",s),t.addEventListener("keydown",s),t.addEventListener("keypress",s),t!==window&&(window.addEventListener("blur",a),window.addEventListener("keyup",s),window.addEventListener("keydown",s),window.addEventListener("keypress",s)))}e||(e=t,t=window);var f=0,p=0,d=0,m={shift:!1,alt:!1,control:!1,meta:!1},g=!1;h();var v={element:t};return Object.defineProperties(v,{enabled:{get:function(){return g},set:function(t){t&&h()},enumerable:!0},buttons:{get:function(){return f},enumerable:!0},x:{get:function(){return p},enumerable:!0},y:{get:function(){return d},enumerable:!0},mods:{get:function(){return m},enumerable:!0}}),v}e.exports=n;var i=t("mouse-event")},{"mouse-event":386}],386:[function(t,e,r){"use strict";function n(t){if("object"==typeof t){if("buttons"in t)return t.buttons;if("which"in t){var e=t.which;if(2===e)return 4;if(3===e)return 2;if(e>0)return 1<=0)return 1<i;++i)e&1<e;++e)F.push(c(e),"+=",p(e,b[t]),";");F.push("}")}function I(t){for(var e=t-1;e>=0;--e)L(e,0);for(var r=[],e=0;D>e;++e)S[e]?r.push(i(e)+".get("+c(e)+")"):r.push(i(e)+"["+c(e)+"]");for(var e=0;x>e;++e)r.push(u(e));F.push(M,"[",T,"++]=phase(",r.join(),");");for(var e=0;t>e;++e)z(e);for(var n=0;D>n;++n)F.push(c(n),"+=",p(n,b[t]),";")}function P(t){for(var e=0;D>e;++e)S[e]?F.push(o(e,0),"=",i(e),".get(",c(e),");"):F.push(o(e,0),"=",i(e),"[",c(e),"];");for(var r=[],e=0;D>e;++e)r.push(o(e,0));for(var e=0;x>e;++e)r.push(u(e));F.push(d(0),"=",M,"[",T,"]=phase(",r.join(),");");for(var n=1;1<n;++n)F.push(d(n),"=",M,"[",T,"+",g(n),"];");for(var a=[],n=1;1<n;++n)a.push("("+d(0)+"!=="+d(n)+")");F.push("if(",a.join("||"),"){");for(var s=[],e=0;O>e;++e)s.push(f(e));for(var e=0;D>e;++e){s.push(o(e,0));for(var n=1;1<n;++n)S[e]?F.push(o(e,n),"=",i(e),".get(",c(e),"+",h(e,n),");"):F.push(o(e,n),"=",i(e),"[",c(e),"+",h(e,n),"];"),s.push(o(e,n))}for(var e=0;1<e;++e)s.push(d(e));for(var e=0;x>e;++e)s.push(u(e));F.push("vertex(",s.join(),");",v(0),"=",w,"[",T,"]=",A,"++;");for(var l=(1<n;++n)if(0===(t&~(1<0;_=_-1&m)b.push(w+"["+T+"+"+g(_)+"]");b.push(v(0));for(var _=0;D>_;++_)1&n?b.push(o(_,l),o(_,m)):b.push(o(_,m),o(_,l));1&n?b.push(p,y):b.push(y,p);for(var _=0;x>_;++_)b.push(u(_));F.push("if(",p,"!==",y,"){","face(",b.join(),")}")}F.push("}",T,"+=1;")}function C(){for(var t=1;1<t;++t)F.push(E,"=",g(t),";",g(t),"=",m(t),";",m(t),"=",E,";")}function R(t,e){if(0>t)return void P(e);I(t),F.push("if(",a(b[t]),">0){",f(b[t]),"=1;"),R(t-1,e|1<r;++r)F.push(c(r),"+=",p(r,b[t]),";");t===O-1&&(F.push(T,"=0;"),C()),L(t,2),R(t-1,e),t===O-1&&(F.push("if(",f(b[O-1]),"&1){",T,"=0;}"),C()),z(t),F.push("}")}var D=S.length,O=b.length;if(2>O)throw new Error("ndarray-extract-contour: Dimension must be at least 2");for(var j="extractContour"+b.join("_"),F=[],N=[],B=[],U=0;D>U;++U)B.push(n(U));for(var U=0;x>U;++U)B.push(u(U));for(var U=0;O>U;++U)N.push(a(U)+"="+n(0)+".shape["+U+"]|0");for(var U=0;D>U;++U){N.push(i(U)+"="+n(U)+".data",l(U)+"="+n(U)+".offset|0");for(var V=0;O>V;++V)N.push(s(U,V)+"="+n(U)+".stride["+V+"]|0")}for(var U=0;D>U;++U){N.push(c(U)+"="+l(U)),N.push(o(U,0));for(var V=1;1<V;++V){for(var q=[],G=0;O>G;++G)V&1<U;++U)for(var V=0;O>V;++V){var H=[s(U,b[V])];V>0&&H.push(s(U,b[V-1])+"*"+a(b[V-1])),N.push(p(U,b[V])+"=("+H.join("-")+")|0")}for(var U=0;O>U;++U)N.push(f(U)+"=0");N.push(A+"=0");for(var X=["2"],U=O-2;U>=0;--U)X.push(a(b[U]));N.push(k+"=("+X.join("*")+")|0",M+"=mallocUint32("+k+")",w+"=mallocUint32("+k+")",T+"=0"),N.push(d(0)+"=0");for(var V=1;1<V;++V){for(var Y=[],W=[],G=0;O>G;++G)V&1<n&&e("Must have at least one array argument");var i=t.scalarArguments||0;0>i&&e("Scalar arg count must be > 0"),"function"!=typeof t.vertex&&e("Must specify vertex creation function"),"function"!=typeof t.cell&&e("Must specify cell creation function"),"function"!=typeof t.phase&&e("Must specify phase function");for(var o=t.getters||[],a=new Array(n),s=0;n>s;++s)o.indexOf(s)>=0?a[s]=!0:a[s]=!1;return x(t.vertex,t.cell,t.phase,i,r,a)}var _=t("typedarray-pool");e.exports=b;var w="V",M="P",A="N",k="Q",T="X",E="T"},{"typedarray-pool":468}],389:[function(t,e,r){"use strict";var n=t("cwise/lib/wrapper")({args:["index","array","scalar"],pre:{body:"{}",args:[],thisVars:[],localVars:[]},body:{body:"{_inline_1_arg1_=_inline_1_arg2_.apply(void 0,_inline_1_arg0_)}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_1_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:[],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"cwise",blockSize:64});e.exports=function(t,e){return n(t,e),t}},{"cwise/lib/wrapper":89}],390:[function(t,e,r){"use strict";function n(t){if(t in l)return l[t];for(var e=[],r=0;t>r;++r)e.push("out",r,"s=0.5*(inp",r,"l-inp",r,"r);");for(var n=["array"],i=["junk"],r=0;t>r;++r){n.push("array"),i.push("out"+r+"s");var o=a(t);o[r]=-1,n.push({array:0,offset:o.slice()}),o[r]=1,n.push({array:0,offset:o.slice()}),i.push("inp"+r+"l","inp"+r+"r")}return l[t]=s({args:n,pre:c,post:c,body:{body:e.join(""),args:i.map(function(t){return{name:t,lvalue:0===t.indexOf("out"),rvalue:0===t.indexOf("inp"),count:"junk"!==t|0}}),thisVars:[],localVars:[]},funcName:"fdTemplate"+t})}function i(t){function e(e){for(var r=o-e.length,n=[],i=[],s=[],l=0;o>l;++l)e.indexOf(l+1)>=0?s.push("0"):e.indexOf(-(l+1))>=0?s.push("s["+l+"]-1"):(s.push("-1"),n.push("1"),i.push("s["+l+"]-2"));var u=".lo("+n.join()+").hi("+i.join()+")";if(0===n.length&&(u=""),r>0){a.push("if(1");for(var l=0;o>l;++l)e.indexOf(l+1)>=0||e.indexOf(-(l+1))>=0||a.push("&&s[",l,"]>2");a.push("){grad",r,"(src.pick(",s.join(),")",u);for(var l=0;o>l;++l)e.indexOf(l+1)>=0||e.indexOf(-(l+1))>=0||a.push(",dst.pick(",s.join(),",",l,")",u);a.push(");")}for(var l=0;l1){dst.set(",s.join(),",",c,",0.5*(src.get(",f.join(),")-src.get(",p.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):a.push("if(s[",c,"]>1){diff(",h,",src.pick(",f.join(),")",u,",src.pick(",p.join(),")",u,");}else{zero(",h,");};");break;case"mirror":0===r?a.push("dst.set(",s.join(),",",c,",0);"):a.push("zero(",h,");");break;case"wrap":var d=s.slice(),m=s.slice();e[l]<0?(d[c]="s["+c+"]-2",m[c]="0"):(d[c]="s["+c+"]-1",m[c]="1"),0===r?a.push("if(s[",c,"]>2){dst.set(",s.join(),",",c,",0.5*(src.get(",d.join(),")-src.get(",m.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):a.push("if(s[",c,"]>2){diff(",h,",src.pick(",d.join(),")",u,",src.pick(",m.join(),")",u,");}else{zero(",h,");};");break;default:throw new Error("ndarray-gradient: Invalid boundary condition")}}r>0&&a.push("};")}var r=t.join(),i=u[r];if(i)return i;for(var o=t.length,a=["function gradient(dst,src){var s=src.shape.slice();"],s=0;1<s;++s){for(var c=[],p=0;o>p;++p)s&1<=s;++s)g.push("grad"+s),v.push(n(s));g.push(a.join(""));var y=Function.apply(void 0,g),i=y.apply(void 0,v);return l[r]=i,i}function o(t,e,r){if(Array.isArray(r)){if(r.length!==e.dimension)throw new Error("ndarray-gradient: invalid boundary conditions")}else r="string"==typeof r?a(e.dimension,r):a(e.dimension,"clamp");if(t.dimension!==e.dimension+1)throw new Error("ndarray-gradient: output dimension must be +1 input dimension");if(t.shape[e.dimension]!==e.dimension)throw new Error("ndarray-gradient: output shape must match input shape");for(var n=0;nr;++r){t[r]=a[(n+1)*n+r];for(var i=0;n>i;++i)t[r]+=a[(n+1)*i+r]*e[i]}for(var o=a[(n+1)*(n+1)-1],i=0;n>i;++i)o+=a[(n+1)*i+n]*e[i];for(var s=1/o,r=0;n>r;++r)t[r]*=s;return t}),t}var i=t("ndarray-warp"),o=t("gl-matrix-invert");e.exports=n},{"gl-matrix-invert":154,"ndarray-warp":398}],392:[function(t,e,r){"use strict";function n(t,e){var r=Math.floor(e),n=e-r,i=r>=0&&r=0&&r+1=0&&n=0&&n+1=0&&s=0&&s+1=0&&i=0&&i+1=0&&l=0&&l+1=0&&f=0&&f+1e;++e)r=+arguments[e+1],i[e]=Math.floor(r),o[e]=r-i[e],a[e]=0<=i[e]&&i[e]e;++e){for(u=1,c=t.offset,l=0;n>l;++l)if(e&1<>",rrshift:">>>"};!function(){for(var t in l){var e=l[t];r[t]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a"+e+"=b"},rvalue:!0,funcName:t+"eq"}),r[t+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a"+e+"=s"},rvalue:!0,funcName:t+"seq"})}}();var u={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var t in u){var e=u[t];r[t]=o({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t}),r[t+"eq"]=o({args:["array"],body:{args:["a"],body:"a="+e+"a"},rvalue:!0,count:2,funcName:t+"eq"})}}();var c={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};!function(){for(var t in c){var e=c[t];r[t]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:!0,count:2,funcName:t+"eq"}),r[t+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+e+"s"},rvalue:!0,count:2,funcName:t+"seq"})}}();var h=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];!function(){for(var t=0;tthis_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),r.norm1=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:3}],body:"this_s+=a<0?-a:a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm1"}),r.sup=a({args:["array"],pre:{body:"this_h=-Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),r.inf=a({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),r.random=o({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),r.assign=o({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),r.assigns=o({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),r.equals=a({args:["array","array"],pre:s,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":86}],394:[function(t,e,r){"use strict";var n=t("ndarray"),i=t("./doConvert.js");e.exports=function(t,e){for(var r=[],o=t,a=1;o instanceof Array;)r.push(o.length),a*=o.length,o=o[0];return 0===r.length?n():(e||(e=n(new Float64Array(a),r)),i(e,t),e)}},{"./doConvert.js":395,ndarray:399}],395:[function(t,e,r){e.exports=t("cwise-compiler")({args:["array","scalar","index"],pre:{body:"{}",args:[],thisVars:[],localVars:[]},body:{body:"{\nvar _inline_1_v=_inline_1_arg1_,_inline_1_i\nfor(_inline_1_i=0;_inline_1_i<_inline_1_arg2_.length-1;++_inline_1_i) {\n_inline_1_v=_inline_1_v[_inline_1_arg2_[_inline_1_i]]\n}\n_inline_1_arg0_=_inline_1_v[_inline_1_arg2_[_inline_1_arg2_.length-1]]\n}",args:[{name:"_inline_1_arg0_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg2_",lvalue:!1,rvalue:!0,count:4}],thisVars:[],localVars:["_inline_1_i","_inline_1_v"]},post:{body:"{}",args:[],thisVars:[],localVars:[]},funcName:"convert",blockSize:64})},{"cwise-compiler":86}],396:[function(t,e,r){"use strict";function n(t){switch(t){case"uint8":return[l.mallocUint8,l.freeUint8];case"uint16":return[l.mallocUint16,l.freeUint16];case"uint32":return[l.mallocUint32,l.freeUint32];case"int8":return[l.mallocInt8,l.freeInt8];case"int16":return[l.mallocInt16,l.freeInt16];case"int32":return[l.mallocInt32,l.freeInt32];case"float32":return[l.mallocFloat,l.freeFloat];case"float64":return[l.mallocDouble,l.freeDouble];default:return null}}function i(t){for(var e=[],r=0;t>r;++r)e.push("s"+r);for(var r=0;t>r;++r)e.push("n"+r);for(var r=1;t>r;++r)e.push("d"+r);for(var r=1;t>r;++r)e.push("e"+r);for(var r=1;t>r;++r)e.push("f"+r);return e}function o(t,e){function r(t){return"generic"===e?["data.get(",t,")"].join(""):["data[",t,"]"].join("")}function o(t,r){return"generic"===e?["data.set(",t,",",r,")"].join(""):["data[",t,"]=",r].join("")}var a=["'use strict'"],s=["ndarrayInsertionSort",t.join("d"),e].join(""),l=["left","right","data","offset"].concat(i(t.length)),u=n(e),c=["i,j,cptr,ptr=left*s0+offset"];if(t.length>1){for(var h=[],f=1;f1){a.push("dptr=0;sptr=ptr");for(var f=t.length-1;f>=0;--f){var p=t[f];0!==p&&a.push(["for(i",p,"=0;i",p,"left){","dptr=0","sptr=cptr-s0");for(var f=1;fb){break __l}"].join(""));for(var f=t.length-1;f>=1;--f)a.push("sptr+=e"+f,"dptr+=f"+f,"}");a.push("dptr=cptr;sptr=cptr-s0");for(var f=t.length-1;f>=0;--f){var p=t[f];0!==p&&a.push(["for(i",p,"=0;i",p,"=0;--f){var p=t[f];0!==p&&a.push(["for(i",p,"=0;i",p,"left)&&("+r("cptr-s0")+">scratch)){",o("cptr",r("cptr-s0")),"cptr-=s0","}",o("cptr","scratch"));if(a.push("}"),t.length>1&&u&&a.push("free(scratch)"),a.push("} return "+s),u){var d=new Function("malloc","free",a.join("\n"));return d(u[0],u[1])}var d=new Function(a.join("\n"));return d()}function a(t,e,r){function o(t){return["(offset+",t,"*s0)"].join("")}function a(t){return"generic"===e?["data.get(",t,")"].join(""):["data[",t,"]"].join("")}function s(t,r){return"generic"===e?["data.set(",t,",",r,")"].join(""):["data[",t,"]=",r].join("")}function l(e,r,n){if(1===e.length)_.push("ptr0="+o(e[0]));else for(var i=0;i=0;--i){var a=t[i];0!==a&&_.push(["for(i",a,"=0;i",a,"1)for(var i=0;i1?_.push("ptr_shift+=d"+a):_.push("ptr0+=d"+a),_.push("}"))}}function c(e,r,n,i){if(1===r.length)_.push("ptr0="+o(r[0]));else{for(var a=0;a1)for(var a=0;a=1;--a)n&&_.push("pivot_ptr+=f"+a),r.length>1?_.push("ptr_shift+=e"+a):_.push("ptr0+=e"+a),_.push("}")}function h(){t.length>1&&A&&_.push("free(pivot1)","free(pivot2)")}function f(e,r){var n="el"+e,i="el"+r;if(t.length>1){var s="__l"+ ++k;c(s,[n,i],!1,["comp=",a("ptr0"),"-",a("ptr1"),"\n","if(comp>0){tmp0=",n,";",n,"=",i,";",i,"=tmp0;break ",s,"}\n","if(comp<0){break ",s,"}"].join(""))}else _.push(["if(",a(o(n)),">",a(o(i)),"){tmp0=",n,";",n,"=",i,";",i,"=tmp0}"].join(""))}function p(e,r){t.length>1?l([e,r],!1,s("ptr0",a("ptr1"))):_.push(s(o(e),a(o(r))))}function d(e,r,n){if(t.length>1){var i="__l"+ ++k;c(i,[r],!0,[e,"=",a("ptr0"),"-pivot",n,"[pivot_ptr]\n","if(",e,"!==0){break ",i,"}"].join(""))}else _.push([e,"=",a(o(r)),"-pivot",n].join(""))}function m(e,r){t.length>1?l([e,r],!1,["tmp=",a("ptr0"),"\n",s("ptr0",a("ptr1")),"\n",s("ptr1","tmp")].join("")):_.push(["ptr0=",o(e),"\n","ptr1=",o(r),"\n","tmp=",a("ptr0"),"\n",s("ptr0",a("ptr1")),"\n",s("ptr1","tmp")].join(""))}function g(e,r,n){t.length>1?(l([e,r,n],!1,["tmp=",a("ptr0"),"\n",s("ptr0",a("ptr1")),"\n",s("ptr1",a("ptr2")),"\n",s("ptr2","tmp")].join("")),_.push("++"+r,"--"+n)):_.push(["ptr0=",o(e),"\n","ptr1=",o(r),"\n","ptr2=",o(n),"\n","++",r,"\n","--",n,"\n","tmp=",a("ptr0"),"\n",s("ptr0",a("ptr1")),"\n",s("ptr1",a("ptr2")),"\n",s("ptr2","tmp")].join(""))}function v(t,e){m(t,e),_.push("--"+e)}function y(e,r,n){t.length>1?l([e,r],!0,[s("ptr0",a("ptr1")),"\n",s("ptr1",["pivot",n,"[pivot_ptr]"].join(""))].join("")):_.push(s(o(e),a(o(r))),s(o(r),"pivot"+n))}function x(e,r){_.push(["if((",r,"-",e,")<=",u,"){\n","insertionSort(",e,",",r,",data,offset,",i(t.length).join(","),")\n","}else{\n",w,"(",e,",",r,",data,offset,",i(t.length).join(","),")\n","}"].join(""))}function b(e,r,n){t.length>1?(_.push(["__l",++k,":while(true){"].join("")),l([e],!0,["if(",a("ptr0"),"!==pivot",r,"[pivot_ptr]){break __l",k,"}"].join("")),_.push(n,"}")):_.push(["while(",a(o(e)),"===pivot",r,"){",n,"}"].join(""))}var _=["'use strict'"],w=["ndarrayQuickSort",t.join("d"),e].join(""),M=["left","right","data","offset"].concat(i(t.length)),A=n(e),k=0;_.push(["function ",w,"(",M.join(","),"){"].join(""));var T=["sixth=((right-left+1)/6)|0","index1=left+sixth","index5=right-sixth","index3=(left+right)>>1","index2=index3-sixth","index4=index3+sixth","el1=index1","el2=index2","el3=index3","el4=index4","el5=index5","less=left+1","great=right-1","pivots_are_equal=true","tmp","tmp0","x","y","z","k","ptr0","ptr1","ptr2","comp_pivot1=0","comp_pivot2=0","comp=0"];if(t.length>1){for(var E=[],S=1;SS;++S)T.push("b_ptr"+S);T.push("ptr3","ptr4","ptr5","ptr6","ptr7","pivot_ptr","ptr_shift","elementSize="+E.join("*")),A?T.push("pivot1=malloc(elementSize)","pivot2=malloc(elementSize)"):T.push("pivot1=new Array(elementSize),pivot2=new Array(elementSize)")}else T.push("pivot1","pivot2");if(_.push("var "+T.join(",")),f(1,2),f(4,5),f(1,3),f(2,3),f(1,4),f(3,4),f(2,5),f(2,3),f(4,5),t.length>1?l(["el1","el2","el3","el4","el5","index1","index3","index5"],!0,["pivot1[pivot_ptr]=",a("ptr1"),"\n","pivot2[pivot_ptr]=",a("ptr3"),"\n","pivots_are_equal=pivots_are_equal&&(pivot1[pivot_ptr]===pivot2[pivot_ptr])\n","x=",a("ptr0"),"\n","y=",a("ptr2"),"\n","z=",a("ptr4"),"\n",s("ptr5","x"),"\n",s("ptr6","y"),"\n",s("ptr7","z")].join("")):_.push(["pivot1=",a(o("el2")),"\n","pivot2=",a(o("el4")),"\n","pivots_are_equal=pivot1===pivot2\n","x=",a(o("el1")),"\n","y=",a(o("el3")),"\n","z=",a(o("el5")),"\n",s(o("index1"),"x"),"\n",s(o("index3"),"y"),"\n",s(o("index5"),"z")].join("")),p("index2","left"),p("index4","right"),_.push("if(pivots_are_equal){"),_.push("for(k=less;k<=great;++k){"),d("comp","k",1),_.push("if(comp===0){continue}"),_.push("if(comp<0){"),_.push("if(k!==less){"),m("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),_.push("while(true){"),d("comp","great",1),_.push("if(comp>0){"),_.push("great--"),_.push("}else if(comp<0){"),g("k","less","great"),_.push("break"),_.push("}else{"),v("k","great"),_.push("break"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}else{"),_.push("for(k=less;k<=great;++k){"),d("comp_pivot1","k",1),_.push("if(comp_pivot1<0){"),_.push("if(k!==less){"),m("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),d("comp_pivot2","k",2),_.push("if(comp_pivot2>0){"),_.push("while(true){"),d("comp","great",2),_.push("if(comp>0){"),_.push("if(--greatindex5){"),b("less",1,"++less"),b("great",2,"--great"),_.push("for(k=less;k<=great;++k){"),d("comp_pivot1","k",1),_.push("if(comp_pivot1===0){"),_.push("if(k!==less){"),m("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),d("comp_pivot2","k",2),_.push("if(comp_pivot2===0){"),_.push("while(true){"),d("comp","great",2),_.push("if(comp===0){"),_.push("if(--great1&&A){var L=new Function("insertionSort","malloc","free",_.join("\n"));return L(r,A[0],A[1])}var L=new Function("insertionSort",_.join("\n"));return L(r)}function s(t,e){var r=["'use strict'"],n=["ndarraySortWrapper",t.join("d"),e].join(""),s=["array"];r.push(["function ",n,"(",s.join(","),"){"].join(""));for(var l=["data=array.data,offset=array.offset|0,shape=array.shape,stride=array.stride"],c=0;c0?l.push(["d",g,"=s",g,"-d",d,"*n",d].join("")):l.push(["d",g,"=s",g].join("")),d=g);var p=t.length-1-c;0!==p&&(m>0?l.push(["e",p,"=s",p,"-e",m,"*n",m,",f",p,"=",h[p],"-f",m,"*n",m].join("")):l.push(["e",p,"=s",p,",f",p,"=",h[p]].join("")),m=p)}r.push("var "+l.join(","));var v=["0","n0-1","data","offset"].concat(i(t.length));r.push(["if(n0<=",u,"){","insertionSort(",v.join(","),")}else{","quickSort(",v.join(","),")}"].join("")),r.push("}return "+n);var y=new Function("insertionSort","quickSort",r.join("\n")),x=o(t,e),b=a(t,e,x);return y(x,b)}var l=t("typedarray-pool"),u=32;e.exports=s},{"typedarray-pool":468}],397:[function(t,e,r){"use strict";function n(t){var e=t.order,r=t.dtype,n=[e,r],a=n.join(":"),s=o[a];return s||(o[a]=s=i(e,r)),s(t),t}var i=t("./lib/compile_sort.js"),o={};e.exports=n},{"./lib/compile_sort.js":396}],398:[function(t,e,r){"use strict";var n=t("ndarray-linear-interpolate"),i=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=new Array(_inline_6_arg4_)}",args:[{name:"_inline_6_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_6_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_6_arg2_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_6_arg3_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_6_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_7_arg2_(this_warped,_inline_7_arg0_),_inline_7_arg1_=_inline_7_arg3_.apply(void 0,this_warped)}",args:[{name:"_inline_7_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_7_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_7_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_7_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_7_arg4_",lvalue:!1,rvalue:!1,count:0}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warpND",blockSize:64}),o=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=[0]}",args:[],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_10_arg2_(this_warped,_inline_10_arg0_),_inline_10_arg1_=_inline_10_arg3_(_inline_10_arg4_,this_warped[0])}",args:[{name:"_inline_10_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_10_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_10_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_10_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_10_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warp1D",blockSize:64}),a=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=[0,0]}",args:[],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_13_arg2_(this_warped,_inline_13_arg0_),_inline_13_arg1_=_inline_13_arg3_(_inline_13_arg4_,this_warped[0],this_warped[1])}",args:[{name:"_inline_13_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_13_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_13_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_13_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_13_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warp2D",blockSize:64}),s=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=[0,0,0]}",args:[],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_16_arg2_(this_warped,_inline_16_arg0_),_inline_16_arg1_=_inline_16_arg3_(_inline_16_arg4_,this_warped[0],this_warped[1],this_warped[2])}",args:[{name:"_inline_16_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_16_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_16_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_16_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_16_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warp3D",blockSize:64});e.exports=function(t,e,r){switch(e.shape.length){case 1:o(t,r,n.d1,e);break;case 2:a(t,r,n.d2,e);break;case 3:s(t,r,n.d3,e);break;default:i(t,r,n.bind(void 0,e),e.shape.length)}return t}},{"cwise/lib/wrapper":89,"ndarray-linear-interpolate":392}],399:[function(t,e,r){function n(t,e){return t[0]-e[0]}function i(){var t,e=this.stride,r=new Array(e.length);for(t=0;te&&(r="View_Nil"+t);var n="generic"===t;if(-1===e){var o="function "+r+"(a){this.data=a;};var proto="+r+".prototype;proto.dtype='"+t+"';proto.index=function(){return -1};proto.size=0;proto.dimension=-1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function(){return new "+r+"(this.data);};proto.get=proto.set=function(){};proto.pick=function(){return null};return function construct_"+r+"(a){return new "+r+"(a);}",a=new Function(o);return a()}if(0===e){var o="function "+r+"(a,d) {this.data = a;this.offset = d};var proto="+r+".prototype;proto.dtype='"+t+"';proto.index=function(){return this.offset};proto.dimension=0;proto.size=1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function "+r+"_copy() {return new "+r+"(this.data,this.offset)};proto.pick=function "+r+"_pick(){return TrivialArray(this.data);};proto.valueOf=proto.get=function "+r+"_get(){return "+(n?"this.data.get(this.offset)":"this.data[this.offset]")+"};proto.set=function "+r+"_set(v){return "+(n?"this.data.set(this.offset,v)":"this.data[this.offset]=v")+"};return function construct_"+r+"(a,b,c,d){return new "+r+"(a,d)}",a=new Function("TrivialArray",o);return a(h[t][0])}var o=["'use strict'"],s=l(e),u=s.map(function(t){return"i"+t}),c="this.offset+"+s.map(function(t){return"this.stride["+t+"]*i"+t}).join("+"),f=s.map(function(t){return"b"+t}).join(","),p=s.map(function(t){return"c"+t}).join(",");o.push("function "+r+"(a,"+f+","+p+",d){this.data=a","this.shape=["+f+"]","this.stride=["+p+"]","this.offset=d|0}","var proto="+r+".prototype","proto.dtype='"+t+"'","proto.dimension="+e),o.push("Object.defineProperty(proto,'size',{get:function "+r+"_size(){return "+s.map(function(t){return"this.shape["+t+"]"}).join("*"),"}})"),1===e?o.push("proto.order=[0]"):(o.push("Object.defineProperty(proto,'order',{get:"),4>e?(o.push("function "+r+"_order(){"),2===e?o.push("return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===e&&o.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):o.push("ORDER})")),o.push("proto.set=function "+r+"_set("+u.join(",")+",v){"),n?o.push("return this.data.set("+c+",v)}"):o.push("return this.data["+c+"]=v}"),o.push("proto.get=function "+r+"_get("+u.join(",")+"){"),n?o.push("return this.data.get("+c+")}"):o.push("return this.data["+c+"]}"),o.push("proto.index=function "+r+"_index(",u.join(),"){return "+c+"}"),o.push("proto.hi=function "+r+"_hi("+u.join(",")+"){return new "+r+"(this.data,"+s.map(function(t){return["(typeof i",t,"!=='number'||i",t,"<0)?this.shape[",t,"]:i",t,"|0"].join("")}).join(",")+","+s.map(function(t){return"this.stride["+t+"]"}).join(",")+",this.offset)}");var d=s.map(function(t){return"a"+t+"=this.shape["+t+"]"}),m=s.map(function(t){return"c"+t+"=this.stride["+t+"]"});o.push("proto.lo=function "+r+"_lo("+u.join(",")+"){var b=this.offset,d=0,"+d.join(",")+","+m.join(","));for(var g=0;e>g;++g)o.push("if(typeof i"+g+"==='number'&&i"+g+">=0){d=i"+g+"|0;b+=c"+g+"*d;a"+g+"-=d}");o.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"c"+t}).join(",")+",b)}"),o.push("proto.step=function "+r+"_step("+u.join(",")+"){var "+s.map(function(t){return"a"+t+"=this.shape["+t+"]"}).join(",")+","+s.map(function(t){return"b"+t+"=this.stride["+t+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var g=0;e>g;++g)o.push("if(typeof i"+g+"==='number'){d=i"+g+"|0;if(d<0){c+=b"+g+"*(a"+g+"-1);a"+g+"=ceil(-a"+g+"/d)}else{a"+g+"=ceil(a"+g+"/d)}b"+g+"*=d}");o.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"b"+t}).join(",")+",c)}");for(var v=new Array(e),y=new Array(e),g=0;e>g;++g)v[g]="a[i"+g+"]",y[g]="b[i"+g+"]";o.push("proto.transpose=function "+r+"_transpose("+u+"){"+u.map(function(t,e){return t+"=("+t+"===undefined?"+e+":"+t+"|0)"}).join(";"),"var a=this.shape,b=this.stride;return new "+r+"(this.data,"+v.join(",")+","+y.join(",")+",this.offset)}"),o.push("proto.pick=function "+r+"_pick("+u+"){var a=[],b=[],c=this.offset");for(var g=0;e>g;++g)o.push("if(typeof i"+g+"==='number'&&i"+g+">=0){c=(c+this.stride["+g+"]*i"+g+")|0}else{a.push(this.shape["+g+"]);b.push(this.stride["+g+"])}");o.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),o.push("return function construct_"+r+"(data,shape,stride,offset){return new "+r+"(data,"+s.map(function(t){return"shape["+t+"]"}).join(",")+","+s.map(function(t){return"stride["+t+"]"}).join(",")+",offset)}");var a=new Function("CTOR_LIST","ORDER",o.join("\n"));return a(h[t],i)}function a(t){if(u(t))return"buffer";if(c)switch(Object.prototype.toString.call(t)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped"}return Array.isArray(t)?"array":"generic"}function s(t,e,r,n){if(void 0===t){var i=h.array[0];return i([])}"number"==typeof t&&(t=[t]),void 0===e&&(e=[t.length]);var s=e.length;if(void 0===r){r=new Array(s);for(var l=s-1,u=1;l>=0;--l)r[l]=u,u*=e[l]}if(void 0===n){n=0;for(var l=0;s>l;++l)r[l]<0&&(n-=(e[l]-1)*r[l])}for(var c=a(t),f=h[c];f.length<=s+1;)f.push(o(c,f.length-1));var i=f[s+1];return i(t,e,r,n)}var l=t("iota-array"),u=t("is-buffer"),c="undefined"!=typeof Float64Array,h={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],buffer:[],generic:[]};e.exports=s},{"iota-array":229,"is-buffer":230}],400:[function(t,e,r){"use strict";function n(t,e){if(isNaN(t)||isNaN(e))return NaN;if(t===e)return t;if(0===t)return 0>e?-o:o;var r=i.hi(t),n=i.lo(t);return e>t==t>0?n===a?(r+=1,n=0):n+=1:0===n?(n=a,r-=1):n-=1,i.pack(n,r)}var i=t("double-bits"),o=Math.pow(2,-1074),a=-1>>>0;e.exports=n},{"double-bits":92}],401:[function(t,e,r){var n=1e-6,i=1e-6;r.vertexNormals=function(t,e,r){for(var i=e.length,o=new Array(i),a=void 0===r?n:r,s=0;i>s;++s)o[s]=[0,0,0];for(var s=0;sb;++b)g[b]=p[b]-d[b],v+=g[b]*g[b],y[b]=m[b]-d[b],x+=y[b]*y[b];if(v*x>a)for(var _=o[c],w=1/Math.sqrt(v*x),b=0;3>b;++b){var M=(b+1)%3,A=(b+2)%3;_[b]+=w*(y[M]*g[A]-y[A]*g[M])}}for(var s=0;i>s;++s){for(var _=o[s],k=0,b=0;3>b;++b)k+=_[b]*_[b];if(k>a)for(var w=1/Math.sqrt(k),b=0;3>b;++b)_[b]*=w;else for(var b=0;3>b;++b)_[b]=0}return o},r.faceNormals=function(t,e,r){for(var n=t.length,o=new Array(n),a=void 0===r?i:r,s=0;n>s;++s){for(var l=t[s],u=new Array(3),c=0;3>c;++c)u[c]=e[l[c]];for(var h=new Array(3),f=new Array(3),c=0;3>c;++c)h[c]=u[1][c]-u[0][c],f[c]=u[2][c]-u[0][c];for(var p=new Array(3),d=0,c=0;3>c;++c){var m=(c+1)%3,g=(c+2)%3;p[c]=h[m]*f[g]-h[g]*f[m],d+=p[c]*p[c]}d=d>a?1/Math.sqrt(d):0;for(var c=0;3>c;++c)p[c]*=d;o[s]=p}return o}},{}],402:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a,s,l,u){var c=e+o+u;if(h>0){var h=Math.sqrt(c+1);t[0]=.5*(a-l)/h,t[1]=.5*(s-n)/h,t[2]=.5*(r-o)/h,t[3]=.5*h}else{var f=Math.max(e,o,u),h=Math.sqrt(2*f-c+1);e>=f?(t[0]=.5*h,t[1]=.5*(i+r)/h,t[2]=.5*(s+n)/h,t[3]=.5*(a-l)/h):o>=f?(t[0]=.5*(r+i)/h,t[1]=.5*h,t[2]=.5*(l+a)/h,t[3]=.5*(s-n)/h):(t[0]=.5*(n+s)/h,t[1]=.5*(a+l)/h,t[2]=.5*h,t[3]=.5*(r-i)/h)}return t}e.exports=n},{}],403:[function(t,e,r){"use strict";function n(t,e,r){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2))}function i(t,e,r,n){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2)+Math.pow(n,2))}function o(t,e){var r=e[0],n=e[1],o=e[2],a=e[3],s=i(r,n,o,a);s>1e-6?(t[0]=r/s,t[1]=n/s,t[2]=o/s,t[3]=a/s):(t[0]=t[1]=t[2]=0,t[3]=1)}function a(t,e,r){this.radius=l([r]),this.center=l(e),this.rotation=l(t),this.computedRadius=this.radius.curve(0),this.computedCenter=this.center.curve(0),this.computedRotation=this.rotation.curve(0),this.computedUp=[.1,0,0],this.computedEye=[.1,0,0],this.computedMatrix=[.1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.recalcMatrix(0)}function s(t){t=t||{};var e=t.center||[0,0,0],r=t.rotation||[0,0,0,1],n=t.radius||1;e=[].slice.call(e,0,3),r=[].slice.call(r,0,4),o(r,r);var i=new a(r,e,Math.log(n));return i.setDistanceLimits(t.zoomMin,t.zoomMax),("eye"in t||"up"in t)&&i.lookAt(0,t.eye,t.center,t.up),i}e.exports=s;var l=t("filtered-vector"),u=t("gl-mat4/lookAt"),c=t("gl-mat4/fromQuat"),h=t("gl-mat4/invert"),f=t("./lib/quatFromFrame"),p=a.prototype;p.lastT=function(){return Math.max(this.radius.lastT(),this.center.lastT(),this.rotation.lastT())},p.recalcMatrix=function(t){this.radius.curve(t),this.center.curve(t),this.rotation.curve(t);var e=this.computedRotation;o(e,e);var r=this.computedMatrix;c(r,e);var n=this.computedCenter,i=this.computedEye,a=this.computedUp,s=Math.exp(this.computedRadius[0]);i[0]=n[0]+s*r[2],i[1]=n[1]+s*r[6],i[2]=n[2]+s*r[10],a[0]=r[1],a[1]=r[5],a[2]=r[9];for(var l=0;3>l;++l){for(var u=0,h=0;3>h;++h)u+=r[l+4*h]*i[h];r[12+l]=-u}},p.getMatrix=function(t,e){this.recalcMatrix(t);var r=this.computedMatrix;if(e){for(var n=0;16>n;++n)e[n]=r[n];return e}return r},p.idle=function(t){this.center.idle(t),this.radius.idle(t),this.rotation.idle(t)},p.flush=function(t){this.center.flush(t),this.radius.flush(t),this.rotation.flush(t)},p.pan=function(t,e,r,i){e=e||0,r=r||0,i=i||0,this.recalcMatrix(t);var o=this.computedMatrix,a=o[1],s=o[5],l=o[9],u=n(a,s,l);a/=u,s/=u,l/=u;var c=o[0],h=o[4],f=o[8],p=c*a+h*s+f*l;c-=a*p,h-=s*p,f-=l*p;var d=n(c,h,f);c/=d,h/=d,f/=d;var m=o[2],g=o[6],v=o[10],y=m*a+g*s+v*l,x=m*c+g*h+v*f;m-=y*a+x*c,g-=y*s+x*h,v-=y*l+x*f;var b=n(m,g,v);m/=b,g/=b,v/=b;var _=c*e+a*r,w=h*e+s*r,M=f*e+l*r;this.center.move(t,_,w,M);var A=Math.exp(this.computedRadius[0]);A=Math.max(1e-4,A+i),this.radius.set(t,Math.log(A))},p.rotate=function(t,e,r,o){this.recalcMatrix(t),e=e||0,r=r||0;var a=this.computedMatrix,s=a[0],l=a[4],u=a[8],c=a[1],h=a[5],f=a[9],p=a[2],d=a[6],m=a[10],g=e*s+r*c,v=e*l+r*h,y=e*u+r*f,x=-(d*y-m*v),b=-(m*g-p*y),_=-(p*v-d*g),w=Math.sqrt(Math.max(0,1-Math.pow(x,2)-Math.pow(b,2)-Math.pow(_,2))),M=i(x,b,_,w);M>1e-6?(x/=M,b/=M,_/=M,w/=M):(x=b=_=0,w=1);var A=this.computedRotation,k=A[0],T=A[1],E=A[2],S=A[3],L=k*w+S*x+T*_-E*b,z=T*w+S*b+E*x-k*_,I=E*w+S*_+k*b-T*x,P=S*w-k*x-T*b-E*_;if(o){x=p,b=d,_=m;var C=Math.sin(o)/n(x,b,_);x*=C,b*=C,_*=C,w=Math.cos(e),L=L*w+P*x+z*_-I*b,z=z*w+P*b+I*x-L*_,I=I*w+P*_+L*b-z*x,P=P*w-L*x-z*b-I*_}var R=i(L,z,I,P);R>1e-6?(L/=R,z/=R,I/=R,P/=R):(L=z=I=0,P=1),this.rotation.set(t,L,z,I,P)},p.lookAt=function(t,e,r,n){this.recalcMatrix(t),r=r||this.computedCenter,e=e||this.computedEye,n=n||this.computedUp;var i=this.computedMatrix;u(i,e,r,n);var a=this.computedRotation;f(a,i[0],i[1],i[2],i[4],i[5],i[6],i[8],i[9],i[10]),o(a,a),this.rotation.set(t,a[0],a[1],a[2],a[3]);for(var s=0,l=0;3>l;++l)s+=Math.pow(r[l]-e[l],2);this.radius.set(t,.5*Math.log(Math.max(s,1e-6))),this.center.set(t,r[0],r[1],r[2])},p.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},p.setMatrix=function(t,e){var r=this.computedRotation;f(r,e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10]),o(r,r),this.rotation.set(t,r[0],r[1],r[2],r[3]);var n=this.computedMatrix;h(n,e);var i=n[15];if(Math.abs(i)>1e-6){var a=n[12]/i,s=n[13]/i,l=n[14]/i;this.recalcMatrix(t);var u=Math.exp(this.computedRadius[0]);this.center.set(t,a-n[2]*u,s-n[6]*u,l-n[10]*u),this.radius.idle(t)}else this.center.idle(t),this.radius.idle(t)},p.setDistance=function(t,e){e>0&&this.radius.set(t,Math.log(e))},p.setDistanceLimits=function(t,e){t=t>0?Math.log(t):-(1/0),e=e>0?Math.log(e):1/0,e=Math.max(e,t),this.radius.bounds[0][0]=t,this.radius.bounds[1][0]=e},p.getDistanceLimits=function(t){var e=this.radius.bounds;return t?(t[0]=Math.exp(e[0][0]),t[1]=Math.exp(e[1][0]),t):[Math.exp(e[0][0]),Math.exp(e[1][0])]},p.toJSON=function(){return this.recalcMatrix(this.lastT()),{center:this.computedCenter.slice(),rotation:this.computedRotation.slice(),distance:Math.log(this.computedRadius[0]),zoomMin:this.radius.bounds[0][0],zoomMax:this.radius.bounds[1][0]}},p.fromJSON=function(t){var e=this.lastT(),r=t.center;r&&this.center.set(e,r[0],r[1],r[2]);var n=t.rotation;n&&this.rotation.set(e,n[0],n[1],n[2],n[3]);var i=t.distance;i&&i>0&&this.radius.set(e,Math.log(i)),this.setDistanceLimits(t.zoomMin,t.zoomMax)}},{"./lib/quatFromFrame":402,"filtered-vector":101,"gl-mat4/fromQuat":140,"gl-mat4/invert":143,"gl-mat4/lookAt":144}],404:[function(t,e,r){"use strict";var n=t("repeat-string"); +st:"^1.2.0",tap:"^5.7.0","transform-loader":"^0.2.3","unist-util-visit":"1.1.0",vinyl:"1.1.1","vinyl-fs":"2.4.3",watchify:"^3.7.0",webpack:"^1.13.1","webworkify-webpack":"^1.1.3"},directories:{},dist:{shasum:"92a965547d4c2f24c22cbc487eeda48694cb627a",tarball:"https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-0.22.1.tgz"},engines:{node:">=4.0.0"},gitHead:"13a9015341f0602ccb55c98c53079838ad4b70b5",homepage:"https://github.com/mapbox/mapbox-gl-js#readme",license:"BSD-3-Clause",main:"js/mapbox-gl.js",maintainers:[{email:"aaronlidman@gmail.com",name:"aaronlidman"},{email:"aj.ashton@gmail.com",name:"ajashton"},{email:"ansis.brammanis@gmail.com",name:"ansis"},{email:"wb@bergwerk-gis.at",name:"bergwerkgis"},{email:"bryan@mapbox.com",name:"bhousel"},{email:"bobby@mapbox.com",name:"bsudekum"},{email:"camille@mapbox.com",name:"camilleanne"},{email:"damon@mapbox.com",name:"dnomadb"},{email:"dthompson@gmail.com",name:"dthompson"},{email:"emily@mapbox.com",name:"emilymcafee"},{email:"flippmoke@gmail.com",name:"flippmoke"},{email:"spam@freenerd.de",name:"freenerd"},{email:"carol@mapbox.com",name:"gretacb"},{email:"ian.villeda@gmail.com",name:"ian29"},{email:"ian@mapbox.com",name:"ianshward"},{email:"nicholas.ingalls@gmail.com",name:"ingalls"},{email:"john.firebaugh@gmail.com",name:"jfirebaugh"},{email:"jake@jakepruitt.com",name:"jrpruit1"},{email:"karen@mapbox.com",name:"karenzshea"},{email:"kkaefer@gmail.com",name:"kkaefer"},{email:"lauren@mapbox.com",name:"lbud"},{email:"lucas@lucaswoj.com",name:"lucaswoj"},{email:"alex@mapbox.com",name:"lxbarth"},{email:"lyzi@mapbox.com",name:"lyzidiamond"},{email:"accounts@mapbox.com",name:"mapbox-admin"},{email:"matt@mapbox.com",name:"mateov"},{email:"mcwhittemore@gmail.com",name:"mcwhittemore"},{email:"jeff@miccolis.net",name:"miccolis"},{email:"michael.patrick.morris@gmail.com",name:"mikemorris"},{email:"morgan.herlocker@gmail.com",name:"morganherlocker"},{email:"agafonkin@gmail.com",name:"mourner"},{email:"nicki@mapbox.com",name:"nickidlugash"},{email:"ryan.clark.j@gmail.com",name:"rclark"},{email:"saman@mapbox.com",name:"samanbb"},{email:"tlee@mapbox.com",name:"sbma44"},{email:"scothis@gmail.com",name:"scothis"},{email:"sean@mapbox.com",name:"sgillies"},{email:"dane@mapbox.com",name:"springmeyer"},{email:"patrick@mapbox.com",name:"themarex"},{email:"tom@macwright.org",name:"tmcw"},{email:"tristen.brown@gmail.com",name:"tristen"},{email:"will@mapbox.com",name:"willwhite"},{email:"young@mapbox.com",name:"yhahn"}],name:"mapbox-gl",optionalDependencies:{},readme:"ERROR: No README data found!",repository:{type:"git",url:"git://github.com/mapbox/mapbox-gl-js.git"},scripts:{build:"npm run build-docs # invoked by publisher when publishing docs on the mb-pages branch","build-dev":"browserify js/mapbox-gl.js --debug --standalone mapboxgl > dist/mapbox-gl-dev.js && tap --no-coverage test/build/dev.test.js","build-docs":"documentation build --github --format html -c documentation.yml --theme ./docs/_theme --output docs/api/","build-min":"browserify js/mapbox-gl.js --debug -t unassertify --plugin [minifyify --map mapbox-gl.js.map --output dist/mapbox-gl.js.map] --standalone mapboxgl > dist/mapbox-gl.js && tap --no-coverage test/build/min.test.js","build-token":"browserify debug/access-token-src.js --debug -t envify > debug/access-token.js",lint:"eslint --ignore-path .gitignore js test bench docs/_posts/examples/*.html","open-changed-examples":"git diff --name-only mb-pages HEAD -- docs/_posts/examples/*.html | awk '{print \"http://127.0.0.1:4000/mapbox-gl-js/example/\" substr($0,33,length($0)-37)}' | xargs open",start:"run-p build-token watch-dev watch-bench start-server","start-bench":"run-p build-token watch-bench start-server","start-debug":"run-p build-token watch-dev start-server","start-docs":"npm run build-min && npm run build-docs && jekyll serve -w","start-server":"st --no-cache --localhost --port 9966 --index index.html .",test:"npm run lint && tap --reporter dot test/js/*/*.js test/build/webpack.test.js","test-suite":"node test/render.test.js && node test/query.test.js","watch-bench":"node bench/download-data.js && watchify bench/index.js --plugin [minifyify --no-map] -t [babelify --presets react] -t unassertify -t envify -o bench/bench.js -v","watch-dev":"watchify js/mapbox-gl.js --debug --standalone mapboxgl -o dist/mapbox-gl-dev.js -v"},version:"0.22.1"}},{}],378:[function(t,e,r){"use strict";function n(t,e,r){for(var n=new Array(t),i=0;t>i;++i)n[i]=0,i===e&&(n[i]+=.5),i===r&&(n[i]+=.5);return n}function i(t,e){if(0===e||e===(1<=o;++o)if(e&1<=s;++s)~e&1<n;++n)r[n]=i(t,n);return r}e.exports=o;var a=t("convex-hull")},{"convex-hull":79}],379:[function(t,e,r){function n(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*a,t}function i(t,e){t[0][0]=e[0],t[0][1]=e[1],t[0][2]=e[2],t[1][0]=e[4],t[1][1]=e[5],t[1][2]=e[6],t[2][0]=e[8],t[2][1]=e[9],t[2][2]=e[10]}function o(t,e,r,n,i){t[0]=e[0]*n+r[0]*i,t[1]=e[1]*n+r[1]*i,t[2]=e[2]*n+r[2]*i}var a=t("./normalize"),s=t("gl-mat4/create"),l=t("gl-mat4/clone"),u=t("gl-mat4/determinant"),c=t("gl-mat4/invert"),h=t("gl-mat4/transpose"),f={length:t("gl-vec3/length"),normalize:t("gl-vec3/normalize"),dot:t("gl-vec3/dot"),cross:t("gl-vec3/cross")},p=s(),d=s(),m=[0,0,0,0],g=[[0,0,0],[0,0,0],[0,0,0]],v=[0,0,0];e.exports=function(t,e,r,s,y,x){if(e||(e=[0,0,0]),r||(r=[0,0,0]),s||(s=[0,0,0]),y||(y=[0,0,0,1]),x||(x=[0,0,0,1]),!a(p,t))return!1;if(l(d,p),d[3]=0,d[7]=0,d[11]=0,d[15]=1,Math.abs(u(d)<1e-8))return!1;var b=p[3],_=p[7],w=p[11],M=p[12],A=p[13],k=p[14],T=p[15];if(0!==b||0!==_||0!==w){m[0]=b,m[1]=_,m[2]=w,m[3]=T;var E=c(d,d);if(!E)return!1;h(d,d),n(y,m,d)}else y[0]=y[1]=y[2]=0,y[3]=1;if(e[0]=M,e[1]=A,e[2]=k,i(g,p),r[0]=f.length(g[0]),f.normalize(g[0],g[0]),s[0]=f.dot(g[0],g[1]),o(g[1],g[1],g[0],1,-s[0]),r[1]=f.length(g[1]),f.normalize(g[1],g[1]),s[0]/=r[1],s[1]=f.dot(g[0],g[2]),o(g[2],g[2],g[0],1,-s[1]),s[2]=f.dot(g[1],g[2]),o(g[2],g[2],g[1],1,-s[2]),r[2]=f.length(g[2]),f.normalize(g[2],g[2]),s[1]/=r[2],s[2]/=r[2],f.cross(v,g[1],g[2]),f.dot(g[0],v)<0)for(var S=0;3>S;S++)r[S]*=-1,g[S][0]*=-1,g[S][1]*=-1,g[S][2]*=-1;return x[0]=.5*Math.sqrt(Math.max(1+g[0][0]-g[1][1]-g[2][2],0)),x[1]=.5*Math.sqrt(Math.max(1-g[0][0]+g[1][1]-g[2][2],0)),x[2]=.5*Math.sqrt(Math.max(1-g[0][0]-g[1][1]+g[2][2],0)),x[3]=.5*Math.sqrt(Math.max(1+g[0][0]+g[1][1]+g[2][2],0)),g[2][1]>g[1][2]&&(x[0]=-x[0]),g[0][2]>g[2][0]&&(x[1]=-x[1]),g[1][0]>g[0][1]&&(x[2]=-x[2]),!0}},{"./normalize":380,"gl-mat4/clone":137,"gl-mat4/create":138,"gl-mat4/determinant":139,"gl-mat4/invert":143,"gl-mat4/transpose":153,"gl-vec3/cross":208,"gl-vec3/dot":209,"gl-vec3/length":210,"gl-vec3/normalize":212}],380:[function(t,e,r){e.exports=function(t,e){var r=e[15];if(0===r)return!1;for(var n=1/r,i=0;16>i;i++)t[i]=e[i]*n;return!0}},{}],381:[function(t,e,r){function n(t,e,r,n){if(0===c(e)||0===c(r))return!1;var i=u(e,f.translate,f.scale,f.skew,f.perspective,f.quaternion),o=u(r,p.translate,p.scale,p.skew,p.perspective,p.quaternion);return i&&o?(s(d.translate,f.translate,p.translate,n),s(d.skew,f.skew,p.skew,n),s(d.scale,f.scale,p.scale,n),s(d.perspective,f.perspective,p.perspective,n),h(d.quaternion,f.quaternion,p.quaternion,n),l(t,d.translate,d.scale,d.skew,d.perspective,d.quaternion),!0):!1}function i(){return{translate:o(),scale:o(1),skew:o(),perspective:a(),quaternion:a()}}function o(t){return[t||0,t||0,t||0]}function a(){return[0,0,0,1]}var s=t("gl-vec3/lerp"),l=t("mat4-recompose"),u=t("mat4-decompose"),c=t("gl-mat4/determinant"),h=t("quat-slerp"),f=i(),p=i(),d=i();e.exports=n},{"gl-mat4/determinant":139,"gl-vec3/lerp":211,"mat4-decompose":379,"mat4-recompose":382,"quat-slerp":419}],382:[function(t,e,r){var n={identity:t("gl-mat4/identity"),translate:t("gl-mat4/translate"),multiply:t("gl-mat4/multiply"),create:t("gl-mat4/create"),scale:t("gl-mat4/scale"),fromRotationTranslation:t("gl-mat4/fromRotationTranslation")},i=(n.create(),n.create());e.exports=function(t,e,r,o,a,s){return n.identity(t),n.fromRotationTranslation(t,s,e),t[3]=a[0],t[7]=a[1],t[11]=a[2],t[15]=a[3],n.identity(i),0!==o[2]&&(i[9]=o[2],n.multiply(t,t,i)),0!==o[1]&&(i[9]=0,i[8]=o[1],n.multiply(t,t,i)),0!==o[0]&&(i[8]=0,i[4]=o[0],n.multiply(t,t,i)),n.scale(t,t,r),t}},{"gl-mat4/create":138,"gl-mat4/fromRotationTranslation":141,"gl-mat4/identity":142,"gl-mat4/multiply":145,"gl-mat4/scale":151,"gl-mat4/translate":152}],383:[function(t,e,r){"use strict";function n(t){this._components=t.slice(),this._time=[0],this.prevMatrix=t.slice(),this.nextMatrix=t.slice(),this.computedMatrix=t.slice(),this.computedInverse=t.slice(),this.computedEye=[0,0,0],this.computedUp=[0,0,0],this.computedCenter=[0,0,0],this.computedRadius=[0],this._limits=[-(1/0),1/0]}function i(t){t=t||{};var e=t.matrix||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];return new n(e)}var o=t("binary-search-bounds"),a=t("mat4-interpolate"),s=t("gl-mat4/invert"),l=t("gl-mat4/rotateX"),u=t("gl-mat4/rotateY"),c=t("gl-mat4/rotateZ"),h=t("gl-mat4/lookAt"),f=t("gl-mat4/translate"),p=(t("gl-mat4/scale"),t("gl-vec3/normalize")),d=[0,0,0];e.exports=i;var m=n.prototype;m.recalcMatrix=function(t){var e=this._time,r=o.le(e,t),n=this.computedMatrix;if(!(0>r)){var i=this._components;if(r===e.length-1)for(var l=16*r,u=0;16>u;++u)n[u]=i[l++];else{for(var c=e[r+1]-e[r],l=16*r,h=this.prevMatrix,f=!0,u=0;16>u;++u)h[u]=i[l++];for(var d=this.nextMatrix,u=0;16>u;++u)d[u]=i[l++],f=f&&h[u]===d[u];if(1e-6>c||f)for(var u=0;16>u;++u)n[u]=h[u];else a(n,h,d,(t-e[r])/c)}var m=this.computedUp;m[0]=n[1],m[1]=n[5],m[2]=n[6],p(m,m);var g=this.computedInverse;s(g,n);var v=this.computedEye,y=g[15];v[0]=g[12]/y,v[1]=g[13]/y,v[2]=g[14]/y;for(var x=this.computedCenter,b=Math.exp(this.computedRadius[0]),u=0;3>u;++u)x[u]=v[u]-n[2+4*u]*b}},m.idle=function(t){if(!(tn;++n)e.push(e[r++]);this._time.push(t)}},m.flush=function(t){var e=o.gt(this._time,t)-2;0>e||(this._time.slice(0,e),this._components.slice(0,16*e))},m.lastT=function(){return this._time[this._time.length-1]},m.lookAt=function(t,e,r,n){this.recalcMatrix(t),e=e||this.computedEye,r=r||d,n=n||this.computedUp,this.setMatrix(t,h(this.computedMatrix,e,r,n));for(var i=0,o=0;3>o;++o)i+=Math.pow(r[o]-e[o],2);i=Math.log(Math.sqrt(i)),this.computedRadius[0]=i},m.rotate=function(t,e,r,n){this.recalcMatrix(t);var i=this.computedInverse;e&&u(i,i,e),r&&l(i,i,r),n&&c(i,i,n),this.setMatrix(t,s(this.computedMatrix,i))};var g=[0,0,0];m.pan=function(t,e,r,n){g[0]=-(e||0),g[1]=-(r||0),g[2]=-(n||0),this.recalcMatrix(t);var i=this.computedInverse;f(i,i,g),this.setMatrix(t,s(i,i))},m.translate=function(t,e,r,n){g[0]=e||0,g[1]=r||0,g[2]=n||0,this.recalcMatrix(t);var i=this.computedMatrix;f(i,i,g),this.setMatrix(t,i)},m.setMatrix=function(t,e){if(!(tr;++r)this._components.push(e[r])}},m.setDistance=function(t,e){this.computedRadius[0]=e},m.setDistanceLimits=function(t,e){var r=this._limits;r[0]=t,r[1]=e},m.getDistanceLimits=function(t){var e=this._limits;return t?(t[0]=e[0],t[1]=e[1],t):e}},{"binary-search-bounds":49,"gl-mat4/invert":143,"gl-mat4/lookAt":144,"gl-mat4/rotateX":148,"gl-mat4/rotateY":149,"gl-mat4/rotateZ":150,"gl-mat4/scale":151,"gl-mat4/translate":152,"gl-vec3/normalize":212,"mat4-interpolate":381}],384:[function(t,e,r){"use strict";function n(t){var e=t.length;if(3>e){for(var r=new Array(e),n=0;e>n;++n)r[n]=n;return 2===e&&t[0][0]===t[1][0]&&t[0][1]===t[1][1]?[0]:r}for(var o=new Array(e),n=0;e>n;++n)o[n]=n;o.sort(function(e,r){var n=t[e][0]-t[r][0];return n?n:t[e][1]-t[r][1]});for(var a=[o[0],o[1]],s=[o[0],o[1]],n=2;e>n;++n){for(var l=o[n],u=t[l],c=a.length;c>1&&i(t[a[c-2]],t[a[c-1]],u)<=0;)c-=1,a.pop();for(a.push(l),c=s.length;c>1&&i(t[s[c-2]],t[s[c-1]],u)>=0;)c-=1,s.pop();s.push(l)}for(var r=new Array(s.length+a.length-2),h=0,n=0,f=a.length;f>n;++n)r[h++]=a[n];for(var p=s.length-2;p>0;--p)r[h++]=s[p];return r}e.exports=n;var i=t("robust-orientation")[3]},{"robust-orientation":437}],385:[function(t,e,r){"use strict";function n(t,e){function r(t){var e=!1;return"altKey"in t&&(e=e||t.altKey!==m.alt,m.alt=!!t.altKey),"shiftKey"in t&&(e=e||t.shiftKey!==m.shift,m.shift=!!t.shiftKey),"ctrlKey"in t&&(e=e||t.ctrlKey!==m.control,m.control=!!t.ctrlKey),"metaKey"in t&&(e=e||t.metaKey!==m.meta,m.meta=!!t.metaKey),e}function n(t,n){var o=i.x(n),a=i.y(n);"buttons"in n&&(t=0|n.buttons),(t!==f||o!==p||a!==d||r(n))&&(f=0|t,p=o||0,d=a||0,e&&e(f,p,d,m))}function o(t){n(0,t)}function a(){(f||p||d||m.shift||m.alt||m.meta||m.control)&&(p=d=0,f=0,m.shift=m.alt=m.control=m.meta=!1,e&&e(0,0,0,m))}function s(t){r(t)&&e&&e(f,p,d,m)}function l(t){0===i.buttons(t)?n(0,t):n(f,t)}function u(t){n(f|i.buttons(t),t)}function c(t){n(f&~i.buttons(t),t)}function h(){g||(g=!0,t.addEventListener("mousemove",l),t.addEventListener("mousedown",u),t.addEventListener("mouseup",c),t.addEventListener("mouseleave",o),t.addEventListener("mouseenter",o),t.addEventListener("mouseout",o),t.addEventListener("mouseover",o),t.addEventListener("blur",a),t.addEventListener("keyup",s),t.addEventListener("keydown",s),t.addEventListener("keypress",s),t!==window&&(window.addEventListener("blur",a),window.addEventListener("keyup",s),window.addEventListener("keydown",s),window.addEventListener("keypress",s)))}e||(e=t,t=window);var f=0,p=0,d=0,m={shift:!1,alt:!1,control:!1,meta:!1},g=!1;h();var v={element:t};return Object.defineProperties(v,{enabled:{get:function(){return g},set:function(t){t&&h()},enumerable:!0},buttons:{get:function(){return f},enumerable:!0},x:{get:function(){return p},enumerable:!0},y:{get:function(){return d},enumerable:!0},mods:{get:function(){return m},enumerable:!0}}),v}e.exports=n;var i=t("mouse-event")},{"mouse-event":386}],386:[function(t,e,r){"use strict";function n(t){if("object"==typeof t){if("buttons"in t)return t.buttons;if("which"in t){var e=t.which;if(2===e)return 4;if(3===e)return 2;if(e>0)return 1<=0)return 1<i;++i)e&1<e;++e)F.push(c(e),"+=",p(e,b[t]),";");F.push("}")}function I(t){for(var e=t-1;e>=0;--e)L(e,0);for(var r=[],e=0;D>e;++e)S[e]?r.push(i(e)+".get("+c(e)+")"):r.push(i(e)+"["+c(e)+"]");for(var e=0;x>e;++e)r.push(u(e));F.push(M,"[",T,"++]=phase(",r.join(),");");for(var e=0;t>e;++e)z(e);for(var n=0;D>n;++n)F.push(c(n),"+=",p(n,b[t]),";")}function P(t){for(var e=0;D>e;++e)S[e]?F.push(o(e,0),"=",i(e),".get(",c(e),");"):F.push(o(e,0),"=",i(e),"[",c(e),"];");for(var r=[],e=0;D>e;++e)r.push(o(e,0));for(var e=0;x>e;++e)r.push(u(e));F.push(d(0),"=",M,"[",T,"]=phase(",r.join(),");");for(var n=1;1<n;++n)F.push(d(n),"=",M,"[",T,"+",g(n),"];");for(var a=[],n=1;1<n;++n)a.push("("+d(0)+"!=="+d(n)+")");F.push("if(",a.join("||"),"){");for(var s=[],e=0;O>e;++e)s.push(f(e));for(var e=0;D>e;++e){s.push(o(e,0));for(var n=1;1<n;++n)S[e]?F.push(o(e,n),"=",i(e),".get(",c(e),"+",h(e,n),");"):F.push(o(e,n),"=",i(e),"[",c(e),"+",h(e,n),"];"),s.push(o(e,n))}for(var e=0;1<e;++e)s.push(d(e));for(var e=0;x>e;++e)s.push(u(e));F.push("vertex(",s.join(),");",v(0),"=",w,"[",T,"]=",A,"++;");for(var l=(1<n;++n)if(0===(t&~(1<0;_=_-1&m)b.push(w+"["+T+"+"+g(_)+"]");b.push(v(0));for(var _=0;D>_;++_)1&n?b.push(o(_,l),o(_,m)):b.push(o(_,m),o(_,l));1&n?b.push(p,y):b.push(y,p);for(var _=0;x>_;++_)b.push(u(_));F.push("if(",p,"!==",y,"){","face(",b.join(),")}")}F.push("}",T,"+=1;")}function C(){for(var t=1;1<t;++t)F.push(E,"=",g(t),";",g(t),"=",m(t),";",m(t),"=",E,";")}function R(t,e){if(0>t)return void P(e);I(t),F.push("if(",a(b[t]),">0){",f(b[t]),"=1;"),R(t-1,e|1<r;++r)F.push(c(r),"+=",p(r,b[t]),";");t===O-1&&(F.push(T,"=0;"),C()),L(t,2),R(t-1,e),t===O-1&&(F.push("if(",f(b[O-1]),"&1){",T,"=0;}"),C()),z(t),F.push("}")}var D=S.length,O=b.length;if(2>O)throw new Error("ndarray-extract-contour: Dimension must be at least 2");for(var j="extractContour"+b.join("_"),F=[],N=[],B=[],U=0;D>U;++U)B.push(n(U));for(var U=0;x>U;++U)B.push(u(U));for(var U=0;O>U;++U)N.push(a(U)+"="+n(0)+".shape["+U+"]|0");for(var U=0;D>U;++U){N.push(i(U)+"="+n(U)+".data",l(U)+"="+n(U)+".offset|0");for(var V=0;O>V;++V)N.push(s(U,V)+"="+n(U)+".stride["+V+"]|0")}for(var U=0;D>U;++U){N.push(c(U)+"="+l(U)),N.push(o(U,0));for(var V=1;1<V;++V){for(var q=[],G=0;O>G;++G)V&1<U;++U)for(var V=0;O>V;++V){var H=[s(U,b[V])];V>0&&H.push(s(U,b[V-1])+"*"+a(b[V-1])),N.push(p(U,b[V])+"=("+H.join("-")+")|0")}for(var U=0;O>U;++U)N.push(f(U)+"=0");N.push(A+"=0");for(var X=["2"],U=O-2;U>=0;--U)X.push(a(b[U]));N.push(k+"=("+X.join("*")+")|0",M+"=mallocUint32("+k+")",w+"=mallocUint32("+k+")",T+"=0"),N.push(d(0)+"=0");for(var V=1;1<V;++V){for(var Y=[],W=[],G=0;O>G;++G)V&1<n&&e("Must have at least one array argument");var i=t.scalarArguments||0;0>i&&e("Scalar arg count must be > 0"),"function"!=typeof t.vertex&&e("Must specify vertex creation function"),"function"!=typeof t.cell&&e("Must specify cell creation function"),"function"!=typeof t.phase&&e("Must specify phase function");for(var o=t.getters||[],a=new Array(n),s=0;n>s;++s)o.indexOf(s)>=0?a[s]=!0:a[s]=!1;return x(t.vertex,t.cell,t.phase,i,r,a)}var _=t("typedarray-pool");e.exports=b;var w="V",M="P",A="N",k="Q",T="X",E="T"},{"typedarray-pool":468}],389:[function(t,e,r){"use strict";var n=t("cwise/lib/wrapper")({args:["index","array","scalar"],pre:{body:"{}",args:[],thisVars:[],localVars:[]},body:{body:"{_inline_4_arg1_=_inline_4_arg2_.apply(void 0,_inline_4_arg0_)}",args:[{name:"_inline_4_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_4_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_4_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:[],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"cwise",blockSize:64});e.exports=function(t,e){return n(t,e),t}},{"cwise/lib/wrapper":89}],390:[function(t,e,r){"use strict";function n(t){if(t in l)return l[t];for(var e=[],r=0;t>r;++r)e.push("out",r,"s=0.5*(inp",r,"l-inp",r,"r);");for(var n=["array"],i=["junk"],r=0;t>r;++r){n.push("array"),i.push("out"+r+"s");var o=a(t);o[r]=-1,n.push({array:0,offset:o.slice()}),o[r]=1,n.push({array:0,offset:o.slice()}),i.push("inp"+r+"l","inp"+r+"r")}return l[t]=s({args:n,pre:c,post:c,body:{body:e.join(""),args:i.map(function(t){return{name:t,lvalue:0===t.indexOf("out"),rvalue:0===t.indexOf("inp"),count:"junk"!==t|0}}),thisVars:[],localVars:[]},funcName:"fdTemplate"+t})}function i(t){function e(e){for(var r=o-e.length,n=[],i=[],s=[],l=0;o>l;++l)e.indexOf(l+1)>=0?s.push("0"):e.indexOf(-(l+1))>=0?s.push("s["+l+"]-1"):(s.push("-1"),n.push("1"),i.push("s["+l+"]-2"));var u=".lo("+n.join()+").hi("+i.join()+")";if(0===n.length&&(u=""),r>0){a.push("if(1");for(var l=0;o>l;++l)e.indexOf(l+1)>=0||e.indexOf(-(l+1))>=0||a.push("&&s[",l,"]>2");a.push("){grad",r,"(src.pick(",s.join(),")",u);for(var l=0;o>l;++l)e.indexOf(l+1)>=0||e.indexOf(-(l+1))>=0||a.push(",dst.pick(",s.join(),",",l,")",u);a.push(");")}for(var l=0;l1){dst.set(",s.join(),",",c,",0.5*(src.get(",f.join(),")-src.get(",p.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):a.push("if(s[",c,"]>1){diff(",h,",src.pick(",f.join(),")",u,",src.pick(",p.join(),")",u,");}else{zero(",h,");};");break;case"mirror":0===r?a.push("dst.set(",s.join(),",",c,",0);"):a.push("zero(",h,");");break;case"wrap":var d=s.slice(),m=s.slice();e[l]<0?(d[c]="s["+c+"]-2",m[c]="0"):(d[c]="s["+c+"]-1",m[c]="1"),0===r?a.push("if(s[",c,"]>2){dst.set(",s.join(),",",c,",0.5*(src.get(",d.join(),")-src.get(",m.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):a.push("if(s[",c,"]>2){diff(",h,",src.pick(",d.join(),")",u,",src.pick(",m.join(),")",u,");}else{zero(",h,");};");break;default:throw new Error("ndarray-gradient: Invalid boundary condition")}}r>0&&a.push("};")}var r=t.join(),i=u[r];if(i)return i;for(var o=t.length,a=["function gradient(dst,src){var s=src.shape.slice();"],s=0;1<s;++s){for(var c=[],p=0;o>p;++p)s&1<=s;++s)g.push("grad"+s),v.push(n(s));g.push(a.join(""));var y=Function.apply(void 0,g),i=y.apply(void 0,v);return l[r]=i,i}function o(t,e,r){if(Array.isArray(r)){if(r.length!==e.dimension)throw new Error("ndarray-gradient: invalid boundary conditions")}else r="string"==typeof r?a(e.dimension,r):a(e.dimension,"clamp");if(t.dimension!==e.dimension+1)throw new Error("ndarray-gradient: output dimension must be +1 input dimension");if(t.shape[e.dimension]!==e.dimension)throw new Error("ndarray-gradient: output shape must match input shape");for(var n=0;nr;++r){t[r]=a[(n+1)*n+r];for(var i=0;n>i;++i)t[r]+=a[(n+1)*i+r]*e[i]}for(var o=a[(n+1)*(n+1)-1],i=0;n>i;++i)o+=a[(n+1)*i+n]*e[i];for(var s=1/o,r=0;n>r;++r)t[r]*=s;return t}),t}var i=t("ndarray-warp"),o=t("gl-matrix-invert");e.exports=n},{"gl-matrix-invert":154,"ndarray-warp":398}],392:[function(t,e,r){"use strict";function n(t,e){var r=Math.floor(e),n=e-r,i=r>=0&&r=0&&r+1=0&&n=0&&n+1=0&&s=0&&s+1=0&&i=0&&i+1=0&&l=0&&l+1=0&&f=0&&f+1e;++e)r=+arguments[e+1],i[e]=Math.floor(r),o[e]=r-i[e],a[e]=0<=i[e]&&i[e]e;++e){for(u=1,c=t.offset,l=0;n>l;++l)if(e&1<>",rrshift:">>>"};!function(){for(var t in l){var e=l[t];r[t]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a"+e+"=b"},rvalue:!0,funcName:t+"eq"}),r[t+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a"+e+"=s"},rvalue:!0,funcName:t+"seq"})}}();var u={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var t in u){var e=u[t];r[t]=o({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t}),r[t+"eq"]=o({args:["array"],body:{args:["a"],body:"a="+e+"a"},rvalue:!0,count:2,funcName:t+"eq"})}}();var c={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};!function(){for(var t in c){var e=c[t];r[t]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:!0,count:2,funcName:t+"eq"}),r[t+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+e+"s"},rvalue:!0,count:2,funcName:t+"seq"})}}();var h=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];!function(){for(var t=0;tthis_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),r.norm1=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:3}],body:"this_s+=a<0?-a:a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm1"}),r.sup=a({args:["array"],pre:{body:"this_h=-Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),r.inf=a({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),r.random=o({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),r.assign=o({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),r.assigns=o({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),r.equals=a({args:["array","array"],pre:s,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":86}],394:[function(t,e,r){"use strict";var n=t("ndarray"),i=t("./doConvert.js");e.exports=function(t,e){for(var r=[],o=t,a=1;o instanceof Array;)r.push(o.length),a*=o.length,o=o[0];return 0===r.length?n():(e||(e=n(new Float64Array(a),r)),i(e,t),e)}},{"./doConvert.js":395,ndarray:399}],395:[function(t,e,r){e.exports=t("cwise-compiler")({args:["array","scalar","index"],pre:{body:"{}",args:[],thisVars:[],localVars:[]},body:{body:"{\nvar _inline_1_v=_inline_1_arg1_,_inline_1_i\nfor(_inline_1_i=0;_inline_1_i<_inline_1_arg2_.length-1;++_inline_1_i) {\n_inline_1_v=_inline_1_v[_inline_1_arg2_[_inline_1_i]]\n}\n_inline_1_arg0_=_inline_1_v[_inline_1_arg2_[_inline_1_arg2_.length-1]]\n}",args:[{name:"_inline_1_arg0_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg2_",lvalue:!1,rvalue:!0,count:4}],thisVars:[],localVars:["_inline_1_i","_inline_1_v"]},post:{body:"{}",args:[],thisVars:[],localVars:[]},funcName:"convert",blockSize:64})},{"cwise-compiler":86}],396:[function(t,e,r){"use strict";function n(t){switch(t){case"uint8":return[l.mallocUint8,l.freeUint8];case"uint16":return[l.mallocUint16,l.freeUint16];case"uint32":return[l.mallocUint32,l.freeUint32];case"int8":return[l.mallocInt8,l.freeInt8];case"int16":return[l.mallocInt16,l.freeInt16];case"int32":return[l.mallocInt32,l.freeInt32];case"float32":return[l.mallocFloat,l.freeFloat];case"float64":return[l.mallocDouble,l.freeDouble];default:return null}}function i(t){for(var e=[],r=0;t>r;++r)e.push("s"+r);for(var r=0;t>r;++r)e.push("n"+r);for(var r=1;t>r;++r)e.push("d"+r);for(var r=1;t>r;++r)e.push("e"+r);for(var r=1;t>r;++r)e.push("f"+r);return e}function o(t,e){function r(t){return"generic"===e?["data.get(",t,")"].join(""):["data[",t,"]"].join("")}function o(t,r){return"generic"===e?["data.set(",t,",",r,")"].join(""):["data[",t,"]=",r].join("")}var a=["'use strict'"],s=["ndarrayInsertionSort",t.join("d"),e].join(""),l=["left","right","data","offset"].concat(i(t.length)),u=n(e),c=["i,j,cptr,ptr=left*s0+offset"];if(t.length>1){for(var h=[],f=1;f1){a.push("dptr=0;sptr=ptr");for(var f=t.length-1;f>=0;--f){var p=t[f];0!==p&&a.push(["for(i",p,"=0;i",p,"left){","dptr=0","sptr=cptr-s0");for(var f=1;fb){break __l}"].join(""));for(var f=t.length-1;f>=1;--f)a.push("sptr+=e"+f,"dptr+=f"+f,"}");a.push("dptr=cptr;sptr=cptr-s0");for(var f=t.length-1;f>=0;--f){var p=t[f];0!==p&&a.push(["for(i",p,"=0;i",p,"=0;--f){var p=t[f];0!==p&&a.push(["for(i",p,"=0;i",p,"left)&&("+r("cptr-s0")+">scratch)){",o("cptr",r("cptr-s0")),"cptr-=s0","}",o("cptr","scratch"));if(a.push("}"),t.length>1&&u&&a.push("free(scratch)"),a.push("} return "+s),u){var d=new Function("malloc","free",a.join("\n"));return d(u[0],u[1])}var d=new Function(a.join("\n"));return d()}function a(t,e,r){function o(t){return["(offset+",t,"*s0)"].join("")}function a(t){return"generic"===e?["data.get(",t,")"].join(""):["data[",t,"]"].join("")}function s(t,r){return"generic"===e?["data.set(",t,",",r,")"].join(""):["data[",t,"]=",r].join("")}function l(e,r,n){if(1===e.length)_.push("ptr0="+o(e[0]));else for(var i=0;i=0;--i){var a=t[i];0!==a&&_.push(["for(i",a,"=0;i",a,"1)for(var i=0;i1?_.push("ptr_shift+=d"+a):_.push("ptr0+=d"+a),_.push("}"))}}function c(e,r,n,i){if(1===r.length)_.push("ptr0="+o(r[0]));else{for(var a=0;a1)for(var a=0;a=1;--a)n&&_.push("pivot_ptr+=f"+a),r.length>1?_.push("ptr_shift+=e"+a):_.push("ptr0+=e"+a),_.push("}")}function h(){t.length>1&&A&&_.push("free(pivot1)","free(pivot2)")}function f(e,r){var n="el"+e,i="el"+r;if(t.length>1){var s="__l"+ ++k;c(s,[n,i],!1,["comp=",a("ptr0"),"-",a("ptr1"),"\n","if(comp>0){tmp0=",n,";",n,"=",i,";",i,"=tmp0;break ",s,"}\n","if(comp<0){break ",s,"}"].join(""))}else _.push(["if(",a(o(n)),">",a(o(i)),"){tmp0=",n,";",n,"=",i,";",i,"=tmp0}"].join(""))}function p(e,r){t.length>1?l([e,r],!1,s("ptr0",a("ptr1"))):_.push(s(o(e),a(o(r))))}function d(e,r,n){if(t.length>1){var i="__l"+ ++k;c(i,[r],!0,[e,"=",a("ptr0"),"-pivot",n,"[pivot_ptr]\n","if(",e,"!==0){break ",i,"}"].join(""))}else _.push([e,"=",a(o(r)),"-pivot",n].join(""))}function m(e,r){t.length>1?l([e,r],!1,["tmp=",a("ptr0"),"\n",s("ptr0",a("ptr1")),"\n",s("ptr1","tmp")].join("")):_.push(["ptr0=",o(e),"\n","ptr1=",o(r),"\n","tmp=",a("ptr0"),"\n",s("ptr0",a("ptr1")),"\n",s("ptr1","tmp")].join(""))}function g(e,r,n){t.length>1?(l([e,r,n],!1,["tmp=",a("ptr0"),"\n",s("ptr0",a("ptr1")),"\n",s("ptr1",a("ptr2")),"\n",s("ptr2","tmp")].join("")),_.push("++"+r,"--"+n)):_.push(["ptr0=",o(e),"\n","ptr1=",o(r),"\n","ptr2=",o(n),"\n","++",r,"\n","--",n,"\n","tmp=",a("ptr0"),"\n",s("ptr0",a("ptr1")),"\n",s("ptr1",a("ptr2")),"\n",s("ptr2","tmp")].join(""))}function v(t,e){m(t,e),_.push("--"+e)}function y(e,r,n){t.length>1?l([e,r],!0,[s("ptr0",a("ptr1")),"\n",s("ptr1",["pivot",n,"[pivot_ptr]"].join(""))].join("")):_.push(s(o(e),a(o(r))),s(o(r),"pivot"+n))}function x(e,r){_.push(["if((",r,"-",e,")<=",u,"){\n","insertionSort(",e,",",r,",data,offset,",i(t.length).join(","),")\n","}else{\n",w,"(",e,",",r,",data,offset,",i(t.length).join(","),")\n","}"].join(""))}function b(e,r,n){t.length>1?(_.push(["__l",++k,":while(true){"].join("")),l([e],!0,["if(",a("ptr0"),"!==pivot",r,"[pivot_ptr]){break __l",k,"}"].join("")),_.push(n,"}")):_.push(["while(",a(o(e)),"===pivot",r,"){",n,"}"].join(""))}var _=["'use strict'"],w=["ndarrayQuickSort",t.join("d"),e].join(""),M=["left","right","data","offset"].concat(i(t.length)),A=n(e),k=0;_.push(["function ",w,"(",M.join(","),"){"].join(""));var T=["sixth=((right-left+1)/6)|0","index1=left+sixth","index5=right-sixth","index3=(left+right)>>1","index2=index3-sixth","index4=index3+sixth","el1=index1","el2=index2","el3=index3","el4=index4","el5=index5","less=left+1","great=right-1","pivots_are_equal=true","tmp","tmp0","x","y","z","k","ptr0","ptr1","ptr2","comp_pivot1=0","comp_pivot2=0","comp=0"];if(t.length>1){for(var E=[],S=1;SS;++S)T.push("b_ptr"+S);T.push("ptr3","ptr4","ptr5","ptr6","ptr7","pivot_ptr","ptr_shift","elementSize="+E.join("*")),A?T.push("pivot1=malloc(elementSize)","pivot2=malloc(elementSize)"):T.push("pivot1=new Array(elementSize),pivot2=new Array(elementSize)")}else T.push("pivot1","pivot2");if(_.push("var "+T.join(",")),f(1,2),f(4,5),f(1,3),f(2,3),f(1,4),f(3,4),f(2,5),f(2,3),f(4,5),t.length>1?l(["el1","el2","el3","el4","el5","index1","index3","index5"],!0,["pivot1[pivot_ptr]=",a("ptr1"),"\n","pivot2[pivot_ptr]=",a("ptr3"),"\n","pivots_are_equal=pivots_are_equal&&(pivot1[pivot_ptr]===pivot2[pivot_ptr])\n","x=",a("ptr0"),"\n","y=",a("ptr2"),"\n","z=",a("ptr4"),"\n",s("ptr5","x"),"\n",s("ptr6","y"),"\n",s("ptr7","z")].join("")):_.push(["pivot1=",a(o("el2")),"\n","pivot2=",a(o("el4")),"\n","pivots_are_equal=pivot1===pivot2\n","x=",a(o("el1")),"\n","y=",a(o("el3")),"\n","z=",a(o("el5")),"\n",s(o("index1"),"x"),"\n",s(o("index3"),"y"),"\n",s(o("index5"),"z")].join("")),p("index2","left"),p("index4","right"),_.push("if(pivots_are_equal){"),_.push("for(k=less;k<=great;++k){"),d("comp","k",1),_.push("if(comp===0){continue}"),_.push("if(comp<0){"),_.push("if(k!==less){"),m("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),_.push("while(true){"),d("comp","great",1),_.push("if(comp>0){"),_.push("great--"),_.push("}else if(comp<0){"),g("k","less","great"),_.push("break"),_.push("}else{"),v("k","great"),_.push("break"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}else{"),_.push("for(k=less;k<=great;++k){"),d("comp_pivot1","k",1),_.push("if(comp_pivot1<0){"),_.push("if(k!==less){"),m("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),d("comp_pivot2","k",2),_.push("if(comp_pivot2>0){"),_.push("while(true){"),d("comp","great",2),_.push("if(comp>0){"),_.push("if(--greatindex5){"),b("less",1,"++less"),b("great",2,"--great"),_.push("for(k=less;k<=great;++k){"),d("comp_pivot1","k",1),_.push("if(comp_pivot1===0){"),_.push("if(k!==less){"),m("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),d("comp_pivot2","k",2),_.push("if(comp_pivot2===0){"),_.push("while(true){"),d("comp","great",2),_.push("if(comp===0){"),_.push("if(--great1&&A){var L=new Function("insertionSort","malloc","free",_.join("\n"));return L(r,A[0],A[1])}var L=new Function("insertionSort",_.join("\n"));return L(r)}function s(t,e){var r=["'use strict'"],n=["ndarraySortWrapper",t.join("d"),e].join(""),s=["array"];r.push(["function ",n,"(",s.join(","),"){"].join(""));for(var l=["data=array.data,offset=array.offset|0,shape=array.shape,stride=array.stride"],c=0;c0?l.push(["d",g,"=s",g,"-d",d,"*n",d].join("")):l.push(["d",g,"=s",g].join("")),d=g);var p=t.length-1-c;0!==p&&(m>0?l.push(["e",p,"=s",p,"-e",m,"*n",m,",f",p,"=",h[p],"-f",m,"*n",m].join("")):l.push(["e",p,"=s",p,",f",p,"=",h[p]].join("")),m=p)}r.push("var "+l.join(","));var v=["0","n0-1","data","offset"].concat(i(t.length));r.push(["if(n0<=",u,"){","insertionSort(",v.join(","),")}else{","quickSort(",v.join(","),")}"].join("")),r.push("}return "+n);var y=new Function("insertionSort","quickSort",r.join("\n")),x=o(t,e),b=a(t,e,x);return y(x,b)}var l=t("typedarray-pool"),u=32;e.exports=s},{"typedarray-pool":468}],397:[function(t,e,r){"use strict";function n(t){var e=t.order,r=t.dtype,n=[e,r],a=n.join(":"),s=o[a];return s||(o[a]=s=i(e,r)),s(t),t}var i=t("./lib/compile_sort.js"),o={};e.exports=n},{"./lib/compile_sort.js":396}],398:[function(t,e,r){"use strict";var n=t("ndarray-linear-interpolate"),i=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=new Array(_inline_18_arg4_)}",args:[{name:"_inline_18_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_18_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_18_arg2_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_18_arg3_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_18_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_19_arg2_(this_warped,_inline_19_arg0_),_inline_19_arg1_=_inline_19_arg3_.apply(void 0,this_warped)}",args:[{name:"_inline_19_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_19_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_19_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_19_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_19_arg4_",lvalue:!1,rvalue:!1,count:0}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warpND",blockSize:64}),o=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=[0]}",args:[],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_22_arg2_(this_warped,_inline_22_arg0_),_inline_22_arg1_=_inline_22_arg3_(_inline_22_arg4_,this_warped[0])}",args:[{name:"_inline_22_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_22_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_22_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_22_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_22_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warp1D",blockSize:64}),a=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=[0,0]}",args:[],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_25_arg2_(this_warped,_inline_25_arg0_),_inline_25_arg1_=_inline_25_arg3_(_inline_25_arg4_,this_warped[0],this_warped[1])}",args:[{name:"_inline_25_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_25_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_25_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_25_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_25_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warp2D",blockSize:64}),s=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=[0,0,0]}",args:[],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_28_arg2_(this_warped,_inline_28_arg0_),_inline_28_arg1_=_inline_28_arg3_(_inline_28_arg4_,this_warped[0],this_warped[1],this_warped[2])}",args:[{name:"_inline_28_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_28_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_28_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_28_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_28_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warp3D",blockSize:64});e.exports=function(t,e,r){switch(e.shape.length){case 1:o(t,r,n.d1,e);break;case 2:a(t,r,n.d2,e);break;case 3:s(t,r,n.d3,e);break;default:i(t,r,n.bind(void 0,e),e.shape.length)}return t}},{"cwise/lib/wrapper":89,"ndarray-linear-interpolate":392}],399:[function(t,e,r){function n(t,e){return t[0]-e[0]}function i(){var t,e=this.stride,r=new Array(e.length);for(t=0;te&&(r="View_Nil"+t);var n="generic"===t;if(-1===e){var o="function "+r+"(a){this.data=a;};var proto="+r+".prototype;proto.dtype='"+t+"';proto.index=function(){return -1};proto.size=0;proto.dimension=-1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function(){return new "+r+"(this.data);};proto.get=proto.set=function(){};proto.pick=function(){return null};return function construct_"+r+"(a){return new "+r+"(a);}",a=new Function(o);return a()}if(0===e){var o="function "+r+"(a,d) {this.data = a;this.offset = d};var proto="+r+".prototype;proto.dtype='"+t+"';proto.index=function(){return this.offset};proto.dimension=0;proto.size=1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function "+r+"_copy() {return new "+r+"(this.data,this.offset)};proto.pick=function "+r+"_pick(){return TrivialArray(this.data);};proto.valueOf=proto.get=function "+r+"_get(){return "+(n?"this.data.get(this.offset)":"this.data[this.offset]")+"};proto.set=function "+r+"_set(v){return "+(n?"this.data.set(this.offset,v)":"this.data[this.offset]=v")+"};return function construct_"+r+"(a,b,c,d){return new "+r+"(a,d)}",a=new Function("TrivialArray",o);return a(h[t][0])}var o=["'use strict'"],s=l(e),u=s.map(function(t){return"i"+t}),c="this.offset+"+s.map(function(t){return"this.stride["+t+"]*i"+t}).join("+"),f=s.map(function(t){return"b"+t}).join(","),p=s.map(function(t){return"c"+t}).join(",");o.push("function "+r+"(a,"+f+","+p+",d){this.data=a","this.shape=["+f+"]","this.stride=["+p+"]","this.offset=d|0}","var proto="+r+".prototype","proto.dtype='"+t+"'","proto.dimension="+e),o.push("Object.defineProperty(proto,'size',{get:function "+r+"_size(){return "+s.map(function(t){return"this.shape["+t+"]"}).join("*"),"}})"),1===e?o.push("proto.order=[0]"):(o.push("Object.defineProperty(proto,'order',{get:"),4>e?(o.push("function "+r+"_order(){"),2===e?o.push("return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===e&&o.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):o.push("ORDER})")),o.push("proto.set=function "+r+"_set("+u.join(",")+",v){"),n?o.push("return this.data.set("+c+",v)}"):o.push("return this.data["+c+"]=v}"),o.push("proto.get=function "+r+"_get("+u.join(",")+"){"),n?o.push("return this.data.get("+c+")}"):o.push("return this.data["+c+"]}"),o.push("proto.index=function "+r+"_index(",u.join(),"){return "+c+"}"),o.push("proto.hi=function "+r+"_hi("+u.join(",")+"){return new "+r+"(this.data,"+s.map(function(t){return["(typeof i",t,"!=='number'||i",t,"<0)?this.shape[",t,"]:i",t,"|0"].join("")}).join(",")+","+s.map(function(t){return"this.stride["+t+"]"}).join(",")+",this.offset)}");var d=s.map(function(t){return"a"+t+"=this.shape["+t+"]"}),m=s.map(function(t){return"c"+t+"=this.stride["+t+"]"});o.push("proto.lo=function "+r+"_lo("+u.join(",")+"){var b=this.offset,d=0,"+d.join(",")+","+m.join(","));for(var g=0;e>g;++g)o.push("if(typeof i"+g+"==='number'&&i"+g+">=0){d=i"+g+"|0;b+=c"+g+"*d;a"+g+"-=d}");o.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"c"+t}).join(",")+",b)}"),o.push("proto.step=function "+r+"_step("+u.join(",")+"){var "+s.map(function(t){return"a"+t+"=this.shape["+t+"]"}).join(",")+","+s.map(function(t){return"b"+t+"=this.stride["+t+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var g=0;e>g;++g)o.push("if(typeof i"+g+"==='number'){d=i"+g+"|0;if(d<0){c+=b"+g+"*(a"+g+"-1);a"+g+"=ceil(-a"+g+"/d)}else{a"+g+"=ceil(a"+g+"/d)}b"+g+"*=d}");o.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"b"+t}).join(",")+",c)}");for(var v=new Array(e),y=new Array(e),g=0;e>g;++g)v[g]="a[i"+g+"]",y[g]="b[i"+g+"]";o.push("proto.transpose=function "+r+"_transpose("+u+"){"+u.map(function(t,e){return t+"=("+t+"===undefined?"+e+":"+t+"|0)"}).join(";"),"var a=this.shape,b=this.stride;return new "+r+"(this.data,"+v.join(",")+","+y.join(",")+",this.offset)}"),o.push("proto.pick=function "+r+"_pick("+u+"){var a=[],b=[],c=this.offset");for(var g=0;e>g;++g)o.push("if(typeof i"+g+"==='number'&&i"+g+">=0){c=(c+this.stride["+g+"]*i"+g+")|0}else{a.push(this.shape["+g+"]);b.push(this.stride["+g+"])}");o.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),o.push("return function construct_"+r+"(data,shape,stride,offset){return new "+r+"(data,"+s.map(function(t){return"shape["+t+"]"}).join(",")+","+s.map(function(t){return"stride["+t+"]"}).join(",")+",offset)}");var a=new Function("CTOR_LIST","ORDER",o.join("\n"));return a(h[t],i)}function a(t){if(u(t))return"buffer";if(c)switch(Object.prototype.toString.call(t)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped"}return Array.isArray(t)?"array":"generic"}function s(t,e,r,n){if(void 0===t){var i=h.array[0];return i([])}"number"==typeof t&&(t=[t]),void 0===e&&(e=[t.length]);var s=e.length;if(void 0===r){r=new Array(s);for(var l=s-1,u=1;l>=0;--l)r[l]=u,u*=e[l]}if(void 0===n){n=0;for(var l=0;s>l;++l)r[l]<0&&(n-=(e[l]-1)*r[l])}for(var c=a(t),f=h[c];f.length<=s+1;)f.push(o(c,f.length-1));var i=f[s+1];return i(t,e,r,n)}var l=t("iota-array"),u=t("is-buffer"),c="undefined"!=typeof Float64Array,h={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],buffer:[],generic:[]};e.exports=s},{"iota-array":229,"is-buffer":230}],400:[function(t,e,r){"use strict";function n(t,e){if(isNaN(t)||isNaN(e))return NaN;if(t===e)return t;if(0===t)return 0>e?-o:o;var r=i.hi(t),n=i.lo(t);return e>t==t>0?n===a?(r+=1,n=0):n+=1:0===n?(n=a,r-=1):n-=1,i.pack(n,r)}var i=t("double-bits"),o=Math.pow(2,-1074),a=-1>>>0;e.exports=n},{"double-bits":92}],401:[function(t,e,r){var n=1e-6,i=1e-6;r.vertexNormals=function(t,e,r){for(var i=e.length,o=new Array(i),a=void 0===r?n:r,s=0;i>s;++s)o[s]=[0,0,0];for(var s=0;sb;++b)g[b]=p[b]-d[b],v+=g[b]*g[b],y[b]=m[b]-d[b],x+=y[b]*y[b];if(v*x>a)for(var _=o[c],w=1/Math.sqrt(v*x),b=0;3>b;++b){var M=(b+1)%3,A=(b+2)%3;_[b]+=w*(y[M]*g[A]-y[A]*g[M])}}for(var s=0;i>s;++s){for(var _=o[s],k=0,b=0;3>b;++b)k+=_[b]*_[b];if(k>a)for(var w=1/Math.sqrt(k),b=0;3>b;++b)_[b]*=w;else for(var b=0;3>b;++b)_[b]=0}return o},r.faceNormals=function(t,e,r){for(var n=t.length,o=new Array(n),a=void 0===r?i:r,s=0;n>s;++s){for(var l=t[s],u=new Array(3),c=0;3>c;++c)u[c]=e[l[c]];for(var h=new Array(3),f=new Array(3),c=0;3>c;++c)h[c]=u[1][c]-u[0][c],f[c]=u[2][c]-u[0][c];for(var p=new Array(3),d=0,c=0;3>c;++c){var m=(c+1)%3,g=(c+2)%3;p[c]=h[m]*f[g]-h[g]*f[m],d+=p[c]*p[c]}d=d>a?1/Math.sqrt(d):0;for(var c=0;3>c;++c)p[c]*=d;o[s]=p}return o}},{}],402:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a,s,l,u){var c=e+o+u;if(h>0){var h=Math.sqrt(c+1);t[0]=.5*(a-l)/h,t[1]=.5*(s-n)/h,t[2]=.5*(r-o)/h,t[3]=.5*h}else{var f=Math.max(e,o,u),h=Math.sqrt(2*f-c+1);e>=f?(t[0]=.5*h,t[1]=.5*(i+r)/h,t[2]=.5*(s+n)/h,t[3]=.5*(a-l)/h):o>=f?(t[0]=.5*(r+i)/h,t[1]=.5*h,t[2]=.5*(l+a)/h,t[3]=.5*(s-n)/h):(t[0]=.5*(n+s)/h,t[1]=.5*(a+l)/h,t[2]=.5*h,t[3]=.5*(r-i)/h)}return t}e.exports=n},{}],403:[function(t,e,r){"use strict";function n(t,e,r){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2))}function i(t,e,r,n){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2)+Math.pow(n,2))}function o(t,e){var r=e[0],n=e[1],o=e[2],a=e[3],s=i(r,n,o,a);s>1e-6?(t[0]=r/s,t[1]=n/s,t[2]=o/s,t[3]=a/s):(t[0]=t[1]=t[2]=0,t[3]=1)}function a(t,e,r){this.radius=l([r]),this.center=l(e),this.rotation=l(t),this.computedRadius=this.radius.curve(0),this.computedCenter=this.center.curve(0),this.computedRotation=this.rotation.curve(0),this.computedUp=[.1,0,0],this.computedEye=[.1,0,0],this.computedMatrix=[.1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.recalcMatrix(0)}function s(t){t=t||{};var e=t.center||[0,0,0],r=t.rotation||[0,0,0,1],n=t.radius||1;e=[].slice.call(e,0,3),r=[].slice.call(r,0,4),o(r,r);var i=new a(r,e,Math.log(n));return i.setDistanceLimits(t.zoomMin,t.zoomMax),("eye"in t||"up"in t)&&i.lookAt(0,t.eye,t.center,t.up),i}e.exports=s;var l=t("filtered-vector"),u=t("gl-mat4/lookAt"),c=t("gl-mat4/fromQuat"),h=t("gl-mat4/invert"),f=t("./lib/quatFromFrame"),p=a.prototype;p.lastT=function(){return Math.max(this.radius.lastT(),this.center.lastT(),this.rotation.lastT())},p.recalcMatrix=function(t){this.radius.curve(t),this.center.curve(t),this.rotation.curve(t);var e=this.computedRotation;o(e,e);var r=this.computedMatrix;c(r,e);var n=this.computedCenter,i=this.computedEye,a=this.computedUp,s=Math.exp(this.computedRadius[0]);i[0]=n[0]+s*r[2],i[1]=n[1]+s*r[6],i[2]=n[2]+s*r[10],a[0]=r[1],a[1]=r[5],a[2]=r[9];for(var l=0;3>l;++l){for(var u=0,h=0;3>h;++h)u+=r[l+4*h]*i[h];r[12+l]=-u}},p.getMatrix=function(t,e){this.recalcMatrix(t);var r=this.computedMatrix;if(e){for(var n=0;16>n;++n)e[n]=r[n];return e}return r},p.idle=function(t){this.center.idle(t),this.radius.idle(t),this.rotation.idle(t)},p.flush=function(t){this.center.flush(t),this.radius.flush(t),this.rotation.flush(t)},p.pan=function(t,e,r,i){e=e||0,r=r||0,i=i||0,this.recalcMatrix(t);var o=this.computedMatrix,a=o[1],s=o[5],l=o[9],u=n(a,s,l);a/=u,s/=u,l/=u;var c=o[0],h=o[4],f=o[8],p=c*a+h*s+f*l;c-=a*p,h-=s*p,f-=l*p;var d=n(c,h,f);c/=d,h/=d,f/=d;var m=o[2],g=o[6],v=o[10],y=m*a+g*s+v*l,x=m*c+g*h+v*f;m-=y*a+x*c,g-=y*s+x*h,v-=y*l+x*f;var b=n(m,g,v);m/=b,g/=b,v/=b;var _=c*e+a*r,w=h*e+s*r,M=f*e+l*r;this.center.move(t,_,w,M);var A=Math.exp(this.computedRadius[0]);A=Math.max(1e-4,A+i),this.radius.set(t,Math.log(A))},p.rotate=function(t,e,r,o){this.recalcMatrix(t),e=e||0,r=r||0;var a=this.computedMatrix,s=a[0],l=a[4],u=a[8],c=a[1],h=a[5],f=a[9],p=a[2],d=a[6],m=a[10],g=e*s+r*c,v=e*l+r*h,y=e*u+r*f,x=-(d*y-m*v),b=-(m*g-p*y),_=-(p*v-d*g),w=Math.sqrt(Math.max(0,1-Math.pow(x,2)-Math.pow(b,2)-Math.pow(_,2))),M=i(x,b,_,w);M>1e-6?(x/=M,b/=M,_/=M,w/=M):(x=b=_=0,w=1);var A=this.computedRotation,k=A[0],T=A[1],E=A[2],S=A[3],L=k*w+S*x+T*_-E*b,z=T*w+S*b+E*x-k*_,I=E*w+S*_+k*b-T*x,P=S*w-k*x-T*b-E*_;if(o){x=p,b=d,_=m;var C=Math.sin(o)/n(x,b,_);x*=C,b*=C,_*=C,w=Math.cos(e),L=L*w+P*x+z*_-I*b,z=z*w+P*b+I*x-L*_,I=I*w+P*_+L*b-z*x,P=P*w-L*x-z*b-I*_}var R=i(L,z,I,P);R>1e-6?(L/=R,z/=R,I/=R,P/=R):(L=z=I=0,P=1),this.rotation.set(t,L,z,I,P)},p.lookAt=function(t,e,r,n){this.recalcMatrix(t),r=r||this.computedCenter,e=e||this.computedEye,n=n||this.computedUp;var i=this.computedMatrix;u(i,e,r,n);var a=this.computedRotation;f(a,i[0],i[1],i[2],i[4],i[5],i[6],i[8],i[9],i[10]),o(a,a),this.rotation.set(t,a[0],a[1],a[2],a[3]);for(var s=0,l=0;3>l;++l)s+=Math.pow(r[l]-e[l],2);this.radius.set(t,.5*Math.log(Math.max(s,1e-6))),this.center.set(t,r[0],r[1],r[2])},p.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},p.setMatrix=function(t,e){var r=this.computedRotation;f(r,e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10]),o(r,r),this.rotation.set(t,r[0],r[1],r[2],r[3]);var n=this.computedMatrix;h(n,e);var i=n[15];if(Math.abs(i)>1e-6){var a=n[12]/i,s=n[13]/i,l=n[14]/i;this.recalcMatrix(t);var u=Math.exp(this.computedRadius[0]);this.center.set(t,a-n[2]*u,s-n[6]*u,l-n[10]*u),this.radius.idle(t)}else this.center.idle(t),this.radius.idle(t)},p.setDistance=function(t,e){e>0&&this.radius.set(t,Math.log(e))},p.setDistanceLimits=function(t,e){t=t>0?Math.log(t):-(1/0),e=e>0?Math.log(e):1/0,e=Math.max(e,t),this.radius.bounds[0][0]=t,this.radius.bounds[1][0]=e},p.getDistanceLimits=function(t){var e=this.radius.bounds;return t?(t[0]=Math.exp(e[0][0]),t[1]=Math.exp(e[1][0]),t):[Math.exp(e[0][0]),Math.exp(e[1][0])]},p.toJSON=function(){return this.recalcMatrix(this.lastT()),{center:this.computedCenter.slice(),rotation:this.computedRotation.slice(),distance:Math.log(this.computedRadius[0]),zoomMin:this.radius.bounds[0][0],zoomMax:this.radius.bounds[1][0]}},p.fromJSON=function(t){var e=this.lastT(),r=t.center;r&&this.center.set(e,r[0],r[1],r[2]);var n=t.rotation;n&&this.rotation.set(e,n[0],n[1],n[2],n[3]);var i=t.distance;i&&i>0&&this.radius.set(e,Math.log(i)),this.setDistanceLimits(t.zoomMin,t.zoomMax)}},{"./lib/quatFromFrame":402,"filtered-vector":101,"gl-mat4/fromQuat":140,"gl-mat4/invert":143,"gl-mat4/lookAt":144}],404:[function(t,e,r){"use strict";var n=t("repeat-string"); e.exports=function(t,e,r){return r="undefined"!=typeof r?r+"":" ",n(r,e)+t}},{"repeat-string":429}],405:[function(t,e,r){e.exports=function(t,e){e||(e=[0,""]),t=String(t);var r=parseFloat(t,10);return e[0]=r,e[1]=t.match(/[\d.\-\+]*\s*(.*)/)[1]||"",e}},{}],406:[function(t,e,r){(function(t){function e(t,e){for(var r=0,n=t.length-1;n>=0;n--){var i=t[n];"."===i?t.splice(n,1):".."===i?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r--;r)t.unshift("..");return t}function n(t,e){if(t.filter)return t.filter(e);for(var r=[],n=0;n=-1&&!i;o--){var a=o>=0?arguments[o]:t.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(r=a+"/"+r,i="/"===a.charAt(0))}return r=e(n(r.split("/"),function(t){return!!t}),!i).join("/"),(i?"/":"")+r||"."},r.normalize=function(t){var i=r.isAbsolute(t),o="/"===a(t,-1);return t=e(n(t.split("/"),function(t){return!!t}),!i).join("/"),t||i||(t="."),t&&o&&(t+="/"),(i?"/":"")+t},r.isAbsolute=function(t){return"/"===t.charAt(0)},r.join=function(){var t=Array.prototype.slice.call(arguments,0);return r.normalize(n(t,function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},r.relative=function(t,e){function n(t){for(var e=0;e=0&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=r.resolve(t).substr(1),e=r.resolve(e).substr(1);for(var i=n(t.split("/")),o=n(e.split("/")),a=Math.min(i.length,o.length),s=a,l=0;a>l;l++)if(i[l]!==o[l]){s=l;break}for(var u=[],l=s;le&&(e=t.length+e),t.substr(e,r)}}).call(this,t("_process"))},{_process:417}],407:[function(t,e,r){"use strict";function n(t){var e;t&&t.length&&(e=t,t=e.length);var r=new Uint8Array(t||0);return e&&r.set(e),r.readUInt32LE=o.readUInt32LE,r.writeUInt32LE=o.writeUInt32LE,r.readInt32LE=o.readInt32LE,r.writeInt32LE=o.writeInt32LE,r.readFloatLE=o.readFloatLE,r.writeFloatLE=o.writeFloatLE,r.readDoubleLE=o.readDoubleLE,r.writeDoubleLE=o.writeDoubleLE,r.toString=o.toString,r.write=o.write,r.slice=o.slice,r.copy=o.copy,r._isBuffer=!0,r}function i(t){for(var e,r,n=t.length,i=[],o=0;n>o;o++){if(e=t.charCodeAt(o),e>55295&&57344>e){if(!r){e>56319||o+1===n?i.push(239,191,189):r=e;continue}if(56320>e){i.push(239,191,189),r=e;continue}e=r-55296<<10|e-56320|65536,r=null}else r&&(i.push(239,191,189),r=null);128>e?i.push(e):2048>e?i.push(e>>6|192,63&e|128):65536>e?i.push(e>>12|224,e>>6&63|128,63&e|128):i.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}return i}e.exports=n;var o,a,s,l=t("ieee754");o={readUInt32LE:function(t){return(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},writeUInt32LE:function(t,e){this[e]=t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24},readInt32LE:function(t){return(this[t]|this[t+1]<<8|this[t+2]<<16)+(this[t+3]<<24)},readFloatLE:function(t){return l.read(this,t,!0,23,4)},readDoubleLE:function(t){return l.read(this,t,!0,52,8)},writeFloatLE:function(t,e){return l.write(this,t,e,!0,23,4)},writeDoubleLE:function(t,e){return l.write(this,t,e,!0,52,8)},toString:function(t,e,r){var n="",i="";e=e||0,r=Math.min(this.length,r||this.length);for(var o=e;r>o;o++){var a=this[o];127>=a?(n+=decodeURIComponent(i)+String.fromCharCode(a),i=""):i+="%"+a.toString(16)}return n+=decodeURIComponent(i)},write:function(t,e){for(var r=t===a?s:i(t),n=0;nr)return t;if(r=n[e.pos++],t+=34359738368*(127&r),128>r)return t;if(r=n[e.pos++],t+=4398046511104*(127&r),128>r)return t;if(r=n[e.pos++],t+=562949953421312*(127&r),128>r)return t;if(r=n[e.pos++],t+=72057594037927940*(127&r),128>r)return t;if(r=n[e.pos++],t+=0x8000000000000000*(127&r),128>r)return t;throw new Error("Expected varint not more than 10 bytes")}function o(t,e){e.realloc(10);for(var r=e.pos+10;t>=1;){if(e.pos>=r)throw new Error("Given varint doesn't fit into 10 bytes");var n=255&t;e.buf[e.pos++]=n|(t>=128?128:0),t/=128}}function a(t,e,r){var n=16383>=e?1:2097151>=e?2:268435455>=e?3:Math.ceil(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function s(t,e){for(var r=0;r>3,o=this.pos;t(i,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=this.buf.readUInt32LE(this.pos);return this.pos+=4,t},readSFixed32:function(){var t=this.buf.readInt32LE(this.pos);return this.pos+=4,t},readFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+this.buf.readUInt32LE(this.pos+4)*v;return this.pos+=8,t},readSFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+this.buf.readInt32LE(this.pos+4)*v;return this.pos+=8,t},readFloat:function(){var t=this.buf.readFloatLE(this.pos);return this.pos+=4,t},readDouble:function(){var t=this.buf.readDoubleLE(this.pos);return this.pos+=8,t},readVarint:function(){var t,e,r=this.buf;return e=r[this.pos++],t=127&e,128>e?t:(e=r[this.pos++],t|=(127&e)<<7,128>e?t:(e=r[this.pos++],t|=(127&e)<<14,128>e?t:(e=r[this.pos++],t|=(127&e)<<21,128>e?t:i(t,this))))},readVarint64:function(){var t=this.pos,e=this.readVarint();if(x>e)return e;for(var r=this.pos-2;255===this.buf[r];)r--;t>r&&(r=t),e=0;for(var n=0;r-t+1>n;n++){var i=127&~this.buf[t+n];e+=4>n?i<<7*n:i*Math.pow(2,7*n)}return-e-1},readSVarint:function(){var t=this.readVarint();return t%2===1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.buf.toString("utf8",this.pos,t);return this.pos=t,e},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.slice(this.pos,t);return this.pos=t,e},readPackedVarint:function(){for(var t=this.readVarint()+this.pos,e=[];this.pos127;);else if(e===n.Bytes)this.pos=this.readVarint()+this.pos;else if(e===n.Fixed32)this.pos+=4;else{if(e!==n.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455?void o(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),void(127>=t||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),127>=t||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),127>=t||(this.buf[this.pos++]=t>>>7&127)))))},writeSVarint:function(t){this.writeVarint(0>t?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t);var e=g.byteLength(t);this.writeVarint(e),this.realloc(e),this.buf.write(t,this.pos),this.pos+=e},writeFloat:function(t){this.realloc(4),this.buf.writeFloatLE(t,this.pos),this.pos+=4},writeDouble:function(t){this.realloc(8),this.buf.writeDoubleLE(t,this.pos),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;e>r;r++)this.buf[this.pos++]=t[r]},writeRawMessage:function(t,e){this.pos++;var r=this.pos;t(e,this);var n=this.pos-r;n>=128&&a(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,n.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){this.writeMessage(t,s,e)},writePackedSVarint:function(t,e){this.writeMessage(t,l,e)},writePackedBoolean:function(t,e){this.writeMessage(t,h,e)},writePackedFloat:function(t,e){this.writeMessage(t,u,e)},writePackedDouble:function(t,e){this.writeMessage(t,c,e)},writePackedFixed32:function(t,e){this.writeMessage(t,f,e)},writePackedSFixed32:function(t,e){this.writeMessage(t,p,e)},writePackedFixed64:function(t,e){this.writeMessage(t,d,e)},writePackedSFixed64:function(t,e){this.writeMessage(t,m,e)},writeBytesField:function(t,e){this.writeTag(t,n.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,n.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,n.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,n.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,n.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,n.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,n.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,n.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,n.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,n.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./buffer":407}],409:[function(t,e,r){"use strict";function n(t){var e=t.length;if(i>e){for(var r=1,n=0;e>n;++n)for(var a=0;n>a;++a)if(t[n]n;++n)s[n]=0;for(var r=1,n=0;e>n;++n)if(!s[n]){var l=1;s[n]=1;for(var a=t[n];a!==n;a=t[a]){if(s[a])return o.freeUint8(s),0;l+=1,s[a]=1}1&l||(r=-r)}return o.freeUint8(s),r}e.exports=n;var i=32,o=t("typedarray-pool")},{"typedarray-pool":468}],410:[function(t,e,r){"use strict";function n(t){var e=t.length;switch(e){case 0:case 1:return 0;case 2:return t[1]}var r,n,i,s=o.mallocUint32(e),l=o.mallocUint32(e),u=0;for(a(t,l),i=0;e>i;++i)s[i]=t[i];for(i=e-1;i>0;--i)n=l[i],r=s[i],s[i]=s[n],s[n]=r,l[i]=l[r],l[r]=n,u=(u+r)*i;return o.freeUint32(l),o.freeUint32(s),u}function i(t,e,r){switch(t){case 0:return r?r:[];case 1:return r?(r[0]=0,r):[0];case 2:return r?(e?(r[0]=0,r[1]=1):(r[0]=1,r[1]=0),r):e?[0,1]:[1,0]}r=r||new Array(t);var n,i,o,a=1;for(r[0]=0,o=1;t>o;++o)r[o]=o,a=a*o|0;for(o=t-1;o>0;--o)n=e/a|0,e=e-n*a|0,a=a/o|0,i=0|r[o],r[o]=0|r[n],r[n]=0|i;return r}var o=t("typedarray-pool"),a=t("invert-permutation");r.rank=n,r.unrank=i},{"invert-permutation":228,"typedarray-pool":468}],411:[function(t,e,r){"use strict";function n(t,e){function r(t,e){var r=u[e][t[e]];r.splice(r.indexOf(t),1)}function n(t,n,o){for(var a,s,l,c=0;2>c;++c)if(u[c][n].length>0){a=u[c][n][0],l=c;break}s=a[1^l];for(var h=0;2>h;++h)for(var f=u[h][n],p=0;p0&&(a=d,s=m,l=h)}return o?s:(a&&r(a,l),s)}function o(t,o){var a=u[o][t][0],s=[t];r(a,o);for(var l=a[1^o];;){for(;l!==t;)s.push(l),l=n(s[s.length-2],l,!1);if(u[0][t].length+u[1][t].length===0)break;var c=s[s.length-1],h=t,f=s[1],p=n(c,h,!0);if(i(e[c],e[h],e[f],e[p])<0)break;s.push(t),l=n(c,h)}return s}function a(t,e){return e[1]===e[e.length-1]}for(var s=0|e.length,l=t.length,u=[new Array(s),new Array(s)],c=0;s>c;++c)u[0][c]=[],u[1][c]=[];for(var c=0;l>c;++c){var h=t[c];u[0][h[0]].push(h),u[1][h[1]].push(h)}for(var f=[],c=0;s>c;++c)u[0][c].length+u[1][c].length===0&&f.push([c]);for(var c=0;s>c;++c)for(var p=0;2>p;++p){for(var d=[];u[p][c].length>0;){var m=(u[0][c].length,o(c,p));a(d,m)?d.push.apply(d,m):(d.length>0&&f.push(d),d=m)}d.length>0&&f.push(d)}return f}e.exports=n;var i=t("compare-angle")},{"compare-angle":76}],412:[function(t,e,r){"use strict";function n(t,e){for(var r=i(t,e.length),n=new Array(e.length),o=new Array(e.length),a=[],s=0;s=l&&a.push(s)}for(;a.length>0;){var u=a.pop();n[u]=!1;for(var c=r[u],s=0;sn;++n)r[n]=e;return r}function i(t){for(var e=new Array(t),r=0;t>r;++r)e[r]=[];return e}function o(t,e){function r(t){for(var r=t.length,n=[0],i=0;r>i;++i){var o=e[t[i]],a=e[t[(i+1)%r]],s=u(-o[0],o[1]),l=u(-o[0],a[1]),h=u(a[0],o[1]),f=u(a[0],a[1]);n=c(n,c(c(s,l),c(h,f)))}return n[n.length-1]>0}function o(t){for(var e=t.length,r=0;e>r;++r)if(!R[t[r]])return!1;return!0}var p=f(t,e);t=p[0],e=p[1];for(var d=e.length,m=(t.length,a(t,e.length)),g=0;d>g;++g)if(m[g].length%2===1)throw new Error("planar-graph-to-polyline: graph must be manifold");var v=s(t,e);v=v.filter(r);for(var y=v.length,x=new Array(y),b=new Array(y),g=0;y>g;++g){x[g]=g;var _=new Array(y),w=v[g].map(function(t){return e[t]}),M=l([w]),A=0;t:for(var k=0;y>k;++k)if(_[k]=0,g!==k){for(var T=v[k],E=T.length,S=0;E>S;++S){var L=M(e[T[S]]);if(0!==L){0>L&&(_[k]=1,A+=1);continue t}}_[k]=1,A+=1}b[g]=[A,g,_]}b.sort(function(t,e){return e[0]-t[0]});for(var g=0;y>g;++g)for(var _=b[g],z=_[1],I=_[2],k=0;y>k;++k)I[k]&&(x[k]=z);for(var P=i(y),g=0;y>g;++g)P[g].push(x[g]),P[x[g]].push(g);for(var C={},R=n(d,!1),g=0;y>g;++g)for(var T=v[g],E=T.length,k=0;E>k;++k){var D=T[k],O=T[(k+1)%E],j=Math.min(D,O)+":"+Math.max(D,O);if(j in C){var F=C[j];P[F].push(g),P[g].push(F),R[D]=R[O]=!0}else C[j]=g}for(var N=[],B=n(y,-1),g=0;y>g;++g)x[g]!==g||o(v[g])?B[g]=-1:(N.push(g),B[g]=0);for(var p=[];N.length>0;){var U=N.pop(),V=P[U];h(V,function(t,e){return t-e});var q,G=V.length,H=B[U];if(0===H){var T=v[U];q=[T]}for(var g=0;G>g;++g){var X=V[g];if(!(B[X]>=0)&&(B[X]=1^H,N.push(X),0===H)){var T=v[X];o(T)||(T.reverse(),q.push(T))}}0===H&&p.push(q)}return p}e.exports=o;var a=t("edges-to-adjacency-list"),s=t("planar-dual"),l=t("point-in-big-polygon"),u=t("two-product"),c=t("robust-sum"),h=t("uniq"),f=t("./lib/trim-leaves")},{"./lib/trim-leaves":412,"edges-to-adjacency-list":95,"planar-dual":411,"point-in-big-polygon":415,"robust-sum":442,"two-product":466,uniq:470}],414:[function(t,e,r){"use strict";function n(t,e){this.x=t,this.y=e}e.exports=n,n.prototype={clone:function(){return new n(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=e*this.x-r*this.y,i=r*this.x+e*this.y;return this.x=n,this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},n.convert=function(t){return t instanceof n?t:Array.isArray(t)?new n(t[0],t[1]):t}},{}],415:[function(t,e,r){function n(){return!0}function i(t){return function(e,r){var i=t[e];return i?!!i.queryPoint(r,n):!1}}function o(t){for(var e={},r=0;rn)return 1;var i=t[n];if(!i){if(!(n>0&&e[n]===r[0]))return 1;i=t[n-1]}for(var o=1;i;){var a=i.key,s=h(r,a[0],a[1]);if(a[0][0]s)i=i.left;else{if(!(s>0))return 0;o=-1,i=i.right}else if(s>0)i=i.left;else{if(!(0>s))return 0;o=1,i=i.right}}return o}}function s(t){return 1}function l(t){return function(e){return t(e[0],e[1])?0:1}}function u(t,e){return function(r){return t(r[0],r[1])?0:e(r)}}function c(t){for(var e=t.length,r=[],n=[],i=0;e>i;++i)for(var c=t[i],h=c.length,p=h-1,d=0;h>d;p=d++){var m=c[p],g=c[d];m[0]===g[0]?n.push([m,g]):r.push([m,g])}if(0===r.length)return 0===n.length?s:l(o(n));var v=f(r),y=a(v.slabs,v.coordinates);return 0===n.length?y:u(o(n),y)}e.exports=c;var h=t("robust-orientation")[3],f=t("slab-decomposition"),p=t("interval-tree-1d"),d=t("binary-search-bounds")},{"binary-search-bounds":49,"interval-tree-1d":227,"robust-orientation":437,"slab-decomposition":454}],416:[function(t,e,r){"use strict";function n(t,e,r,n,s){i.length=b+_)if(0>b)0>_&&0>f?(_=0,-f>=u?(b=1,y=u+2*f+d):(b=-f/u,y=f*b+d)):(b=0,p>=0?(_=0,y=d):-p>=h?(_=1,y=h+2*p+d):(_=-p/h,y=p*_+d));else if(0>_)_=0,f>=0?(b=0,y=d):-f>=u?(b=1,y=u+2*f+d):(b=-f/u,y=f*b+d);else{var w=1/x;b*=w,_*=w,y=b*(u*b+c*_+2*f)+_*(c*b+h*_+2*p)+d}else{var M,A,k,T;0>b?(M=c+f,A=h+p,A>M?(k=A-M,T=u-2*c+h,k>=T?(b=1,_=0,y=u+2*f+d):(b=k/T,_=1-b,y=b*(u*b+c*_+2*f)+_*(c*b+h*_+2*p)+d)):(b=0,0>=A?(_=1,y=h+2*p+d):p>=0?(_=0,y=d):(_=-p/h,y=p*_+d))):0>_?(M=c+p,A=u+f,A>M?(k=A-M,T=u-2*c+h,k>=T?(_=1,b=0,y=h+2*p+d):(_=k/T,b=1-_,y=b*(u*b+c*_+2*f)+_*(c*b+h*_+2*p)+d)):(_=0,0>=A?(b=1,y=u+2*f+d):f>=0?(b=0,y=d):(b=-f/u,y=f*b+d))):(k=h+p-c-f,0>=k?(b=0,_=1,y=h+2*p+d):(T=u-2*c+h,k>=T?(b=1,_=0,y=u+2*f+d):(b=k/T,_=1-b,y=b*(u*b+c*_+2*f)+_*(c*b+h*_+2*p)+d)))}for(var E=1-b-_,l=0;ly?0:y}var i=new Float64Array(4),o=new Float64Array(4),a=new Float64Array(4);e.exports=n},{}],417:[function(t,e,r){function n(){c&&s&&(c=!1,s.length?u=s.concat(u):h=-1,u.length&&i())}function i(){if(!c){var t=setTimeout(n);c=!0;for(var e=u.length;e;){for(s=u,u=[];++h1)for(var r=1;r1&&(n=r[0]+"@",t=r[1]),t=t.replace(C,".");var i=t.split("."),o=a(i,e).join(".");return n+o}function l(t){for(var e,r,n=[],i=0,o=t.length;o>i;)e=t.charCodeAt(i++),e>=55296&&56319>=e&&o>i?(r=t.charCodeAt(i++),56320==(64512&r)?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),i--)):n.push(e);return n}function u(t){return a(t,function(t){var e="";return t>65535&&(t-=65536,e+=j(t>>>10&1023|55296),t=56320|1023&t),e+=j(t)}).join("")}function c(t){return 10>t-48?t-22:26>t-65?t-65:26>t-97?t-97:M}function h(t,e){return t+22+75*(26>t)-((0!=e)<<5)}function f(t,e,r){var n=0;for(t=r?O(t/E):t>>1,t+=O(t/e);t>D*k>>1;n+=M)t=O(t/D);return O(n+(D+1)*t/(t+T))}function p(t){var e,r,n,i,a,s,l,h,p,d,m=[],g=t.length,v=0,y=L,x=S;for(r=t.lastIndexOf(z),0>r&&(r=0),n=0;r>n;++n)t.charCodeAt(n)>=128&&o("not-basic"),m.push(t.charCodeAt(n));for(i=r>0?r+1:0;g>i;){for(a=v,s=1,l=M;i>=g&&o("invalid-input"),h=c(t.charCodeAt(i++)),(h>=M||h>O((w-v)/s))&&o("overflow"),v+=h*s,p=x>=l?A:l>=x+k?k:l-x,!(p>h);l+=M)d=M-p,s>O(w/d)&&o("overflow"),s*=d;e=m.length+1,x=f(v-a,e,0==a),O(v/e)>w-y&&o("overflow"),y+=O(v/e),v%=e,m.splice(v++,0,y)}return u(m)}function d(t){var e,r,n,i,a,s,u,c,p,d,m,g,v,y,x,b=[];for(t=l(t),g=t.length,e=L,r=0,a=S,s=0;g>s;++s)m=t[s],128>m&&b.push(j(m));for(n=i=b.length,i&&b.push(z);g>n;){for(u=w,s=0;g>s;++s)m=t[s],m>=e&&u>m&&(u=m);for(v=n+1,u-e>O((w-r)/v)&&o("overflow"),r+=(u-e)*v,e=u,s=0;g>s;++s)if(m=t[s],e>m&&++r>w&&o("overflow"),m==e){for(c=r,p=M;d=a>=p?A:p>=a+k?k:p-a,!(d>c);p+=M)x=c-d,y=M-d,b.push(j(h(d+x%y,0))),c=O(x/y);b.push(j(h(c,0))),a=f(r,v,n==i),r=0,++n}++r,++e}return b.join("")}function m(t){return s(t,function(t){return I.test(t)?p(t.slice(4).toLowerCase()):t})}function g(t){return s(t,function(t){return P.test(t)?"xn--"+d(t):t})}var v="object"==typeof n&&n&&!n.nodeType&&n,y="object"==typeof r&&r&&!r.nodeType&&r,x="object"==typeof e&&e;x.global!==x&&x.window!==x&&x.self!==x||(i=x);var b,_,w=2147483647,M=36,A=1,k=26,T=38,E=700,S=72,L=128,z="-",I=/^xn--/,P=/[^\x20-\x7E]/,C=/[\x2E\u3002\uFF0E\uFF61]/g,R={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},D=M-A,O=Math.floor,j=String.fromCharCode;if(b={version:"1.4.1",ucs2:{decode:l,encode:u},decode:p,encode:d,toASCII:g,toUnicode:m},"function"==typeof t&&"object"==typeof t.amd&&t.amd)t("punycode",function(){return b});else if(v&&y)if(r.exports==v)y.exports=b;else for(_ in b)b.hasOwnProperty(_)&&(v[_]=b[_]);else i.punycode=b}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],419:[function(t,e,r){e.exports=t("gl-quat/slerp")},{"gl-quat/slerp":177}],420:[function(t,e,r){"use strict";function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.exports=function(t,e,r,o){e=e||"&",r=r||"=";var a={};if("string"!=typeof t||0===t.length)return a;var s=/\+/g;t=t.split(e);var l=1e3;o&&"number"==typeof o.maxKeys&&(l=o.maxKeys);var u=t.length;l>0&&u>l&&(u=l);for(var c=0;u>c;++c){var h,f,p,d,m=t[c].replace(s,"%20"),g=m.indexOf(r);g>=0?(h=m.substr(0,g),f=m.substr(g+1)):(h=m,f=""),p=decodeURIComponent(h),d=decodeURIComponent(f),n(a,p)?i(a[p])?a[p].push(d):a[p]=[a[p],d]:a[p]=d}return a};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],421:[function(t,e,r){"use strict";function n(t,e){if(t.map)return t.map(e);for(var r=[],n=0;nr;){if(a-r>600){var l=a-r+1,u=e-r+1,c=Math.log(l),h=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*h*(l-h)/l)*(0>u-l/2?-1:1),p=Math.max(r,Math.floor(e-u*h/l+f)),d=Math.min(a,Math.floor(e+(l-u)*h/l+f));n(t,e,p,d,s)}var m=t[e],g=r,v=a;for(i(t,r,e),s(t[a],m)>0&&i(t,r,a);v>g;){for(i(t,g,v),g++,v--;s(t[g],m)<0;)g++;for(;s(t[v],m)>0;)v--}0===s(t[r],m)?i(t,r,v):(v++,i(t,v,a)),e>=v&&(r=v+1),v>=e&&(a=v-1)}}function i(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function o(t,e){return e>t?-1:t>e?1:0}e.exports=n},{}],424:[function(t,e,r){"use strict";function n(t,e){for(var r=t.length,n=new Array(r),o=0;r>o;++o)n[o]=i(t[o],e[o]);return n}var i=t("big-rat/add");e.exports=n},{"big-rat/add":33}],425:[function(t,e,r){"use strict";function n(t){for(var e=new Array(t.length),r=0;rs;++s)a[s]=o(t[s],r);return a}var i=t("big-rat"),o=t("big-rat/mul");e.exports=n},{"big-rat":36,"big-rat/mul":45}],427:[function(t,e,r){"use strict";function n(t,e){for(var r=t.length,n=new Array(r),o=0;r>o;++o)n[o]=i(t[o],e[o]);return n}var i=t("big-rat/sub");e.exports=n},{"big-rat/sub":47}],428:[function(t,e,r){"use strict";function n(t){t.sort(o);for(var e=t.length,r=0,n=0;e>n;++n){var s=t[n],l=a(s);if(0!==l){if(r>0){var u=t[r-1];if(0===i(s,u)&&a(u)!==l){r-=1;continue}}t[r++]=s}}return t.length=r,t}var i=t("compare-cell"),o=t("compare-oriented-cell"),a=t("cell-orientation");e.exports=n},{"cell-orientation":68,"compare-cell":77,"compare-oriented-cell":78}],429:[function(t,e,r){"use strict";function n(t,e){if("string"!=typeof t)throw new TypeError("repeat-string expects a string.");if(1===e)return t;if(2===e)return t+t;var r=t.length*e;for(i===t&&"undefined"!=typeof i||(i=t,o="");r>o.length&&e>0&&(1&e&&(o+=t),e>>=1);)t+=t;return o.substr(0,r)}var i,o="";e.exports=n},{}],430:[function(e,r,n){void function(e,i){"function"==typeof t&&t.amd?t(i):"object"==typeof n?r.exports=i():e.resolveUrl=i()}(this,function(){function t(){var t=arguments.length;if(0===t)throw new Error("resolveUrl requires at least one argument; got none.");var e=document.createElement("base");if(e.href=arguments[0],1===t)return e.href;var r=document.getElementsByTagName("head")[0];r.insertBefore(e,r.firstChild);for(var n,i=document.createElement("a"),o=1;t>o;o++)i.href=arguments[o],n=i.href,e.href=n;return r.removeChild(e),n}return t})},{}],431:[function(t,e,r){(function(t){e.exports=t.performance&&t.performance.now?function(){return performance.now()}:Date.now||function(){return+new Date}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],432:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=t[t.length-1],n=e,i=e-2;i>=0;--i){var o=r,a=t[i];r=o+a;var s=r-o,l=a-s;l&&(t[--n]=r,r=l)}for(var u=0,i=n;e>i;++i){var o=t[i],a=r;r=o+a;var s=r-o,l=a-s;l&&(t[u++]=l)}return t[u++]=r,t.length=u,t}e.exports=n},{}],433:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t.length-1),n=1;nr;++r){e[r]=new Array(t);for(var n=0;t>n;++n)e[r][n]=["m[",r,"][",n,"]"].join("")}return e}function o(t){return 1&t?"-":""}function a(t){if(1===t.length)return t[0];if(2===t.length)return["sum(",t[0],",",t[1],")"].join("");var e=t.length>>1;return["sum(",a(t.slice(0,e)),",",a(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("");for(var e=[],r=0;rn;++n)t.push("det"+n),r.push("case ",n,":return det",n,"(m);");r.push("}var det=CACHE[m.length];if(!det)det=CACHE[m.length]=gen(m.length);return det(m);}return robustDeterminant"),t.push("CACHE","gen",r.join(""));var i=Function.apply(void 0,t);e.exports=i.apply(void 0,m.concat([m,l]));for(var n=0;nr;++r){e[r]=new Array(t);for(var n=0;t>n;++n)e[r][n]=["m",n,"[",t-r-2,"]"].join("")}return e}function o(t){if(1===t.length)return t[0];if(2===t.length)return["sum(",t[0],",",t[1],")"].join("");var e=t.length>>1;return["sum(",o(t.slice(0,e)),",",o(t.slice(e)),")"].join("")}function a(t,e){if("m"===t.charAt(0)){if("w"===e.charAt(0)){var r=t.split("[");return["w",e.substr(1),"m",r[0].substr(1)].join("")}return["prod(",t,",",e,")"].join("")}return a(e,t)}function s(t){return t&!0?"-":""}function l(t){if(2===t.length)return[["diff(",a(t[0][0],t[1][1]),",",a(t[1][0],t[0][1]),")"].join("")];for(var e=[],r=0;rn;++n)r.push(["prod(m",t,"[",n,"],m",t,"[",n,"])"].join(""));return o(r)}function c(t){for(var e=[],r=[],a=i(t),s=0;t>s;++s)a[0][s]="1",a[t-1][s]="w"+s;for(var s=0;t>s;++s)0===(1&s)?e.push.apply(e,l(n(a,s))):r.push.apply(r,l(n(a,s)));for(var c=o(e),h=o(r),f="exactInSphere"+t,p=[],s=0;t>s;++s)p.push("m"+s);for(var d=["function ",f,"(",p.join(),"){"],s=0;t>s;++s){d.push("var w",s,"=",u(s,t),";");for(var m=0;t>m;++m)m!==s&&d.push("var w",s,"m",m,"=scale(w",s,",m",m,"[0]);")}d.push("var p=",c,",n=",h,",d=diff(p,n);return d[d.length-1];}return ",f);var b=new Function("sum","diff","prod","scale",d.join(""));return b(v,y,g,x)}function h(){return 0}function f(){return 0}function p(){return 0}function d(t){var e=_[t.length];return e||(e=_[t.length]=c(t.length)),e.apply(void 0,t)}function m(){for(;_.length<=b;)_.push(c(_.length));for(var t=[],r=["slow"],n=0;b>=n;++n)t.push("a"+n),r.push("o"+n);for(var i=["function testInSphere(",t.join(),"){switch(arguments.length){case 0:case 1:return 0;"],n=2;b>=n;++n)i.push("case ",n,":return o",n,"(",t.slice(0,n).join(),");");i.push("}var s=new Array(arguments.length);for(var i=0;i=n;++n)e.exports[n]=_[n]}var g=t("two-product"),v=t("robust-sum"),y=t("robust-subtract"),x=t("robust-scale"),b=6,_=[h,f,p];m()},{"robust-scale":439,"robust-subtract":441,"robust-sum":442,"two-product":466}],436:[function(t,e,r){"use strict";function n(t){for(var e="robustLinearSolve"+t+"d",r=["function ",e,"(A,b){return ["],n=0;t>n;++n){r.push("det([");for(var i=0;t>i;++i){i>0&&r.push(","),r.push("[");for(var o=0;t>o;++o)o>0&&r.push(","),o===n?r.push("+b[",i,"]"):r.push("+A[",i,"][",o,"]");r.push("]")}r.push("]),")}r.push("det(A)]}return ",e);var a=new Function("det",r.join(""));return a(6>t?s[t]:s)}function i(){return[0]}function o(t,e){return[[e[0]],[t[0][0]]]}function a(){for(;u.lengthi;++i)t.push("s"+i),r.push("case ",i,":return s",i,"(A,b);");r.push("}var s=CACHE[A.length];if(!s)s=CACHE[A.length]=g(A.length);return s(A,b)}return dispatchLinearSolve"),t.push("CACHE","g",r.join(""));var o=Function.apply(void 0,t);e.exports=o.apply(void 0,u.concat([u,n]));for(var i=0;l>i;++i)e.exports[i]=u[i]}var s=t("robust-determinant"),l=6,u=[i,o];a()},{"robust-determinant":433}],437:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t.length-1),n=1;nr;++r){e[r]=new Array(t);for(var n=0;t>n;++n)e[r][n]=["m",n,"[",t-r-1,"]"].join("")}return e}function o(t){return 1&t?"-":""}function a(t){if(1===t.length)return t[0];if(2===t.length)return["sum(",t[0],",",t[1],")"].join("");var e=t.length>>1;return["sum(",a(t.slice(0,e)),",",a(t.slice(e)),")"].join("")}function s(t){if(2===t.length)return[["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("")];for(var e=[],r=0;ru;++u)0===(1&u)?e.push.apply(e,s(n(o,u))):r.push.apply(r,s(n(o,u))),l.push("m"+u);var c=a(e),m=a(r),g="orientation"+t+"Exact",v=["function ",g,"(",l.join(),"){var p=",c,",n=",m,",d=sub(p,n);return d[d.length-1];};return ",g].join(""),y=new Function("sum","prod","scale","sub",v);return y(f,h,p,d)}function u(t){var e=_[t.length];return e||(e=_[t.length]=l(t.length)),e.apply(void 0,t)}function c(){for(;_.length<=m;)_.push(l(_.length));for(var t=[],r=["slow"],n=0;m>=n;++n)t.push("a"+n),r.push("o"+n);for(var i=["function getOrientation(",t.join(),"){switch(arguments.length){case 0:case 1:return 0;"],n=2;m>=n;++n)i.push("case ",n,":return o",n,"(",t.slice(0,n).join(),");");i.push("}var s=new Array(arguments.length);for(var i=0;i=n;++n)e.exports[n]=_[n]}var h=t("two-product"),f=t("robust-sum"),p=t("robust-scale"),d=t("robust-subtract"),m=5,g=1.1102230246251565e-16,v=(3+16*g)*g,y=(7+56*g)*g,x=l(3),b=l(4),_=[function(){return 0},function(){return 0},function(t,e){return e[0]-t[0]},function(t,e,r){var n,i=(t[1]-r[1])*(e[0]-r[0]),o=(t[0]-r[0])*(e[1]-r[1]),a=i-o;if(i>0){if(0>=o)return a;n=i+o}else{if(!(0>i))return a;if(o>=0)return a;n=-(i+o)}var s=v*n;return a>=s||-s>=a?a:x(t,e,r)},function(t,e,r,n){var i=t[0]-n[0],o=e[0]-n[0],a=r[0]-n[0],s=t[1]-n[1],l=e[1]-n[1],u=r[1]-n[1],c=t[2]-n[2],h=e[2]-n[2],f=r[2]-n[2],p=o*u,d=a*l,m=a*s,g=i*u,v=i*l,x=o*s,_=c*(p-d)+h*(m-g)+f*(v-x),w=(Math.abs(p)+Math.abs(d))*Math.abs(c)+(Math.abs(m)+Math.abs(g))*Math.abs(h)+(Math.abs(v)+Math.abs(x))*Math.abs(f),M=y*w;return _>M||-_>M?_:b(t,e,r,n)}];c()},{"robust-scale":439,"robust-subtract":441,"robust-sum":442,"two-product":466}],438:[function(t,e,r){"use strict";function n(t,e){if(1===t.length)return o(e,t[0]);if(1===e.length)return o(t,e[0]);if(0===t.length||0===e.length)return[0];var r=[0];if(t.lengthc;++c){i(t[c],e,l);var h=s[1];o(h,l[0],s),s[0]&&(a[u++]=s[0]);var f=l[1],p=s[1],d=f+p,m=d-f,g=p-m;s[1]=d,g&&(a[u++]=g)}return s[1]&&(a[u++]=s[1]),0===u&&(a[u++]=0),a.length=u,a}var i=t("two-product"),o=t("two-sum");e.exports=n},{"two-product":466,"two-sum":467}],440:[function(t,e,r){"use strict";function n(t,e,r,n){for(var i=0;2>i;++i){var o=t[i],a=e[i],s=Math.min(o,a),l=Math.max(o,a),u=r[i],c=n[i],h=Math.min(u,c),f=Math.max(u,c);if(s>f||h>l)return!1}return!0}function i(t,e,r,i){var a=o(t,r,i),s=o(e,r,i);if(a>0&&s>0||0>a&&0>s)return!1;var l=o(r,t,e),u=o(i,t,e);return l>0&&u>0||0>l&&0>u?!1:0===a&&0===s&&0===l&&0===u?n(t,e,r,i):!0}e.exports=i;var o=t("robust-orientation")[3]},{"robust-orientation":437}],441:[function(t,e,r){"use strict";function n(t,e){var r=t+e,n=r-t,i=r-n,o=e-n,a=t-i,s=a+o;return s?[s,r]:[r]}function i(t,e){var r=0|t.length,i=0|e.length;if(1===r&&1===i)return n(t[0],-e[0]);var o,a,s=r+i,l=new Array(s),u=0,c=0,h=0,f=Math.abs,p=t[c],d=f(p),m=-e[h],g=f(m);g>d?(a=p,c+=1,r>c&&(p=t[c],d=f(p))):(a=m,h+=1,i>h&&(m=-e[h],g=f(m))),r>c&&g>d||h>=i?(o=p,c+=1,r>c&&(p=t[c],d=f(p))):(o=m,h+=1,i>h&&(m=-e[h],g=f(m)));for(var v,y,x,b,_,w=o+a,M=w-o,A=a-M,k=A,T=w;r>c&&i>h;)g>d?(o=p,c+=1,r>c&&(p=t[c],d=f(p))):(o=m,h+=1,i>h&&(m=-e[h],g=f(m))),a=k,w=o+a,M=w-o,A=a-M,A&&(l[u++]=A),v=T+w,y=v-T,x=v-y,b=w-y,_=T-x,k=_+b,T=v;for(;r>c;)o=p,a=k,w=o+a,M=w-o,A=a-M,A&&(l[u++]=A),v=T+w,y=v-T,x=v-y,b=w-y,_=T-x,k=_+b,T=v,c+=1,r>c&&(p=t[c]);for(;i>h;)o=m,a=k,w=o+a,M=w-o,A=a-M,A&&(l[u++]=A),v=T+w,y=v-T,x=v-y,b=w-y,_=T-x,k=_+b,T=v,h+=1,i>h&&(m=-e[h]);return k&&(l[u++]=k),T&&(l[u++]=T),u||(l[u++]=0),l.length=u,l}e.exports=i},{}],442:[function(t,e,r){"use strict";function n(t,e){var r=t+e,n=r-t,i=r-n,o=e-n,a=t-i,s=a+o;return s?[s,r]:[r]}function i(t,e){var r=0|t.length,i=0|e.length;if(1===r&&1===i)return n(t[0],e[0]);var o,a,s=r+i,l=new Array(s),u=0,c=0,h=0,f=Math.abs,p=t[c],d=f(p),m=e[h],g=f(m);g>d?(a=p,c+=1,r>c&&(p=t[c],d=f(p))):(a=m,h+=1,i>h&&(m=e[h],g=f(m))),r>c&&g>d||h>=i?(o=p,c+=1,r>c&&(p=t[c],d=f(p))):(o=m,h+=1,i>h&&(m=e[h],g=f(m)));for(var v,y,x,b,_,w=o+a,M=w-o,A=a-M,k=A,T=w;r>c&&i>h;)g>d?(o=p,c+=1,r>c&&(p=t[c],d=f(p))):(o=m,h+=1,i>h&&(m=e[h],g=f(m))),a=k,w=o+a,M=w-o,A=a-M,A&&(l[u++]=A),v=T+w,y=v-T,x=v-y,b=w-y,_=T-x,k=_+b,T=v;for(;r>c;)o=p,a=k,w=o+a,M=w-o,A=a-M,A&&(l[u++]=A),v=T+w,y=v-T,x=v-y,b=w-y,_=T-x,k=_+b,T=v,c+=1,r>c&&(p=t[c]);for(;i>h;)o=m,a=k,w=o+a,M=w-o,A=a-M,A&&(l[u++]=A),v=T+w,y=v-T,x=v-y,b=w-y,_=T-x,k=_+b,T=v,h+=1,i>h&&(m=e[h]);return k&&(l[u++]=k),T&&(l[u++]=T),u||(l[u++]=0),l.length=u,l}e.exports=i},{}],443:[function(e,r,n){!function(e,i){"object"==typeof n&&"undefined"!=typeof r?r.exports=i():"function"==typeof t&&t.amd?t(i):e.ShelfPack=i()}(this,function(){function t(t,e,r){r=r||{},this.w=t||64,this.h=e||64,this.autoResize=!!r.autoResize,this.shelves=[],this.stats={},this.count=function(t){this.stats[t]=(0|this.stats[t])+1}}function e(t,e,r){this.x=0,this.y=t,this.w=this.free=e,this.h=r}return t.prototype.pack=function(t,e){t=[].concat(t),e=e||{};for(var r,n,i,o=[],a=0;a0){for(var s=0,l=0,u=0;un.h||t>n.free||r=c||t>c)&&(h=2*Math.max(t,c)),(c>l||r>l)&&(u=2*Math.max(r,l)),this.resize(h,u),this.packOne(t,r)}return null},t.prototype.clear=function(){this.shelves=[],this.stats={}},t.prototype.resize=function(t,e){this.w=t,this.h=e;for(var r=0;rthis.free||e>this.h)return null;var r=this.x;return this.x+=t,this.free-=t,{x:r,y:this.y,w:t,h:e,width:t,height:e}},e.prototype.resize=function(t){return this.free+=t-this.w,this.w=t,!0},t})},{}],444:[function(t,e,r){"use strict";e.exports=function(t){return 0>t?-1:t>0?1:0}},{}],445:[function(t,e,r){"use strict";function n(t){return o(i(t))}e.exports=n;var i=t("boundary-cells"),o=t("reduce-simplicial-complex")},{"boundary-cells":52,"reduce-simplicial-complex":428}],446:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=0,n=0;e>n;++n)r=0|Math.max(r,t[n].length);return r-1}function i(t,e){for(var r=t.length,n=h.mallocUint8(r),i=0;r>i;++i)n[i]=t[i]a;++a)for(var s=t[a],e=s.length,l=0;e>l;++l)for(var u=0;l>u;++u){var p=s[u],d=s[l];i[o++]=0|Math.min(p,d),i[o++]=0|Math.max(p,d)}var m=o/2|0;f(c(i,[m,2]));for(var g=2,a=2;o>a;a+=2)i[a-2]===i[a]&&i[a-1]===i[a+1]||(i[g++]=i[a],i[g++]=i[a+1]);return c(i,[g/2|0,2])}function a(t,e,r,n){for(var i=t.data,o=t.shape[0],a=h.mallocDouble(o),s=0,l=0;o>l;++l){var u=i[2*l],f=i[2*l+1];if(r[u]!==r[f]){var p=e[u],d=e[f];i[2*s]=u,i[2*s+1]=f,a[s++]=(d-n)/(d-p)}}return t.shape[0]=s,c(a,[s])}function s(t,e){var r=h.mallocInt32(2*e),n=t.shape[0],i=t.data;r[0]=0;for(var o=0,a=0;n>a;++a){var s=i[2*a];if(s!==o){for(r[2*o+1]=a;++oi;++i)n[i]=[r[2*i],r[2*i+1]];return n}function u(t,e,r,u){r=r||0,"undefined"==typeof u&&(u=n(t));var c=t.length;if(0===c||1>u)return{cells:[],vertexIds:[],vertexWeights:[]};var f=i(e,+r),d=o(t,u),m=a(d,e,f,+r),g=s(d,0|e.length),v=p(u)(t,d.data,g,f),y=l(d),x=[].slice.call(m.data,0,m.shape[0]);return h.free(f),h.free(d.data),h.free(m.data),h.free(g),{cells:v,vertexIds:y,vertexWeights:x}}e.exports=u;var c=t("ndarray"),h=t("typedarray-pool"),f=t("ndarray-sort"),p=t("./lib/codegen")},{"./lib/codegen":447,ndarray:399,"ndarray-sort":397,"typedarray-pool":468}],447:[function(t,e,r){"use strict";function n(t){function e(t){if(!(t.length<=0)){u.push("R.push(");for(var e=0;e0&&u.push(","),u.push("[");for(var n=0;n0&&u.push(","),u.push("B(C,E,c[",i[0],"],c[",i[1],"])")}u.push("]")}u.push(");")}}var r=0,n=new Array(t+1);n[0]=[[]];for(var i=1;t>=i;++i)for(var s=n[i]=a(i),l=0;l>1,v=E[2*m+1];","if(v===b){return m}","if(b1;--i){t+1>i&&u.push("else "),u.push("if(l===",i,"){");for(var c=[],l=0;i>l;++l)c.push("(S[c["+l+"]]<<"+l+")");u.push("var M=",c.join("+"),";if(M===0||M===",(1<n;++n)e=r(e,t[n].length);return e-1}function i(t){for(var e=-1,r=Math.max,n=0,i=t.length;i>n;++n)for(var o=t[n],a=0,s=o.length;s>a;++a)e=r(e,o[a]);return e+1}function o(t){for(var e=new Array(t.length),r=0,n=t.length;n>r;++r)e[r]=t[r].slice(0);return e}function a(t,e){var r=t.length,n=t.length-e.length,i=Math.min;if(n)return n;switch(r){case 0:return 0;case 1:return t[0]-e[0];case 2:var o=t[0]+t[1]-e[0]-e[1];return o?o:i(t[0],t[1])-i(e[0],e[1]);case 3:var a=t[0]+t[1],s=e[0]+e[1];if(o=a+t[2]-(s+e[2]))return o;var l=i(t[0],t[1]),u=i(e[0],e[1]),o=i(l,t[2])-i(u,e[2]);return o?o:i(l+t[2],a)-i(u+e[2],s);default:var c=t.slice(0);c.sort();var h=e.slice(0);h.sort();for(var f=0;r>f;++f)if(n=c[f]-h[f])return n;return 0}}function s(t,e){return a(t[0],e[0])}function l(t,e){if(e){for(var r=t.length,n=new Array(r),i=0;r>i;++i)n[i]=[t[i],e[i]];n.sort(s);for(var i=0;r>i;++i)t[i]=n[i][0],e[i]=n[i][1];return t}return t.sort(a),t}function u(t){if(0===t.length)return[];for(var e=1,r=t.length,n=1;r>n;++n){var i=t[n];if(a(i,t[n-1])){if(n===e){e++;continue}t[e++]=i}}return t.length=e,t}function c(t,e){for(var r=0,n=t.length-1,i=-1;n>=r;){var o=r+n>>1,s=a(t[o],e);0>=s?(0===s&&(i=o),r=o+1):s>0&&(n=o-1)}return i}function h(t,e){for(var r=new Array(t.length),n=0,i=r.length;i>n;++n)r[n]=[];for(var o=[],n=0,s=e.length;s>n;++n)for(var l=e[n],u=l.length,h=1,f=1<h;++h){o.length=x.popCount(h);for(var p=0,d=0;u>d;++d)h&1<m))for(;;)if(r[m++].push(n),m>=t.length||0!==a(t[m],o))break}return r}function f(t,e){if(!e)return h(u(d(t,0)),t,0);for(var r=new Array(e),n=0;e>n;++n)r[n]=[];for(var n=0,i=t.length;i>n;++n)for(var o=t[n],a=0,s=o.length;s>a;++a)r[o[a]].push(n);return r}function p(t){for(var e=[],r=0,n=t.length;n>r;++r)for(var i=t[r],o=0|i.length,a=1,s=1<a;++a){for(var u=[],c=0;o>c;++c)a>>>c&1&&u.push(i[c]);e.push(u)}return l(e)}function d(t,e){if(0>e)return[];for(var r=[],n=(1<r;++r)for(var i=t[r],o=0,a=i.length;a>o;++o){for(var s=new Array(i.length-1),u=0,c=0;a>u;++u)u!==o&&(s[c++]=i[u]);e.push(s)}return l(e)}function g(t,e){for(var r=new b(e),n=0;ne;++e)this.roots[e]=e,this.ranks[e]=0}e.exports=n,n.prototype.length=function(){return this.roots.length},n.prototype.makeSet=function(){var t=this.roots.length;return this.roots.push(t),this.ranks.push(0),t},n.prototype.find=function(t){for(var e=this.roots;e[t]!==t;){var r=e[t];e[t]=e[r],t=r}return t},n.prototype.link=function(t,e){var r=this.find(t),n=this.find(e);if(r!==n){var i=this.ranks,o=this.roots,a=i[r],s=i[n];s>a?o[r]=n:a>s?o[n]=r:(o[n]=r,++i[r])}}},{}],452:[function(t,e,r){"use strict";function n(t,e,r){var n=Math.abs(o(t,e,r)),i=Math.sqrt(Math.pow(e[0]-r[0],2)+Math.pow(e[1]-r[1],2));return n/i}function i(t,e,r){function i(t){if(b[t])return 1/0;var r=v[t],i=y[t];return 0>r||0>i?1/0:n(e[t],e[r],e[i])}function o(t,e){var r=k[t],n=k[e];k[t]=n,k[e]=r,T[r]=e,T[n]=t}function s(t){return x[k[t]]}function l(t){return 1&t?t-1>>1:(t>>1)-1}function u(t){for(var e=s(t);;){var r=e,n=2*t+1,i=2*(t+1),a=t;if(S>n){var l=s(n);r>l&&(a=n,r=l)}if(S>i){var u=s(i);r>u&&(a=i)}if(a===t)return t;o(t,a),t=a}}function c(t){for(var e=s(t);t>0;){var r=l(t);if(r>=0){var n=s(r);if(n>e){o(t,r),t=r;continue}}return t}}function h(){if(S>0){var t=k[0];return o(0,S-1),S-=1,u(0),t}return-1}function f(t,e){var r=k[t];return x[r]===e?t:(x[r]=-(1/0),c(t),h(),x[r]=e,S+=1,c(S-1))}function p(t){if(!b[t]){b[t]=!0;var e=v[t],r=y[t];v[r]>=0&&(v[r]=e),y[e]>=0&&(y[e]=r),T[e]>=0&&f(T[e],i(e)),T[r]>=0&&f(T[r],i(r))}}function d(t,e){if(t[e]<0)return e;var r=e,n=e;do{var i=t[n];if(!b[n]||0>i||i===n)break;if(n=i,i=t[n],!b[n]||0>i||i===n)break;n=i,r=t[r]}while(r!==n);for(var o=e;o!==n;o=t[o])t[o]=n;return n}for(var m=e.length,g=t.length,v=new Array(m),y=new Array(m),x=new Array(m),b=new Array(m),_=0;m>_;++_)v[_]=y[_]=-1,x[_]=1/0,b[_]=!1;for(var _=0;g>_;++_){var w=t[_];if(2!==w.length)throw new Error("Input must be a graph");var M=w[1],A=w[0];-1!==y[A]?y[A]=-2:y[A]=M,-1!==v[M]?v[M]=-2:v[M]=A}for(var k=[],T=new Array(m),_=0;m>_;++_){var E=x[_]=i(_);1/0>E?(T[_]=k.length,k.push(_)):T[_]=-1}for(var S=k.length,_=S>>1;_>=0;--_)u(_);for(;;){var L=h();if(0>L||x[L]>r)break;p(L)}for(var z=[],_=0;m>_;++_)b[_]||(T[_]=z.length,z.push(e[_].slice()));var I=(z.length,[]);return t.forEach(function(t){var e=d(v,t[0]),r=d(y,t[1]);if(e>=0&&r>=0&&e!==r){var n=T[e],i=T[r];n!==i&&I.push([n,i])}}),a.unique(a.normalize(I)),{positions:z,edges:I}}e.exports=i;var o=t("robust-orientation"),a=t("simplicial-complex")},{"robust-orientation":437,"simplicial-complex":450}],453:[function(t,e,r){"use strict";function n(t,e){var r,n;if(e[0][0]e[1][0])){var i=Math.min(t[0][1],t[1][1]),a=Math.max(t[0][1],t[1][1]),s=Math.min(e[0][1],e[1][1]),l=Math.max(e[0][1],e[1][1]);return s>a?a-s:i>l?i-l:a-l}r=e[1],n=e[0]}var u,c;t[0][1]e[1][0]))return n(e,t);r=e[1],i=e[0]}var a,s;if(t[0][0]t[1][0]))return-n(t,e);a=t[1],s=t[0]}var l=o(r,i,s),u=o(r,i,a);if(0>l){if(0>=u)return l}else if(l>0){if(u>=0)return l}else if(u)return u;if(l=o(s,a,i),u=o(s,a,r),0>l){if(0>=u)return l}else if(l>0){if(u>=0)return l}else if(u)return u;return i[0]-s[0]}e.exports=i;var o=t("robust-orientation")},{"robust-orientation":437}],454:[function(t,e,r){"use strict";function n(t,e,r){this.slabs=t,this.coordinates=e,this.horizontal=r}function i(t,e){return t.y-e}function o(t,e){for(var r=null;t;){var n,i,a=t.key;a[0][0]s)t=t.left;else if(s>0)if(e[0]!==a[1][0])r=t,t=t.right;else{var l=o(t.right,e);if(l)return l;t=t.left}else{if(e[0]!==a[1][0])return t;var l=o(t.right,e);if(l)return l;t=t.left}}return r}function a(t,e,r,n){this.y=t,this.index=e,this.start=r,this.closed=n}function s(t,e,r,n){this.x=t,this.segment=e,this.create=r,this.index=n}function l(t){for(var e=t.length,r=2*e,i=new Array(r),o=0;e>o;++o){var l=t[o],u=l[0][0]o;){for(var g=i[o].x,v=[];r>o;){var y=i[o];if(y.x!==g)break;o+=1,y.segment[0][0]===y.x&&y.segment[1][0]===y.x?y.create&&(y.segment[0][1]e)return-1;var r=(this.slabs[e],o(this.slabs[e],t)),n=-1;if(r&&(n=r.value),this.coordinates[e]===t[0]){var a=null;if(r&&(a=r.key),e>0){var s=o(this.slabs[e-1],t);s&&(a?f(s.key,a)>0&&(a=s.key,n=s.value):(n=s.value,a=s.key))}var l=this.horizontal[e];if(l.length>0){var c=u.ge(l,t[1],i);if(c=l.length)return n;p=l[c]}}if(p.start)if(a){var d=h(a[0],a[1],[t[0],p.y]);a[0][0]>a[1][0]&&(d=-d),d>0&&(n=p.index)}else n=p.index;else p.y!==t[1]&&(n=p.index)}}}return n}},{"./lib/order-segments":453,"binary-search-bounds":49,"functional-red-black-tree":102,"robust-orientation":437}],455:[function(t,e,r){"use strict";function n(t,e){var r=u(l(t,e),[e[e.length-1]]);return r[r.length-1]}function i(t,e,r,n){var i=n-e,o=-e/i;0>o?o=0:o>1&&(o=1);for(var a=1-o,s=t.length,l=new Array(s),u=0;s>u;++u)l[u]=o*t[u]+a*r[u];return l}function o(t,e){for(var r=[],o=[],a=n(t[t.length-1],e),s=t[t.length-1],l=t[0],u=0;ua&&c>0||a>0&&0>c){var h=i(s,c,l,a);r.push(h),o.push(h.slice())}0>c?o.push(l.slice()):c>0?r.push(l.slice()):(r.push(l.slice()),o.push(l.slice())),a=c}return{positive:r,negative:o}}function a(t,e){for(var r=[],o=n(t[t.length-1],e),a=t[t.length-1],s=t[0],l=0;lo&&u>0||o>0&&0>u)&&r.push(i(a,u,s,o)),u>=0&&r.push(s.slice()),o=u}return r}function s(t,e){for(var r=[],o=n(t[t.length-1],e),a=t[t.length-1],s=t[0],l=0;lo&&u>0||o>0&&0>u)&&r.push(i(a,u,s,o)),0>=u&&r.push(s.slice()),o=u}return r}var l=t("robust-dot-product"),u=t("robust-sum");e.exports=o,e.exports.positive=a,e.exports.negative=s},{"robust-dot-product":434,"robust-sum":442}],456:[function(e,r,n){!function(e){function r(){var t=arguments[0],e=r.cache;return e[t]&&e.hasOwnProperty(t)||(e[t]=r.parse(t)),r.format.call(null,e[t],arguments)}function i(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}function o(t,e){return Array(e+1).join(t)}var a={not_string:/[^s]/,number:/[diefg]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/};r.format=function(t,e){var n,s,l,u,c,h,f,p=1,d=t.length,m="",g=[],v=!0,y="";for(s=0;d>s;s++)if(m=i(t[s]),"string"===m)g[g.length]=t[s];else if("array"===m){if(u=t[s],u[2])for(n=e[p],l=0;l=0),u[8]){case"b":n=n.toString(2);break;case"c":n=String.fromCharCode(n);break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,u[6]?parseInt(u[6]):0);break;case"e":n=u[7]?n.toExponential(u[7]):n.toExponential();break;case"f":n=u[7]?parseFloat(n).toFixed(u[7]):parseFloat(n);break;case"g":n=u[7]?parseFloat(n).toPrecision(u[7]):parseFloat(n);break;case"o":n=n.toString(8);break;case"s":n=(n=String(n))&&u[7]?n.substring(0,u[7]):n;break;case"u":n>>>=0;break;case"x":n=n.toString(16);break;case"X":n=n.toString(16).toUpperCase()}a.json.test(u[8])?g[g.length]=n:(!a.number.test(u[8])||v&&!u[3]?y="":(y=v?"+":"-",n=n.toString().replace(a.sign,"")),h=u[4]?"0"===u[4]?"0":u[4].charAt(1):" ",f=u[6]-(y+n).length,c=u[6]&&f>0?o(h,f):"",g[g.length]=u[5]?y+n+c:"0"===h?y+c+n:c+y+n)}return g.join("")},r.cache={},r.parse=function(t){for(var e=t,r=[],n=[],i=0;e;){if(null!==(r=a.text.exec(e)))n[n.length]=r[0];else if(null!==(r=a.modulo.exec(e)))n[n.length]="%";else{if(null===(r=a.placeholder.exec(e)))throw new SyntaxError("[sprintf] unexpected placeholder");if(r[2]){i|=1;var o=[],s=r[2],l=[];if(null===(l=a.key.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(o[o.length]=l[1];""!==(s=s.substring(l[0].length));)if(null!==(l=a.key_access.exec(s)))o[o.length]=l[1];else{if(null===(l=a.index_access.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");o[o.length]=l[1]}r[2]=o}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n[n.length]=r}e=e.substring(r[0].length)}return n};var s=function(t,e,n){return n=(e||[]).slice(0),n.splice(0,0,t),r.apply(null,n)};"undefined"!=typeof n?(n.sprintf=r,n.vsprintf=s):(e.sprintf=r,e.vsprintf=s,"function"==typeof t&&t.amd&&t(function(){return{sprintf:r,vsprintf:s}}))}("undefined"==typeof window?this:window)},{}],457:[function(t,e,r){"use strict";function n(t){return new i(t)}function i(t){this.options=p(Object.create(this.options),t),this.trees=new Array(this.options.maxZoom+1)}function o(t,e,r,n){return{x:t,y:e,zoom:1/0,id:n,numPoints:r}}function a(t,e){var r=t.geometry.coordinates;return o(u(r[0]),c(r[1]),1,e)}function s(t){return{type:"Feature",properties:l(t),geometry:{type:"Point",coordinates:[h(t.x),f(t.y)]}}}function l(t){var e=t.numPoints,r=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return{cluster:!0,point_count:e,point_count_abbreviated:r}}function u(t){return t/360+.5}function c(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return 0>r?0:r>1?1:r}function h(t){return 360*(t-.5)}function f(t){var e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function p(t,e){for(var r in e)t[r]=e[r];return t}function d(t){return t.x}function m(t){return t.y}var g=t("kdbush");e.exports=n,i.prototype={options:{minZoom:0,maxZoom:16,radius:40,extent:512,nodeSize:64,log:!1},load:function(t){var e=this.options.log;e&&console.time("total time");var r="prepare "+t.length+" points";e&&console.time(r),this.points=t;var n=t.map(a);e&&console.timeEnd(r);for(var i=this.options.maxZoom;i>=this.options.minZoom;i--){var o=+Date.now();this.trees[i+1]=g(n,d,m,this.options.nodeSize,Float32Array),n=this._cluster(n,i),e&&console.log("z%d: %d clusters in %dms",i,n.length,+Date.now()-o)}return this.trees[this.options.minZoom]=g(n,d,m,this.options.nodeSize,Float32Array),e&&console.timeEnd("total time"),this},getClusters:function(t,e){for(var r=this.trees[this._limitZoom(e)],n=r.range(u(t[0]),c(t[3]),u(t[2]),c(t[1])),i=[],o=0;o c)|0 },"),"generic"===e&&n.push("getters:[0],");for(var o=[],l=[],u=0;r>u;++u)o.push("d"+u),l.push("d"+u);for(var u=0;1<u;++u)o.push("v"+u),l.push("v"+u);for(var u=0;1<u;++u)o.push("p"+u),l.push("p"+u);o.push("a","b","c"),l.push("a","c"),n.push("vertex:function vertexFunc(",o.join(),"){");for(var c=[],u=0;1<u;++u)c.push("(p"+u+"<<"+u+")");n.push("var m=(",c.join("+"),")|0;if(m===0||m===",(1<<(1<=1<<(1<>>7){");for(var u=0;1<<(1<u;++u){if(1<<(1<128&&u%128===0){h.length>0&&f.push("}}");var p="vExtra"+h.length;n.push("case ",u>>>7,":",p,"(m&0x7f,",l.join(),");break;"),f=["function ",p,"(m,",l.join(),"){switch(m){"],h.push(f)}f.push("case ",127&u,":");for(var d=new Array(r),m=new Array(r),g=new Array(r),v=new Array(r),y=0,x=0;r>x;++x)d[x]=[],m[x]=[],g[x]=0,v[x]=0;for(var x=0;1<x;++x)for(var b=0;r>b;++b){var _=x^1<x)&&!(u&1<<_)!=!(u&1<w?(d[b].push("-v"+x+"-v"+_),g[b]+=2):(d[b].push("v"+x+"+v"+_), g[b]-=2),y+=1;for(var M=0;r>M;++M)M!==b&&(_&1<b;++b)if(0===d[b].length)A.push("d"+b+"-0.5");else{var k="";g[b]<0?k=g[b]+"*c":g[b]>0&&(k="+"+g[b]+"*c");var T=.5*(d[b].length/y),E=.5+.5*(v[b]/y);A.push("d"+b+"-"+E+"-"+T+"*("+d[b].join("+")+k+")/("+m[b].join("+")+")")}f.push("a.push([",A.join(),"]);","break;")}n.push("}},"),h.length>0&&f.push("}}");for(var S=[],u=0;1<u;++u)S.push("v"+u);S.push("c0","c1","p0","p1","a","b","c"),n.push("cell:function cellFunc(",S.join(),"){");var L=s(r-1);n.push("if(p0){b.push(",L.map(function(t){return"["+t.map(function(t){return"v"+t})+"]"}).join(),")}else{b.push(",L.map(function(t){var e=t.slice();return e.reverse(),"["+e.map(function(t){return"v"+t})+"]"}).join(),")}}});function ",i,"(array,level){var verts=[],cells=[];contour(array,verts,cells,level);return {positions:verts,cells:cells};} return ",i,";");for(var u=0;ua;++a)i[a]=[r[a]],o[a]=[a];return{positions:i,cells:o}}function o(t,e){if(t.dimension<=0)return{positions:[],cells:[]};if(1===t.dimension)return i(t,e);var r=t.order.join()+"-"+t.dtype,o=u[r],e=+e||0;return o||(o=u[r]=n(t.order,t.dtype)),o(t,e)}e.exports=o;var a=t("ndarray-extract-contour"),s=t("triangulate-hypercube"),l=t("zero-crossings"),u={}},{"ndarray-extract-contour":388,"triangulate-hypercube":464,"zero-crossings":493}],460:[function(t,e,r){(function(r){"use strict";function n(t){for(var e=t.cells,r=t.positions,n=new Float32Array(6*e.length),i=0,o=0,a=0;al;++l){var u=r[s[l]];n[i++]=u[0],n[i++]=u[1]+1.4,o=Math.max(u[0],o)}return{data:n,shape:o}}function i(t,e){var r=s[t];r||(r=s[t]={" ":{data:new Float32Array(0),shape:.2}});var a=r[e];if(!a)if(e.length<=1||!/\d/.test(e))a=r[e]=n(o(e,{triangles:!0,font:t,textAlign:"left",textBaseline:"alphabetic"}));else{for(var l=e.split(/(\d|\s)/),u=new Array(l.length),c=0,h=0,f=0;f0&&(h+=.02);for(var p=new Float32Array(c),d=0,m=-.5*h,f=0;f.5?l/(2-o-a):l/(o+a),o){case t:n=(e-r)/l+(r>e?6:0);break;case e:n=(r-t)/l+2;break;case r:n=(t-e)/l+4}n/=6}return{h:n,s:i,l:s}}function a(t,e,r){function n(t,e,r){return 0>r&&(r+=1),r>1&&(r-=1),1/6>r?t+6*(e-t)*r:.5>r?e:2/3>r?t+(e-t)*(2/3-r)*6:t}var i,o,a;if(t=T(t,360),e=T(e,100),r=T(r,100),0===e)i=o=a=r;else{var s=.5>r?r*(1+e):r+e-r*e,l=2*r-s;i=n(l,s,t+1/3),o=n(l,s,t),a=n(l,s,t-1/3)}return{r:255*i,g:255*o,b:255*a}}function s(t,e,r){t=T(t,255),e=T(e,255),r=T(r,255);var n,i,o=q(t,e,r),a=V(t,e,r),s=o,l=o-a;if(i=0===o?0:l/o,o==a)n=0;else{switch(o){case t:n=(e-r)/l+(r>e?6:0);break;case e:n=(r-t)/l+2;break;case r:n=(t-e)/l+4}n/=6}return{h:n,s:i,v:s}}function l(t,e,r){t=6*T(t,360),e=T(e,100),r=T(r,100);var n=B.floor(t),i=t-n,o=r*(1-e),a=r*(1-i*e),s=r*(1-(1-i)*e),l=n%6,u=[r,a,o,o,s,r][l],c=[s,r,r,a,o,o][l],h=[o,o,s,r,r,a][l];return{r:255*u,g:255*c,b:255*h}}function u(t,e,r,n){var i=[I(U(t).toString(16)),I(U(e).toString(16)),I(U(r).toString(16))];return n&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function c(t,e,r,n){var i=[I(C(n)),I(U(t).toString(16)),I(U(e).toString(16)),I(U(r).toString(16))];return i.join("")}function h(t,r){r=0===r?0:r||10;var n=e(t).toHsl();return n.s-=r/100,n.s=E(n.s),e(n)}function f(t,r){r=0===r?0:r||10;var n=e(t).toHsl();return n.s+=r/100,n.s=E(n.s),e(n)}function p(t){return e(t).desaturate(100)}function d(t,r){r=0===r?0:r||10;var n=e(t).toHsl();return n.l+=r/100,n.l=E(n.l),e(n)}function m(t,r){r=0===r?0:r||10;var n=e(t).toRgb();return n.r=q(0,V(255,n.r-U(255*-(r/100)))),n.g=q(0,V(255,n.g-U(255*-(r/100)))),n.b=q(0,V(255,n.b-U(255*-(r/100)))),e(n)}function g(t,r){r=0===r?0:r||10;var n=e(t).toHsl();return n.l-=r/100,n.l=E(n.l),e(n)}function v(t,r){var n=e(t).toHsl(),i=(U(n.h)+r)%360;return n.h=0>i?360+i:i,e(n)}function y(t){var r=e(t).toHsl();return r.h=(r.h+180)%360,e(r)}function x(t){var r=e(t).toHsl(),n=r.h;return[e(t),e({h:(n+120)%360,s:r.s,l:r.l}),e({h:(n+240)%360,s:r.s,l:r.l})]}function b(t){var r=e(t).toHsl(),n=r.h;return[e(t),e({h:(n+90)%360,s:r.s,l:r.l}),e({h:(n+180)%360,s:r.s,l:r.l}),e({h:(n+270)%360,s:r.s,l:r.l})]}function _(t){var r=e(t).toHsl(),n=r.h;return[e(t),e({h:(n+72)%360,s:r.s,l:r.l}),e({h:(n+216)%360,s:r.s,l:r.l})]}function w(t,r,n){r=r||6,n=n||30;var i=e(t).toHsl(),o=360/n,a=[e(t)];for(i.h=(i.h-(o*r>>1)+720)%360;--r;)i.h=(i.h+o)%360,a.push(e(i));return a}function M(t,r){r=r||6;for(var n=e(t).toHsv(),i=n.h,o=n.s,a=n.v,s=[],l=1/r;r--;)s.push(e({h:i,s:o,v:a})),a=(a+l)%1;return s}function A(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}function k(t){return t=parseFloat(t),(isNaN(t)||0>t||t>1)&&(t=1),t}function T(t,e){L(t)&&(t="100%");var r=z(t);return t=V(e,q(0,parseFloat(t))),r&&(t=parseInt(t*e,10)/100),B.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function E(t){return V(1,q(0,t))}function S(t){return parseInt(t,16)}function L(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)}function z(t){return"string"==typeof t&&-1!=t.indexOf("%")}function I(t){return 1==t.length?"0"+t:""+t}function P(t){return 1>=t&&(t=100*t+"%"),t}function C(t){return Math.round(255*parseFloat(t)).toString(16)}function R(t){return S(t)/255}function D(t){t=t.replace(j,"").replace(F,"").toLowerCase();var e=!1;if(H[t])t=H[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=Y.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=Y.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Y.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=Y.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Y.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=Y.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Y.hex8.exec(t))?{a:R(r[1]),r:S(r[2]),g:S(r[3]),b:S(r[4]),format:e?"name":"hex8"}:(r=Y.hex6.exec(t))?{r:S(r[1]),g:S(r[2]),b:S(r[3]),format:e?"name":"hex"}:(r=Y.hex3.exec(t))?{r:S(r[1]+""+r[1]),g:S(r[2]+""+r[2]),b:S(r[3]+""+r[3]),format:e?"name":"hex"}:!1}function O(t){var e,r;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==r&&"large"!==r&&(r="small"),{level:e,size:r}}var j=/^\s+/,F=/\s+$/,N=0,B=Math,U=B.round,V=B.min,q=B.max,G=B.random;e.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,e,r,n,i,o,a=this.toRgb();return t=a.r/255,e=a.g/255,r=a.b/255,n=.03928>=t?t/12.92:Math.pow((t+.055)/1.055,2.4),i=.03928>=e?e/12.92:Math.pow((e+.055)/1.055,2.4),o=.03928>=r?r/12.92:Math.pow((r+.055)/1.055,2.4),.2126*n+.7152*i+.0722*o},setAlpha:function(t){return this._a=k(t),this._roundA=U(100*this._a)/100,this},toHsv:function(){var t=s(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=s(this._r,this._g,this._b),e=U(360*t.h),r=U(100*t.s),n=U(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=o(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=o(this._r,this._g,this._b),e=U(360*t.h),r=U(100*t.s),n=U(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return u(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(){return c(this._r,this._g,this._b,this._a)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:U(this._r),g:U(this._g),b:U(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+U(this._r)+", "+U(this._g)+", "+U(this._b)+")":"rgba("+U(this._r)+", "+U(this._g)+", "+U(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:U(100*T(this._r,255))+"%",g:U(100*T(this._g,255))+"%",b:U(100*T(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+U(100*T(this._r,255))+"%, "+U(100*T(this._g,255))+"%, "+U(100*T(this._b,255))+"%)":"rgba("+U(100*T(this._r,255))+"%, "+U(100*T(this._g,255))+"%, "+U(100*T(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":this._a<1?!1:X[u(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var r="#"+c(this._r,this._g,this._b,this._a),n=r,i=this._gradientType?"GradientType = 1, ":"";if(t){var o=e(t);n=o.toHex8String()}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+r+",endColorstr="+n+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0,i=!e&&n&&("hex"===t||"hex6"===t||"hex3"===t||"name"===t);return i?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return e(this.toString())},_applyModification:function(t,e){var r=t.apply(null,[this].concat([].slice.call(e)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(d,arguments)},brighten:function(){return this._applyModification(m,arguments)},darken:function(){return this._applyModification(g,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(f,arguments)},greyscale:function(){return this._applyModification(p,arguments)},spin:function(){return this._applyModification(v,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(w,arguments)},complement:function(){return this._applyCombination(y,arguments)},monochromatic:function(){return this._applyCombination(M,arguments)},splitcomplement:function(){return this._applyCombination(_,arguments)},triad:function(){return this._applyCombination(x,arguments)},tetrad:function(){return this._applyCombination(b,arguments)}},e.fromRatio=function(t,r){if("object"==typeof t){var n={};for(var i in t)t.hasOwnProperty(i)&&("a"===i?n[i]=t[i]:n[i]=P(t[i]));t=n}return e(t,r)},e.equals=function(t,r){return t&&r?e(t).toRgbString()==e(r).toRgbString():!1},e.random=function(){return e.fromRatio({r:G(),g:G(),b:G()})},e.mix=function(t,r,n){n=0===n?0:n||50;var i,o=e(t).toRgb(),a=e(r).toRgb(),s=n/100,l=2*s-1,u=a.a-o.a;i=l*u==-1?l:(l+u)/(1+l*u),i=(i+1)/2;var c=1-i,h={r:a.r*i+o.r*c,g:a.g*i+o.g*c,b:a.b*i+o.b*c,a:a.a*s+o.a*(1-s)};return e(h)},e.readability=function(t,r){var n=e(t),i=e(r);return(Math.max(n.getLuminance(),i.getLuminance())+.05)/(Math.min(n.getLuminance(),i.getLuminance())+.05)},e.isReadable=function(t,r,n){var i,o,a=e.readability(t,r);switch(o=!1,i=O(n),i.level+i.size){case"AAsmall":case"AAAlarge":o=a>=4.5;break;case"AAlarge":o=a>=3;break;case"AAAsmall":o=a>=7}return o},e.mostReadable=function(t,r,n){var i,o,a,s,l=null,u=0;n=n||{},o=n.includeFallbackColors,a=n.level,s=n.size;for(var c=0;cu&&(u=i,l=e(r[c]));return e.isReadable(t,l,{level:a,size:s})||!o?l:(n.includeFallbackColors=!1,e.mostReadable(t,["#fff","#000"],n))};var H=e.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},X=e.hexNames=A(H),Y=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",r="(?:"+e+")|(?:"+t+")",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();"undefined"!=typeof r&&r.exports?r.exports=e:"function"==typeof t&&t.amd?t(function(){return e}):window.tinycolor=e}()},{}],462:[function(t,e,r){"use strict";function n(t,e){var r=a(getComputedStyle(t).getPropertyValue(e));return r[0]*o(r[1],t)}function i(t,e){var r=document.createElement("div");r.style["font-size"]="128"+t,e.appendChild(r);var i=n(r,"font-size")/128;return e.removeChild(r),i}function o(t,e){switch(e=e||document.body,t=(t||"px").trim().toLowerCase(),e!==window&&e!==document||(e=document.body),t){case"%":return e.clientHeight/100;case"ch":case"ex":return i(t,e);case"em":return n(e,"font-size");case"rem":return n(document.body,"font-size");case"vw":return window.innerWidth/100;case"vh":return window.innerHeight/100;case"vmin":return Math.min(window.innerWidth,window.innerHeight)/100;case"vmax":return Math.max(window.innerWidth,window.innerHeight)/100;case"in":return s;case"cm":return s/2.54;case"mm":return s/25.4;case"pt":return s/72;case"pc":return s/6}return 1}var a=t("parse-unit");e.exports=o;var s=96},{"parse-unit":405}],463:[function(e,r,n){!function(e,i){"object"==typeof n&&"undefined"!=typeof r?i(n):"function"==typeof t&&t.amd?t(["exports"],i):i(e.topojson=e.topojson||{})}(this,function(t){"use strict";function e(){}function r(t){if(!t)return e;var r,n,i=t.scale[0],o=t.scale[1],a=t.translate[0],s=t.translate[1];return function(t,e){e||(r=n=0),t[0]=(r+=t[0])*i+a,t[1]=(n+=t[1])*o+s}}function n(t){if(!t)return e;var r,n,i=t.scale[0],o=t.scale[1],a=t.translate[0],s=t.translate[1];return function(t,e){e||(r=n=0);var l=Math.round((t[0]-a)/i),u=Math.round((t[1]-s)/o);t[0]=l-r,t[1]=u-n,r=l,n=u}}function i(t,e){for(var r,n=t.length,i=n-e;i<--n;)r=t[i],t[i++]=t[n],t[n]=r}function o(t,e){for(var r=0,n=t.length;n>r;){var i=r+n>>>1;t[i]t?~t:t],o=0,a=n.length;a>o;++o)e.push(r=n[o].slice()),c(r,o);0>t&&i(e,a)}function o(t){return t=t.slice(),c(t,0),t}function a(t){for(var e=[],r=0,i=t.length;i>r;++r)n(t[r],e);return e.length<2&&e.push(e[0].slice()),e}function s(t){for(var e=a(t);e.length<4;)e.push(e[0].slice());return e}function l(t){return t.map(s)}function u(t){var e=t.type;return"GeometryCollection"===e?{type:e,geometries:t.geometries.map(u)}:e in f?{type:e,coordinates:f[e](t)}:null}var c=r(t.transform),h=t.arcs,f={Point:function(t){return o(t.coordinates)},MultiPoint:function(t){return t.coordinates.map(o)},LineString:function(t){return a(t.arcs)},MultiLineString:function(t){return t.arcs.map(a)},Polygon:function(t){return l(t.arcs)},MultiPolygon:function(t){return t.arcs.map(l)}};return u(e)}function u(t,e){function r(e){var r,n=t.arcs[0>e?~e:e],i=n[0];return t.transform?(r=[0,0],n.forEach(function(t){r[0]+=t[0],r[1]+=t[1]})):r=n[n.length-1],0>e?[r,i]:[i,r]}function n(t,e){for(var r in t){var n=t[r];delete e[n.start],delete n.start,delete n.end,n.forEach(function(t){i[0>t?~t:t]=1}),s.push(n)}}var i={},o={},a={},s=[],l=-1;return e.forEach(function(r,n){var i,o=t.arcs[0>r?~r:r];o.length<3&&!o[1][0]&&!o[1][1]&&(i=e[++l],e[l]=r,e[n]=i)}),e.forEach(function(t){var e,n,i=r(t),s=i[0],l=i[1];if(e=a[s])if(delete a[e.end],e.push(t),e.end=l,n=o[l]){delete o[n.start];var u=n===e?e:e.concat(n);o[u.start=e.start]=a[u.end=n.end]=u}else o[e.start]=a[e.end]=e;else if(e=o[l])if(delete o[e.start],e.unshift(t),e.start=s,n=a[s]){delete a[n.end];var c=n===e?e:n.concat(e);o[c.start=n.start]=a[c.end=e.end]=c}else o[e.start]=a[e.end]=e;else e=[t],o[e.start=s]=a[e.end=l]=e}),n(a,o),n(o,a),e.forEach(function(t){i[0>t?~t:t]||s.push([t])}),s}function c(t){return l(t,h.apply(this,arguments))}function h(t,e,r){function n(t){var e=0>t?~t:t;(c[e]||(c[e]=[])).push({i:t,g:l})}function i(t){t.forEach(n)}function o(t){t.forEach(i)}function a(t){"GeometryCollection"===t.type?t.geometries.forEach(a):t.type in h&&(l=t,h[t.type](t.arcs))}var s=[];if(arguments.length>1){var l,c=[],h={LineString:i,MultiLineString:o,Polygon:o,MultiPolygon:function(t){t.forEach(o)}};a(e),c.forEach(arguments.length<3?function(t){s.push(t[0].i)}:function(t){r(t[0].g,t[t.length-1].g)&&s.push(t[0].i)})}else for(var f=0,p=t.arcs.length;p>f;++f)s.push(f);return{type:"MultiLineString",arcs:u(t,s)}}function f(t){var e=t[0],r=t[1],n=t[2];return Math.abs((e[0]-n[0])*(r[1]-e[1])-(e[0]-r[0])*(n[1]-e[1]))}function p(t){for(var e,r=-1,n=t.length,i=t[n-1],o=0;++re?~e:e]||(i[e]=[])).push(t)})}),o.push(t)}function n(e){return Math.abs(p(l(t,{type:"Polygon",arcs:[e]}).coordinates[0]))}var i={},o=[],a=[];return e.forEach(function(t){"Polygon"===t.type?r(t.arcs):"MultiPolygon"===t.type&&t.arcs.forEach(r)}),o.forEach(function(t){if(!t._){var e=[],r=[t];for(t._=1,a.push(e);t=r.pop();)e.push(t),t.forEach(function(t){t.forEach(function(t){i[0>t?~t:t].forEach(function(t){t._||(t._=1,r.push(t))})})})}}),o.forEach(function(t){delete t._}),{type:"MultiPolygon",arcs:a.map(function(e){var r,o=[];if(e.forEach(function(t){t.forEach(function(t){t.forEach(function(t){i[0>t?~t:t].length<2&&o.push(t)})})}),o=u(t,o),(r=o.length)>1)for(var a,s,l=1,c=n(o[0]);r>l;++l)(a=n(o[l]))>c&&(s=o[0],o[0]=o[l],o[l]=s,c=a);return o})}}function g(t){function e(t,e){t.forEach(function(t){0>t&&(t=~t);var r=i[t];r?r.push(e):i[t]=[e]})}function r(t,r){t.forEach(function(t){e(t,r)})}function n(t,e){"GeometryCollection"===t.type?t.geometries.forEach(function(t){n(t,e)}):t.type in s&&s[t.type](t.arcs,e)}var i={},a=t.map(function(){return[]}),s={LineString:e,MultiLineString:r,Polygon:r,MultiPolygon:function(t,e){t.forEach(function(t){r(t,e)})}};t.forEach(n);for(var l in i)for(var u=i[l],c=u.length,h=0;c>h;++h)for(var f=h+1;c>f;++f){var p,d=u[h],m=u[f];(p=a[d])[l=o(p,m)]!==m&&p.splice(l,0,m),(p=a[m])[l=o(p,d)]!==d&&p.splice(l,0,d)}return a}function v(t,e){return t[1][2]-e[1][2]}function y(){function t(t,e){for(;e>0;){var r=(e+1>>1)-1,i=n[r];if(v(t,i)>=0)break;n[i._=e]=i,n[t._=e=r]=t}}function e(t,e){for(;;){var r=e+1<<1,o=r-1,a=e,s=n[a];if(i>o&&v(n[o],s)<0&&(s=n[a=o]),i>r&&v(n[r],s)<0&&(s=n[a=r]),a===e)break;n[s._=e]=s,n[t._=e=a]=t}}var r={},n=[],i=0;return r.push=function(e){return t(n[e._=i]=e,i++),i},r.pop=function(){if(!(0>=i)){var t,r=n[0];return--i>0&&(t=n[i],e(n[t._=0]=t,0)),r}},r.remove=function(r){var o,a=r._;if(n[a]===r)return a!==--i&&(o=n[i],(v(o,r)<0?t:e)(n[o._=a]=o,a)),a},r}function x(t,e){function i(t){s.remove(t),t[1][2]=e(t),s.push(t)}var o=r(t.transform),a=n(t.transform),s=y();return e||(e=f),t.arcs.forEach(function(t){var r,n,l,u,c=[],h=0;for(n=0,l=t.length;l>n;++n)u=t[n],o(t[n]=[u[0],u[1],1/0],n);for(n=1,l=t.length-1;l>n;++n)r=t.slice(n-1,n+2),r[1][2]=e(r),c.push(r),s.push(r);for(n=0,l=c.length;l>n;++n)r=c[n],r.previous=c[n-1],r.next=c[n+1];for(;r=s.pop();){var f=r.previous,p=r.next;r[1][2]t)return[];if(0===t)return[[0]];for(var e=0|Math.round(a(t+1)),r=[],n=0;e>n;++n){for(var s=i.unrank(t,n),l=[0],u=0,c=0;cMath.max(r,n)?i[2]=1:r>Math.max(e,n)?i[0]=1:i[1]=1;for(var o=0,a=0,s=0;3>s;++s)o+=t[s]*t[s],a+=i[s]*t[s];for(var s=0;3>s;++s)i[s]-=a/o*t[s];return f(i,i),i}function a(t,e,r,n,i,o,a,s){this.center=l(r),this.up=l(n),this.right=l(i),this.radius=l([o]),this.angle=l([a,s]),this.angle.bounds=[[-(1/0),-Math.PI/2],[1/0,Math.PI/2]],this.setDistanceLimits(t,e),this.computedCenter=this.center.curve(0),this.computedUp=this.up.curve(0),this.computedRight=this.right.curve(0),this.computedRadius=this.radius.curve(0),this.computedAngle=this.angle.curve(0),this.computedToward=[0,0,0],this.computedEye=[0,0,0],this.computedMatrix=new Array(16);for(var u=0;16>u;++u)this.computedMatrix[u]=.5;this.recalcMatrix(0)}function s(t){t=t||{};var e=t.center||[0,0,0],r=t.up||[0,1,0],i=t.right||o(r),s=t.radius||1,l=t.theta||0,u=t.phi||0;if(e=[].slice.call(e,0,3),r=[].slice.call(r,0,3),f(r,r),i=[].slice.call(i,0,3),f(i,i),"eye"in t){var c=t.eye,d=[c[0]-e[0],c[1]-e[1],c[2]-e[2]];h(i,d,r),n(i[0],i[1],i[2])<1e-6?i=o(r):f(i,i),s=n(d[0],d[1],d[2]);var m=p(r,d)/s,g=p(i,d)/s;u=Math.acos(m),l=Math.acos(g)}return s=Math.log(s),new a(t.zoomMin,t.zoomMax,e,r,i,s,l,u)}e.exports=s;var l=t("filtered-vector"),u=t("gl-mat4/invert"),c=t("gl-mat4/rotate"),h=t("gl-vec3/cross"),f=t("gl-vec3/normalize"),p=t("gl-vec3/dot"),d=a.prototype;d.setDistanceLimits=function(t,e){t=t>0?Math.log(t):-(1/0),e=e>0?Math.log(e):1/0,e=Math.max(e,t),this.radius.bounds[0][0]=t,this.radius.bounds[1][0]=e},d.getDistanceLimits=function(t){var e=this.radius.bounds[0];return t?(t[0]=Math.exp(e[0][0]),t[1]=Math.exp(e[1][0]),t):[Math.exp(e[0][0]),Math.exp(e[1][0])]},d.recalcMatrix=function(t){this.center.curve(t),this.up.curve(t),this.right.curve(t),this.radius.curve(t),this.angle.curve(t);for(var e=this.computedUp,r=this.computedRight,i=0,o=0,a=0;3>a;++a)o+=e[a]*r[a],i+=e[a]*e[a];for(var s=Math.sqrt(i),l=0,a=0;3>a;++a)r[a]-=e[a]*o/i,l+=r[a]*r[a],e[a]/=s;for(var u=Math.sqrt(l),a=0;3>a;++a)r[a]/=u;var c=this.computedToward;h(c,e,r),f(c,c);for(var p=Math.exp(this.computedRadius[0]),d=this.computedAngle[0],m=this.computedAngle[1],g=Math.cos(d),v=Math.sin(d),y=Math.cos(m),x=Math.sin(m),b=this.computedCenter,_=g*y,w=v*y,M=x,A=-g*x,k=-v*x,T=y,E=this.computedEye,S=this.computedMatrix,a=0;3>a;++a){var L=_*r[a]+w*c[a]+M*e[a];S[4*a+1]=A*r[a]+k*c[a]+T*e[a],S[4*a+2]=L,S[4*a+3]=0}var z=S[1],I=S[5],P=S[9],C=S[2],R=S[6],D=S[10],O=I*D-P*R,j=P*C-z*D,F=z*R-I*C,N=n(O,j,F);O/=N,j/=N,F/=N,S[0]=O,S[4]=j,S[8]=F;for(var a=0;3>a;++a)E[a]=b[a]+S[2+4*a]*p;for(var a=0;3>a;++a){for(var l=0,B=0;3>B;++B)l+=S[a+4*B]*E[B];S[12+a]=-l}S[15]=1},d.getMatrix=function(t,e){this.recalcMatrix(t);var r=this.computedMatrix;if(e){for(var n=0;16>n;++n)e[n]=r[n];return e}return r};var m=[0,0,0];d.rotate=function(t,e,r,n){if(this.angle.move(t,e,r),n){this.recalcMatrix(t);var i=this.computedMatrix;m[0]=i[2],m[1]=i[6],m[2]=i[10];for(var o=this.computedUp,a=this.computedRight,s=this.computedToward,l=0;3>l;++l)i[4*l]=o[l],i[4*l+1]=a[l],i[4*l+2]=s[l];c(i,i,n,m);for(var l=0;3>l;++l)o[l]=i[4*l],a[l]=i[4*l+1];this.up.set(t,o[0],o[1],o[2]),this.right.set(t,a[0],a[1],a[2])}},d.pan=function(t,e,r,i){e=e||0,r=r||0,i=i||0,this.recalcMatrix(t);var o=this.computedMatrix,a=(Math.exp(this.computedRadius[0]),o[1]),s=o[5],l=o[9],u=n(a,s,l);a/=u,s/=u,l/=u;var c=o[0],h=o[4],f=o[8],p=c*a+h*s+f*l;c-=a*p,h-=s*p,f-=l*p;var d=n(c,h,f);c/=d,h/=d,f/=d;var m=c*e+a*r,g=h*e+s*r,v=f*e+l*r;this.center.move(t,m,g,v);var y=Math.exp(this.computedRadius[0]);y=Math.max(1e-4,y+i),this.radius.set(t,Math.log(y))},d.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},d.setMatrix=function(t,e,r,o){var a=1;"number"==typeof r&&(a=0|r),(0>a||a>3)&&(a=1);var s=(a+2)%3;e||(this.recalcMatrix(t),e=this.computedMatrix);var l=e[a],c=e[a+4],h=e[a+8];if(o){var f=Math.abs(l),p=Math.abs(c),d=Math.abs(h),m=Math.max(f,p,d);f===m?(l=0>l?-1:1,c=h=0):d===m?(h=0>h?-1:1,l=c=0):(c=0>c?-1:1,l=h=0)}else{var g=n(l,c,h);l/=g,c/=g,h/=g}var v=e[s],y=e[s+4],x=e[s+8],b=v*l+y*c+x*h;v-=l*b,y-=c*b,x-=h*b;var _=n(v,y,x);v/=_,y/=_,x/=_;var w=c*x-h*y,M=h*v-l*x,A=l*y-c*v,k=n(w,M,A);w/=k,M/=k,A/=k,this.center.jump(t,G,H,X),this.radius.idle(t),this.up.jump(t,l,c,h),this.right.jump(t,v,y,x);var T,E;if(2===a){var S=e[1],L=e[5],z=e[9],I=S*v+L*y+z*x,P=S*w+L*M+z*A;T=0>O?-Math.PI/2:Math.PI/2,E=Math.atan2(P,I)}else{var C=e[2],R=e[6],D=e[10],O=C*l+R*c+D*h,j=C*v+R*y+D*x,F=C*w+R*M+D*A;T=Math.asin(i(O)),E=Math.atan2(F,j)}this.angle.jump(t,E,T),this.recalcMatrix(t);var N=e[2],B=e[6],U=e[10],V=this.computedMatrix;u(V,e);var q=V[15],G=V[12]/q,H=V[13]/q,X=V[14]/q,Y=Math.exp(this.computedRadius[0]);this.center.jump(t,G-N*Y,H-B*Y,X-U*Y)},d.lastT=function(){return Math.max(this.center.lastT(),this.up.lastT(),this.right.lastT(),this.radius.lastT(),this.angle.lastT())},d.idle=function(t){this.center.idle(t),this.up.idle(t),this.right.idle(t),this.radius.idle(t),this.angle.idle(t)},d.flush=function(t){this.center.flush(t),this.up.flush(t),this.right.flush(t),this.radius.flush(t),this.angle.flush(t)},d.setDistance=function(t,e){e>0&&this.radius.set(t,Math.log(e))},d.lookAt=function(t,e,r,o){this.recalcMatrix(t),e=e||this.computedEye,r=r||this.computedCenter,o=o||this.computedUp;var a=o[0],s=o[1],l=o[2],u=n(a,s,l);if(!(1e-6>u)){a/=u,s/=u,l/=u;var c=e[0]-r[0],h=e[1]-r[1],f=e[2]-r[2],p=n(c,h,f);if(!(1e-6>p)){c/=p,h/=p,f/=p;var d=this.computedRight,m=d[0],g=d[1],v=d[2],y=a*m+s*g+l*v;m-=y*a,g-=y*s,v-=y*l;var x=n(m,g,v);if(!(.01>x&&(m=s*f-l*h,g=l*c-a*f,v=a*h-s*c,x=n(m,g,v),1e-6>x))){m/=x,g/=x,v/=x,this.up.set(t,a,s,l),this.right.set(t,m,g,v),this.center.set(t,r[0],r[1],r[2]),this.radius.set(t,Math.log(p));var b=s*v-l*g,_=l*m-a*v,w=a*g-s*m,M=n(b,_,w);b/=M,_/=M,w/=M;var A=a*c+s*h+l*f,k=m*c+g*h+v*f,T=b*c+_*h+w*f,E=Math.asin(i(A)),S=Math.atan2(T,k),L=this.angle._state,z=L[L.length-1],I=L[L.length-2];z%=2*Math.PI;var P=Math.abs(z+2*Math.PI-S),C=Math.abs(z-S),R=Math.abs(z-2*Math.PI-S);C>P&&(z+=2*Math.PI),C>R&&(z-=2*Math.PI),this.angle.jump(this.angle.lastT(),z,I),this.angle.set(t,S,E)}}}}},{"filtered-vector":101,"gl-mat4/invert":143,"gl-mat4/rotate":147,"gl-vec3/cross":208,"gl-vec3/dot":209,"gl-vec3/normalize":212}],466:[function(t,e,r){"use strict";function n(t,e,r){var n=t*e,o=i*t,a=o-t,s=o-a,l=t-s,u=i*e,c=u-e,h=u-c,f=e-h,p=n-s*h,d=p-l*h,m=d-s*f,g=l*f-m;return r?(r[0]=g,r[1]=n,r):[g,n]}e.exports=n;var i=+(Math.pow(2,27)+1)},{}],467:[function(t,e,r){"use strict";function n(t,e,r){var n=t+e,i=n-t,o=n-i,a=e-i,s=t-o;return r?(r[0]=s+a,r[1]=n,r):[s+a,n]}e.exports=n},{}],468:[function(t,e,r){(function(e,n){"use strict";function i(t){if(t){var e=t.length||t.byteLength,r=y.log2(e);w[r].push(t)}}function o(t){i(t.buffer)}function a(t){var t=y.nextPow2(t),e=y.log2(t),r=w[e];return r.length>0?r.pop():new ArrayBuffer(t)}function s(t){return new Uint8Array(a(t),0,t)}function l(t){return new Uint16Array(a(2*t),0,t)}function u(t){return new Uint32Array(a(4*t),0,t)}function c(t){return new Int8Array(a(t),0,t)}function h(t){return new Int16Array(a(2*t),0,t)}function f(t){return new Int32Array(a(4*t),0,t)}function p(t){return new Float32Array(a(4*t),0,t)}function d(t){return new Float64Array(a(8*t),0,t)}function m(t){return b?new Uint8ClampedArray(a(t),0,t):s(t)}function g(t){return new DataView(a(t),0,t)}function v(t){t=y.nextPow2(t);var e=y.log2(t),r=M[e];return r.length>0?r.pop():new n(t)}var y=t("bit-twiddle"),x=t("dup");e.__TYPEDARRAY_POOL||(e.__TYPEDARRAY_POOL={UINT8:x([32,0]),UINT16:x([32,0]), @@ -43,7 +43,7 @@ writable:!0,configurable:!0},has:{value:function(t){return this.has___(t)},writa r[t]=function(e){return arguments.length?(b[t]=u.isPlainObject(b[t])?u.extendFlat(b[t],e):e,r):b[t]}}),r.options=function(t){return Object.keys(t).forEach(function(e){"function"==typeof r[e]&&r[e](t[e])}),r},r._opts=b,r}},{"../../lib":583,"../../lib/extend":578,"../../lib/setcursor":592,"../../plotly":604,"../../plots/cartesian/axes":607,"../../plots/cartesian/axis_defaults":608,"../../plots/cartesian/layout_attributes":616,"../../plots/cartesian/position_defaults":619,"../../plots/plots":663,"../color":498,"../dragelement":519,"../drawing":521,"../titles":561,"./attributes":499,d3:90,tinycolor2:461}],502:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t){return n.isPlainObject(t.colorbar)}},{"../../lib":583}],503:[function(t,e,r){"use strict";r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.draw=t("./draw"),r.hasColorbar=t("./has_colorbar")},{"./attributes":499,"./defaults":500,"./draw":501,"./has_colorbar":502}],504:[function(t,e,r){"use strict";e.exports={zauto:{valType:"boolean",dflt:!0},zmin:{valType:"number",dflt:null},zmax:{valType:"number",dflt:null},colorscale:{valType:"colorscale"},autocolorscale:{valType:"boolean",dflt:!0},reversescale:{valType:"boolean",dflt:!1},showscale:{valType:"boolean",dflt:!0}}},{}],505:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./scales"),o=t("./flip_scale");e.exports=function(t,e,r,a){var s,l;r?(s=n.nestedProperty(t,r).get(),l=n.nestedProperty(t._input,r).get()):(s=t,l=t._input);var u=s[a+"auto"],c=s[a+"min"],h=s[a+"max"],f=s.colorscale;u===!1&&void 0!==c||(c=n.aggNums(Math.min,null,e)),u===!1&&void 0!==h||(h=n.aggNums(Math.max,null,e)),c===h&&(c-=.5,h+=.5),s[a+"min"]=c,s[a+"max"]=h,l[a+"min"]=c,l[a+"max"]=h,s.autocolorscale&&(f=0>c*h?i.RdBu:c>=0?i.Reds:i.Blues,l.colorscale=f,s.reversescale&&(f=o(f)),s.colorscale=f)}},{"../../lib":583,"./flip_scale":509,"./scales":516}],506:[function(t,e,r){"use strict";var n=t("./attributes"),i=t("../../lib/extend").extendDeep;t("./scales.js");e.exports=function(t){return{color:{valType:"color",arrayOk:!0},colorscale:i({},n.colorscale,{}),cauto:i({},n.zauto,{}),cmax:i({},n.zmax,{}),cmin:i({},n.zmin,{}),autocolorscale:i({},n.autocolorscale,{}),reversescale:i({},n.reversescale,{})}}},{"../../lib/extend":578,"./attributes":504,"./scales.js":516}],507:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":516}],508:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),o=t("../colorbar/has_colorbar"),a=t("../colorbar/defaults"),s=t("./is_valid_scale"),l=t("./flip_scale");e.exports=function(t,e,r,u,c){var h=c.prefix,f=c.cLetter,p=h.slice(0,h.length-1),d=h?i.nestedProperty(t,p).get()||{}:t,m=h?i.nestedProperty(e,p).get()||{}:e,g=d[f+"min"],v=d[f+"max"],y=d.colorscale,x=n(g)&&n(v)&&v>g;u(h+f+"auto",!x),u(h+f+"min"),u(h+f+"max");var b;void 0!==y&&(b=!s(y)),u(h+"autocolorscale",b);var _=u(h+"colorscale"),w=u(h+"reversescale");if(w&&(m.colorscale=l(_)),"marker.line."!==h){var M;h&&(M=o(d));var A=u(h+"showscale",M);A&&a(d,m,r)}}},{"../../lib":583,"../colorbar/defaults":500,"../colorbar/has_colorbar":502,"./flip_scale":509,"./is_valid_scale":513,"fast-isnumeric":99}],509:[function(t,e,r){"use strict";e.exports=function(t){for(var e,r=t.length,n=new Array(r),i=r-1,o=0;i>=0;i--,o++)e=t[i],n[o]=[1-e[0],e[1]];return n}},{}],510:[function(t,e,r){"use strict";var n=t("./scales"),i=t("./default_scale"),o=t("./is_valid_scale_array");e.exports=function(t,e){function r(){try{t=n[t]||JSON.parse(t)}catch(r){t=e}}return e||(e=i),t?("string"==typeof t&&(r(),"string"==typeof t&&r()),o(t)?t:e):e}},{"./default_scale":507,"./is_valid_scale_array":514,"./scales":516}],511:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),o=t("./is_valid_scale");e.exports=function(t,e){var r=e?i.nestedProperty(t,e).get()||{}:t,a=r.color,s=!1;if(Array.isArray(a))for(var l=0;lf;f++)l=t[f],c[f]=e+l[0]*(r-e),h[f]=i(l[1]).toRgb();var p=n.scale.linear().domain(c).interpolate(n.interpolateObject).range(h);return function(t){if(o(t)){var n=a.constrain(t,e,r),l=p(n);return i(l).toRgbString()}return i(t).isValid()?t:s.defaultLine}}},{"../../lib":583,"../color":498,d3:90,"fast-isnumeric":99,tinycolor2:461}],516:[function(t,e,r){"use strict";e.exports={Greys:[[0,"rgb(0,0,0)"],[1,"rgb(255,255,255)"]],YlGnBu:[[0,"rgb(8,29,88)"],[.125,"rgb(37,52,148)"],[.25,"rgb(34,94,168)"],[.375,"rgb(29,145,192)"],[.5,"rgb(65,182,196)"],[.625,"rgb(127,205,187)"],[.75,"rgb(199,233,180)"],[.875,"rgb(237,248,217)"],[1,"rgb(255,255,217)"]],Greens:[[0,"rgb(0,68,27)"],[.125,"rgb(0,109,44)"],[.25,"rgb(35,139,69)"],[.375,"rgb(65,171,93)"],[.5,"rgb(116,196,118)"],[.625,"rgb(161,217,155)"],[.75,"rgb(199,233,192)"],[.875,"rgb(229,245,224)"],[1,"rgb(247,252,245)"]],YlOrRd:[[0,"rgb(128,0,38)"],[.125,"rgb(189,0,38)"],[.25,"rgb(227,26,28)"],[.375,"rgb(252,78,42)"],[.5,"rgb(253,141,60)"],[.625,"rgb(254,178,76)"],[.75,"rgb(254,217,118)"],[.875,"rgb(255,237,160)"],[1,"rgb(255,255,204)"]],Bluered:[[0,"rgb(0,0,255)"],[1,"rgb(255,0,0)"]],RdBu:[[0,"rgb(5,10,172)"],[.35,"rgb(106,137,247)"],[.5,"rgb(190,190,190)"],[.6,"rgb(220,170,132)"],[.7,"rgb(230,145,90)"],[1,"rgb(178,10,28)"]],Reds:[[0,"rgb(220,220,220)"],[.2,"rgb(245,195,157)"],[.4,"rgb(245,160,105)"],[1,"rgb(178,10,28)"]],Blues:[[0,"rgb(5,10,172)"],[.35,"rgb(40,60,190)"],[.5,"rgb(70,100,245)"],[.6,"rgb(90,120,245)"],[.7,"rgb(106,137,247)"],[1,"rgb(220,220,220)"]],Picnic:[[0,"rgb(0,0,255)"],[.1,"rgb(51,153,255)"],[.2,"rgb(102,204,255)"],[.3,"rgb(153,204,255)"],[.4,"rgb(204,204,255)"],[.5,"rgb(255,255,255)"],[.6,"rgb(255,204,255)"],[.7,"rgb(255,153,255)"],[.8,"rgb(255,102,204)"],[.9,"rgb(255,102,102)"],[1,"rgb(255,0,0)"]],Rainbow:[[0,"rgb(150,0,90)"],[.125,"rgb(0,0,200)"],[.25,"rgb(0,25,255)"],[.375,"rgb(0,152,255)"],[.5,"rgb(44,255,150)"],[.625,"rgb(151,255,0)"],[.75,"rgb(255,234,0)"],[.875,"rgb(255,111,0)"],[1,"rgb(255,0,0)"]],Portland:[[0,"rgb(12,51,131)"],[.25,"rgb(10,136,186)"],[.5,"rgb(242,211,56)"],[.75,"rgb(242,143,56)"],[1,"rgb(217,30,30)"]],Jet:[[0,"rgb(0,0,131)"],[.125,"rgb(0,60,170)"],[.375,"rgb(5,255,255)"],[.625,"rgb(255,255,0)"],[.875,"rgb(250,0,0)"],[1,"rgb(128,0,0)"]],Hot:[[0,"rgb(0,0,0)"],[.3,"rgb(230,0,0)"],[.6,"rgb(255,210,0)"],[1,"rgb(255,255,255)"]],Blackbody:[[0,"rgb(0,0,0)"],[.2,"rgb(230,0,0)"],[.4,"rgb(230,210,0)"],[.7,"rgb(255,255,255)"],[1,"rgb(160,200,255)"]],Earth:[[0,"rgb(0,0,130)"],[.1,"rgb(0,180,180)"],[.2,"rgb(40,210,40)"],[.4,"rgb(230,230,50)"],[.6,"rgb(120,70,20)"],[1,"rgb(255,255,255)"]],Electric:[[0,"rgb(0,0,0)"],[.15,"rgb(30,0,100)"],[.4,"rgb(120,0,100)"],[.6,"rgb(160,90,0)"],[.8,"rgb(230,200,0)"],[1,"rgb(255,250,220)"]],Viridis:[[0,"#440154"],[.06274509803921569,"#48186a"],[.12549019607843137,"#472d7b"],[.18823529411764706,"#424086"],[.25098039215686274,"#3b528b"],[.3137254901960784,"#33638d"],[.3764705882352941,"#2c728e"],[.4392156862745098,"#26828e"],[.5019607843137255,"#21918c"],[.5647058823529412,"#1fa088"],[.6274509803921569,"#28ae80"],[.6901960784313725,"#3fbc73"],[.7529411764705882,"#5ec962"],[.8156862745098039,"#84d44b"],[.8784313725490196,"#addc30"],[.9411764705882353,"#d8e219"],[1,"#fde725"]]}},{}],517:[function(t,e,r){"use strict";e.exports=function(t,e,r,n,i){var o=(t-r)/(n-r),a=o+e/(n-r),s=(o+a)/2;return"left"===i||"bottom"===i?o:"center"===i||"middle"===i?s:"right"===i||"top"===i?a:2/3-s>o?o:a>4/3-s?a:s}},{}],518:[function(t,e,r){"use strict";var n=t("../../lib"),i=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,r,o){return t="left"===r?0:"center"===r?1:"right"===r?2:n.constrain(Math.floor(3*t),0,2),e="bottom"===o?0:"middle"===o?1:"top"===o?2:n.constrain(Math.floor(3*e),0,2),i[e][t]}},{"../../lib":583}],519:[function(t,e,r){"use strict";function n(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function i(t){t._dragging=!1,t._replotPending&&o.plot(t)}var o=t("../../plotly"),a=t("../../lib"),s=t("../../plots/cartesian/constants"),l=e.exports={};l.align=t("./align"),l.getCursor=t("./cursor");var u=t("./unhover");l.unhover=u.wrapped,l.unhoverRaw=u.raw,l.init=function(t){function e(e){return t.element.onmousemove=d,m._dragged=!1,m._dragging=!0,u=e.clientX,c=e.clientY,p=e.target,h=(new Date).getTime(),h-m._mouseDownTimev&&(g=Math.max(g-1,1)),t.doneFn&&t.doneFn(m._dragged,g),!m._dragged){var r=document.createEvent("MouseEvents");r.initEvent("click",!0,!0),p.dispatchEvent(r)}return i(m),m._dragged=!1,a.pauseEvent(e)}var u,c,h,f,p,d,m=a.getPlotDiv(t.element)||{},g=1,v=s.DBLCLICKDELAY;m._mouseDownTime||(m._mouseDownTime=0),d=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"}},{"../../lib":583,"../../plotly":604,"../../plots/cartesian/constants":612,"./align":517,"./cursor":518,"./unhover":520}],520:[function(t,e,r){"use strict";var n=t("../../lib/events"),i=e.exports={};i.wrapped=function(t,e,r){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),i.raw(t,e,r)},i.raw=function(t,e){var r=t._fullLayout;e||(e={}),e.target&&n.triggerHandler(t,"plotly_beforehover",e)===!1||(r._hoverlayer.selectAll("g").remove(),e.target&&t._hoverdata&&t.emit("plotly_unhover",{points:t._hoverdata}),t._hoverdata=void 0)}},{"../../lib/events":577}],521:[function(t,e,r){"use strict";function n(t,e,r,n){var o=t[0]-e[0],a=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],u=Math.pow(o*o+a*a,b/2),c=Math.pow(s*s+l*l,b/2),h=(c*c*o-u*u*s)*n,f=(c*c*a-u*u*l)*n,p=3*c*(u+c),d=3*u*(u+c);return[[i.round(e[0]+(p&&h/p),2),i.round(e[1]+(p&&f/p),2)],[i.round(e[0]-(d&&h/d),2),i.round(e[1]-(d&&f/d),2)]]}var i=t("d3"),o=t("fast-isnumeric"),a=t("../../plots/plots"),s=t("../color"),l=t("../colorscale"),u=t("../../lib"),c=t("../../lib/svg_text_utils"),h=t("../../constants/xmlns_namespaces"),f=t("../../traces/scatter/subtypes"),p=t("../../traces/scatter/make_bubble_size_func"),d=e.exports={};d.font=function(t,e,r,n){e&&e.family&&(n=e.color,r=e.size,e=e.family),e&&t.style("font-family",e),r+1&&t.style("font-size",r+"px"),n&&t.call(s.fill,n)},d.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},d.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},d.setRect=function(t,e,r,n,i){t.call(d.setPosition,e,r).call(d.setSize,n,i)},d.translatePoints=function(t,e,r){t.each(function(t){var n=t.xp||e.c2p(t.x),a=t.yp||r.c2p(t.y),s=i.select(this);o(n)&&o(a)?"text"===this.nodeName?s.attr("x",n).attr("y",a):s.attr("transform","translate("+n+","+a+")"):s.remove()})},d.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},d.crispRound=function(t,e,r){return e&&o(e)?t._context.staticPlot?e:1>e?1:Math.round(e):r||0},d.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var o=(((t||[])[0]||{}).trace||{}).line||{},a=e||o.width||0,l=n||o.dash||"";i.select(this).call(s.stroke,r||o.color).call(d.dashLine,l,a)})},d.dashLine=function(t,e,r){var n=Math.max(r,3);"solid"===e?e="":"dot"===e?e=n+"px,"+n+"px":"dash"===e?e=3*n+"px,"+3*n+"px":"longdash"===e?e=5*n+"px,"+5*n+"px":"dashdot"===e?e=3*n+"px,"+n+"px,"+n+"px,"+n+"px":"longdashdot"===e&&(e=5*n+"px,"+2*n+"px,"+n+"px,"+2*n+"px"),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},d.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=i.select(this);try{r.call(s.fill,e[0].trace.fillcolor)}catch(n){u.error(n,t),r.remove()}})};var m=t("./symbol_defs");d.symbolNames=[],d.symbolFuncs=[],d.symbolNeedLines={},d.symbolNoDot={},d.symbolList=[],Object.keys(m).forEach(function(t){var e=m[t];d.symbolList=d.symbolList.concat([e.n,t,e.n+100,t+"-open"]),d.symbolNames[e.n]=t,d.symbolFuncs[e.n]=e.f,e.needLine&&(d.symbolNeedLines[e.n]=!0),e.noDot?d.symbolNoDot[e.n]=!0:d.symbolList=d.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var g=d.symbolNames.length,v="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";d.symbolNumber=function(t){if("string"==typeof t){var e=0;t.indexOf("-open")>0&&(e=100,t=t.replace("-open","")),t.indexOf("-dot")>0&&(e+=200,t=t.replace("-dot","")),t=d.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=g||t>=400?0:Math.floor(Math.max(t,0))},d.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=r.line;if(a.traceIs(e,"symbols")){var o=p(e);t.attr("d",function(t){var n;n="various"===t.ms||"various"===r.size?3:f.isBubble(e)?o(t.ms):(r.size||6)/2,t.mrc=n;var i=d.symbolNumber(t.mx||r.symbol)||0,a=i%100;return t.om=i%200>=100,d.symbolFuncs[a](n)+(i>=200?v:"")}).style("opacity",function(t){return(t.mo+1||r.opacity+1)-1})}var l=(e._input||{}).marker||{},u=d.tryColorscale(r,l,""),c=d.tryColorscale(r,l,"line.");t.each(function(t){var e,o,a;t.so?(a=n.outlierwidth,o=n.outliercolor,e=r.outliercolor):(a=(t.mlw+1||n.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,o="mlc"in t?t.mlcc=c(t.mlc):Array.isArray(n.color)?s.defaultLine:n.color,e="mc"in t?t.mcc=u(t.mc):Array.isArray(r.color)?s.defaultLine:r.color||"rgba(0,0,0,0)");var l=i.select(this);t.om?l.call(s.stroke,e).style({"stroke-width":(a||1)+"px",fill:"none"}):(l.style("stroke-width",a+"px").call(s.fill,e),a&&l.call(s.stroke,o))})}},d.tryColorscale=function(t,e,r){var n=u.nestedProperty(t,r+"color").get(),i=u.nestedProperty(t,r+"colorscale").get(),a=u.nestedProperty(t,r+"cauto").get(),s=u.nestedProperty(t,r+"cmin"),c=u.nestedProperty(t,r+"cmax"),h=s.get(),f=c.get();return i&&Array.isArray(n)?(!a&&o(h)&&o(f)||(h=1/0,f=-(1/0),n.forEach(function(t){o(t)&&(h>t&&(h=+t),t>f&&(f=+t))}),h>f&&(h=0,f=1),s.set(h),c.set(f),u.nestedProperty(e,r+"cmin").set(h),u.nestedProperty(e,r+"cmax").set(f)),l.makeScaleFunction(i,h,f)):u.identity};var y={start:1,end:-1,middle:0,bottom:1,top:-1},x=1.3;d.textPointStyle=function(t,e){t.each(function(t){var r=i.select(this),n=t.tx||e.text;if(!n||Array.isArray(n))return void r.remove();var a=t.tp||e.textposition,s=-1!==a.indexOf("top")?"top":-1!==a.indexOf("bottom")?"bottom":"middle",l=-1!==a.indexOf("left")?"end":-1!==a.indexOf("right")?"start":"middle",u=t.ts||e.textfont.size,h=t.mrc?t.mrc/.8+1:0;u=o(u)&&u>0?u:0,r.call(d.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",l).text(n).call(c.convertToTspans);var f=i.select(this.parentNode),p=r.selectAll("tspan.line"),m=((p[0].length||1)-1)*x+1,g=y[l]*h,v=.75*u+y[s]*h+(y[s]-1)*m*u/2;f.attr("transform","translate("+g+","+v+")"),m>1&&p.attr({x:r.attr("x"),y:r.attr("y")})})};var b=.5;d.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,i="M"+t[0],o=[];for(r=1;rr;r++)a.push(n(t[r-1],t[r],t[r+1],e));for(a.push(n(t[o-1],t[o],t[0],e)),r=1;o>=r;r++)i+="C"+a[r-1][1]+" "+a[r][0]+" "+t[r];return i+="C"+a[o][1]+" "+a[0][0]+" "+t[0]+"Z"};var _={hv:function(t,e){return"H"+i.round(e[0],2)+"V"+i.round(e[1],2)},vh:function(t,e){return"V"+i.round(e[1],2)+"H"+i.round(e[0],2)},hvh:function(t,e){return"H"+i.round((t[0]+e[0])/2,2)+"V"+i.round(e[1],2)+"H"+i.round(e[0],2)},vhv:function(t,e){return"V"+i.round((t[1]+e[1])/2,2)+"H"+i.round(e[0],2)+"V"+i.round(e[1],2)}},w=function(t,e){return"L"+i.round(e[0],2)+","+i.round(e[1],2)};d.steps=function(t){var e=_[t]||w;return function(t){for(var r="M"+i.round(t[0][0],2)+","+i.round(t[0][1],2),n=1;n=A&&(i.selectAll("[data-bb]").attr("data-bb",null),M=[]),t.setAttribute("data-bb",M.length),M.push(l),u.extendFlat({},l)},d.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=i.select("base");n.size()&&n.attr("href")&&(r=window.location.href+r),t.attr("clip-path","url("+r+")")}},{"../../constants/xmlns_namespaces":571,"../../lib":583,"../../lib/svg_text_utils":596,"../../plots/plots":663,"../../traces/scatter/make_bubble_size_func":785,"../../traces/scatter/subtypes":790,"../color":498,"../colorscale":512,"./symbol_defs":522,d3:90,"fast-isnumeric":99}],522:[function(t,e,r){"use strict";var n=t("d3");e.exports={circle:{n:0,f:function(t){var e=n.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=n.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=n.round(.4*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H"+e+"V"+r+"H-"+e+"V"+e+"H-"+r+"V-"+e+"H-"+e+"V-"+r+"H"+e+"V-"+e+"H"+r+"Z"}},x:{n:4,f:function(t){var e=n.round(.8*t/Math.sqrt(2),2),r="l"+e+","+e,i="l"+e+",-"+e,o="l-"+e+",-"+e,a="l-"+e+","+e;return"M0,"+e+r+i+o+i+o+a+o+a+r+a+r+"Z"}},"triangle-up":{n:5,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+","+r+"H"+e+"L0,-"+i+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+e+",-"+r+"H"+e+"L0,"+i+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M"+r+",-"+e+"V"+e+"L-"+i+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2),r=n.round(t/2,2),i=n.round(t,2);return"M-"+r+",-"+e+"V"+e+"L"+i+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),i=n.round(-t,2),o=n.round(t*-.309,2),a=n.round(.809*t,2);return"M"+e+","+o+"L"+r+","+a+"H-"+r+"L-"+e+","+o+"L0,"+i+"Z"}},hexagon:{n:14,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),i=n.round(t*Math.sqrt(3)/2,2);return"M"+i+",-"+r+"V"+r+"L0,"+e+"L-"+i+","+r+"V-"+r+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),i=n.round(t*Math.sqrt(3)/2,2);return"M-"+r+","+i+"H"+r+"L"+e+",0L"+r+",-"+i+"H-"+r+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=n.round(.924*t,2),r=n.round(.383*t,2);return"M-"+r+",-"+e+"H"+r+"L"+e+",-"+r+"V"+r+"L"+r+","+e+"H-"+r+"L-"+e+","+r+"V-"+r+"Z"}},star:{n:17,f:function(t){var e=1.4*t,r=n.round(.225*e,2),i=n.round(.951*e,2),o=n.round(.363*e,2),a=n.round(.588*e,2),s=n.round(-e,2),l=n.round(e*-.309,2),u=n.round(.118*e,2),c=n.round(.809*e,2),h=n.round(.382*e,2);return"M"+r+","+l+"H"+i+"L"+o+","+u+"L"+a+","+c+"L0,"+h+"L-"+a+","+c+"L-"+o+","+u+"L-"+i+","+l+"H-"+r+"L0,"+s+"Z"}},hexagram:{n:18,f:function(t){var e=n.round(.66*t,2),r=n.round(.38*t,2),i=n.round(.76*t,2);return"M-"+i+",0l-"+r+",-"+e+"h"+i+"l"+r+",-"+e+"l"+r+","+e+"h"+i+"l-"+r+","+e+"l"+r+","+e+"h-"+i+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+i+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),o=n.round(4*t,2),a="A "+o+","+o+" 0 0 1 ";return"M-"+e+","+r+a+e+","+r+a+"0,-"+i+a+"-"+e+","+r+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),o=n.round(4*t,2),a="A "+o+","+o+" 0 0 1 ";return"M"+e+",-"+r+a+"-"+e+",-"+r+a+"0,"+i+a+e+",-"+r+"Z"}},"star-square":{n:21,f:function(t){var e=n.round(1.1*t,2),r=n.round(2*t,2),i="A "+r+","+r+" 0 0 1 ";return"M-"+e+",-"+e+i+"-"+e+","+e+i+e+","+e+i+e+",-"+e+i+"-"+e+",-"+e+"Z"}},"star-diamond":{n:22,f:function(t){var e=n.round(1.4*t,2),r=n.round(1.9*t,2),i="A "+r+","+r+" 0 0 1 ";return"M-"+e+",0"+i+"0,"+e+i+e+",0"+i+"0,-"+e+i+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=n.round(.7*t,2),r=n.round(1.4*t,2);return"M0,"+r+"L"+e+",0L0,-"+r+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=n.round(1.4*t,2),r=n.round(.7*t,2);return"M0,"+r+"L"+e+",0L0,-"+r+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=n.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=n.round(t,2),r=n.round(t/Math.sqrt(2),2);return"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=n.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=n.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=n.round(1.3*t,2),r=n.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+r+",-"+r+"L"+r+","+r+"M-"+r+","+r+"L"+r+",-"+r},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0},"x-thin":{n:34,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},asterisk:{n:35,f:function(t){var e=n.round(1.2*t,2),r=n.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0},hash:{n:36,f:function(t){var e=n.round(t/2,2),r=n.round(t,2);return"M"+e+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+e+"H-"+r+"m0,-"+r+"H"+r},needLine:!0},"y-up":{n:37,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+","+i+"L0,0M"+e+","+i+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0},"y-down":{n:38,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+",-"+i+"L0,0M"+e+",-"+i+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0},"y-left":{n:39,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M"+i+","+e+"L0,0M"+i+",-"+e+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0},"y-right":{n:40,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+i+","+e+"L0,0M-"+i+",-"+e+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0},"line-ew":{n:41,f:function(t){var e=n.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0},"line-ns":{n:42,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0},"line-ne":{n:43,f:function(t){var e=n.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0},"line-nw":{n:44,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0}}},{d3:90}],523:[function(t,e,r){"use strict";e.exports={visible:{valType:"boolean"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"]},symmetric:{valType:"boolean"},array:{valType:"data_array"},arrayminus:{valType:"data_array"},value:{valType:"number",min:0,dflt:10},valueminus:{valType:"number",min:0,dflt:10},traceref:{valType:"integer",min:0,dflt:0},tracerefminus:{valType:"integer",min:0,dflt:0},copy_ystyle:{valType:"boolean"},copy_zstyle:{valType:"boolean"},color:{valType:"color"},thickness:{valType:"number",min:0,dflt:2},width:{valType:"number",min:0},_deprecated:{opacity:{valType:"number"}}}},{}],524:[function(t,e,r){"use strict";function n(t,e,r,n){var o=e["error_"+n]||{},l=o.visible&&-1!==["linear","log"].indexOf(r.type),u=[];if(l){for(var c=s(o),h=0;hs;s++)a[s]={x:r[s],y:i[s]};return a[0].trace=t,n.calc({calcdata:[a],_fullLayout:e}),a},n.plot=t("./plot"),n.style=t("./style"),n.hoverInfo=function(t,e,r){(e.error_y||{}).visible&&(r.yerr=t.yh-t.y,e.error_y.symmetric||(r.yerrneg=t.y-t.ys)),(e.error_x||{}).visible&&(r.xerr=t.xh-t.x,e.error_x.symmetric||(r.xerrneg=t.x-t.xs))}},{"./attributes":523,"./calc":524,"./defaults":526,"./plot":528,"./style":529}],528:[function(t,e,r){"use strict";function n(t,e,r){var n={x:e.c2p(t.x),y:r.c2p(t.y)};return void 0!==t.yh&&(n.yh=r.c2p(t.yh),n.ys=r.c2p(t.ys),o(n.ys)||(n.noYS=!0,n.ys=r.c2p(t.ys,!0))),void 0!==t.xh&&(n.xh=e.c2p(t.xh),n.xs=e.c2p(t.xs),o(n.xs)||(n.noXS=!0,n.xs=e.c2p(t.xs,!0))),n}var i=t("d3"),o=t("fast-isnumeric"),a=t("../../lib"),s=t("../../traces/scatter/subtypes");e.exports=function(t,e){var r=e.x(),l=e.y();t.each(function(t){var e=t[0].trace,u=e.error_x||{},c=e.error_y||{},h=s.hasMarkers(e)&&e.marker.maxdisplayed>0;if(c.visible||u.visible){var f=i.select(this).selectAll("g.errorbar").data(a.identity);f.enter().append("g").classed("errorbar",!0),f.each(function(t){var e=i.select(this),a=n(t,r,l);if(!h||t.vis){var s;if(c.visible&&o(a.x)&&o(a.yh)&&o(a.ys)){var f=c.width;s="M"+(a.x-f)+","+a.yh+"h"+2*f+"m-"+f+",0V"+a.ys,a.noYS||(s+="m-"+f+",0h"+2*f),e.append("path").classed("yerror",!0).attr("d",s)}if(u.visible&&o(a.y)&&o(a.xh)&&o(a.xs)){var p=(u.copy_ystyle?c:u).width;s="M"+a.xh+","+(a.y-p)+"v"+2*p+"m0,-"+p+"H"+a.xs,a.noXS||(s+="m0,-"+p+"v"+2*p),e.append("path").classed("xerror",!0).attr("d",s)}}})}})}},{"../../lib":583,"../../traces/scatter/subtypes":790,d3:90,"fast-isnumeric":99}],529:[function(t,e,r){"use strict";var n=t("d3"),i=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,r=e.error_y||{},o=e.error_x||{},a=n.select(this);a.selectAll("path.yerror").style("stroke-width",r.thickness+"px").call(i.stroke,r.color),o.copy_ystyle&&(o=r),a.selectAll("path.xerror").style("stroke-width",o.thickness+"px").call(i.stroke,o.color)})}},{"../color":498,d3:90}],530:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:!0,source:{valType:"string"},layer:{valType:"enumerated",values:["below","above"],dflt:"above"},sizex:{valType:"number",dflt:0},sizey:{valType:"number",dflt:0},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain"},opacity:{valType:"number",min:0,max:1,dflt:1},x:{valType:"number",dflt:0},y:{valType:"number",dflt:0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top"},xref:{valType:"enumerated",values:["paper",n.idRegex.x.toString()],dflt:"paper"},yref:{valType:"enumerated",values:["paper",n.idRegex.y.toString()], dflt:"paper"}}},{"../../plots/cartesian/constants":612}],531:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,a,r,n)}e=e||{},n("source"),n("layer"),n("x"),n("y"),n("xanchor"),n("yanchor"),n("sizex"),n("sizey"),n("sizing"),n("opacity");for(var s=0;2>s;s++){var l={_fullLayout:r},u=["x","y"][s];i.coerceRef(t,e,l,u,"paper")}return e}var i=t("../../plots/cartesian/axes"),o=t("../../lib"),a=t("./attributes");e.exports=function(t,e){if(t.images&&Array.isArray(t.images))for(var r=t.images,i=e.images=[],o=0;o=2/3},r.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},r.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},r.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],535:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),o=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:o({},n,{}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"]},tracegroupgap:{valType:"number",min:0,dflt:10},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"}}},{"../../lib/extend":578,"../../plots/font_attributes":625,"../color/attributes":497}],536:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],537:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/plots"),o=t("./attributes"),a=t("./helpers");e.exports=function(t,e,r){function s(t,e){return n.coerce(f,p,o,t,e)}for(var l,u,c,h,f=t.legend||{},p=e.legend={},d=0,m="normal",g=0;g1);if(y!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),n.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var x=t.xaxis;x&&x.rangeslider&&x.rangeslider.visible?(l=0,c="left",u=1.1,h="bottom"):(l=0,c="left",u=-.1,h="top")}s("traceorder",m),a.isGrouped(e.legend)&&s("tracegroupgap"),s("x",l),s("xanchor",c),s("y",u),s("yanchor",h),n.noneOrAll(f,p,["x","y"])}}},{"../../lib":583,"../../plots/plots":663,"./attributes":535,"./helpers":540}],538:[function(t,e,r){"use strict";function n(t,e){function r(r){c.util.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(o,e)})}var n=t.data()[0][0],i=e._fullLayout,a=n.trace,s=f.traceIs(a,"pie"),l=a.index,u=s?n.label:a.name,h=t.selectAll("text.legendtext").data([0]);h.enter().append("text").classed("legendtext",!0),h.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(d.font,i.legend.font).text(u),e._context.editable&&!s?h.call(c.util.makeEditable).call(r).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(r),this.text()||(t=" "),c.restyle(e,"name",t,l)}):h.call(r)}function i(t,e){var r=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],n=t.selectAll("rect").data([0]);n.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),n.on("click",function(){if(!e._dragged){var n,i,o=t.data()[0][0],a=e._fullData,s=o.trace,l=s.legendgroup,u=[];if(f.traceIs(s,"pie")){var h=o.label,p=r.indexOf(h);-1===p?r.push(h):r.splice(p,1),c.relayout(e,"hiddenlabels",r)}else{if(""===l)u=[s.index];else for(var d=0;dtspan"),p=f[0].length||1;r=l*p,n=c.node()&&d.bBox(c.node()).width;var m=l*(.3+(1-p)/2);c.attr("y",m),f.attr("y",m)}r=Math.max(r,16)+3,o.attr({x:0,y:-r/2,height:r}),i.height=r,i.width=n}function a(t,e,r){var n=t._fullLayout,i=n.legend,o=i.borderwidth,a=x.isGrouped(i);if(x.isVertical(i))a&&e.each(function(t,e){h.setTranslate(this,0,e*i.tracegroupgap)}),i.width=0,i.height=0,r.each(function(t){var e=t[0],r=e.height,n=e.width;h.setTranslate(this,o,5+o+i.height+r/2),i.height+=r,i.width=Math.max(i.width,n)}),i.width+=45+2*o,i.height+=10+2*o,a&&(i.height+=(i._lgroupsLength-1)*i.tracegroupgap),r.selectAll(".legendtoggle").attr("width",(t._context.editable?0:i.width)+40),i.width=Math.ceil(i.width),i.height=Math.ceil(i.height);else if(a){i.width=0,i.height=0;for(var s=[i.width],l=e.data(),c=0,f=l.length;f>c;c++){var p=l[c].map(function(t){return t[0].width}),d=40+Math.max.apply(null,p);i.width+=i.tracegroupgap+d,s.push(i.width)}e.each(function(t,e){h.setTranslate(this,s[e],0)}),e.each(function(){var t=u.select(this),e=t.selectAll("g.traces"),r=0;e.each(function(t){var e=t[0],n=e.height;h.setTranslate(this,0,5+o+r+n/2),r+=n}),i.height=Math.max(i.height,r)}),i.height+=10+2*o,i.width+=2*o,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.selectAll(".legendtoggle").attr("width",t._context.editable?0:i.width)}else{i.width=0,i.height=0;var m=0,g=0,v=0,y=0;r.each(function(t){v=Math.max(40+t[0].width,v)}),r.each(function(t){var e=t[0],r=v,a=i.tracegroupgap||5;o+y+a+r>n.width-(n.margin.r+n.margin.l)&&(y=0,m+=g,i.height=i.height+g,g=0),h.setTranslate(this,o+y,5+o+e.height/2+m),i.width+=a+r,i.height=Math.max(i.height,e.height),y+=a+r,g=Math.max(e.height,g)}),i.width+=2*o,i.height+=10+2*o,i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.selectAll(".legendtoggle").attr("width",t._context.editable?0:i.width)}}function s(t){var e=t._fullLayout,r=e.legend,n="left";b.isRightAnchor(r)?n="right":b.isCenterAnchor(r)&&(n="center");var i="top";b.isBottomAnchor(r)?i="bottom":b.isMiddleAnchor(r)&&(i="middle"),f.autoMargin(t,"legend",{x:r.x,y:r.y,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:r.height*({top:1,middle:.5}[i]||0),t:r.height*({bottom:1,middle:.5}[i]||0)})}function l(t){var e=t._fullLayout,r=e.legend,n="left";b.isRightAnchor(r)?n="right":b.isCenterAnchor(r)&&(n="center"),f.autoMargin(t,"legend",{x:r.x,y:.5,l:r.width*({right:1,center:.5}[n]||0),r:r.width*({left:1,center:.5}[n]||0),b:0,t:0})}var u=t("d3"),c=t("../../plotly"),h=t("../../lib"),f=t("../../plots/plots"),p=t("../dragelement"),d=t("../drawing"),m=t("../color"),g=t("./constants"),v=t("./get_legend_data"),y=t("./style"),x=t("./helpers"),b=t("./anchor_utils");e.exports=function(t){function e(t,e){T.attr("data-scroll",e).call(h.setTranslate,0,e),E.call(d.setRect,F,t,g.scrollBarWidth,g.scrollBarHeight),A.select("rect").attr({y:x.borderwidth-e})}var r=t._fullLayout,o="legend"+r._uid;if(r._infolayer&&t.calcdata){var x=r.legend,_=r.showlegend&&v(t.calcdata,x),w=r.hiddenlabels||[];if(!r.showlegend||!_.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+o).remove(),void f.autoMargin(t,"legend");var M=r._infolayer.selectAll("g.legend").data([0]);M.enter().append("g").attr({"class":"legend","pointer-events":"all"});var A=r._topdefs.selectAll("#"+o).data([0]);A.enter().append("clipPath").attr("id",o).append("rect");var k=M.selectAll("rect.bg").data([0]);k.enter().append("rect").attr({"class":"bg","shape-rendering":"crispEdges"}),k.call(m.stroke,x.bordercolor),k.call(m.fill,x.bgcolor),k.style("stroke-width",x.borderwidth+"px");var T=M.selectAll("g.scrollbox").data([0]);T.enter().append("g").attr("class","scrollbox");var E=M.selectAll("rect.scrollbar").data([0]);E.enter().append("rect").attr({"class":"scrollbar",rx:20,ry:2,width:0,height:0}).call(m.fill,"#808BA4");var S=T.selectAll("g.groups").data(_);S.enter().append("g").attr("class","groups"),S.exit().remove();var L=S.selectAll("g.traces").data(h.identity);L.enter().append("g").attr("class","traces"),L.exit().remove(),L.call(y).style("opacity",function(t){var e=t[0].trace;return f.traceIs(e,"pie")?-1!==w.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(n,t).call(i,t)});var z=0!==M.enter().size();z&&(a(t,S,L),s(t));var I=0,P=r.width,C=0,R=r.height;a(t,S,L),x.height>R?l(t):s(t);var D=r._size,O=D.l+D.w*x.x,j=D.t+D.h*(1-x.y);b.isRightAnchor(x)?O-=x.width:b.isCenterAnchor(x)&&(O-=x.width/2),b.isBottomAnchor(x)?j-=x.height:b.isMiddleAnchor(x)&&(j-=x.height/2);var F=x.width;D.w;O+F>P&&(O=P-F),I>O&&(O=I),F=Math.min(P-O,x.width);var N=x.height,B=D.h;N>B?(j=D.t,N=B):(j+N>R&&(j=R-N),C>j&&(j=C),N=Math.min(R-j,x.height)),h.setTranslate(M,O,j);var U,V,q=N-g.scrollBarHeight-2*g.scrollBarMargin,G=x.height-N;if(x.height<=N||t._context.staticPlot)k.attr({width:F-x.borderwidth,height:N-x.borderwidth,x:x.borderwidth/2,y:x.borderwidth/2}),h.setTranslate(T,0,0),A.select("rect").attr({width:F-2*x.borderwidth,height:N-2*x.borderwidth,x:x.borderwidth,y:x.borderwidth}),T.call(d.setClipUrl,o);else{U=g.scrollBarMargin,V=T.attr("data-scroll")||0,k.attr({width:F-2*x.borderwidth+g.scrollBarWidth+g.scrollBarMargin,height:N-x.borderwidth,x:x.borderwidth/2,y:x.borderwidth/2}),A.select("rect").attr({width:F-2*x.borderwidth+g.scrollBarWidth+g.scrollBarMargin,height:N-2*x.borderwidth,x:x.borderwidth,y:x.borderwidth-V}),T.call(d.setClipUrl,o),z&&e(U,V),M.on("wheel",null),M.on("wheel",function(){V=h.constrain(T.attr("data-scroll")-u.event.deltaY/q*G,-G,0),U=g.scrollBarMargin-V/G*q,e(U,V),u.event.preventDefault()}),E.on(".drag",null),T.on(".drag",null);var H=u.behavior.drag().on("drag",function(){U=h.constrain(u.event.y-g.scrollBarHeight/2,g.scrollBarMargin,g.scrollBarMargin+q),V=-(U-g.scrollBarMargin)/q*G,e(U,V)});E.call(H),T.call(H)}if(t._context.editable){var X,Y,W,Z;M.classed("cursor-move",!0),p.init({element:M.node(),prepFn:function(){var t=h.getTranslate(M);W=t.x,Z=t.y},moveFn:function(t,e){var r=W+t,n=Z+e;h.setTranslate(M,r,n),X=p.align(r,0,D.l,D.l+D.w,x.xanchor),Y=p.align(n,0,D.t+D.h,D.t,x.yanchor)},doneFn:function(e){e&&void 0!==X&&void 0!==Y&&c.relayout(t,{"legend.x":X,"legend.y":Y})}})}}}},{"../../lib":583,"../../plotly":604,"../../plots/plots":663,"../color":498,"../dragelement":519,"../drawing":521,"./anchor_utils":534,"./constants":536,"./get_legend_data":539,"./helpers":540,"./style":542,d3:90}],539:[function(t,e,r){"use strict";var n=t("../../plots/plots"),i=t("./helpers");e.exports=function(t,e){function r(t,r){if(""!==t&&i.isGrouped(e))-1===l.indexOf(t)?(l.push(t),u=!0,s[t]=[[r]]):s[t].push([r]);else{var n="~~i"+h;l.push(n),s[n]=[[r]],h++}}var o,a,s={},l=[],u=!1,c={},h=0;for(o=0;oo;o++)v=s[l[o]],y[o]=i.isReversed(e)?v.reverse():v;else{for(y=[new Array(x)],o=0;x>o;o++)v=s[l[o]][0],y[0][i.isReversed(e)?x-o-1:o]=v;x=1}return e._lgroupsLength=x,y}},{"../../plots/plots":663,"./helpers":540}],540:[function(t,e,r){"use strict";var n=t("../../plots/plots");r.legendGetsTrace=function(t){return t.visible&&n.traceIs(t,"showLegend")},r.isGrouped=function(t){return-1!==(t.traceorder||"").indexOf("grouped")},r.isVertical=function(t){return"h"!==t.orientation},r.isReversed=function(t){return-1!==(t.traceorder||"").indexOf("reversed")}},{"../../plots/plots":663}],541:[function(t,e,r){"use strict";var n=e.exports={};n.layoutAttributes=t("./attributes"),n.supplyLayoutDefaults=t("./defaults"),n.draw=t("./draw"),n.style=t("./style")},{"./attributes":535,"./defaults":537,"./draw":538,"./style":542}],542:[function(t,e,r){"use strict";function n(t){var e=t[0].trace,r=e.visible&&e.fill&&"none"!==e.fill,n=p.hasLines(e),i=l.select(this).select(".legendfill").selectAll("path").data(r?[t]:[]);i.enter().append("path").classed("js-fill",!0),i.exit().remove(),i.attr("d","M5,0h30v6h-30z").call(h.fillGroupStyle);var o=l.select(this).select(".legendlines").selectAll("path").data(n?[t]:[]);o.enter().append("path").classed("js-line",!0).attr("d","M5,0h30"),o.exit().remove(),o.call(h.lineGroupStyle)}function i(t){function e(t,e,r){var n=u.nestedProperty(a,t).get(),i=Array.isArray(n)&&e?e(n):n;if(r){if(ir[1])return r[1]}return i}function r(t){return t[0]}var n,i,o=t[0],a=o.trace,s=p.hasMarkers(a),c=p.hasText(a),f=p.hasLines(a);if(s||c||f){var d={},m={};s&&(d.mc=e("marker.color",r),d.mo=e("marker.opacity",u.mean,[.2,1]),d.ms=e("marker.size",u.mean,[2,16]),d.mlc=e("marker.line.color",r),d.mlw=e("marker.line.width",u.mean,[0,5]),m.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),f&&(m.line={width:e("line.width",r,[0,10])}),c&&(d.tx="Aa",d.tp=e("textposition",r),d.ts=10,d.tc=e("textfont.color",r),d.tf=e("textfont.family",r)),n=[u.minExtend(o,d)],i=u.minExtend(a,m)}var g=l.select(this).select("g.legendpoints"),v=g.selectAll("path.scatterpts").data(s?n:[]);v.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),v.exit().remove(),v.call(h.pointStyle,i),s&&(n[0].mrc=3);var y=g.selectAll("g.pointtext").data(c?n:[]);y.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),y.exit().remove(),y.selectAll("text").call(h.textPointStyle,i)}function o(t){var e=t[0].trace,r=e.marker||{},n=r.line||{},i=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(c.traceIs(e,"bar")?[t]:[]);i.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),i.exit().remove(),i.each(function(t){var e=(t.mlw+1||n.width+1)-1,i=l.select(this);i.style("stroke-width",e+"px").call(f.fill,t.mc||r.color),e&&i.call(f.stroke,t.mlc||n.color)})}function a(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendbox").data(c.traceIs(e,"box")&&e.visible?[t]:[]);r.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.each(function(t){var r=(t.lw+1||e.line.width+1)-1,n=l.select(this);n.style("stroke-width",r+"px").call(f.fill,t.fc||e.fillcolor),r&&n.call(f.stroke,t.lc||e.line.color)})}function s(t){var e=t[0].trace,r=l.select(this).select("g.legendpoints").selectAll("path.legendpie").data(c.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(d,t[0],e)}var l=t("d3"),u=t("../../lib"),c=t("../../plots/plots"),h=t("../drawing"),f=t("../color"),p=t("../../traces/scatter/subtypes"),d=t("../../traces/pie/style_one");e.exports=function(t){t.each(function(t){var e=l.select(this),r=e.selectAll("g.legendfill").data([t]);r.enter().append("g").classed("legendfill",!0);var n=e.selectAll("g.legendlines").data([t]);n.enter().append("g").classed("legendlines",!0);var i=e.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.style("opacity",t[0].trace.opacity),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(a).each(s).each(n).each(i)}},{"../../lib":583,"../../plots/plots":663,"../../traces/pie/style_one":763,"../../traces/scatter/subtypes":790,"../color":498,"../drawing":521,d3:90}],543:[function(t,e,r){"use strict";function n(t,e){var r=e.currentTarget,n=r.getAttribute("data-attr"),i=r.getAttribute("data-val")||!0,o=t._fullLayout,a={};if("zoom"===n){for(var s,l,c="in"===i?.5:2,h=(1+c)/2,f=(1-c)/2,p=u.Axes.list(t,null,!0),d=0;dy;y++){var x=s[y];f=v[x]={};for(var b=0;b1)return n(["resetViews","toggleHover"]),a(g,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),f&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var v=i(s),y=[];return((u||d)&&!v||m)&&(y=["zoom2d","pan2d"]),(u||m)&&o(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!u&&!d||v||m||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&p?n(["toggleHover"]):d?n(["hoverClosestGl2d"]):u?n(["hoverClosestCartesian","hoverCompareCartesian"]):p&&n(["hoverClosestPie"]),a(g,r)}function i(t){for(var e=l.Axes.list({_fullLayout:t},null,!0),r=!0,n=0;n0);if(d){var m=i(e,r,l);c("x",m[0]),c("y",m[1]),o.noneOrAll(t,e,["x","y"]),c("xanchor"),c("yanchor"),o.coerceFont(c,"font",r.font);var g=c("bgcolor");c("activecolor",a.contrast(g,u.lightAmount,u.darkAmount)),c("bordercolor"),c("borderwidth")}}},{"../../lib":583,"../color":498,"./attributes":546,"./button_attributes":547,"./constants":548}],550:[function(t,e,r){"use strict";function n(t){for(var e=v.list(t,"x",!0),r=[],n=0;ne){var r=e;e=t,t=r}s.setAttributes(w,{"data-min":t,"data-max":e}),s.setAttributes(C,{x:t,width:e-t}),s.setAttributes(k,{width:t}),s.setAttributes(T,{x:e,width:d-e}),s.setAttributes(E,{transform:"translate("+(t-g-1)+")"}),s.setAttributes(z,{transform:"translate("+e+")"})}var h=t._fullLayout,f=h._infolayer.selectAll("g.range-slider"),p=h.xaxis.rangeslider,d=h._size.w,m=(h.height-h.margin.b-h.margin.t)*p.thickness,g=2,v=Math.floor(p.borderwidth/2),y=h.margin.l,x=h.height-m-h.margin.b,b=0,_=d,w=document.createElementNS(a,"g");s.setAttributes(w,{"class":"range-slider","data-min":b,"data-max":_,"pointer-events":"all",transform:"translate("+y+","+x+")"});var M=document.createElementNS(a,"rect"),A=p.borderwidth%2===0?p.borderwidth:p.borderwidth-1;s.setAttributes(M,{fill:p.bgcolor,stroke:p.bordercolor,"stroke-width":p.borderwidth,height:m+A,width:d+A,transform:"translate(-"+v+", -"+v+")","shape-rendering":"crispEdges"});var k=document.createElementNS(a,"rect");s.setAttributes(k,{x:0,width:b,height:m,fill:"rgba(0,0,0,0.4)"});var T=document.createElementNS(a,"rect");s.setAttributes(T,{x:_,width:d-_,height:m,fill:"rgba(0,0,0,0.4)"});var E=document.createElementNS(a,"g"),S=document.createElementNS(a,"rect"),L=document.createElementNS(a,"rect");s.setAttributes(E,{transform:"translate("+(b-g-1)+")"}),s.setAttributes(S,{width:10,height:m,x:-6,fill:"transparent",cursor:"col-resize"}),s.setAttributes(L,{width:g,height:m/2,y:m/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges"}),s.appendChildren(E,[L,S]);var z=document.createElementNS(a,"g"),I=document.createElementNS(a,"rect"),P=document.createElementNS(a,"rect");s.setAttributes(z,{transform:"translate("+_+")"}),s.setAttributes(I,{width:10,height:m,x:-2,fill:"transparent",cursor:"col-resize"}),s.setAttributes(P,{width:g,height:m/2,y:m/4,rx:1,fill:"white",stroke:"#666","shape-rendering":"crispEdges"}),s.appendChildren(z,[P,I]);var C=document.createElementNS(a,"rect");s.setAttributes(C,{x:b,width:_-b,height:m,cursor:"ew-resize",fill:"transparent"}),w.addEventListener("mousedown",function(t){function r(t){var r,n,h=+t.clientX-o;switch(i){case C:w.style.cursor="ew-resize",r=+s+h,n=+l+h,c(r,n),u(e(r),e(n));break;case S:w.style.cursor="col-resize",r=+s+h,n=+l,c(r,n),u(e(r),e(n));break;case I:w.style.cursor="col-resize",r=+s,n=+l+h,c(r,n),u(e(r),e(n));break;default:w.style.cursor="ew-resize",r=a,n=a+h,c(r,n),u(e(r),e(n))}}function n(){window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",n),w.style.cursor="auto"}var i=t.target,o=t.clientX,a=o-w.getBoundingClientRect().left,s=w.getAttribute("data-min"),l=w.getAttribute("data-max");window.addEventListener("mousemove",r),window.addEventListener("mouseup",n)}),p.range||(p.range=i.getAutoRange(h.xaxis));var R=l(t,d,m);s.appendChildren(w,[M,R,k,T,C,E,z]),r(h.xaxis.range[0],h.xaxis.range[1]),f.data([0]).enter().append(function(){return p.setRange=r,w})}},{"../../constants/xmlns_namespaces":571,"../../lib":583,"../../plotly":604,"../../plots/cartesian/axes":607,"./helpers":556,"./range_plot":558}],555:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes");e.exports=function(t,e,r,o){function a(t,e){return n.coerce(s,l,i,t,e)}if(t[r].rangeslider){var s=n.isPlainObject(t[r].rangeslider)?t[r].rangeslider:{},l=e[r].rangeslider={};if(a("bgcolor"),a("bordercolor"),a("borderwidth"),a("thickness"),a("visible"),a("range"),l.range&&!e[r].autorange){var u=l.range,c=e[r].range;u[0]=Math.min(u[0],c[0]),u[1]=Math.max(u[1],c[1])}else e[r]._needsExpand=!0;l.visible&&o.forEach(function(t){var r=e[t]||{};r.fixedrange=!0,e[t]=r})}}},{"../../lib":583,"./attributes":553}],556:[function(t,e,r){"use strict";r.setAttributes=function(t,e){for(var r in e)t.setAttribute(r,e[r])},r.appendChildren=function(t,e){for(var r=0;rl;l++){var u=s[l],c={_fullLayout:e},h=k.coerceRef(t,n,c,u);if("path"!==a){var f=.25,p=.75;if("paper"!==h){var d=k.getFromId(c,h),m=o(d);f=m(d.range[0]+f*(d.range[1]-d.range[0])),p=m(d.range[0]+p*(d.range[1]-d.range[0]))}r(u+"0",f),r(u+"1",p)}}return"path"===a?r("path"):A.noneOrAll(t,n,["x0","x1","y0","y1"]),n}function i(t){return"category"===t.type?t.c2l:t.d2l}function o(t){return"category"===t.type?t.l2c:t.l2d}function a(t,e){t.layout.shapes=e,z.supplyLayoutDefaults(t.layout,t._fullLayout),z.drawAll(t)}function s(t){delete t.layout.shapes,t._fullLayout.shapes=[],z.drawAll(t)}function l(t,e,r){for(var n=0;ne;i--)p(t,i).selectAll('[data-index="'+(i-1)+'"]').attr("data-index",i),z.draw(t,i)}function h(t,e,r,a){function s(r){var n={"data-index":e,"fill-rule":"evenodd",d:x(t,z)},i=z.line.width?z.line.color:"rgba(0,0,0,0)",o=r.append("path").attr(n).style("opacity",z.opacity).call(T.stroke,i).call(T.fill,z.fillcolor).call(E.dashLine,z.line.dash,z.line.width);I&&o.call(E.setClipUrl,"clip"+t._fullLayout._uid+I),t._context.editable&&f(t,o,z,e)}var l,u;p(t,e).selectAll('[data-index="'+e+'"]').remove();var c=t.layout.shapes[e];if(c){var h={xref:c.xref,yref:c.yref},m={};"string"==typeof r&&r?m[r]=a:A.isPlainObject(r)&&(m=r);var g=Object.keys(m);for(l=0;ll;l++){var b=y[l];if(void 0===m[b]&&void 0!==c[b]){var _,w=b.charAt(0),M=k.getFromId(t,k.coerceRef(h,{},t,w)),S=k.getFromId(t,k.coerceRef(c,{},t,w)),L=c[b];void 0!==m[w+"ref"]&&(M?(_=i(M)(L),L=(_-M.range[0])/(M.range[1]-M.range[0])):L=(L-S.domain[0])/(S.domain[1]-S.domain[0]),S?(_=S.range[0]+L*(S.range[1]-S.range[0]),L=o(S)(_)):L=M.domain[0]+L*(M.domain[1]-M.domain[0])),c[b]=L}}var z=n(c,t._fullLayout);t._fullLayout.shapes[e]=z;var I;if("below"!==z.layer)I=(z.xref+z.yref).replace(/paper/g,""),s(t._fullLayout._shapeUpperLayer);else if("paper"===z.xref&&"paper"===z.yref)I="",s(t._fullLayout._shapeLowerLayer);else{var P,C=t._fullLayout._plots||{},R=Object.keys(C);for(l=0,u=R.length;u>l;l++)P=C[R[l]],I=R[l],d(t,z,P)&&s(P.shapelayer)}}}function f(t,e,r,n){function i(t){var r=K.right-K.left,n=K.bottom-K.top,i=t.clientX-K.left,o=t.clientY-K.top,a=r>W&&n>Z&&!t.shiftKey?S.getCursor(i/r,1-o/n):"move";L(e,a),Y=a.split("-")[0]}function o(e){U=k.getFromId(t,r.xref),V=k.getFromId(t,r.yref),q=v(t,U),G=v(t,V,!0),H=y(t,U),X=y(t,V,!0);var o="shapes["+n+"]";"path"===r.type?(N=r.path,B=o+".path"):(c=q(r.x0),h=G(r.y0),f=q(r.x1),p=G(r.y1),d=o+".x0",m=o+".y0",_=o+".x1",w=o+".y1"),f>c?(E=c,C=o+".x0",j="x0",z=f,R=o+".x1",F="x1"):(E=f,C=o+".x1",j="x1",z=c,R=o+".x0",F="x0"),p>h?(A=h,I=o+".y0",D="y0",T=p,P=o+".y1",O="y1"):(A=p,I=o+".y1",D="y1",T=h,P=o+".y0",O="y0"),u={},i(e),Q.moveFn="move"===Y?s:l}function a(r){L(e),r&&M.relayout(t,u)}function s(n,i){if("path"===r.type){var o=function(t){return H(q(t)+n)};U&&"date"===U.type&&(o=g(o));var a=function(t){return X(G(t)+i)};V&&"date"===V.type&&(a=g(a)),r.path=b(N,o,a),u[B]=r.path}else u[d]=r.x0=H(c+n),u[m]=r.y0=X(h+i),u[_]=r.x1=H(f+n),u[w]=r.y1=X(p+i);e.attr("d",x(t,r))}function l(n,i){if("path"===r.type){var o=function(t){return H(q(t)+n)};U&&"date"===U.type&&(o=g(o));var a=function(t){return X(G(t)+i)};V&&"date"===V.type&&(a=g(a)),r.path=b(N,o,a),u[B]=r.path}else{var s=~Y.indexOf("n")?A+i:A,l=~Y.indexOf("s")?T+i:T,c=~Y.indexOf("w")?E+n:E,h=~Y.indexOf("e")?z+n:z;l-s>Z&&(u[I]=r[D]=X(s),u[P]=r[O]=X(l)),h-c>W&&(u[C]=r[j]=H(c),u[R]=r[F]=H(h))}e.attr("d",x(t,r))}var u,c,h,f,p,d,m,_,w,A,T,E,z,I,P,C,R,D,O,j,F,N,B,U,V,q,G,H,X,Y,W=10,Z=10,Q={setCursor:i,element:e.node(),prepFn:o,doneFn:a},K=Q.element.getBoundingClientRect();S.init(Q)}function p(t,e){var r=t._fullLayout.shapes[e],n=t._fullLayout._shapeUpperLayer;return r?"below"===r.layer&&(n="paper"===r.xref&&"paper"===r.yref?t._fullLayout._shapeLowerLayer:t._fullLayout._shapeSubplotLayer):A.log("getShapeLayer: undefined shape: index",e),n}function d(t,e,r){var n=M.Axes.getFromId(t,r.id,"x")._id,i=M.Axes.getFromId(t,r.id,"y")._id,o="below"===e.layer,a=n===e.xref||i===e.yref,s=!!r.shapelayer;return o&&a&&s}function m(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}}function g(t){return function(e){return t(e).replace(" ","_")}}function v(t,e,r){var n,o=t._fullLayout._size;if(e){var a=i(e);n=function(t){return e._offset+e.l2p(a(t,!0))},"date"===e.type&&(n=m(n))}else n=r?function(t){return o.t+o.h*(1-t)}:function(t){return o.l+o.w*t};return n}function y(t,e,r){var n,i=t._fullLayout._size;if(e){var a=o(e);n=function(t){return a(e.p2l(t-e._offset))}}else n=r?function(t){return 1-(t-i.t)/i.h}:function(t){return(t-i.l)/i.w};return n}function x(t,e){var r,n,o,a,s=e.type,l=k.getFromId(t,e.xref),u=k.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(r=i(l),n=function(t){return l._offset+l.l2p(r(t,!0))}):n=function(t){return c.l+c.w*t},u?(o=i(u),a=function(t){return u._offset+u.l2p(o(t,!0))}):a=function(t){return c.t+c.h*(1-t)},"path"===s)return l&&"date"===l.type&&(n=m(n)),u&&"date"===u.type&&(a=m(a)),z.convertPath(e.path,n,a);var h=n(e.x0),f=n(e.x1),p=a(e.y0),d=a(e.y1);if("line"===s)return"M"+h+","+p+"L"+f+","+d;if("rect"===s)return"M"+h+","+p+"H"+f+"V"+d+"H"+h+"Z";var g=(h+f)/2,v=(p+d)/2,y=Math.abs(g-h),x=Math.abs(v-p),b="A"+y+","+x,_=g+y+","+v,w=g+","+(v-x);return"M"+_+b+" 0 1,1 "+w+b+" 0 0,1 "+_+"Z"}function b(t,e,r){return t.replace(I,function(t){var n=0,i=t.charAt(0),o=C[i],a=R[i],s=D[i],l=t.substr(1).replace(P,function(t){return n>=s?t:(o[n]?t=e(t):a[n]&&(t=r(t)),n++,t)});return i+l})}function _(t,e,r,n,i){var o="category"===t.type?Number:t.d2c;if(void 0!==e)return[o(e),o(r)];if(n){var a,s,l,u,c,h=1/0,f=-(1/0),p=n.match(I);for("date"===t.type&&(o=m(o)),a=0;ac&&(h=c),c>f&&(f=c)));return f>=h?[h,f]:void 0}}var w=t("fast-isnumeric"),M=t("../../plotly"),A=t("../../lib"),k=t("../../plots/cartesian/axes"),T=t("../color"),E=t("../drawing"),S=t("../dragelement"),L=t("../../lib/setcursor"),z=e.exports={};z.layoutAttributes=t("./attributes"),z.supplyLayoutDefaults=function(t,e){for(var r=t.shapes||[],i=e.shapes=[],o=0;os&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),A.log("Ignoring extra params in segment "+t)),i+l})},z.calcAutorange=function(t){var e,r,n,i,o,a=t._fullLayout,s=a.shapes;if(s.length&&t._fullData.length)for(e=0;ef?r=f:(c.left-=x.offsetLeft,c.right-=x.offsetLeft,c.top-=x.offsetTop,c.bottom-=x.offsetTop,x.selection.each(function(){var t=l.bBox(this);s.bBoxIntersect(c,t,u)&&(r=Math.max(r,a*(t[x.side]-c[o])+u))}),r=Math.min(f,r)),r>0||0>f){var p={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[x.side];e.attr("transform","translate("+p+")")}}}function d(){E=0,S=!0,L=I,M._infolayer.select("."+e).attr({"data-unformatted":L}).text(L).on("mouseover.opacity",function(){n.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(1e3).style("opacity",0)})}var m=r.propContainer,g=r.propName,v=r.traceIndex,y=r.dfltName,x=r.avoid||{},b=r.attributes,_=r.transform,w=r.containerGroup,M=t._fullLayout,A=m.titlefont.family,k=m.titlefont.size,T=m.titlefont.color,E=1,S=!1,L=m.title.trim();""===L&&(E=0),L.match(/Click to enter .+ title/)&&(E=.2,S=!0),w||(w=M._infolayer.selectAll(".g-"+e).data([0]),w.enter().append("g").classed("g-"+e,!0));var z=w.selectAll("text").data([0]);z.enter().append("text"),z.text(L).attr("class",e),z.attr({"data-unformatted":L}).call(h);var I="Click to enter "+y+" title",P=t._context.editable;P&&(m===M?P=t._context.editableMainTitle:m===M.xaxis?P=t._context.editableAxisXTitle:m===M.yaxis?P=t._context.editableAxisYTitle:m===M.yaxis2?P=t._context.editableAxisY2Title:m===M.xaxis2&&(P=t._context.editableAxisX2Title)),P?(L||d(),z.call(c.makeEditable).on("edit",function(e){void 0!==v?o.restyle(t,g,e,v):o.relayout(t,g,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(h)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):L&&!L.match(/Click to enter .+ title/)||z.remove(),z.classed("js-placeholder",S),m._titleElement=z}},{"../../lib":583,"../../lib/svg_text_utils":596,"../../plotly":604,"../../plots/plots":663,"../color":498,"../drawing":521,d3:90,"fast-isnumeric":99}],562:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),o=t("../../lib/extend").extendFlat,a={_isLinkedToArray:!0,method:{valType:"enumerated",values:["restyle","relayout"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""}};e.exports={_isLinkedToArray:!0,visible:{valType:"boolean"},active:{valType:"integer",min:-1,dflt:0},buttons:a,x:{valType:"number",min:-2,max:3,dflt:-.05},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"right"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"bottom"},font:o({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":578,"../../plots/font_attributes":625,"../color/attributes":497}],563:[function(t,e,r){"use strict";e.exports={name:"updatemenus",itemName:"updatemenu",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",buttonGroupClassName:"updatemenu-button-group",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:40,fontSizeToHeight:1.3,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF"}},{}],564:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,a,r,n)}var s=i(t,e),l=n("visible",s.length>0);l&&(n("active"),n("x"),n("y"),o.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),o.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function i(t,e){function r(t,e){return o.coerce(n,i,u,t,e)}for(var n,i,a=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(l.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),l.exit().remove(),l.exit().size()&&v(t),0!==r.length){var u=l.selectAll("g."+T.headerGroupClassName).data(r,i);u.enter().append("g").classed(T.headerGroupClassName,!0);var c=l.selectAll("g."+T.buttonGroupClassName).data([0]);c.enter().append("g").classed(T.buttonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&c.call(g).attr(T.menuIndexAttrName,"-1"),u.exit().each(function(e){y.select(this).remove(),c.call(g).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var h=0;h",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],571:[function(t,e,r){"use strict";r.xmlns="http://www.w3.org/2000/xmlns/",r.svg="http://www.w3.org/2000/svg",r.xlink="http://www.w3.org/1999/xlink",r.svgAttrs={xmlns:r.svg,"xmlns:xlink":r.xlink}},{}],572:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.16.3-d15",r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=n.register,r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=n.Fx,r.Snapshot=n.Snapshot,r.PlotSchema=n.PlotSchema,r.Queue=n.Queue,r.d3=t("d3")},{"../build/ploticon":2,"./plot_api/set_plot_config":601,"./plot_api/to_image":602,"./plot_api/validate":603,"./plotly":604,"./snapshot/download":678,d3:90}],573:[function(t,e,r){"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],574:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){Array.isArray(t)&&(e[r]=t[n])}},{}],575:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),o=t("./nested_property"),a=t("../components/colorscale/get_scale"),s=(Object.keys(t("../components/colorscale/scales")),/^([2-9]|[1-9][0-9]+)$/);r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),-1===n.values.indexOf(t)?e.set(r):e.set(t)}},"boolean":{coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,i){!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,i){t%1||!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;n.strict!==!0&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){i(t).isValid()?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(a(t,r))}},angle:{coerceFunction:function(t,e,r){"auto"===t?e.set("auto"):n(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){var n=r.length;return"string"==typeof t&&t.substr(0,n)===r&&s.test(t.substr(n))?void e.set(t):void e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r?!0:"string"!=typeof t?!1:!(t.substr(0,n)!==r||!s.test(t.substr(n)))}},flaglist:{coerceFunction:function(t,e,r,n){if("string"!=typeof t)return void e.set(r);if(-1!==(n.extras||[]).indexOf(t))return void e.set(t);for(var i=t.split("+"),o=0;o2)return!1;var l=a[0].split("-");if(l.length>3||3!==l.length&&a[1])return!1;if(4===l[0].length)r=Number(l[0]);else{if(2!==l[0].length)return!1;var u=(new Date).getFullYear();r=((Number(l[0])-u+70)%100+200)%100+u-70}return s(r)?1===l.length?new Date(r,0,1).getTime():(n=Number(l[1])-1,l[1].length>2||!(n>=0&&11>=n)?!1:2===l.length?new Date(r,n,1).getTime():(i=Number(l[2]),l[2].length>2||!(i>=1&&31>=i)?!1:(i=new Date(r,n,i).getTime(),a[1]?(l=a[1].split(":"),l.length>3?!1:(o=Number(l[0]),l[0].length>2||!(o>=0&&23>=o)?!1:(i+=36e5*o,1===l.length?i:(n=Number(l[1]),l[1].length>2||!(n>=0&&59>=n)?!1:(i+=6e4*n,2===l.length?i:(t=Number(l[2]),t>=0&&60>t?i+1e3*t:!1)))))):i))):!1},r.isDateTime=function(t){return r.dateTime2ms(t)!==!1},r.ms2DateTime=function(t,e){if("undefined"==typeof a)return void l.error("d3 is not defined.");e||(e=0);var r=new Date(t),i=a.time.format("%Y-%m-%d")(r);return 7776e6>e?(i+=" "+n(r.getHours(),2),432e6>e&&(i+=":"+n(r.getMinutes(),2),108e5>e&&(i+=":"+n(r.getSeconds(),2),3e5>e&&(i+="."+n(r.getMilliseconds(),3)))),i.replace(/([:\s]00)*\.?[0]*$/,"")):i};var u={H:["%H:%M:%S~%L","%H:%M:%S","%H:%M"],I:["%I:%M:%S~%L%p","%I:%M:%S%p","%I:%M%p"],D:["%H","%I%p","%Hh"]},c={Y:["%Y~%m~%d","%Y%m%d","%y%m%d","%m~%d~%Y","%d~%m~%Y"],Yb:["%b~%d~%Y","%d~%b~%Y","%Y~%d~%b","%Y~%b~%d"],y:["%m~%d~%y","%d~%m~%y","%y~%m~%d"],yb:["%b~%d~%y","%d~%b~%y","%y~%d~%b","%y~%b~%d"]},h=a.time.format.utc,f={Y:{H:["%Y~%m~%dT%H:%M:%S","%Y~%m~%dT%H:%M:%S~%L"].map(h),I:[],D:["%Y%m%d%H%M%S","%Y~%m","%m~%Y"].map(h)},Yb:{H:[],I:[],D:["%Y~%b","%b~%Y"].map(h)},y:{H:[],I:[],D:[]},yb:{H:[],I:[],D:[]}};["Y","Yb","y","yb"].forEach(function(t){c[t].forEach(function(e){f[t].D.push(h(e)),["H","I","D"].forEach(function(r){u[r].forEach(function(n){var i=f[t][r];i.push(h(e+"~"+n)),i.push(h(n+"~"+e))})})})});var p=/[a-z]*/g,d=function(t){return t.substr(0,3)},m=/(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g,g=/[\s,\/\-\.\(\)]+/g,v=/~?([ap])~?m(~|$)/,y=function(t,e){return e+"m "},x=/\d\d\d\d/,b=/(^|~)[a-z]{3}/,_=/[ap]m/,w=/:/,M=/q([1-4])/,A=["31~mar","30~jun","30~sep","31~dec"],k=function(t,e){return A[e-1]},T=/ ?([+\-]\d\d:?\d\d|Z)$/;r.parseDate=function(t){if(t.getTime)return t;if("string"!=typeof t)return!1;t=t.toLowerCase().replace(p,d).replace(m,"").replace(g,"~").replace(v,y).replace(M,k).trim().replace(T,"");var e,r,n=null,a=i(t),s=o(t);e=f[a][s],r=e.length;for(var l=0;r>l&&!(n=e[l].parse(t));l++);if(!(n instanceof Date))return!1;var u=n.getTimezoneOffset();return n.setTime(n.getTime()+60*u*1e3),n}},{"../lib":583,d3:90,"fast-isnumeric":99}],577:[function(t,e,r){"use strict";var n=t("events").EventEmitter,i={init:function(t){if(t._ev instanceof n)return t;var e=new n;return t._ev=e,t.on=e.on.bind(e),t.once=e.once.bind(e),t.removeListener=e.removeListener.bind(e),t.removeAllListeners=e.removeAllListeners.bind(e),t.emit=function(r,n){"undefined"!=typeof jQuery&&jQuery(t).trigger(r,n),e.emit(r,n)},t},triggerHandler:function(t,e,r){var n,i;"undefined"!=typeof jQuery&&(n=jQuery(t).triggerHandler(e,r));var o=t._ev;if(!o)return n;var a=o._events[e];if(!a)return n;"function"==typeof a&&(a=[a]);for(var s=a.pop(),l=0;lv;v++){l=t[v];for(u in l)c=m[u],h=l[u],s&&a(h)?m[u]=h:e&&h&&(o(h)||(f=a(h)))?(f?(f=!1,p=c&&a(c)?c:[]):p=c&&o(c)?c:{},m[u]=i([p,h],e,r,s)):("undefined"!=typeof h||r)&&(m[u]=h)}return m}var o=t("./is_plain_object.js"),a=Array.isArray;r.extendFlat=function(){return i(arguments,!1,!1,!1)},r.extendDeep=function(){return i(arguments,!0,!1,!1)},r.extendDeepAll=function(){return i(arguments,!0,!0,!1)},r.extendDeepNoArrays=function(){return i(arguments,!0,!1,!0)}},{"./is_plain_object.js":584}],579:[function(t,e,r){"use strict";e.exports=function(t){for(var e=[],r=0;ry;y++)h=s(d,y),p=l(e,y),v[y]=n(h,p);else v=n(d,e);return v}var s=t("tinycolor2"),l=t("fast-isnumeric"),u=t("../components/colorscale/make_scale_function"),c=t("../components/color/attributes").defaultLine,h=t("./str2rgbarray"),f=1;e.exports=a},{"../components/color/attributes":497,"../components/colorscale/make_scale_function":515,"./str2rgbarray":595,"fast-isnumeric":99,tinycolor2:461}],582:[function(t,e,r){"use strict";function n(t){for(var e=0;(e=t.indexOf("",e))>=0;){var r=t.indexOf("",e);if(e>r)break;t=t.slice(0,e)+l(t.slice(e+5,r))+t.slice(r+6)}return t}function i(t){return t.replace(/\/g,"\n")}function o(t){return t.replace(/\<.*\>/g,"")}function a(t){for(var e=u.entityToUnicode,r=0;(r=t.indexOf("&",r))>=0;){var n=t.indexOf(";",r);if(r>n)r+=1;else{var i=e[t.slice(r+1,n)];t=i?t.slice(0,r)+i+t.slice(n+1):t.slice(0,r)+t.slice(n+1)}}return t}function s(t){return""+a(o(n(i(t))))}var l=t("superscript-text"),u=t("../constants/string_mappings");e.exports=s},{"../constants/string_mappings":570,"superscript-text":458}],583:[function(t,e,r){"use strict";var n=t("d3"),i=e.exports={};i.nestedProperty=t("./nested_property"),i.isPlainObject=t("./is_plain_object");var o=t("./coerce");i.valObjects=o.valObjects,i.coerce=o.coerce,i.coerce2=o.coerce2,i.coerceFont=o.coerceFont,i.validate=o.validate;var a=t("./dates");i.dateTime2ms=a.dateTime2ms,i.isDateTime=a.isDateTime,i.ms2DateTime=a.ms2DateTime,i.parseDate=a.parseDate;var s=t("./search");i.findBin=s.findBin,i.sorterAsc=s.sorterAsc,i.sorterDes=s.sorterDes,i.distinctVals=s.distinctVals,i.roundUp=s.roundUp;var l=t("./stats");i.aggNums=l.aggNums,i.len=l.len,i.mean=l.mean,i.variance=l.variance,i.stdev=l.stdev,i.interp=l.interp;var u=t("./matrix");i.init2dArray=u.init2dArray,i.transposeRagged=u.transposeRagged,i.dot=u.dot,i.translationMatrix=u.translationMatrix,i.rotationMatrix=u.rotationMatrix,i.rotationXYMatrix=u.rotationXYMatrix,i.apply2DTransform=u.apply2DTransform,i.apply2DTransform2=u.apply2DTransform2;var c=t("./extend");i.extendFlat=c.extendFlat,i.extendDeep=c.extendDeep,i.extendDeepAll=c.extendDeepAll,i.extendDeepNoArrays=c.extendDeepNoArrays;var h=t("./loggers");i.log=h.log,i.warn=h.warn,i.error=h.error,i.notifier=t("./notifier"),i.swapAttrs=function(t,e,r,n){r||(r="x"),n||(n="y");for(var o=0;or?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},i.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},i.identity=function(t){return t},i.randstr=function f(t,e,r){if(r||(r=16),void 0===e&&(e=24),0>=e)return"0";var n,i,o,a=Math.log(Math.pow(2,e))/Math.log(r),s="";for(n=2;a===1/0;n*=2)a=Math.log(Math.pow(2,e/n))/Math.log(r)*n;var l=a-Math.floor(a);for(n=0;n-1||u!==1/0&&u>=Math.pow(2,e)?f(t,e,r):s},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},i.smooth=function(t,e){if(e=Math.round(e)||0,2>e)return t;var r,n,i,o,a=t.length,s=2*a,l=2*e-1,u=new Array(l),c=new Array(a);for(r=0;l>r;r++)u[r]=(1-Math.cos(Math.PI*(r+1)/e))/(2*e);for(r=0;a>r;r++){for(o=0,n=0;l>n;n++)i=r+n+1-e,-a>i?i-=s*Math.round(i/s):i>=s&&(i-=s*Math.floor(i/s)),0>i?i=-1-i:i>=a&&(i=s-1-i),o+=t[i]*u[n];c[r]=o}return c},i.syncOrAsync=function(t,e,r){function n(){return i.syncOrAsync(t,e,r)}for(var o,a;t.length;)if(a=t.splice(0,1)[0],o=a(e),o&&o.then)return o.then(n).then(void 0,i.promiseError);return r&&r(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,r){if(t){var n,i,o=!1,a=!0;for(n=0;ni;i++)e[i][r]=t[i]},i.minExtend=function(t,e){var r={};"object"!=typeof e&&(e={});var n,o,a,s=3,l=Object.keys(t);for(n=0;n1?n+o[1]:"";if(i&&(o.length>1||a.length>4))for(;r.test(a);)a=a.replace(r,"$1"+i+"$2");return a+s}},{"./coerce":575,"./dates":576,"./extend":578,"./is_plain_object":584,"./loggers":585,"./matrix":586,"./nested_property":587,"./notifier":588,"./search":591,"./stats":594,d3:90}],584:[function(t,e,r){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],585:[function(t,e,r){"use strict";var n=t("../plot_api/plot_config"),i=e.exports={};i.log=function(){if(n.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;en;n++)r[n]=new Array(e);return r},r.transposeRagged=function(t){var e,r,n=0,i=t.length;for(e=0;i>e;e++)n=Math.max(n,t[e].length);var o=new Array(n);for(e=0;n>e;e++)for(o[e]=new Array(i),r=0;i>r;r++)o[e][r]=t[r][e];return o},r.dot=function(t,e){if(!t.length||!e.length||t.length!==e.length)return null;var n,i,o=t.length;if(t[0].length)for(n=new Array(o),i=0;o>i;i++)n[i]=r.dot(t[i],e);else if(e[0].length){var a=r.transposeRagged(e);for(n=new Array(a.length),i=0;ii;i++)n+=t[i]*e[i];return n},r.translationMatrix=function(t,e){return[[1,0,t],[0,1,e],[0,0,1]]},r.rotationMatrix=function(t){var e=t*Math.PI/180;return[[Math.cos(e),-Math.sin(e),0],[Math.sin(e),Math.cos(e),0],[0,0,1]]},r.rotationXYMatrix=function(t,e,n){return r.dot(r.dot(r.translationMatrix(e,n),r.rotationMatrix(t)),r.translationMatrix(-e,-n))},r.apply2DTransform=function(t){return function(){var e=arguments;3===e.length&&(e=e[0]);var n=1===arguments.length?e[0]:[e[0],e[1]];return r.dot(t,[n[0],n[1],1]).slice(0,2)}},r.apply2DTransform2=function(t){var e=r.apply2DTransform(t);return function(t){return e(t.slice(0,2)).concat(e(t.slice(2,4)))}}},{}],587:[function(t,e,r){"use strict";function n(t,e){return function(){var r,i,o,a,s,l=t;for(a=0;a=0;e--){if(n=t[e],a=!1,Array.isArray(n))for(r=n.length-1;r>=0;r--)u(n[r])?a?n[r]=void 0:n.pop():a=!0;else if("object"==typeof n&&null!==n)for(o=Object.keys(n),a=!1,r=o.length-1;r>=0;r--)u(n[o[r]])&&!i(n[o[r]],o[r])?delete n[o[r]]:a=!0;if(a)return}}function u(t){return void 0===t||null===t?!0:"object"!=typeof t?!1:Array.isArray(t)?!t.length:!Object.keys(t).length}function c(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var h=t("fast-isnumeric");e.exports=function(t,e){if(h(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,i,a,s=0,l=e.split(".");sr||r>o||a>n||n>s?!1:!e||!u(t)}function r(t,e){var r=t[0],l=t[1];if(i>r||r>o||a>l||l>s)return!1;var u,c,h,f,p,d=n.length,m=n[0][0],g=n[0][1],v=0;for(u=1;d>u;u++)if(c=m,h=g,m=n[u][0],g=n[u][1],f=Math.min(c,m),!(f>r||r>Math.max(c,m)||l>Math.max(h,g)))if(l=l&&r!==f&&v++}return v%2===1}var n=t.slice(),i=n[0][0],o=i,a=n[0][1],s=a;n.push(n[0]);for(var l=1;lo;o++)if(a=[t[o][0]-l[0],t[o][1]-l[1]],s=n(a,u),0>s||s>c||Math.abs(n(a,f))>i)return!0;return!1};i.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=i;n.splice(a+1);for(var u=l+1;u1){var s=t.pop();r(s)}return{addPt:r,raw:t,filtered:n}}},{"./matrix":586}],590:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],o=0;oo.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},a.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},a.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},a.undo=function(t){var e,r;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;rt}function i(t,e){return e>=t}function o(t,e){return t>e}function a(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("../lib");r.findBin=function(t,e,r){if(s(e.start))return r?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var u,c,h=0,f=e.length,p=0;for(c=e[e.length-1]>=e[0]?r?n:i:r?a:o;f>h&&p++<100;)u=Math.floor((h+f)/2),c(e[u],t)?h=u+1:f=u;return p>90&&l.log("Long binary search..."),h-1},r.sorterAsc=function(t,e){return t-e},r.sorterDes=function(t,e){return e-t},r.distinctVals=function(t){var e=t.slice();e.sort(r.sorterAsc);for(var n=e.length-1,i=e[n]-e[0]||1,o=i/(n||1)/1e4,a=[e[0]],s=0;n>s;s++)e[s+1]>e[s]+o&&(i=Math.min(i,e[s+1]-e[s]),a.push(e[s+1]));return{vals:a,minDiff:i}},r.roundUp=function(t,e,r){for(var n,i=0,o=e.length-1,a=0,s=r?0:1,l=r?1:0,u=r?Math.ceil:Math.floor;o>i&&a++<100;)n=u((i+o)/2),e[n]<=t?i=n+s:o=n-l;return e[i]}},{"../lib":583,"fast-isnumeric":99}],592:[function(t,e,r){"use strict";e.exports=function(t,e){(t.attr("class")||"").split(" ").forEach(function(e){0===e.indexOf("cursor-")&&t.classed(e,!1)}),e&&t.classed("cursor-"+e,!0)}},{}],593:[function(t,e,r){"use strict";var n=t("../components/color"),i=function(){};e.exports=function(t){for(var e in t)"function"==typeof t[e]&&(t[e]=i);t.destroy=function(){t.container.parentNode.removeChild(t.container)};var r=document.createElement("div");return r.textContent="Webgl is not supported by your browser - visit http://get.webgl.org for more info",r.style.cursor="pointer",r.style.fontSize="24px",r.style.color=n.defaults[0],t.container.appendChild(r),t.container.style.background="#FFFFFF",t.container.onclick=function(){window.open("http://get.webgl.org")},!1}},{"../components/color":498}],594:[function(t,e,r){"use strict";var n=t("fast-isnumeric");r.aggNums=function(t,e,i,o){var a,s;if(o||(o=i.length),n(e)||(e=!1),Array.isArray(i[0])){for(s=new Array(o),a=0;o>a;a++)s[a]=r.aggNums(t,e,i[a]);i=s}for(a=0;o>a;a++)n(e)?n(i[a])&&(e=t(+e,+i[a])):e=i[a];return e},r.len=function(t){return r.aggNums(function(t){return t+1},0,t)},r.mean=function(t,e){return e||(e=r.len(t)),r.aggNums(function(t,e){return t+e},0,t)/e},r.variance=function(t,e,i){return e||(e=r.len(t)),n(i)||(i=r.mean(t,e)),r.aggNums(function(t,e){return t+Math.pow(e-i,2)},0,t)/e},r.stdev=function(t,e,n){return Math.sqrt(r.variance(t,e,n))},r.interp=function(t,e){if(!n(e))throw"n should be a finite number";if(e=e*t.length-.5,0>e)return t[0];if(e>t.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"fast-isnumeric":99}],595:[function(t,e,r){"use strict";function n(t){return t=i(t),o.str2RgbaArray(t.toRgbString())}var i=t("tinycolor2"),o=t("arraytools");e.exports=n},{arraytools:28,tinycolor2:461}],596:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function o(t,e,r){var n="math-output-"+f.randstr([],64),o=h.select("body").append("div").attr({ +x:0,y:0,width:e.width,height:e.height1});var s=e.font.size*T.fontSizeToHeight,l=o[0].length||1,u=(l-1)*s/4,c={x:T.textOffsetX,y:e.height1/2-u+T.textOffsetY};i.attr(c),o.attr(c),r.y+=e.height1+r.yPad}function g(t){t.selectAll("g."+T.buttonClassName).remove()}function v(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n0?[0]:[]);if(l.enter().append("g").classed(T.containerClassName,!0).style("cursor","pointer"),l.exit().remove(),l.exit().size()&&v(t),0!==r.length){var u=l.selectAll("g."+T.headerGroupClassName).data(r,i);u.enter().append("g").classed(T.headerGroupClassName,!0);var c=l.selectAll("g."+T.buttonGroupClassName).data([0]);c.enter().append("g").classed(T.buttonGroupClassName,!0).style("pointer-events","all"),u.enter().size()&&c.call(g).attr(T.menuIndexAttrName,"-1"),u.exit().each(function(e){y.select(this).remove(),c.call(g).attr(T.menuIndexAttrName,"-1"),b.autoMargin(t,T.autoMarginIdRoot+e._index)});for(var h=0;h",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],571:[function(t,e,r){"use strict";r.xmlns="http://www.w3.org/2000/xmlns/",r.svg="http://www.w3.org/2000/svg",r.xlink="http://www.w3.org/1999/xlink",r.svgAttrs={xmlns:r.svg,"xmlns:xlink":r.xlink}},{}],572:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.16.3-d16",r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=n.register,r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=n.Fx,r.Snapshot=n.Snapshot,r.PlotSchema=n.PlotSchema,r.Queue=n.Queue,r.d3=t("d3")},{"../build/ploticon":2,"./plot_api/set_plot_config":601,"./plot_api/to_image":602,"./plot_api/validate":603,"./plotly":604,"./snapshot/download":678,d3:90}],573:[function(t,e,r){"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],574:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){Array.isArray(t)&&(e[r]=t[n])}},{}],575:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),o=t("./nested_property"),a=t("../components/colorscale/get_scale"),s=(Object.keys(t("../components/colorscale/scales")),/^([2-9]|[1-9][0-9]+)$/);r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),-1===n.values.indexOf(t)?e.set(r):e.set(t)}},"boolean":{coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,i){!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,i){t%1||!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;n.strict!==!0&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){i(t).isValid()?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(a(t,r))}},angle:{coerceFunction:function(t,e,r){"auto"===t?e.set("auto"):n(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){var n=r.length;return"string"==typeof t&&t.substr(0,n)===r&&s.test(t.substr(n))?void e.set(t):void e.set(r)},validateFunction:function(t,e){var r=e.dflt,n=r.length;return t===r?!0:"string"!=typeof t?!1:!(t.substr(0,n)!==r||!s.test(t.substr(n)))}},flaglist:{coerceFunction:function(t,e,r,n){if("string"!=typeof t)return void e.set(r);if(-1!==(n.extras||[]).indexOf(t))return void e.set(t);for(var i=t.split("+"),o=0;o2)return!1;var l=a[0].split("-");if(l.length>3||3!==l.length&&a[1])return!1;if(4===l[0].length)r=Number(l[0]);else{if(2!==l[0].length)return!1;var u=(new Date).getFullYear();r=((Number(l[0])-u+70)%100+200)%100+u-70}return s(r)?1===l.length?new Date(r,0,1).getTime():(n=Number(l[1])-1,l[1].length>2||!(n>=0&&11>=n)?!1:2===l.length?new Date(r,n,1).getTime():(i=Number(l[2]),l[2].length>2||!(i>=1&&31>=i)?!1:(i=new Date(r,n,i).getTime(),a[1]?(l=a[1].split(":"),l.length>3?!1:(o=Number(l[0]),l[0].length>2||!(o>=0&&23>=o)?!1:(i+=36e5*o,1===l.length?i:(n=Number(l[1]),l[1].length>2||!(n>=0&&59>=n)?!1:(i+=6e4*n,2===l.length?i:(t=Number(l[2]),t>=0&&60>t?i+1e3*t:!1)))))):i))):!1},r.isDateTime=function(t){return r.dateTime2ms(t)!==!1},r.ms2DateTime=function(t,e){if("undefined"==typeof a)return void l.error("d3 is not defined.");e||(e=0);var r=new Date(t),i=a.time.format("%Y-%m-%d")(r);return 7776e6>e?(i+=" "+n(r.getHours(),2),432e6>e&&(i+=":"+n(r.getMinutes(),2),108e5>e&&(i+=":"+n(r.getSeconds(),2),3e5>e&&(i+="."+n(r.getMilliseconds(),3)))),i.replace(/([:\s]00)*\.?[0]*$/,"")):i};var u={H:["%H:%M:%S~%L","%H:%M:%S","%H:%M"],I:["%I:%M:%S~%L%p","%I:%M:%S%p","%I:%M%p"],D:["%H","%I%p","%Hh"]},c={Y:["%Y~%m~%d","%Y%m%d","%y%m%d","%m~%d~%Y","%d~%m~%Y"],Yb:["%b~%d~%Y","%d~%b~%Y","%Y~%d~%b","%Y~%b~%d"],y:["%m~%d~%y","%d~%m~%y","%y~%m~%d"],yb:["%b~%d~%y","%d~%b~%y","%y~%d~%b","%y~%b~%d"]},h=a.time.format.utc,f={Y:{H:["%Y~%m~%dT%H:%M:%S","%Y~%m~%dT%H:%M:%S~%L"].map(h),I:[],D:["%Y%m%d%H%M%S","%Y~%m","%m~%Y"].map(h)},Yb:{H:[],I:[],D:["%Y~%b","%b~%Y"].map(h)},y:{H:[],I:[],D:[]},yb:{H:[],I:[],D:[]}};["Y","Yb","y","yb"].forEach(function(t){c[t].forEach(function(e){f[t].D.push(h(e)),["H","I","D"].forEach(function(r){u[r].forEach(function(n){var i=f[t][r];i.push(h(e+"~"+n)),i.push(h(n+"~"+e))})})})});var p=/[a-z]*/g,d=function(t){return t.substr(0,3)},m=/(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g,g=/[\s,\/\-\.\(\)]+/g,v=/~?([ap])~?m(~|$)/,y=function(t,e){return e+"m "},x=/\d\d\d\d/,b=/(^|~)[a-z]{3}/,_=/[ap]m/,w=/:/,M=/q([1-4])/,A=["31~mar","30~jun","30~sep","31~dec"],k=function(t,e){return A[e-1]},T=/ ?([+\-]\d\d:?\d\d|Z)$/;r.parseDate=function(t){if(t.getTime)return t;if("string"!=typeof t)return!1;t=t.toLowerCase().replace(p,d).replace(m,"").replace(g,"~").replace(v,y).replace(M,k).trim().replace(T,"");var e,r,n=null,a=i(t),s=o(t);e=f[a][s],r=e.length;for(var l=0;r>l&&!(n=e[l].parse(t));l++);if(!(n instanceof Date))return!1;var u=n.getTimezoneOffset();return n.setTime(n.getTime()+60*u*1e3),n}},{"../lib":583,d3:90,"fast-isnumeric":99}],577:[function(t,e,r){"use strict";var n=t("events").EventEmitter,i={init:function(t){if(t._ev instanceof n)return t;var e=new n;return t._ev=e,t.on=e.on.bind(e),t.once=e.once.bind(e),t.removeListener=e.removeListener.bind(e),t.removeAllListeners=e.removeAllListeners.bind(e),t.emit=function(r,n){"undefined"!=typeof jQuery&&jQuery(t).trigger(r,n),e.emit(r,n)},t},triggerHandler:function(t,e,r){var n,i;"undefined"!=typeof jQuery&&(n=jQuery(t).triggerHandler(e,r));var o=t._ev;if(!o)return n;var a=o._events[e];if(!a)return n;"function"==typeof a&&(a=[a]);for(var s=a.pop(),l=0;lv;v++){l=t[v];for(u in l)c=m[u],h=l[u],s&&a(h)?m[u]=h:e&&h&&(o(h)||(f=a(h)))?(f?(f=!1,p=c&&a(c)?c:[]):p=c&&o(c)?c:{},m[u]=i([p,h],e,r,s)):("undefined"!=typeof h||r)&&(m[u]=h)}return m}var o=t("./is_plain_object.js"),a=Array.isArray;r.extendFlat=function(){return i(arguments,!1,!1,!1)},r.extendDeep=function(){return i(arguments,!0,!1,!1)},r.extendDeepAll=function(){return i(arguments,!0,!0,!1)},r.extendDeepNoArrays=function(){return i(arguments,!0,!1,!0)}},{"./is_plain_object.js":584}],579:[function(t,e,r){"use strict";e.exports=function(t){for(var e=[],r=0;ry;y++)h=s(d,y),p=l(e,y),v[y]=n(h,p);else v=n(d,e);return v}var s=t("tinycolor2"),l=t("fast-isnumeric"),u=t("../components/colorscale/make_scale_function"),c=t("../components/color/attributes").defaultLine,h=t("./str2rgbarray"),f=1;e.exports=a},{"../components/color/attributes":497,"../components/colorscale/make_scale_function":515,"./str2rgbarray":595,"fast-isnumeric":99,tinycolor2:461}],582:[function(t,e,r){"use strict";function n(t){for(var e=0;(e=t.indexOf("",e))>=0;){var r=t.indexOf("",e);if(e>r)break;t=t.slice(0,e)+l(t.slice(e+5,r))+t.slice(r+6)}return t}function i(t){return t.replace(/\/g,"\n")}function o(t){return t.replace(/\<.*\>/g,"")}function a(t){for(var e=u.entityToUnicode,r=0;(r=t.indexOf("&",r))>=0;){var n=t.indexOf(";",r);if(r>n)r+=1;else{var i=e[t.slice(r+1,n)];t=i?t.slice(0,r)+i+t.slice(n+1):t.slice(0,r)+t.slice(n+1)}}return t}function s(t){return""+a(o(n(i(t))))}var l=t("superscript-text"),u=t("../constants/string_mappings");e.exports=s},{"../constants/string_mappings":570,"superscript-text":458}],583:[function(t,e,r){"use strict";var n=t("d3"),i=e.exports={};i.nestedProperty=t("./nested_property"),i.isPlainObject=t("./is_plain_object");var o=t("./coerce");i.valObjects=o.valObjects,i.coerce=o.coerce,i.coerce2=o.coerce2,i.coerceFont=o.coerceFont,i.validate=o.validate;var a=t("./dates");i.dateTime2ms=a.dateTime2ms,i.isDateTime=a.isDateTime,i.ms2DateTime=a.ms2DateTime,i.parseDate=a.parseDate;var s=t("./search");i.findBin=s.findBin,i.sorterAsc=s.sorterAsc,i.sorterDes=s.sorterDes,i.distinctVals=s.distinctVals,i.roundUp=s.roundUp;var l=t("./stats");i.aggNums=l.aggNums,i.len=l.len,i.mean=l.mean,i.variance=l.variance,i.stdev=l.stdev,i.interp=l.interp;var u=t("./matrix");i.init2dArray=u.init2dArray,i.transposeRagged=u.transposeRagged,i.dot=u.dot,i.translationMatrix=u.translationMatrix,i.rotationMatrix=u.rotationMatrix,i.rotationXYMatrix=u.rotationXYMatrix,i.apply2DTransform=u.apply2DTransform,i.apply2DTransform2=u.apply2DTransform2;var c=t("./extend");i.extendFlat=c.extendFlat,i.extendDeep=c.extendDeep,i.extendDeepAll=c.extendDeepAll,i.extendDeepNoArrays=c.extendDeepNoArrays;var h=t("./loggers");i.log=h.log,i.warn=h.warn,i.error=h.error,i.notifier=t("./notifier"),i.swapAttrs=function(t,e,r,n){r||(r="x"),n||(n="y");for(var o=0;or?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},i.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},i.identity=function(t){return t},i.randstr=function f(t,e,r){if(r||(r=16),void 0===e&&(e=24),0>=e)return"0";var n,i,o,a=Math.log(Math.pow(2,e))/Math.log(r),s="";for(n=2;a===1/0;n*=2)a=Math.log(Math.pow(2,e/n))/Math.log(r)*n;var l=a-Math.floor(a);for(n=0;n-1||u!==1/0&&u>=Math.pow(2,e)?f(t,e,r):s},i.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},i.smooth=function(t,e){if(e=Math.round(e)||0,2>e)return t;var r,n,i,o,a=t.length,s=2*a,l=2*e-1,u=new Array(l),c=new Array(a);for(r=0;l>r;r++)u[r]=(1-Math.cos(Math.PI*(r+1)/e))/(2*e);for(r=0;a>r;r++){for(o=0,n=0;l>n;n++)i=r+n+1-e,-a>i?i-=s*Math.round(i/s):i>=s&&(i-=s*Math.floor(i/s)),0>i?i=-1-i:i>=a&&(i=s-1-i),o+=t[i]*u[n];c[r]=o}return c},i.syncOrAsync=function(t,e,r){function n(){return i.syncOrAsync(t,e,r)}for(var o,a;t.length;)if(a=t.splice(0,1)[0],o=a(e),o&&o.then)return o.then(n).then(void 0,i.promiseError);return r&&r(e)},i.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},i.noneOrAll=function(t,e,r){if(t){var n,i,o=!1,a=!0;for(n=0;ni;i++)e[i][r]=t[i]},i.minExtend=function(t,e){var r={};"object"!=typeof e&&(e={});var n,o,a,s=3,l=Object.keys(t);for(n=0;n1?n+o[1]:"";if(i&&(o.length>1||a.length>4))for(;r.test(a);)a=a.replace(r,"$1"+i+"$2");return a+s}},{"./coerce":575,"./dates":576,"./extend":578,"./is_plain_object":584,"./loggers":585,"./matrix":586,"./nested_property":587,"./notifier":588,"./search":591,"./stats":594,d3:90}],584:[function(t,e,r){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],585:[function(t,e,r){"use strict";var n=t("../plot_api/plot_config"),i=e.exports={};i.log=function(){if(n.logging>1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;en;n++)r[n]=new Array(e);return r},r.transposeRagged=function(t){var e,r,n=0,i=t.length;for(e=0;i>e;e++)n=Math.max(n,t[e].length);var o=new Array(n);for(e=0;n>e;e++)for(o[e]=new Array(i),r=0;i>r;r++)o[e][r]=t[r][e];return o},r.dot=function(t,e){if(!t.length||!e.length||t.length!==e.length)return null;var n,i,o=t.length;if(t[0].length)for(n=new Array(o),i=0;o>i;i++)n[i]=r.dot(t[i],e);else if(e[0].length){var a=r.transposeRagged(e);for(n=new Array(a.length),i=0;ii;i++)n+=t[i]*e[i];return n},r.translationMatrix=function(t,e){return[[1,0,t],[0,1,e],[0,0,1]]},r.rotationMatrix=function(t){var e=t*Math.PI/180;return[[Math.cos(e),-Math.sin(e),0],[Math.sin(e),Math.cos(e),0],[0,0,1]]},r.rotationXYMatrix=function(t,e,n){return r.dot(r.dot(r.translationMatrix(e,n),r.rotationMatrix(t)),r.translationMatrix(-e,-n))},r.apply2DTransform=function(t){return function(){var e=arguments;3===e.length&&(e=e[0]);var n=1===arguments.length?e[0]:[e[0],e[1]];return r.dot(t,[n[0],n[1],1]).slice(0,2)}},r.apply2DTransform2=function(t){var e=r.apply2DTransform(t);return function(t){return e(t.slice(0,2)).concat(e(t.slice(2,4)))}}},{}],587:[function(t,e,r){"use strict";function n(t,e){return function(){var r,i,o,a,s,l=t;for(a=0;a=0;e--){if(n=t[e],a=!1,Array.isArray(n))for(r=n.length-1;r>=0;r--)u(n[r])?a?n[r]=void 0:n.pop():a=!0;else if("object"==typeof n&&null!==n)for(o=Object.keys(n),a=!1,r=o.length-1;r>=0;r--)u(n[o[r]])&&!i(n[o[r]],o[r])?delete n[o[r]]:a=!0;if(a)return}}function u(t){return void 0===t||null===t?!0:"object"!=typeof t?!1:Array.isArray(t)?!t.length:!Object.keys(t).length}function c(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var h=t("fast-isnumeric");e.exports=function(t,e){if(h(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,i,a,s=0,l=e.split(".");sr||r>o||a>n||n>s?!1:!e||!u(t)}function r(t,e){var r=t[0],l=t[1];if(i>r||r>o||a>l||l>s)return!1;var u,c,h,f,p,d=n.length,m=n[0][0],g=n[0][1],v=0;for(u=1;d>u;u++)if(c=m,h=g,m=n[u][0],g=n[u][1],f=Math.min(c,m),!(f>r||r>Math.max(c,m)||l>Math.max(h,g)))if(l=l&&r!==f&&v++}return v%2===1}var n=t.slice(),i=n[0][0],o=i,a=n[0][1],s=a;n.push(n[0]);for(var l=1;lo;o++)if(a=[t[o][0]-l[0],t[o][1]-l[1]],s=n(a,u),0>s||s>c||Math.abs(n(a,f))>i)return!0;return!1};i.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=i;n.splice(a+1);for(var u=l+1;u1){var s=t.pop();r(s)}return{addPt:r,raw:t,filtered:n}}},{"./matrix":586}],590:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],o=0;oo.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)))},a.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},a.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},a.undo=function(t){var e,r;if(t.framework&&t.framework.isPolar)return void t.framework.undo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;rt}function i(t,e){return e>=t}function o(t,e){return t>e}function a(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("../lib");r.findBin=function(t,e,r){if(s(e.start))return r?Math.ceil((t-e.start)/e.size)-1:Math.floor((t-e.start)/e.size);var u,c,h=0,f=e.length,p=0;for(c=e[e.length-1]>=e[0]?r?n:i:r?a:o;f>h&&p++<100;)u=Math.floor((h+f)/2),c(e[u],t)?h=u+1:f=u;return p>90&&l.log("Long binary search..."),h-1},r.sorterAsc=function(t,e){return t-e},r.sorterDes=function(t,e){return e-t},r.distinctVals=function(t){var e=t.slice();e.sort(r.sorterAsc);for(var n=e.length-1,i=e[n]-e[0]||1,o=i/(n||1)/1e4,a=[e[0]],s=0;n>s;s++)e[s+1]>e[s]+o&&(i=Math.min(i,e[s+1]-e[s]),a.push(e[s+1]));return{vals:a,minDiff:i}},r.roundUp=function(t,e,r){for(var n,i=0,o=e.length-1,a=0,s=r?0:1,l=r?1:0,u=r?Math.ceil:Math.floor;o>i&&a++<100;)n=u((i+o)/2),e[n]<=t?i=n+s:o=n-l;return e[i]}},{"../lib":583,"fast-isnumeric":99}],592:[function(t,e,r){"use strict";e.exports=function(t,e){(t.attr("class")||"").split(" ").forEach(function(e){0===e.indexOf("cursor-")&&t.classed(e,!1)}),e&&t.classed("cursor-"+e,!0)}},{}],593:[function(t,e,r){"use strict";var n=t("../components/color"),i=function(){};e.exports=function(t){for(var e in t)"function"==typeof t[e]&&(t[e]=i);t.destroy=function(){t.container.parentNode.removeChild(t.container)};var r=document.createElement("div");return r.textContent="Webgl is not supported by your browser - visit http://get.webgl.org for more info",r.style.cursor="pointer",r.style.fontSize="24px",r.style.color=n.defaults[0],t.container.appendChild(r),t.container.style.background="#FFFFFF",t.container.onclick=function(){window.open("http://get.webgl.org")},!1}},{"../components/color":498}],594:[function(t,e,r){"use strict";var n=t("fast-isnumeric");r.aggNums=function(t,e,i,o){var a,s;if(o||(o=i.length),n(e)||(e=!1),Array.isArray(i[0])){for(s=new Array(o),a=0;o>a;a++)s[a]=r.aggNums(t,e,i[a]);i=s}for(a=0;o>a;a++)n(e)?n(i[a])&&(e=t(+e,+i[a])):e=i[a];return e},r.len=function(t){return r.aggNums(function(t){return t+1},0,t)},r.mean=function(t,e){return e||(e=r.len(t)),r.aggNums(function(t,e){return t+e},0,t)/e},r.variance=function(t,e,i){return e||(e=r.len(t)),n(i)||(i=r.mean(t,e)),r.aggNums(function(t,e){return t+Math.pow(e-i,2)},0,t)/e},r.stdev=function(t,e,n){return Math.sqrt(r.variance(t,e,n))},r.interp=function(t,e){if(!n(e))throw"n should be a finite number";if(e=e*t.length-.5,0>e)return t[0];if(e>t.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"fast-isnumeric":99}],595:[function(t,e,r){"use strict";function n(t){return t=i(t),o.str2RgbaArray(t.toRgbString())}var i=t("tinycolor2"),o=t("arraytools");e.exports=n},{arraytools:28,tinycolor2:461}],596:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(/(<|<|<)/g,"\\lt ").replace(/(>|>|>)/g,"\\gt ")}function o(t,e,r){var n="math-output-"+f.randstr([],64),o=h.select("body").append("div").attr({ id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(i(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=h.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())f.log("There was an error in the tex syntax.",t),r();else{var n=o.select("svg").node().getBoundingClientRect();r(o.select(".MathJax_SVG"),e,n)}o.remove()})}function a(t,e){for(var r=t||"",n=0;n]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),n=e&&e[2].toLowerCase(),i=m[n];if(void 0!==i){var o=e[1],a=e[3],s=a.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===n){if(o)return"
";if("href"!==a.substr(0,4).toLowerCase())return"";var u=a.substr(4).replace(/["']/g,"").replace(/=/,""),c=document.createElement("a");return c.href=u,-1===g.indexOf(c.protocol)?"":''}if("br"===n)return"
";if(o)return"sup"===n?'':"sub"===n?'':"";var h=""}return r.xml_entity_encode(t).replace(/");i>0;i=e.indexOf("
",i+1))n.push(i);var o=0;n.forEach(function(t){for(var r=t+o,n=e.slice(0,r),i="",a=n.length-1;a>=0;a--){var s=n[a].match(/<(\/?).*>/i);if(s&&"
"!==n[a]){s[1]||(i=n[a]);break}}i&&(e.splice(r+1,0,i),e.splice(r,0,""),o+=2)});var a=e.join(""),u=a.split(/
/gi);return u.length>1&&(e=u.map(function(t,e){return''+t+""})),e.join("")}function c(t,e,r){var n,i,o,a=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},o="right"===a?function(){return l.right-n.width}:"center"===a?function(){return l.left+(l.width-n.width)/2}:function(){return l.left},function(){return n=this.node().getBoundingClientRect(),this.style({top:i()-u.top+"px",left:o()-u.left+"px","z-index":1e3}),this}}var h=t("d3"),f=t("../lib"),p=t("../constants/xmlns_namespaces"),d=t("../constants/string_mappings");h.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),r=(new DOMParser).parseFromString(e,"application/xml"),n=r.documentElement.firstChild;n;)this.node().appendChild(this.node().ownerDocument.importNode(n,!0)),n=n.nextSibling;return r.querySelector("parsererror")?(f.log(r.querySelector("parsererror div").textContent),null):h.select(this.node().lastChild)},r.html_entity_decode=function(t){var e=h.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":e.html(t).text()});return e.remove(),r},r.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")},r.convertToTspans=function(t,e){function r(){p.empty()||(d=s.attr("class")+"-math",p.select("svg."+d).remove()),t.text("").style({visibility:"visible","white-space":"pre"}),c=t.appendSVG(a),c||t.text(i),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(s)}var i=t.text(),a=u(i),s=t,l=!s.attr("data-notex")&&a.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),c=i,p=h.select(s.node().parentNode);if(!p.empty()){var d=s.attr("class")?s.attr("class").split(" ")[0]:"text";d+="-math",p.selectAll("svg."+d).remove(),p.selectAll("g."+d+"-group").remove(),t.style({visibility:null});for(var m=t.node();m&&m.removeAttribute;m=m.parentNode)m.removeAttribute("data-bb");if(l){var g=f.getPlotDiv(s.node());(g&&g._promises||[]).push(new Promise(function(t){s.style({visibility:"hidden"});var i={fontSize:parseInt(s.style("font-size"),10)};o(l[2],i,function(i,o,a){p.selectAll("svg."+d).remove(),p.selectAll("g."+d+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return r(),void t();var u=p.append("g").classed(d+"-group",!0).attr({"pointer-events":"none"});u.node().appendChild(l.node()),o&&o.node()&&l.node().insertBefore(o.node().cloneNode(!0),l.node().firstChild),l.attr({"class":d,height:a.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=s.style("fill")||"black";l.select("g").attr({fill:c,stroke:c});var h=n(l,"width"),f=n(l,"height"),m=+s.attr("x")-h*{start:0,middle:.5,end:1}[s.attr("text-anchor")||"start"],g=parseInt(s.style("font-size"),10)||n(s,"height"),v=-g/4;"y"===d[0]?(u.attr({transform:"rotate("+[-90,+s.attr("x"),+s.attr("y")]+") translate("+[-h/2,v-f/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===d[0]?l.attr({x:s.attr("x"),y:v-f/2}):"a"===d[0]?l.attr({x:0,y:v}):l.attr({x:m,y:+s.attr("y")+v-f/2}),e&&e.call(s,u),t(u)})}))}else r();return t}};var m={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"",span:"",br:"",em:"font-style:italic;font-weight:bold"},g=["http:","https:","mailto:"],v=new RegExp("]*)?/?>","g"),y=Object.keys(d.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:d.entityToUnicode[t]}}),x=Object.keys(d.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+d.unicodeToEntity[t]+";"}});r.plainText=function(t){return(t||"").replace(v," ")},r.makeEditable=function(t,e,r){function n(){o(),a.style({opacity:0});var t,e=u.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&h.select(a.node().parentNode).select(t).style({opacity:0})}function i(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function o(){var t=h.select(f.getPlotDiv(a.node())),e=t.select(".svg-container"),n=e.append("div");n.classed("plugin-editable editable",!0).style({position:"absolute","font-family":a.style("font-family")||"Arial","font-size":a.style("font-size")||12,color:r.fill||a.style("fill")||"black",opacity:1,"background-color":r.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(a.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(r.text||a.attr("data-unformatted")).call(c(a,e,r)).on("blur",function(){a.text(this.textContent).style({opacity:1});var t,e=h.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&h.select(a.node().parentNode).select(t).style({opacity:0});var r=this.textContent;h.select(this).transition().duration(0).remove(),h.select(document).on("mouseup",null),s.edit.call(a,r)}).on("focus",function(){var t=this;h.select(document).on("mouseup",function(){return h.event.target===t?!1:void(document.activeElement===n.node()&&n.node().blur())})}).on("keyup",function(){27===h.event.which?(a.style({opacity:1}),h.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(a,this.textContent)):(s.input.call(a,this.textContent),h.select(this).call(c(a,e,r)))}).on("keydown",function(){13===h.event.which&&this.blur()}).call(i)}r||(r={});var a=this,s=h.dispatch("edit","input","cancel"),l=h.select(this.node()).style({"pointer-events":"all"}),u=e||l;return e&&l.style({"pointer-events":"none"}),r.immediate?n():u.on("click",n),h.rebind(this,s,"on")}},{"../constants/string_mappings":570,"../constants/xmlns_namespaces":571,"../lib":583,d3:90}],597:[function(t,e,r){"use strict";var n=e.exports={},i=t("../plots/geo/constants").locationmodeToLayer,o=t("topojson").feature;n.getTopojsonName=function(t){return[t.scope.replace(/ /g,"-"),"_",t.resolution.toString(),"m"].join("")},n.getTopojsonPath=function(t,e){return t+e+".json"},n.getTopojsonFeatures=function(t,e){var r=i[t.locationmode],n=e.objects[r];return o(e,n).features}},{"../plots/geo/constants":626,topojson:463}],598:[function(t,e,r){"use strict";function n(t){var e;if("string"==typeof t){if(e=document.getElementById(t),null===e)throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t}function i(t){Array.isArray(t._promises)&&t._promises.length>0&&R.log("Clearing previous rejected promises from queue."),t._promises=[]}function o(t,e){t._fullLayout._paperdiv.style("background","white"),C.defaultConfig.setBackground(t,e)}function a(t,e){t._context||(t._context=R.extendFlat({},C.defaultConfig));var r=t._context;e&&(Object.keys(e).forEach(function(t){t in r&&("setBackground"===t&&"opaque"===e[t]?r[t]=o:r[t]=e[t])}),e.plot3dPixelRatio&&!r.plotGlPixelRatio&&(r.plotGlPixelRatio=r.plot3dPixelRatio)),r.staticPlot&&(r.editable=!1,r.autosizable=!1,r.scrollZoom=!1,r.doubleClick=!1,r.showTips=!1,r.showLink=!1,r.displayModeBar=!1)}function s(t,e,r){var n=z.select(t).selectAll(".plot-container").data([0]);n.enter().insert("div",":first-child").classed("plot-container plotly",!0);var i=n.selectAll(".svg-container").data([0]);i.enter().append("div").classed("svg-container",!0).style("position","relative"),i.html(""),e&&(t.data=e),r&&(t.layout=r),C.micropolar.manager.fillLayout(t),"initial"===t._fullLayout.autosize&&t._context.autosizable&&(M(t,{}),t._fullLayout.autosize=r.autosize=!0),i.style({width:t._fullLayout.width+"px",height:t._fullLayout.height+"px"}),t.framework=C.micropolar.manager.framework(t),t.framework({data:t.data,layout:t.layout},i.node()),t.framework.setUndoPoint();var o=t.framework.svg(),a=1,s=t._fullLayout.title;""!==s&&s||(a=0);var l="Click to enter title",u=function(){this.call(C.util.convertToTspans)},c=o.select(".title-group text").call(u);if(t._context.editable){c.attr({"data-unformatted":s}),s&&s!==l||(a=.2,c.attr({"data-unformatted":l}).text(l).style({opacity:a}).on("mouseover.opacity",function(){z.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){z.select(this).transition().duration(1e3).style("opacity",0)}));var h=function(){this.call(C.util.makeEditable).on("edit",function(e){t.framework({layout:{title:e}}),this.attr({"data-unformatted":e}).text(e).call(u),this.call(h)}).on("cancel",function(){var t=this.attr("data-unformatted");this.text(t).call(u)})};c.call(h)}return t._context.setBackground(t,t._fullLayout.paper_bgcolor),j.addLinks(t),Promise.resolve()}function l(t){var e,r;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1);var n=C.Axes.list({_fullLayout:t});for(e=0;ee;e++){var a=t.annotations[e];a.ref&&("paper"===a.ref?(a.xref="paper",a.yref="paper"):"data"===a.ref&&(a.xref="x",a.yref="y"),delete a.ref),u(a,"xref"),u(a,"yref")}void 0===t.shapes||Array.isArray(t.shapes)||(R.warn("Shapes must be an array."),delete t.shapes);var s=(t.shapes||[]).length;for(e=0;s>e;e++){var l=t.shapes[e];u(l,"xref"),u(l,"yref")}var c=t.legend;c&&(c.x>3?(c.x=1.02,c.xanchor="left"):c.x<-2&&(c.x=-.02,c.xanchor="right"),c.y>3?(c.y=1.02,c.yanchor="bottom"):c.y<-2&&(c.y=-.02,c.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var h=j.getSubplotIds(t,"gl3d");for(e=0;er;++r)x[r]=g[e]+v*y[2+4*r];p.camera={eye:{x:x[0],y:x[1],z:x[2]},center:{x:g[0],y:g[1],z:g[2]},up:{x:y[1],y:y[5],z:y[9]}},delete p.cameraposition}}return N.clean(t),t}function u(t,e){var r=t[e],n=e.charAt(0);r&&"paper"!==r&&(t[e]=C.Axes.cleanId(r,n))}function c(t,e){for(var r=[],n=(t.concat(Array.isArray(e)?e:[]).filter(function(t){return"uid"in t}).map(function(t){return t.uid})),i=0;io&&(s=R.randstr(n),-1!==r.indexOf(s));o++);a.uid=R.randstr(n),n.push(a.uid)}if(r.push(a.uid),"histogramy"===a.type&&"xbins"in a&&!("ybins"in a)&&(a.ybins=a.xbins,delete a.xbins),a.error_y&&"opacity"in a.error_y){var l=N.defaults,u=a.error_y.color||(j.traceIs(a,"bar")?N.defaultLine:l[i%l.length]);a.error_y.color=N.addOpacity(N.rgb(u),N.opacity(u)*a.error_y.opacity),delete a.error_y.opacity}if("bardir"in a&&("h"!==a.bardir||!j.traceIs(a,"bar")&&"histogram"!==a.type.substr(0,9)||(a.orientation="h",_(a)),delete a.bardir),"histogramy"===a.type&&_(a),"histogramx"!==a.type&&"histogramy"!==a.type||(a.type="histogram"),"scl"in a&&(a.colorscale=a.scl,delete a.scl),"reversescl"in a&&(a.reversescale=a.reversescl,delete a.reversescl),a.xaxis&&(a.xaxis=C.Axes.cleanId(a.xaxis,"x")),a.yaxis&&(a.yaxis=C.Axes.cleanId(a.yaxis,"y")),j.traceIs(a,"gl3d")&&a.scene&&(a.scene=j.subplotsRegistry.gl3d.cleanId(a.scene)),j.traceIs(a,"pie")||(Array.isArray(a.textposition)?a.textposition=a.textposition.map(h):a.textposition&&(a.textposition=h(a.textposition))),j.traceIs(a,"2dMap")&&("YIGnBu"===a.colorscale&&(a.colorscale="YlGnBu"),"YIOrRd"===a.colorscale&&(a.colorscale="YlOrRd")),j.traceIs(a,"markerColorscale")&&a.marker){var c=a.marker;"YIGnBu"===c.colorscale&&(c.colorscale="YlGnBu"),"YIOrRd"===c.colorscale&&(c.colorscale="YlOrRd")}if("surface"===a.type&&R.isPlainObject(a.contours)){var p=["x","y","z"];for(o=0;on?o.push(i+n):o.push(n);return o}function m(t,e,r){var n,i;for(n=0;n=t.data.length||i<-t.data.length)throw new Error(r+" must be valid indices for gd.data.");if(e.indexOf(i,n+1)>-1||i>=0&&e.indexOf(-t.data.length+i)>-1||0>i&&e.indexOf(t.data.length+i)>-1)throw new Error("each index in "+r+" must be unique.")}}function g(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),m(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&m(t,r,"newIndices"),"undefined"!=typeof r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function v(t,e,r){var n,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if("undefined"==typeof e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&l0){var s=w(t._boundingBoxMargins),l=s.left+s.right,u=s.bottom+s.top,c=o._container.node().getBoundingClientRect(),h=1-2*a.frameMargins;i=Math.round(h*(c.width-l)),n=Math.round(h*(c.height-u))}else r=window.getComputedStyle(t),n=parseFloat(r.height)||o.height,i=parseFloat(r.width)||o.width;return Math.abs(o.width-i)>1||Math.abs(o.height-n)>1?(o.height=t.layout.height=n,o.width=t.layout.width=i):"initial"!==o.autosize&&(delete e.autosize,o.autosize=t.layout.autosize=!0),j.sanitizeMargins(o),e}function A(t){var e=z.select(t),r=t._fullLayout;if(r._container=e.selectAll(".plot-container").data([0]),r._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),r._paperdiv=r._container.selectAll(".svg-container").data([0]),r._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),"initial"===r.autosize&&(M(t,{}),r.autosize=!0,t.layout.autosize=!0),r._glcontainer=r._paperdiv.selectAll(".gl-container").data([0]),r._glcontainer.enter().append("div").classed("gl-container",!0),r._geocontainer=r._paperdiv.selectAll(".geo-container").data([0]),r._geocontainer.enter().append("div").classed("geo-container",!0),r._paperdiv.selectAll(".main-svg").remove(),r._paper=r._paperdiv.insert("svg",":first-child").classed("main-svg",!0),r._toppaper=r._paperdiv.append("svg").classed("main-svg",!0),!r._uid){var n=[];z.selectAll("defs").each(function(){this.id&&n.push(this.id.split("-")[1])}),r._uid=R.randstr(n)}r._paperdiv.selectAll(".main-svg").attr(Q.svgAttrs),r._defs=r._paper.append("defs").attr("id","defs-"+r._uid),r._topdefs=r._toppaper.append("defs").attr("id","topdefs-"+r._uid),r._draggers=r._paper.append("g").classed("draglayer",!0);var i=r._paper.append("g").classed("layer-below",!0);r._imageLowerLayer=i.append("g").classed("imagelayer",!0),r._shapeLowerLayer=i.append("g").classed("shapelayer",!0);var o=C.Axes.getSubplots(t);o.join("")!==Object.keys(t._fullLayout._plots||{}).join("")&&k(t,o),r._has("cartesian")&&T(t,o),r._ternarylayer=r._paper.append("g").classed("ternarylayer",!0);var a=r._paper.selectAll(".layer-subplot");r._imageSubplotLayer=a.selectAll(".imagelayer"),r._shapeSubplotLayer=a.selectAll(".shapelayer");var s=r._paper.append("g").classed("layer-above",!0);r._imageUpperLayer=s.append("g").classed("imagelayer",!0),r._shapeUpperLayer=s.append("g").classed("shapelayer",!0),r._pielayer=r._paper.append("g").classed("pielayer",!0),r._glimages=r._paper.append("g").classed("glimages",!0),r._geoimages=r._paper.append("g").classed("geoimages",!0),r._infolayer=r._toppaper.append("g").classed("infolayer",!0),r._zoomlayer=r._toppaper.append("g").classed("zoomlayer",!0),r._hoverlayer=r._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework");var l=R.syncOrAsync([E,function(){return C.Axes.doTicks(t,"redraw")},F.init],t);return l&&l.then&&t._promises.push(l),l}function k(t,e){function r(e,r){return function(){return C.Axes.getFromId(t,e,r)}}for(var n,i,o=t._fullLayout._plots={},a=0;a0,_=C.Axes.getSubplots(t).join(""),w=Object.keys(t._fullLayout._plots||{}).join(""),M=w===_;b?t.framework===A&&!x&&M||(t.framework=A,A(t)):M?x&&A(t):(t.framework=A,A(t)),x&&C.Axes.saveRangeInitial(t);var k=t._fullLayout,T=!t.calcdata||t.calcdata.length!==(t.data||[]).length;T&&p(t);for(var S=0;SW.range[0]?[1,2]:[2,1]);else{var Q=W.range[0],K=W.range[1];"log"===F?(0>=Q&&0>=K&&o(H+".autorange",!0),0>=Q?Q=K/1e6:0>=K&&(K=Q/1e6),o(H+".range[0]",Math.log(Q)/Math.LN10),o(H+".range[1]",Math.log(K)/Math.LN10)):(o(H+".range[0]",Math.pow(10,Q)),o(H+".range[1]",Math.pow(10,K)))}else o(H+".autorange",!0)}if("reverse"===U)X.range?X.range.reverse():(o(H+".autorange",!0),X.range=[1,0]),Y.autorange?w=!0:_=!0;else if("annotations"===D.parts[0]||"shapes"===D.parts[0]){var $=D.parts[1],J=D.parts[0],tt=m[J]||[],et=C[R.titleCase(J)],rt=tt[$]||{};2===D.parts.length&&("add"===v[I]||R.isPlainObject(v[I])?S[I]="remove":"remove"===v[I]?-1===$?(S[J]=tt,delete S[I]):S[I]=rt:R.log("???",v)),!a(rt,"x")&&!a(rt,"y")||R.containsAny(I,["color","opacity","align","dash"])||(w=!0),et.draw(t,$,D.parts.slice(2).join("."),v[I]),delete v[I]}else if("images"===D.parts[0]){var it=R.objectFromPath(I,F);R.extendDeepAll(t.layout,it),V.supplyLayoutDefaults(t.layout,t._fullLayout),V.draw(t)}else if("mapbox"===D.parts[0]&&"layers"===D.parts[1]){R.extendDeepAll(t.layout,R.objectFromPath(I,F));var ot=(t._fullLayout.mapbox||{}).layers||[];for(P=D.parts[2]+1-ot.length,d=0;P>d;d++)ot.push({});_=!0}else if("updatemenus"===D.parts[0]){R.extendDeepAll(t.layout,R.objectFromPath(I,F));var at=t._fullLayout.updatemenus||[];for(P=D.parts[2]+1-at.length,d=0;P>d;d++)at.push({});_=!0}else 0===D.parts[0].indexOf("scene")?_=!0:0===D.parts[0].indexOf("geo")?_=!0:0===D.parts[0].indexOf("ternary")?_=!0:!g._has("gl2d")||-1===I.indexOf("axis")&&"plot_bgcolor"!==D.parts[0]?"hiddenlabels"===I?w=!0:-1!==D.parts[0].indexOf("legend")?y=!0:-1!==I.indexOf("title")?x=!0:-1!==D.parts[0].indexOf("bgcolor")?b=!0:D.parts.length>1&&R.containsAny(D.parts[1],["tick","exponent","grid","zeroline"])?x=!0:-1!==I.indexOf(".linewidth")&&-1!==I.indexOf("axis")?x=b=!0:D.parts.length>1&&-1!==D.parts[1].indexOf("line")?b=!0:D.parts.length>1&&"mirror"===D.parts[1]?x=b=!0:"margin.pad"===I?x=b=!0:"margin"===D.parts[0]||"autorange"===D.parts[1]||"rangemode"===D.parts[1]||"type"===D.parts[1]||"domain"===D.parts[1]||I.match(/^(bar|box|font)/)?w=!0:-1!==["hovermode","dragmode"].indexOf(I)?A=!0:-1===["hovermode","dragmode","height","width","autosize"].indexOf(I)&&(_=!0):_=!0,D.set(F)}O.add(t,nt,[t,S],nt,[t,T]),v.autosize&&(v=M(t,v)),(v.height||v.width||v.autosize)&&(w=!0);var st=Object.keys(v),lt=[j.previousPromises];if(_||w)lt.push(function(){return t.layout=void 0,w&&(t.calcdata=void 0),C.plot(t,"",m)});else if(st.length&&(j.supplyDefaults(t),g=t._fullLayout,y&<.push(function(){return q.draw(t),j.previousPromises(t)}),b&<.push(E),x&<.push(function(){return C.Axes.doTicks(t,"redraw"),L(t),j.previousPromises(t)}),A)){var ut;for(Z(t),C.Fx.supplyLayoutDefaults(t.layout,g,t._fullData),C.Fx.init(t),ut=j.getSubplotIds(g,"gl3d"),d=0;d1)};u(r.width)&&u(r.height)||s(new Error("Height and width should be pixel values."));var c=n.clone(e,{format:"png",height:r.height,width:r.width}),h=c.td;h.style.position="absolute",h.style.left="-5000px",document.body.appendChild(h);var f=n.getRedrawFunc(h);o.plot(h,c.data,c.layout,c.config).then(f).then(l).then(function(e){t(e)}).catch(function(t){s(t)})});return s}var i=t("fast-isnumeric"),o=t("../plotly"),a=t("../lib");e.exports=n},{"../lib":583,"../plotly":604,"../snapshot":680,"fast-isnumeric":99}],603:[function(t,e,r){"use strict";function n(t,e,r,i,o,u){u=u||[];for(var c=Object.keys(t),f=0;f1&&l.push(a("object","layout"))),f.supplyDefaults(u);for(var c=u._fullData,g=r.length,v=0;g>v;v++){var y=r[v],x=["data",v];if(d(y)){var b=c[v],_=b.type,w=s.traces[_].attributes;w.type={valType:"enumerated",values:[_]},b.visible===!1&&y.visible!==!1&&l.push(a("invisible",x)),n(y,b,w,l,x);var M=y.transforms,A=b.transforms;if(M){m(M)||l.push(a("array",x,["transforms"])),x.push("transforms");for(var k=0;ku&&c>e&&(void 0===i[r]?o[h]=T.tickText(t,e):o[h]=s(t,e,String(i[r])),h++);return h=864e5?t._tickround="d":r>=36e5?t._tickround="H":r>=6e4?t._tickround="M":r>=1e3?t._tickround="S":t._tickround=3-Math.round(Math.log(r/2)/Math.LN10);else{x(r)||(r=Number(r.substr(1))),t._tickround=2-Math.floor(Math.log(r)/Math.LN10+.01),e="log"===t.type?Math.pow(10,Math.max(t.range[0],t.range[1])):Math.max(Math.abs(t.range[0]),Math.abs(t.range[1]));var n=Math.floor(Math.log(e)/Math.LN10+.01);Math.abs(n)>3&&("SI"===t.exponentformat||"B"===t.exponentformat?t._tickexponent=3*Math.round((n-1)/3):t._tickexponent=n)}else"M"===r.charAt(0)?t._tickround=2===r.length?"m":"y":t._tickround=null}function a(t,e){var r=t.match(U),n=new Date(e);if(r){var i=Math.min(+r[1]||6,6),o=String(e/1e3%1+2.0000005).substr(2,i).replace(/0+$/,"")||"0";return y.time.format(t.replace(U,o))(n)}return y.time.format(t)(n)}function s(t,e,r){var n=t.tickfont||t._gd._fullLayout.font;return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function l(t,e,r,n){var i,o=e.x,s=t._tickround,l=new Date(o),u="";r&&t.hoverformat?i=a(t.hoverformat,o):t.tickformat?i=a(t.tickformat,o):(n&&(x(s)?s+=2:s={y:"m",m:"d",d:"H",H:"M",M:"S",S:2}[s]),"y"===s?i=D(l):"m"===s?i=O(l):(o!==t._tmin||r||(u="
"+D(l)),"d"===s?i=j(l):"H"===s?i=F(l):(o!==t._tmin||r||(u="
"+j(l)+", "+D(l)),i=N(l),"M"!==s&&(i+=B(l),"S"!==s&&(i+=f(v(o/1e3,1),t,"none",r).substr(1)))))),e.text=i+u}function u(t,e,r,n,i){var o=t.dtick,a=e.x;if(!n||"string"==typeof o&&"L"===o.charAt(0)||(o="L3"),t.tickformat||"string"==typeof o&&"L"===o.charAt(0))e.text=f(Math.pow(10,a),t,i,n);else if(x(o)||"D"===o.charAt(0)&&v(a+.01,1)<.1)if(-1!==["e","E","power"].indexOf(t.exponentformat)){var s=Math.round(a);0===s?e.text=1:1===s?e.text="10":s>1?e.text="10"+s+"":e.text="10\u2212"+-s+"",e.fontSize*=1.25}else e.text=f(Math.pow(10,a),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,v(a,1)))),e.fontSize*=.75}if("D1"===t.dtick){var l=String(e.text).charAt(0);"0"!==l&&"1"!==l||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(0>a?.5:.25)))}}function c(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function h(t,e,r,n,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=f(e.x,t,i,n)}function f(t,e,r,n){var i=0>t,a=e._tickround,s=r||e.exponentformat||"B",l=e._tickexponent,u=e.tickformat;if(n){var c={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:x(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range:[0,t||1]};o(c),a=(Number(c._tickround)||0)+4,l=c._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return y.format(u)(t).replace(/-/g,"\u2212");var h=Math.pow(10,-a)/2;if("none"===s&&(l=0),t=Math.abs(t),h>t)t="0",i=!1;else{if(t+=h,l&&(t*=Math.pow(10,-l),a+=l),0===a)t=String(Math.floor(t));else if(0>a){t=String(Math.round(t)),t=t.substr(0,t.length+a);for(var f=a;0>f;f++)t+="0"}else{t=String(t);var p=t.indexOf(".")+1;p&&(t=t.substr(0,p+a).replace(/\.?0+$/,""))}t=_.numSeparate(t,e._gd._fullLayout.separators)}if(l&&"hide"!==s){var d;d=0>l?"\u2212"+-l:"power"!==s?"+"+l:String(l),"e"===s||("SI"===s||"B"===s)&&(l>12||-15>l)?t+="e"+d:"E"===s?t+="E"+d:"power"===s?t+="\xd710"+d+"":"B"===s&&9===l?t+="B":"SI"!==s&&"B"!==s||(t+=V[l/3+5])}return i?"\u2212"+t:t}function p(t,e){var r,n,i=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},T.getAutoRange=function(t){var e,r=[],n=t._min[0].val,i=t._max[0].val;for(e=1;e0&&c>0&&h/c>f&&(l=a,u=s,f=h/c);if(n===i){var d=n-1,m=n+1;r="tozero"===t.rangemode?0>n?[d,0]:[0,m]:"nonnegative"===t.rangemode?[Math.max(0,d),Math.max(0,m)]:[d,m]}else f&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(l.val>=0&&(l={val:0,pad:0}),u.val<=0&&(u={val:0,pad:0})):"nonnegative"===t.rangemode&&(l.val-f*l.pad<0&&(l={val:0,pad:0}),u.val<0&&(u={val:1,pad:0})),f=(u.val-l.val)/(t._length-l.pad-u.pad)),r=[l.val-f*l.pad,u.val+f*u.pad]);return r[0]===r[1]&&("tozero"===t.rangemode?r=r[0]<0?[r[0],0]:r[0]>0?[0,r[0]]:[0,1]:(r=[r[0]-1,r[0]+1],"nonnegative"===t.rangemode&&(r[0]=Math.max(0,r[0])))),p&&r.reverse(),r},T.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=T.getAutoRange(t);var r=t._gd.layout[t._name];r||(t._gd.layout[t._name]=r={}),r!==t&&(r.range=t.range.slice(),r.autorange=t.autorange)}},T.saveRangeInitial=function(t,e){for(var r=T.list(t,"",!0),n=!1,i=0;id&&(d=m/10),u=t.c2l(d),c=t.c2l(m),y&&(u=Math.min(0,u),c=Math.max(0,c)),n(u)){for(p=!0,a=0;a=f?p=!1:s.val>=u&&s.pad<=f&&(t._min.splice(a,1),a--);p&&t._min.push({val:u,pad:y&&0===u?0:f})}if(n(c)){for(p=!0,a=0;a=c&&s.pad>=h?p=!1:s.val<=c&&s.pad<=h&&(t._max.splice(a,1),a--);p&&t._max.push({val:c,pad:y&&0===c?0:h})}}}if((t.autorange||t._needsExpand)&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var o,a,s,l,u,c,h,f,p,d,m,g=e.length,v=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type),b=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),_=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),w=n(r.vpadplus||r.vpad),M=n(r.vpadminus||r.vpad);for(o=0;6>o;o++)i(o);for(o=g-1;o>5;o--)i(o)}},T.autoBin=function(t,e,r,n){function i(t){return(1+100*(t-p)/h.dtick)%100<2}var o=_.aggNums(Math.min,null,t),a=_.aggNums(Math.max,null,t);if("category"===e.type)return{start:o-.5,end:a+.5,size:1};var s;if(r)s=(a-o)/r;else{var l=_.distinctVals(t),u=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),c=u*_.roundUp(l.minDiff/u,[.9,1.9,4.9,9.9],!0);s=Math.max(c,2*_.stdev(t)/Math.pow(t.length,n?.25:.4))}var h={type:"log"===e.type?"linear":e.type,range:[o,a]};T.autoTicks(h,s);var f,p=T.tickIncrement(T.tickFirst(h),h.dtick,"reverse");if("number"==typeof h.dtick){for(var d=0,m=0,g=0,v=0,y=0;ym&&(d>.3*b||i(o)||i(a))){var w=h.dtick/2;p+=o>p+w?w:-w}var M=1+Math.floor((a-p)/h.dtick);f=p+M*h.dtick}else for(f=p;a>=f;)f=T.tickIncrement(f,h.dtick);return{start:p,end:f,size:h.dtick}},T.calcTicks=function(t){if("array"===t.tickmode)return n(t);if("auto"===t.tickmode||!t.dtick){var e,r=t.nticks;r||("category"===t.type?(e=t.tickfont?1.2*(t.tickfont.size||12):15,r=t._length/e):(e="y"===t._id.charAt(0)?40:80,r=_.constrain(t._length/e,4,9)+1)),T.autoTicks(t,Math.abs(t.range[1]-t.range[0])/r),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t._forceTick0)}t.tick0||(t.tick0="date"===t.type?new Date(2e3,0,1).getTime():0),o(t),t._tmin=T.tickFirst(t);var i=t.range[1]=s:s>=l)&&(a.push(l),!(a.length>1e3));l=T.tickIncrement(l,t.dtick,i));t._tmax=a[a.length-1];for(var u=new Array(a.length),c=0;c157788e5?(e/=315576e5,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,r,L)):e>12096e5?(e/=26298e5,t.dtick="M"+i(e,1,z)):e>432e5?(t.dtick=i(e,864e5,P),t.tick0=new Date(2e3,0,2).getTime()):e>18e5?t.dtick=i(e,36e5,z):e>3e4?t.dtick=i(e,6e4,I):e>500?t.dtick=i(e,1e3,I):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,L));else if("log"===t.type)if(t.tick0=0,e>.7)t.dtick=Math.ceil(e);else if(Math.abs(t.range[1]-t.range[0])<1){var n=1.5*Math.abs((t.range[1]-t.range[0])/e);e=Math.abs(Math.pow(10,t.range[1])-Math.pow(10,t.range[0]))/n,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+i(e,r,L)}else t.dtick=e>.3?"D2":"D1";else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,L));if(0===t.dtick&&(t.dtick=1),!x(t.dtick)&&"string"!=typeof t.dtick){var o=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(o)}},T.tickIncrement=function(t,e,r){var n=r?-1:1;if(x(e))return t+n*e;var i=e.charAt(0),o=n*Number(e.substr(1));if("M"===i){var a=new Date(t);return a.setMonth(a.getMonth()+o)}if("L"===i)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===i){var s="D2"===e?R:C,l=t+.01*n,u=_.roundUp(v(l,1),s,r);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},T.tickFirst=function(t){var e=t.range[1]n:n>u;)u=T.tickIncrement(u,i,e);return u}if("L"===c)return Math.log(r((Math.pow(10,n)-o)/h)*h+o)/Math.LN10;if("D"===c){var f="D2"===i?R:C,p=_.roundUp(v(n,1),f,e);return Math.floor(n)+Math.log(y.round(Math.pow(10,p),1))/Math.LN10}throw"unrecognized dtick "+String(i)};var D=y.time.format("%Y"),O=y.time.format("%b %Y"),j=y.time.format("%b %-d"),F=y.time.format("%b %-d %Hh"),N=y.time.format("%H:%M"),B=y.time.format(":%S"),U=/%(\d?)f/g;T.tickText=function(t,e,r){function n(n){var i;return void 0===n?!0:r?"none"===n:(i={first:t._tmin,last:t._tmax}[n],"all"!==n&&e!==i)}var i,o,a=s(t,e),f="array"===t.tickmode,p=r||f;if(f&&Array.isArray(t.ticktext)){var d=Math.abs(t.range[1]-t.range[0])/1e4;for(o=0;o1&&er&&(I=90),i(f,I)}u._lastangle=I}return l(),a(e),e+" done"}function l(){var e=.25,r=200,n=("x"===g?t._fullLayout.height:t._fullLayout.width)*e;n=Math.min(n,r),f.each(function(t){var e=y.select(this),r=k.bBox(e.node()),i="x"===g?r.height:r.width;if(i>n){var o=t.text,a=Math.round(n/(i/o.length)),s=Math.floor(a/2),l=a-s-1;o=o.substr(0,s)+"\u2026"+o.substr(-l);var u=e.select("text");u.text(o),e.insert("title","text").text(t.text)}})}function c(){var e,r,n=u._boundingBox,i=0,o=0;if("x"===u._id.charAt(0)?(e="height","2"===u._id.charAt(1)?(o=1,r="t"):r="b"):"y"===u._id.charAt(0)&&(e="width","2"===u._id.charAt(1)?(i=1,r="r"):r="l"),e&&r){var a=n[e];if(u._titleElement){var s=u._titleElement.node().getBoundingClientRect();a+=s[e]+2}var l=.5*t._fullLayout[e];a=Math.min(a,l);var c={x:i,y:o,l:0,r:0,b:0,t:0};c[r]=a,b.Plots.autoMargin(t,u._name,c)}}function h(){u._boundingBox=r.node().getBoundingClientRect()}r.style("pointer-events","all");var f=r.selectAll("g."+z).data(S,L);if(!u.showticklabels||!x(n))return f.remove(),void a(e);var d,v,M,A,T;"x"===g?(T="bottom"===B?1:-1,d=function(t){return t.dx+D*T},A=n+(R+C)*T,v=function(t){return t.dy+A+t.fontSize*("bottom"===B?1:-.5)},M=function(t){return x(t)&&0!==t&&180!==t?0>t*T?"end":"start":"middle"}):(T="right"===B?1:-1,v=function(t){return t.dy+t.fontSize/2-D*T},d=function(t){return t.dx+n+(R+C+(90===Math.abs(u.tickangle)?t.fontSize/2:0))*T},M=function(t){return x(t)&&90===Math.abs(t)?"middle":"right"===B?"start":"end"});var E=0,I=0,P=[],O=f.enter().append("g").classed(z,1);O.append("text").attr("text-anchor","middle").each(function(e){var r=y.select(this),n=t._promises.length;r.call(k.setPosition,d(e),v(e)).call(k.font,e.font,e.fontSize,e.fontColor).text(e.text).call(w.convertToTspans),n=t._promises[n],n?P.push(t._promises.pop().then(function(){i(r,u.tickangle)})):i(r,u.tickangle)}),f.exit().remove(),f.each(function(t){E=Math.max(E,t.fontSize)}),i(f,u._lastangle||u.tickangle);var j=_.syncOrAsync([o,s,h,c]);return j&&j.then&&t._promises.push(j),j}function a(e){if(!r){var n,i,o,a,s=E.getFromId(t,e),l=y.select(t).selectAll("g."+e+"tick"),u={selection:l,side:s.side},h=e.charAt(0),f=t._fullLayout._size,p=1.5,d=s.titlefont.size;if(l.size()){var m=y.select(l.node().parentNode).attr("transform").match(/translate\(([-\.\d]+),([-\.\d]+)\)/);m&&(u.offsetLeft=+m[1],u.offsetTop=+m[2])}"x"===h?(i="free"===s.anchor?{_offset:f.t+(1-(s.position||0))*f.h,_length:0}:E.getFromId(t,s.anchor),o=s._offset+s._length/2,a=i._offset+("top"===s.side?-10-d*(p+(s.showticklabels?1:0)):i._length+10+d*(p+(s.showticklabels?1.5:.5))),s.rangeslider&&s.rangeslider.visible&&s._boundingBox&&(a+=(c.height-c.margin.b-c.margin.t)*s.rangeslider.thickness+s._boundingBox.height),u.side||(u.side="bottom")):(i="free"===s.anchor?{_offset:f.l+(s.position||0)*f.w,_length:0}:E.getFromId(t,s.anchor),a=s._offset+s._length/2,o=i._offset+("right"===s.side?i._length+10+d*(p+(s.showticklabels?1:.5)):-10-d*(p+(s.showticklabels?.5:0))),n={rotate:"-90",offset:0},u.side||(u.side="left")),M.draw(t,e+"title",{propContainer:s,propName:s._name+".title",dfltName:h.toUpperCase()+" axis",avoid:u,transform:n,attributes:{x:o,y:a,"text-anchor":"middle"}})}}function s(t,e){return t.visible!==!0||t.xaxis+t.yaxis!==e?!1:b.Plots.traceIs(t,"bar")&&t.orientation==={x:"h",y:"v"}[g]?!0:t.fill&&t.fill.charAt(t.fill.length-1)===g}function l(e,r,i){var o=e.gridlayer,a=e.zerolinelayer,l=e["hidegrid"+g]?[]:V,c=u._gridpath||"M0,0"+("x"===g?"v":"h")+r._length,h=o.selectAll("path."+I).data(u.showgrid===!1?[]:l,L);if(h.enter().append("path").classed(I,1).classed("crisp",1).attr("d",c).each(function(t){u.zeroline&&("linear"===u.type||"-"===u.type)&&Math.abs(t.x)m;m++){var y=u.mirrors[a._id+f[m]];"ticks"!==y&&"labels"!==y||(h[m]=!0)}return void 0!==n[2]&&(h[2]=!0),h.forEach(function(t,e){var r=n[e],i=U[e];t&&x(r)&&(p+=d(r+C*i,i*u.ticklen))}),i(r,p),l(e,a,t),o(r,n[3])}}).filter(function(t){return t&&t.then});return G.length?Promise.all(G):0},T.swap=function(t,e){for(var r=p(t,e),n=0;n2*n}function c(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,i=0,o=0;o2*n}var h=t("fast-isnumeric"),f=t("tinycolor2").mix,p=t("../../lib"),d=t("../plots"),m=t("../../components/color/attributes").lightFraction,g=t("./layout_attributes"),v=t("./tick_value_defaults"),y=t("./tick_mark_defaults"),x=t("./tick_label_defaults"),b=t("./category_order_defaults"),_=t("./set_convert"),w=t("./ordered_categories"),M=t("./clean_datum"),A=t("./axis_ids");e.exports=function(t,e,r,i){function o(r,n){return p.coerce2(t,e,g,r,n)}var a=i.letter,s=i.font||{},l="Click to enter "+(i.title||a.toUpperCase()+" axis")+" title";i.name&&(e._name=i.name,e._id=A.name2id(i.name));var u=r("type");"-"===u&&(n(e,i.data),"-"===e.type?e.type="linear":u=t.type=e.type),_(e);var c=r("color"),d=c===t.color?c:s.color;r("title",l),p.coerceFont(r,"titlefont",{family:s.family,size:Math.round(1.2*s.size),color:d});var M=2===(t.range||[]).length&&h(t.range[0])&&h(t.range[1]),k=r("autorange",!M);k&&r("rangemode");var T=r("range",[-1,"x"===a?6:4]);T[0]===T[1]&&(e.range=[T[0]-1,T[0]+1]),p.noneOrAll(t.range,e.range,[0,1]),r("fixedrange"),v(t,e,r,u),x(t,e,r,u,i),y(t,e,r,i),b(t,e,r);var E=o("linecolor",c),S=o("linewidth"),L=r("showline",!!E||!!S);L||(delete e.linecolor,delete e.linewidth),(L||e.ticks)&&r("mirror");var z=o("gridcolor",f(c,i.bgColor,m).toRgbString()),I=o("gridwidth"),P=r("showgrid",i.showGrid||!!z||!!I);P||(delete e.gridcolor,delete e.gridwidth);var C=o("zerolinecolor",c),R=o("zerolinewidth"),D=r("zeroline",i.showGrid||!!C||!!R);return D||(delete e.zerolinecolor,delete e.zerolinewidth),e._initialCategories="category"===u?w(a,e.categoryorder,e.categoryarray,i.data):[],e}},{"../../components/color/attributes":497,"../../lib":583,"../plots":663,"./axis_ids":609,"./category_order_defaults":610,"./clean_datum":611,"./layout_attributes":616,"./ordered_categories":618,"./set_convert":621,"./tick_label_defaults":622,"./tick_mark_defaults":623,"./tick_value_defaults":624,"fast-isnumeric":99,tinycolor2:461}],609:[function(t,e,r){"use strict";function n(t,e,r){function n(t,r){for(var n=Object.keys(t),i=/^[xyz]axis[0-9]*/,o=[],a=0;a0;o&&(n="array");var a=r("categoryorder",n);"array"===a&&r("categoryarray"),o||"array"!==a||(e.categoryorder="trace")}}},{}],611:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib");e.exports=function(t){try{if("object"==typeof t&&null!==t&&t.getTime)return i.ms2DateTime(t);if("string"!=typeof t&&!n(t))return"";t=t.toString().replace(/['"%,$# ]/g,"")}catch(e){i.error(e,t)}return t}},{"../../lib":583,"fast-isnumeric":99}],612:[function(t,e,r){"use strict";e.exports={idRegex:{x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},attrRegex:{x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},BADNUM:void 0,xAxisMatch:/^xaxis[0-9]*$/,yAxisMatch:/^yaxis[0-9]*$/,AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,DBLCLICKDELAY:300,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,BENDPX:1.5,REDRAWDELAY:50}},{}],613:[function(t,e,r){"use strict";function n(t,e){var r,n=t.range[e],i=Math.abs(n-t.range[1-e]);return"date"===t.type?c.ms2DateTime(n,i):"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,s.format("."+r+"g")(Math.pow(10,n))):(r=Math.floor(Math.log(Math.abs(n))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,s.format("."+String(r)+"g")(n))}function i(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function o(t){s.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function a(t){var e=["lasso","select"];return-1!==e.indexOf(t)}var s=t("d3"),l=t("tinycolor2"),u=t("../../plotly"),c=t("../../lib"),h=t("../../lib/svg_text_utils"),f=t("../../components/color"),p=t("../../components/drawing"),d=t("../../lib/setcursor"),m=t("../../components/dragelement"),g=t("./axes"),v=t("./select"),y=t("./constants"),x=!0;e.exports=function(t,e,r,s,b,_,w,M){function A(t,e){for(var r=0;r.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+dt+", "+mt+")").attr("d",lt+"Z"),ft=pt.append("path").attr("class","zoombox-corners").style({fill:f.background,stroke:f.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+dt+", "+mt+")").attr("d","M0,0Z"),E();for(var o=0;oi?(ct="",at.r=at.l,at.t=at.b,ft.attr("d","M0,0Z")):(at.t=0,at.b=q,ct="x",ft.attr("d","M"+(at.l-.5)+","+(ot-H-.5)+"h-3v"+(2*H+1)+"h3ZM"+(at.r+.5)+","+(ot-H-.5)+"h3v"+(2*H+1)+"h-3Z")):!K||i.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),ft.transition().style("opacity",1).duration(200),ut=!0)}function L(t,e,r){var n,i,o,a=[];for(n=0;nzoom back out","long"),x=!1),s.pre=!1,t.emit("plotly_zoom",s))}function I(e,r){var i=1===(w+M).length;if(e)O();else if(2!==r||i){if(1===r&&i){var o=w?U[0]:B[0],a="s"===w||"w"===M?0:1,s=o._name+".range["+a+"]",l=n(o,a),c="left",f="middle";if(o.fixedrange)return;w?(f="n"===w?"top":"bottom","right"===o.side&&(c="right")):"e"===M&&(c="right"),et.call(h.makeEditable,null,{immediate:!0,background:F.paper_bgcolor,text:String(l),fill:o.tickfont?o.tickfont.color:"#444",horizontalAlign:c,verticalAlign:f}).on("edit",function(e){var r="category"===o.type?o.c2l(e):o.d2l(e);void 0!==r&&u.relayout(t,s,r)})}}else D()}function P(e){function r(t,e,r){if(!t.fixedrange){k(t.range);var n=t.range,i=n[0]+(n[1]-n[0])*e;t.range=[i+(n[0]-i)*r,i+(n[1]-i)*r]}}if(t._context.scrollZoom||F._enablescrollzoom){var n=t.querySelector(".plotly");if(!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(vt);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void c.log("Did not find wheel motion attributes: ",e);var o,a=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=xt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=gt[0]+gt[2]*l,h=(s.bottom-e.clientY)/s.height,f=gt[1]+gt[3]*(1-h);if(M){for(o=0;o=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function i(t,e,r){for(var i=1-e,o=0,a=0;aa;++a)f[0][a]>f[1][a]?p[a]=1 e.exports=function(t,e,r){function u(r,n){return i.coerce(t,e,o,r,n)}e.type="linear";var c=u("color"),h=c===t.color?c:r.font.color,f=e._name,p=f.charAt(0).toUpperCase(),d="Component "+p,m=u("title",d);e._hovertitle=m===d?m:p,i.coerceFont(u,"titlefont",{family:r.font.family,size:Math.round(1.2*r.font.size),color:h}),u("min"),l(t,e,u,"linear"),a(t,e,u,"linear",{noHover:!1}),s(t,e,u,{outerTicks:!0});var g=u("showticklabels");g&&(i.coerceFont(u,"tickfont",{family:r.font.family,size:r.font.size,color:h}),u("tickangle"),u("tickformat")),u("hoverformat");var v=u("showline");v&&(u("linecolor",c),u("linewidth"));var y=u("showgrid");y&&(u("gridcolor",n(c,r.bgColor,60).toRgbString()),u("gridwidth"))}},{"../../../lib":583,"../../cartesian/tick_label_defaults":622,"../../cartesian/tick_mark_defaults":623,"../../cartesian/tick_value_defaults":624,"./axis_attributes":672,tinycolor2:461}],674:[function(t,e,r){"use strict";function n(t,e,r,n){var o=r("bgcolor"),a=r("sum");n.bgColor=i.combine(o,n.paper_bgcolor);for(var u,c,h,f=0;f=a&&(p.min=0,d.min=0,m.min=0,t.aaxis&&delete t.aaxis.min,t.baxis&&delete t.baxis.min,t.caxis&&delete t.caxis.min)}var i=t("../../../components/color"),o=t("../../subplot_defaults"),a=t("./layout_attributes"),s=t("./axis_defaults"),l=["aaxis","baxis","caxis"];e.exports=function(t,e,r){o(t,e,r,{type:"ternary",attributes:a,handleDefaults:n,font:e.font,paper_bgcolor:e.paper_bgcolor})}},{"../../../components/color":498,"../../subplot_defaults":669,"./axis_defaults":673,"./layout_attributes":675}],675:[function(t,e,r){"use strict";var n=t("../../../components/color/attributes"),i=t("./axis_attributes");e.exports={domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},bgcolor:{valType:"color",dflt:n.background},sum:{valType:"number",dflt:1,min:0},aaxis:i,baxis:i,caxis:i}},{"../../../components/color/attributes":497,"./axis_attributes":672}],676:[function(t,e,r){"use strict";function n(t,e){this.id=t.id,this.graphDiv=t.graphDiv,this.init(e),this.makeFramework()}function i(t){o.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}var o=t("d3"),a=t("tinycolor2"),s=t("../../plotly"),l=t("../../lib"),u=t("../../components/color"),c=t("../../components/drawing"),h=t("../cartesian/set_convert"),f=t("../../lib/extend").extendFlat,p=t("../cartesian/axes"),d=t("../../lib/filter_visible"),m=t("../../components/dragelement"),g=t("../../components/titles"),v=t("../cartesian/select"),y=t("../cartesian/constants"),x=t("../cartesian/graph_interact");e.exports=n;var b=n.prototype;b.init=function(t){this.container=t._ternarylayer,this.defs=t._defs,this.layoutId=t._uid,this.traceHash={}},b.plot=function(t,e){var r,n=this,i=e[n.id],o=e._size;l.getPlotDiv(n.plotContainer.node())!==n.graphDiv&&(n.init(n.graphDiv._fullLayout),n.makeFramework()),n.adjustLayout(i,o);var a=n.traceHash,s={};for(r=0;r_*y?(o=y,i=o*_):(i=v,o=i/_),a=m*i/v,s=g*o/y,r=e.l+e.w*p-i/2,n=e.t+e.h*(1-d)-o/2,l.x0=r,l.y0=n,l.w=i,l.h=o,l.sum=x,l.xaxis={type:"linear",range:[b+2*M-x,x-b-2*w],domain:[p-a/2,p+a/2],_id:"x",_gd:l.graphDiv},h(l.xaxis),l.xaxis.setScale(),l.yaxis={type:"linear",range:[b,x-w-M],domain:[d-s/2,d+s/2],_id:"y",_gd:l.graphDiv},h(l.yaxis),l.yaxis.setScale();var A=l.yaxis.domain[0],k=l.aaxis=f({},t.aaxis,{range:[b,x-w-M],side:"left",_counterangle:30,tickangle:(+t.aaxis.tickangle||0)-30,domain:[A,A+s*_],_axislayer:l.layers.aaxis,_gridlayer:l.layers.agrid,_pos:0,_gd:l.graphDiv,_id:"y",_length:i,_gridpath:"M0,0l"+o+",-"+i/2});h(k);var T=l.baxis=f({},t.baxis,{range:[x-b-M,w],side:"bottom",_counterangle:30,domain:l.xaxis.domain,_axislayer:l.layers.baxis,_gridlayer:l.layers.bgrid,_counteraxis:l.aaxis,_pos:0,_gd:l.graphDiv,_id:"x",_length:i,_gridpath:"M0,0l-"+i/2+",-"+o});h(T),k._counteraxis=T;var E=l.caxis=f({},t.caxis,{range:[x-b-w,M],side:"right",_counterangle:30,tickangle:(+t.caxis.tickangle||0)+30,domain:[A,A+s*_],_axislayer:l.layers.caxis,_gridlayer:l.layers.cgrid,_counteraxis:l.baxis,_pos:0,_gd:l.graphDiv,_id:"y",_length:i,_gridpath:"M0,0l-"+o+","+i/2});h(E);var S="M"+r+","+(n+o)+"h"+i+"l-"+i/2+",-"+o+"Z";l.clipDef.select("path").attr("d",S),l.layers.plotbg.select("path").attr("d",S);var L="translate("+r+","+n+")";l.plotContainer.selectAll(".scatterlayer,.maplayer,.zoom").attr("transform",L);var z="translate("+r+","+(n+o)+")";l.layers.baxis.attr("transform",z),l.layers.bgrid.attr("transform",z);var I="translate("+(r+i/2)+","+n+")rotate(30)";l.layers.aaxis.attr("transform",I),l.layers.agrid.attr("transform",I);var P="translate("+(r+i/2)+","+n+")rotate(-30)";l.layers.caxis.attr("transform",P),l.layers.cgrid.attr("transform",P),l.drawAxes(!0),l.plotContainer.selectAll(".crisp").classed("crisp",!1);var C=l.layers.axlines;C.select(".aline").attr("d",k.showline?"M"+r+","+(n+o)+"l"+i/2+",-"+o:"M0,0").call(u.stroke,k.linecolor||"#000").style("stroke-width",(k.linewidth||0)+"px"),C.select(".bline").attr("d",T.showline?"M"+r+","+(n+o)+"h"+i:"M0,0").call(u.stroke,T.linecolor||"#000").style("stroke-width",(T.linewidth||0)+"px"),C.select(".cline").attr("d",E.showline?"M"+(r+i/2)+","+n+"l"+i/2+","+o:"M0,0").call(u.stroke,E.linecolor||"#000").style("stroke-width",(E.linewidth||0)+"px")},b.drawAxes=function(t){var e=this,r=e.graphDiv,n=e.id.substr(7)+"title",i=e.aaxis,o=e.baxis,a=e.caxis;if(p.doTicks(r,i,!0),p.doTicks(r,o,!0),p.doTicks(r,a,!0),t){var s=Math.max(i.showticklabels?i.tickfont.size/2:0,(a.showticklabels?.75*a.tickfont.size:0)+("outside"===a.ticks?.87*a.ticklen:0));g.draw(r,"a"+n,{propContainer:i,propName:e.id+".aaxis.title",dfltName:"Component A",attributes:{x:e.x0+e.w/2,y:e.y0-i.titlefont.size/3-s,"text-anchor":"middle"}});var l=(o.showticklabels?o.tickfont.size:0)+("outside"===o.ticks?o.ticklen:0)+3;g.draw(r,"b"+n,{propContainer:o,propName:e.id+".baxis.title",dfltName:"Component B",attributes:{x:e.x0-l,y:e.y0+e.h+.83*o.titlefont.size+l,"text-anchor":"middle"}}),g.draw(r,"c"+n,{propContainer:a,propName:e.id+".caxis.title",dfltName:"Component C",attributes:{x:e.x0+e.w+l,y:e.y0+e.h+.83*a.titlefont.size+l,"text-anchor":"middle"}})}};var w=y.MINZOOM/2+.87,M="m-0.87,.5h"+w+"v3h-"+(w+5.2)+"l"+(w/2+2.6)+",-"+(.87*w+4.5)+"l2.6,1.5l-"+w/2+","+.87*w+"Z",A="m0.87,.5h-"+w+"v3h"+(w+5.2)+"l-"+(w/2+2.6)+",-"+(.87*w+4.5)+"l-2.6,1.5l"+w/2+","+.87*w+"Z",k="m0,1l"+w/2+","+.87*w+"l2.6,-1.5l-"+(w/2+2.6)+",-"+(.87*w+4.5)+"l-"+(w/2+2.6)+","+(.87*w+4.5)+"l2.6,1.5l"+w/2+",-"+.87*w+"Z",T="m0.5,0.5h5v-2h-5v-5h-2v5h-5v2h5v5h2Z",E=!0;b.initInteractions=function(){function t(t,e,r){var n=j.getBoundingClientRect();b=e-n.left,w=r-n.top,S={a:O.aaxis.range[0],b:O.baxis.range[1],c:O.caxis.range[1]},z=S,L=O.aaxis.range[1]-S.a,I=a(O.graphDiv._fullLayout[O.id].bgcolor).getLuminance(),P="M0,"+O.h+"L"+O.w/2+", 0L"+O.w+","+O.h+"Z",C=!1,R=N.append("path").attr("class","zoombox").style({fill:I>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("d",P),D=N.append("path").attr("class","zoombox-corners").style({fill:u.background,stroke:u.defaultLine,"stroke-width":1,opacity:0}).attr("d","M0,0Z"),d()}function e(t,e){return 1-e/O.h}function r(t,e){return 1-(t+(O.h-e)/Math.sqrt(3))/O.w}function n(t,e){return(t-(O.h-e)/Math.sqrt(3))/O.w}function o(t,i){var o=b+t,a=w+i,s=Math.max(0,Math.min(1,e(b,w),e(o,a))),l=Math.max(0,Math.min(1,r(b,w),r(o,a))),u=Math.max(0,Math.min(1,n(b,w),n(o,a))),c=(s/2+u)*O.w,h=(1-s/2-l)*O.w,f=(c+h)/2,p=h-c,d=(1-s)*O.h,m=d-p/_;p.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),D.transition().style("opacity",1).duration(200),C=!0)}function c(t,e){if(z===S)return 2===e&&g(),i(F);i(F);var r={};r[O.id+".aaxis.min"]=z.a,r[O.id+".baxis.min"]=z.b,r[O.id+".caxis.min"]=z.c,s.relayout(F,r),E&&F.data&&F._context.showTips&&(l.notifier("Double-click to
zoom back out","long"),E=!1)}function h(){S={a:O.aaxis.range[0],b:O.baxis.range[1],c:O.caxis.range[1]},z=S}function f(t,e){var r=t/O.xaxis._m,n=e/O.yaxis._m;z={a:S.a-n,b:S.b+(r+n)/2,c:S.c-(r-n)/2};var i=[z.a,z.b,z.c].sort(),o={a:i.indexOf(z.a),b:i.indexOf(z.b),c:i.indexOf(z.c)};i[0]<0&&(i[1]+i[0]/2<0?(i[2]+=i[0]+i[1],i[0]=i[1]=0):(i[2]+=i[0]/2,i[1]+=i[0]/2,i[0]=0),z={a:i[o.a],b:i[o.b],c:i[o.c]},e=(S.a-z.a)*O.yaxis._m,t=(S.c-z.c-S.b+z.b)*O.xaxis._m);var a="translate("+(O.x0+t)+","+(O.y0+e)+")";O.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",a),O.aaxis.range=[z.a,O.sum-z.b-z.c],O.baxis.range=[O.sum-z.a-z.c,z.b],O.caxis.range=[O.sum-z.a-z.b,z.c],O.drawAxes(!1),O.plotContainer.selectAll(".crisp").classed("crisp",!1)}function p(t,e){if(t){var r={};r[O.id+".aaxis.min"]=z.a,r[O.id+".baxis.min"]=z.b,r[O.id+".caxis.min"]=z.c,s.relayout(F,r)}else 2===e&&g()}function d(){O.plotContainer.selectAll(".select-outline").remove()}function g(){var t={};t[O.id+".aaxis.min"]=0,t[O.id+".baxis.min"]=0,t[O.id+".caxis.min"]=0,F.emit("plotly_doubleclick",null),s.relayout(F,t)}var b,w,S,L,z,I,P,C,R,D,O=this,j=O.layers.plotbg.select("path").node(),F=O.graphDiv,N=O.layers.zoom,B={element:j,gd:F,plotinfo:{plot:N},doubleclick:g,subplot:O.id,prepFn:function(e,r,n){B.xaxes=[O.xaxis],B.yaxes=[O.yaxis];var i=F._fullLayout.dragmode;e.shiftKey&&(i="pan"===i?"zoom":"pan"),"lasso"===i?B.minDrag=1:B.minDrag=void 0,"zoom"===i?(B.moveFn=o,B.doneFn=c,t(e,r,n)):"pan"===i?(B.moveFn=f,B.doneFn=p,h(),d()):"select"!==i&&"lasso"!==i||v(e,r,n,B,i)}};j.onmousemove=function(t){x.hover(F,t,O.id),F._fullLayout._lasthover=j,F._fullLayout._hoversubplot=O.id},j.onmouseout=function(t){F._dragging||m.unhover(F,t)},j.onclick=function(t){x.click(F,t)},m.init(B)}},{"../../components/color":498,"../../components/dragelement":519,"../../components/drawing":521,"../../components/titles":561,"../../lib":583,"../../lib/extend":578,"../../lib/filter_visible":579,"../../plotly":604,"../cartesian/axes":607,"../cartesian/constants":612,"../cartesian/graph_interact":614,"../cartesian/select":620,"../cartesian/set_convert":621,d3:90,tinycolor2:461}],677:[function(t,e,r){"use strict";function n(t){var e;switch(t){case"themes__thumb":e={autosize:!0,width:150,height:150,title:"",showlegend:!1,margin:{l:5,r:5,t:5,b:5,pad:0},annotations:[]};break;case"thumbnail":e={title:"",hidesources:!0,showlegend:!1,borderwidth:0,bordercolor:"",margin:{l:1,r:1,t:1,b:1,pad:0},annotations:[]};break;default:e={}}return e}function i(t){var e=["xaxis","yaxis","zaxis"];return e.indexOf(t.slice(0,5))>-1}var o=t("../plotly"),a=o.Lib.extendFlat,s=o.Lib.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var r,l=t.data,u=t.layout,c=s([],l),h=s({},u,n(e.tileClass));if(e.width&&(h.width=e.width),e.height&&(h.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){h.annotations=[];var f=Object.keys(h);for(r=0;rl;l++)n(r[l])&&p.push({p:r[l],s:s[l],b:0});return o(e,"marker")&&a(e,e.marker.color,"marker","c"),o(e,"marker.line")&&a(e,e.marker.line.color,"marker.line","c"),p}},{"../../components/colorscale/calc":505,"../../components/colorscale/has_colorscale":511,"../../plots/cartesian/axes":607,"fast-isnumeric":99}],687:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/color"),o=t("../scatter/xy_defaults"),a=t("../bar/style_defaults"),s=t("../../components/errorbars/defaults"),l=t("./attributes");e.exports=function(t,e,r,u){function c(r,i){return n.coerce(t,e,l,r,i)}var h=o(t,e,c);return h?(c("orientation",e.x&&!e.y?"h":"v"),c("text"),a(t,e,c,r,u),s(t,e,i.defaultLine,{axis:"y"}),void s(t,e,i.defaultLine,{axis:"x",inherit:"y"})):void(e.visible=!1)}},{"../../components/color":498,"../../components/errorbars/defaults":526,"../../lib":583,"../bar/style_defaults":695,"../scatter/xy_defaults":792,"./attributes":685}],688:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/graph_interact"),i=t("../../components/errorbars"),o=t("../../components/color");e.exports=function(t,e,r,a){var s,l=t.cd,u=l[0].trace,c=l[0].t,h=t.xa,f=t.ya,p="closest"===a?c.barwidth/2:c.dbar*(1-h._gd._fullLayout.bargap)/2;s="closest"!==a?function(t){return t.p}:"h"===u.orientation?function(t){return t.y}:function(t){return t.x};var d,m;"h"===u.orientation?(d=function(t){return n.inbox(t.b-e,t.x-e)+(t.x-e)/(t.x-t.b)},m=function(t){var e=s(t)-r;return n.inbox(e-p,e+p)}):(m=function(t){return n.inbox(t.b-r,t.y-r)+(t.y-r)/(t.y-t.b)},d=function(t){var r=s(t)-e;return n.inbox(r-p,r+p)});var g=n.getDistanceFunction(a,d,m);if(n.getClosest(l,g,t),t.index!==!1){var v=l[t.index],y=v.mcc||u.marker.color,x=v.mlcc||u.marker.line.color,b=v.mlw||u.marker.line.width;return o.opacity(y)?t.color=y:o.opacity(x)&&b&&(t.color=x),"h"===u.orientation?(t.x0=t.x1=h.c2p(v.x,!0),t.xLabelVal=v.s,t.y0=f.c2p(s(v)-p,!0),t.y1=f.c2p(s(v)+p,!0),t.yLabelVal=v.p):(t.y0=t.y1=f.c2p(v.y,!0),t.yLabelVal=v.s,t.x0=h.c2p(s(v)-p,!0),t.x1=h.c2p(s(v)+p,!0),t.xLabelVal=v.p),v.tx&&(t.text=v.tx),i.hoverInfo(v,u,t),[t]}}},{"../../components/color":498,"../../components/errorbars":527,"../../plots/cartesian/graph_interact":614}],689:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.layoutAttributes=t("./layout_attributes"),n.supplyDefaults=t("./defaults"),n.supplyLayoutDefaults=t("./layout_defaults"),n.calc=t("./calc"),n.setPositions=t("./set_positions"),n.colorbar=t("../scatter/colorbar"),n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.moduleType="trace",n.name="bar",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","bar","oriented","markerColorscale","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":615,"../scatter/colorbar":774,"./arrays_to_calcdata":684,"./attributes":685,"./calc":686,"./defaults":687,"./hover":688,"./layout_attributes":690,"./layout_defaults":691,"./plot":692,"./set_positions":693,"./style":694}],690:[function(t,e,r){"use strict";e.exports={barmode:{valType:"enumerated",values:["stack","group","overlay","relative"],dflt:"group"},barnorm:{valType:"enumerated",values:["","fraction","percent"],dflt:""},bargap:{valType:"number",min:0,max:1},bargroupgap:{valType:"number",min:0,max:1,dflt:0}}},{}],691:[function(t,e,r){"use strict";var n=t("../../plots/plots"),i=t("../../plots/cartesian/axes"),o=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e,r){function s(r,n){return o.coerce(t,e,a,r,n)}for(var l=!1,u=!1,c=!1,h={},f=0;f=2?o(t):t>e?Math.ceil(t):Math.floor(t)}var f,p,d,m;if("h"===s.orientation?(d=c.c2p(r.poffset+e.p,!0),m=c.c2p(r.poffset+e.p+r.barwidth,!0),f=u.c2p(e.b,!0),p=u.c2p(e.s+e.b,!0)):(f=u.c2p(r.poffset+e.p,!0),p=u.c2p(r.poffset+e.p+r.barwidth,!0),m=c.c2p(e.s+e.b,!0),d=c.c2p(e.b,!0)),!(i(f)&&i(p)&&i(d)&&i(m)&&f!==p&&d!==m))return void n.select(this).remove();var g=(e.mlw+1||s.marker.line.width+1||(e.trace?e.trace.marker.line.width:0)+1)-1,v=n.round(g/2%1,2);if(!t._context.staticPlot){var y=a.opacity(e.mc||s.marker.color),x=1>y||g>.01?o:l;f=x(f,p),p=x(p,f),d=x(d,m),m=x(m,d)}n.select(this).attr("d","M"+f+","+d+"V"+m+"H"+p+"V"+d+"Z")})}),f.call(s.plot,e)}},{"../../components/color":498,"../../components/errorbars":527,"../../lib":583,"./arrays_to_calcdata":684,d3:90,"fast-isnumeric":99}],693:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/plots"),o=t("../../plots/cartesian/axes"),a=t("../../lib");e.exports=function(t,e){var r,s,l=t._fullLayout,u=e.x(),c=e.y();["v","h"].forEach(function(h){function f(e){function r(t){t[d]=t.p+f}var n=[];e.forEach(function(e){t.calcdata[e].forEach(function(t){n.push(t.p)})});var i=a.distinctVals(n),s=i.vals,u=i.minDiff,c=!1,h=[];"group"===l.barmode&&e.forEach(function(e){c||(t.calcdata[e].forEach(function(t){c||h.forEach(function(e){Math.abs(t.p-e)_&&(L=!0,k=_),_>A+C&&(L=!0,A=_))}o.expand(v,[k,A],{tozero:!0,padded:L})}else{var R=function(t){return t[m]=t.s,t.s};for(r=0;r1||0===s.bargap&&0===s.bargroupgap&&!t[0].trace.marker.line.width)&&n.select(this).attr("shape-rendering","crispEdges")}),e.selectAll("g.points").each(function(t){var e=t[0].trace,r=e.marker,a=r.line,s=(e._input||{}).marker||{},l=o.tryColorscale(r,s,""),u=o.tryColorscale(r,s,"line.");n.select(this).selectAll("path").each(function(t){var e,o,s=(t.mlw+1||a.width+1)-1,c=n.select(this);e="mc"in t?t.mcc=l(t.mc):Array.isArray(r.color)?i.defaultLine:r.color,c.style("stroke-width",s+"px").call(i.fill,e),s&&(o="mlc"in t?t.mlcc=u(t.mlc):Array.isArray(a.color)?i.defaultLine:a.color,c.call(i.stroke,o))})}),e.call(a.style)}},{"../../components/color":498,"../../components/drawing":521,"../../components/errorbars":527,d3:90}],695:[function(t,e,r){"use strict";var n=t("../../components/color"),i=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults");e.exports=function(t,e,r,a,s){r("marker.color",a),i(t,"marker")&&o(t,e,s,r,{prefix:"marker.",cLetter:"c"}),r("marker.line.color",n.defaultLine),i(t,"marker.line")&&o(t,e,s,r,{prefix:"marker.line.",cLetter:"c"}),r("marker.line.width")}},{"../../components/color":498,"../../components/colorscale/defaults":508,"../../components/colorscale/has_colorscale":511}],696:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../components/color/attributes"),o=t("../../lib/extend").extendFlat,a=n.marker,s=a.line;e.exports={y:{valType:"data_array"},x:{valType:"data_array"},x0:{valType:"any"},y0:{valType:"any"},whiskerwidth:{valType:"number",min:0,max:1,dflt:.5},boxpoints:{valType:"enumerated",values:["all","outliers","suspectedoutliers",!1],dflt:"outliers"},boxmean:{valType:"enumerated",values:[!0,"sd",!1],dflt:!1},jitter:{valType:"number",min:0,max:1},pointpos:{valType:"number",min:-2,max:2},orientation:{valType:"enumerated",values:["v","h"]},marker:{outliercolor:{valType:"color",dflt:"rgba(0, 0, 0, 0)"},symbol:o({},a.symbol,{arrayOk:!1}),opacity:o({},a.opacity,{arrayOk:!1,dflt:1}),size:o({},a.size,{arrayOk:!1}),color:o({},a.color,{arrayOk:!1}),line:{color:o({},s.color,{arrayOk:!1,dflt:i.defaultLine}),width:o({},s.width,{arrayOk:!1,dflt:0}),outliercolor:{valType:"color"},outlierwidth:{valType:"number",min:0,dflt:1}}},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2}},fillcolor:n.fillcolor}},{"../../components/color/attributes":497,"../../lib/extend":578,"../scatter/attributes":771}],697:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),o=t("../../plots/cartesian/axes");e.exports=function(t,e){function r(t,e,r,o,a){var s;return r in e?d=o.makeCalcdata(e,r):(s=r+"0"in e?e[r+"0"]:"name"in e&&("category"===o.type||n(e.name)&&-1!==["linear","log"].indexOf(o.type)||i.isDateTime(e.name)&&"date"===o.type)?e.name:t.numboxes,s=o.d2c(s),d=a.map(function(){return s})),d}function a(t,e,r,o,a){var s,l,u,c,h=o.length,f=e.length,p=[],d=[];for(s=0;h>s;++s)l=o[s],t[s]={pos:l},d[s]=l-a,p[s]=[];for(d.push(o[h-1]+a),s=0;f>s;++s)c=e[s],n(c)&&(u=i.findBin(r[s],d),u>=0&&f>u&&p[u].push(c));return p}function s(t,e){var r,n,o,a;for(a=0;a1,v=r.dPos*(1-f.boxgap)*(1-f.boxgroupgap)/(g?t.numboxes:1),y=g?2*r.dPos*(-.5+(r.boxnum+.5)/t.numboxes)*(1-f.boxgap):0,x=v*m.whiskerwidth;return m.visible!==!0||r.emptybox?void o.select(this).remove():("h"===m.orientation?(l=d,h=p):(l=p,h=d),r.bPos=y,r.bdPos=v,n(),o.select(this).selectAll("path.box").data(a.identity).enter().append("path").attr("class","box").each(function(t){var e=l.c2p(t.pos+y,!0),r=l.c2p(t.pos+y-v,!0),n=l.c2p(t.pos+y+v,!0),i=l.c2p(t.pos+y-x,!0),s=l.c2p(t.pos+y+x,!0),u=h.c2p(t.q1,!0),c=h.c2p(t.q3,!0),f=a.constrain(h.c2p(t.med,!0),Math.min(u,c)+1,Math.max(u,c)-1),p=h.c2p(m.boxpoints===!1?t.min:t.lf,!0),d=h.c2p(m.boxpoints===!1?t.max:t.uf,!0);"h"===m.orientation?o.select(this).attr("d","M"+f+","+r+"V"+n+"M"+u+","+r+"V"+n+"H"+c+"V"+r+"ZM"+u+","+e+"H"+p+"M"+c+","+e+"H"+d+(0===m.whiskerwidth?"":"M"+p+","+i+"V"+s+"M"+d+","+i+"V"+s)):o.select(this).attr("d","M"+r+","+f+"H"+n+"M"+r+","+u+"H"+n+"V"+c+"H"+r+"ZM"+e+","+u+"V"+p+"M"+e+","+c+"V"+d+(0===m.whiskerwidth?"":"M"+i+","+p+"H"+s+"M"+i+","+d+"H"+s))}),m.boxpoints&&o.select(this).selectAll("g.points").data(function(t){return t.forEach(function(t){t.t=r,t.trace=m}),t}).enter().append("g").attr("class","points").selectAll("path").data(function(t){var e,r,n,o,s,l,h,f="all"===m.boxpoints?t.val:t.val.filter(function(e){return et.uf}),p=(t.q3-t.q1)*c,d=[],g=0;if(m.jitter){for(e=0;et.lo&&(n.so=!0),n})}).enter().append("path").call(s.translatePoints,p,d),void(m.boxmean&&o.select(this).selectAll("path.mean").data(a.identity).enter().append("path").attr("class","mean").style("fill","none").each(function(t){var e=l.c2p(t.pos+y,!0),r=l.c2p(t.pos+y-v,!0),n=l.c2p(t.pos+y+v,!0),i=h.c2p(t.mean,!0),a=h.c2p(t.mean-t.sd,!0),s=h.c2p(t.mean+t.sd,!0);"h"===m.orientation?o.select(this).attr("d","M"+i+","+r+"V"+n+("sd"!==m.boxmean?"":"m0,0L"+a+","+e+"L"+i+","+r+"L"+s+","+e+"Z")):o.select(this).attr("d","M"+r+","+i+"H"+n+("sd"!==m.boxmean?"":"m0,0L"+e+","+a+"L"+r+","+i+"L"+e+","+s+"Z"))})))})}},{"../../components/drawing":521,"../../lib":583,d3:90}],704:[function(t,e,r){"use strict";var n=t("../../plots/plots"),i=t("../../plots/cartesian/axes"),o=t("../../lib");e.exports=function(t,e){var r,a,s,l,u=t._fullLayout,c=e.x(),h=e.y(),f=["v","h"];for(a=0;al&&(e.z=c.slice(0,l)),s("locationmode"),s("text"),s("marker.line.color"),s("marker.line.width"),i(t,e,a,s,{prefix:"",cLetter:"z"}),void s("hoverinfo",1===a._dataLength?"location+z+text":void 0)):void(e.visible=!1)}},{"../../components/colorscale/defaults":508,"../../lib":583,"./attributes":706}],709:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../heatmap/colorbar"),n.calc=t("./calc"),n.plot=t("./plot").plot,n.moduleType="trace",n.name="choropleth",n.basePlotModule=t("../../plots/geo"),n.categories=["geo","noOpacity"],n.meta={},e.exports=n},{"../../plots/geo":628,"../heatmap/colorbar":723,"./attributes":706,"./calc":707,"./defaults":708,"./plot":710}],710:[function(t,e,r){"use strict";function n(t,e){function r(e){var r=t.mockAxis;return a.tickText(r,r.c2l(e),"hover").text}var n=e.hoverinfo;if("none"===n)return function(t){delete t.nameLabel,delete t.textLabel};var i="all"===n?g.hoverinfo.flags:n.split("+"),o=-1!==i.indexOf("name"),s=-1!==i.indexOf("location"),l=-1!==i.indexOf("z"),u=-1!==i.indexOf("text"),c=!o&&s;return function(t){var n=[];c?t.nameLabel=t.id:(o&&(t.nameLabel=e.name),s&&n.push(t.id)),l&&n.push(r(t.z)),u&&n.push(t.tx),t.textLabel=n.join("
")}}function i(t){return function(e,r){return{points:[{data:t._input,fullData:t,curveNumber:t.index,pointNumber:r,location:e.id,z:e.z}]}}}var o=t("d3"),a=t("../../plots/cartesian/axes"),s=t("../../plots/cartesian/graph_interact"),l=t("../../components/color"),u=t("../../components/drawing"),c=t("../../components/colorscale/get_scale"),h=t("../../components/colorscale/make_scale_function"),f=t("../../lib/topojson_utils").getTopojsonFeatures,p=t("../../lib/geo_location_utils").locationToFeature,d=t("../../lib/array_to_calc_item"),m=t("../../plots/geo/constants"),g=t("./attributes"),v=e.exports={};v.calcGeoJSON=function(t,e){for(var r,n=[],i=t.locations,o=i.length,a=f(t,e),s=(t.marker||{}).line||{},l=0;o>l;l++)r=p(t.locationmode,i[l],a),void 0!==r&&(r.z=t.z[l],void 0!==t.text&&(r.tx=t.text[l]),d(s.color,r,"mlc",l),d(s.width,r,"mlw",l),n.push(r));return n.length>0&&(n[0].trace=t),n},v.plot=function(t,e,r){var a,l=t.framework,u=l.select("g.choroplethlayer"),c=l.select("g.baselayer"),h=l.select("g.baselayeroverchoropleth"),f=m.baseLayersOverChoropleth,p=u.selectAll("g.trace.choropleth").data(e,function(t){return t.uid});p.enter().append("g").attr("class","trace choropleth"),p.exit().remove(),p.each(function(e){function r(e,r){if(t.showHover){var n=t.projection(e.properties.ct);u(e),s.loneHover({x:n[0],y:n[1],name:e.nameLabel,text:e.textLabel},{container:t.hoverContainer.node()}),h=c(e,r),t.graphDiv.emit("plotly_hover",h)}}function a(e,r){t.graphDiv.emit("plotly_click",c(e,r))}var l=v.calcGeoJSON(e,t.topojson),u=n(t,e),c=i(e),h=null,f=o.select(this).selectAll("path.choroplethlocation").data(l);f.enter().append("path").classed("choroplethlocation",!0).on("mouseover",r).on("click",a).on("mouseout",function(){s.loneUnhover(t.hoverContainer),t.graphDiv.emit("plotly_unhover",h)}).on("mousedown",function(){s.loneUnhover(t.hoverContainer)}).on("mouseup",r),f.exit().remove()}),h.selectAll("*").remove();for(var d=0;dr;r++)e=h[r],p[r]=e[0]*(t.zmax-t.zmin)+t.zmin,d[r]=e[1];var m=n.extent([t.zmin,t.zmax,o.start,o.start+l*(u-1)]),g=m[t.zminr;r++)e=h[r],p[r]=(e[0]*(u+c-1)-c/2)*l+a,d[r]=e[1];var y=n.scale.linear().interpolate(n.interpolateRgb).domain(p).range(d);return y}},{"../../components/colorscale/get_scale":510,d3:90}],718:[function(t,e,r){"use strict";function n(t,e,r){var n=r[0].trace,o=r[0].x,s=r[0].y,u=n.contours,c=n.uid,h=e.x(),f=e.y(),g=t._fullLayout,x="contour"+c,b=i(u,e,r[0]);if(n.visible!==!0)return g._paper.selectAll("."+x+",.hm"+c).remove(),void g._infolayer.selectAll(".cb"+c).remove();"heatmap"===u.coloring?(n.zauto&&n.autocontour===!1&&(n._input.zmin=n.zmin=u.start-u.size/2,n._input.zmax=n.zmax=n.zmin+b.length*u.size),M(t,e,[r])):g._paper.selectAll(".hm"+c).remove(),a(b),l(b);var _=h.c2p(o[0],!0),w=h.c2p(o[o.length-1],!0),A=f.c2p(s[0],!0),k=f.c2p(s[s.length-1],!0),T=[[_,k],[w,k],[w,A],[_,A]],E=p(e,r,x);d(E,T,u),m(E,b,T,u),v(E,b,u),y(E,e,r[0],T)}function i(t,e,r){for(var n=t.size||1,i=[],o=t.start;ot?0:1)+(e[0][1]>t?0:2)+(e[1][1]>t?0:4)+(e[1][0]>t?0:8);if(5===r||10===r){var n=(e[0][0]+e[0][1]+e[1][0]+e[1][1])/4;return t>n?5===r?713:1114:5===r?104:208}return 15===r?0:r}function a(t){var e,r,n,i,a,s,l,u,c,h=t[0].z,f=h.length,p=h[0].length,d=2===f||2===p;for(r=0;f-1>r;r++)for(i=[],0===r&&(i=i.concat(A)),r===f-2&&(i=i.concat(k)),e=0;p-1>e;e++)for(n=i.slice(),0===e&&(n=n.concat(T)),e===p-2&&(n=n.concat(E)),a=e+","+r,s=[[h[r][e],h[r][e+1]],[h[r+1][e],h[r+1][e+1]]],c=0;ci;i++){if(s>20?(s=L[s][(l[0]||l[1])<0?0:1],t.crossings[a]=z[s]):delete t.crossings[a],l=S[s],!l){_.log("Found bad marching index:",s,e,t.level);break}if(p.push(f(t,e,l)),e[0]+=l[0],e[1]+=l[1],c(p[p.length-1],p[p.length-2])&&p.pop(),a=e.join(","),a===o&&l.join(",")===d||r&&(l[0]&&(e[0]<0||e[0]>g-2)||l[1]&&(e[1]<0||e[1]>m-2)))break;s=t.crossings[a]}1e4===i&&_.log("Infinite loop in contour?");var v,y,x,b,w,M,A,k=c(p[0],p[p.length-1]),T=0,E=.2*t.smoothing,I=[],P=0;for(i=1;i=P;i--)if(v=I[i],C>v){for(x=0,y=i-1;y>=P&&v+I[y]x&&v+I[x]e;)e++,r=Object.keys(i.crossings)[0].split(",").map(Number),s(i,r);1e4===e&&_.log("Infinite loop in contour?")}}function u(t,e,r){var n=0,i=0;return t>20&&e?208===t||1114===t?n=0===r[0]?1:-1:i=0===r[1]?1:-1:-1!==A.indexOf(t)?i=1:-1!==T.indexOf(t)?n=1:-1!==k.indexOf(t)?i=-1:n=-1,[n,i]}function c(t,e){return Math.abs(t[0]-e[0])<.01&&Math.abs(t[1]-e[1])<.01}function h(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}function f(t,e,r){var n=e[0]+Math.max(r[0],0),i=e[1]+Math.max(r[1],0),o=t.z[i][n],a=t.xaxis,s=t.yaxis;if(r[1]){var l=(t.level-o)/(t.z[i][n+1]-o);return[a.c2p((1-l)*t.x[n]+l*t.x[n+1],!0),s.c2p(t.y[i],!0)]}var u=(t.level-o)/(t.z[i+1][n]-o);return[a.c2p(t.x[n],!0),s.c2p((1-u)*t.y[i]+u*t.y[i+1],!0)]}function p(t,e,r){var n=t.plot.select(".maplayer").selectAll("g.contour."+r).data(e);return n.enter().append("g").classed("contour",!0).classed(r,!0),n.exit().remove(),n}function d(t,e,r){var n=t.selectAll("g.contourbg").data([0]);n.enter().append("g").classed("contourbg",!0);var i=n.selectAll("path").data("fill"===r.coloring?[0]:[]);i.enter().append("path"),i.exit().remove(),i.attr("d","M"+e.join("L")+"Z").style("stroke","none")}function m(t,e,r,n){var i=t.selectAll("g.contourfill").data([0]);i.enter().append("g").classed("contourfill",!0);var o=i.selectAll("path").data("fill"===n.coloring?e:[]);o.enter().append("path"),o.exit().remove(),o.each(function(t){var e=g(t,r);e?b.select(this).attr("d",e).style("stroke","none"):b.select(this).remove()})}function g(t,e){function r(t){return Math.abs(t[1]-e[0][1])<.01}function n(t){return Math.abs(t[1]-e[2][1])<.01}function i(t){return Math.abs(t[0]-e[0][0])<.01}function o(t){return Math.abs(t[0]-e[2][0])<.01}for(var a,s,l,u,c,h,f=t.edgepaths.length||t.z[0][0]l;l++){if(!a){_.log("Missing end?",p,t);break}for(r(a)&&!o(a)?s=e[1]:i(a)?s=e[0]:n(a)?s=e[3]:o(a)&&(s=e[2]),c=0;c=0&&(s=g,u=c):Math.abs(a[1]-s[1])<.01?Math.abs(a[1]-g[1])<.01&&(g[0]-a[0])*(s[0]-g[0])>=0&&(s=g,u=c):_.log("endpt to newendpt is not vert. or horz.",a,s,g)}if(a=s,u>=0)break;f+="L"+s}if(u===t.edgepaths.length){_.log("unclosed perimeter path");break}p=u,m=-1===d.indexOf(p),m&&(p=d[0],f+="Z")}for(p=0;pe;e++)s.push(1);for(e=0;o>e;e++)i.push(s.slice());for(e=0;ea;a++)for(n=i(l,a),c[a]=new Array(n),s=0;n>s;s++)c[a][s]=e(o(l,a,s));return c}function i(t,e,r,n,i,o){var a,s,l,u=[],c=f.traceIs(t,"contour"),h=f.traceIs(t,"histogram"),p=f.traceIs(t,"gl2d"),d=Array.isArray(e)&&e.length>1;if(d&&!h&&"category"!==o.type){e=e.map(o.d2c);var m=e.length;if(!(i>=m))return c?e.slice(0,i):e.slice(0,i+1);if(c||p)u=e.slice(0,i);else if(1===i)u=[e[0]-.5,e[0]+.5];else{for(u=[1.5*e[0]-.5*e[1]],l=1;m>l;l++)u.push(.5*(e[l-1]+e[l]));u.push(1.5*e[m-1]-.5*e[m-2])}if(i>m){var g=u[u.length-1],v=g-u[u.length-2];for(l=m;i>l;l++)g+=v,u.push(g)}}else for(s=n||1,a=h||"category"===o.type?r||0:Array.isArray(e)&&1===e.length?e[0]:void 0===r?0:o.d2c(r),l=c||p?0:-.5;i>l;l++)u.push(a+s*l);return u}function o(t){return.5-.25*Math.min(1,.5*t)}function a(t,e,r){var n,i,a=1;if(Array.isArray(r))for(n=0;nn&&a>y;n++)a=l(t,e,o(a));return a>y&&c.log("interp2d didn't converge quickly",a),t}function s(t){var e,r,n,i,o,a,s,l,u=[],c={},h=[],f=t[0],p=[],d=[0,0,0],m=v(t);for(r=0;rn;n++)void 0===p[n]&&(a=(void 0!==p[n-1]?1:0)+(void 0!==p[n+1]?1:0)+(void 0!==e[n]?1:0)+(void 0!==f[n]?1:0),a?(0===r&&a++,0===n&&a++,r===t.length-1&&a++,n===p.length-1&&a++,4>a&&(c[[r,n]]=[r,n,a]),u.push([r,n,a])):h.push([r,n]));for(;h.length;){for(s={},l=!1,o=h.length-1;o>=0;o--)i=h[o],r=i[0],n=i[1],a=((c[[r-1,n]]||d)[2]+(c[[r+1,n]]||d)[2]+(c[[r,n-1]]||d)[2]+(c[[r,n+1]]||d)[2])/20,a&&(s[i]=[r,n,a],h.splice(o,1),l=!0);if(!l)throw"findEmpties iterated with no new neighbors";for(i in s)c[i]=s[i],u.push(s[i])}return u.sort(function(t,e){return e[2]-t[2]})}function l(t,e,r){var n,i,o,a,s,l,u,c,h,f,p,d,m,g=0;for(a=0;as;s++)l=x[s],u=t[i+l[0]],u&&(c=u[o+l[1]],void 0!==c&&(0===f?d=m=c:(d=Math.min(d,c),m=Math.max(m,c)),h++,f+=c));if(0===h)throw"iterateInterp2d order is wrong: no defined neighbors";t[i][o]=f/h,void 0===p?4>h&&(g=1):(t[i][o]=(1+r)*t[i][o]-r*p,m>d&&(g=Math.max(g,Math.abs(t[i][o]-p)/(m-d))))}return g}var u=t("fast-isnumeric"),c=t("../../lib"),h=t("../../plots/cartesian/axes"),f=t("../../plots/plots"),p=t("../histogram2d/calc"),d=t("../../components/colorscale/calc"),m=t("./has_columns"),g=t("./convert_column_xyz"),v=t("./max_row_length");e.exports=function(t,e){function r(t){S=e._input.zsmooth=e.zsmooth=!1,c.notifier("cannot fast-zsmooth: "+t)}var o,l,u,y,x,b,_,w,M=h.getFromId(t,e.xaxis||"x"),A=h.getFromId(t,e.yaxis||"y"),k=f.traceIs(e,"contour"),T=f.traceIs(e,"histogram"),E=f.traceIs(e,"gl2d"),S=k?"best":e.zsmooth;if(M._minDtick=0,A._minDtick=0,T){var L=p(t,e);o=L.x,l=L.x0,u=L.dx,y=L.y,x=L.y0,b=L.dy,_=L.z}else m(e)&&g(e,M,A),o=e.x?M.makeCalcdata(e,"x"):[],y=e.y?A.makeCalcdata(e,"y"):[],l=e.x0||0,u=e.dx||1,x=e.y0||0,b=e.dy||1,_=n(e),(k||e.connectgaps)&&(e._emptypoints=s(_),e._interpz=a(_,e._emptypoints,e._interpz));if("fast"===S)if("log"===M.type||"log"===A.type)r("log axis found");else if(!T){if(o.length){var z=(o[o.length-1]-o[0])/(o.length-1),I=Math.abs(z/100);for(w=0;wI){r("x scale is not linear");break}}if(y.length&&"fast"===S){var P=(y[y.length-1]-y[0])/(y.length-1),C=Math.abs(P/100);for(w=0;wC){r("y scale is not linear");break}}}var R=v(_),D="scaled"===e.xtype?"":e.x,O=i(e,D,l,u,R,M),j="scaled"===e.ytype?"":e.y,F=i(e,j,x,b,_.length,A);E||(h.expand(M,O),h.expand(A,F));var N={x:O,y:F,z:_};if(d(e,_,"","z"),k&&e.contours&&"heatmap"===e.contours.coloring){var B="contour"===e.type?"heatmap":"histogram2d";N.xfill=i(B,D,l,u,R,M),N.yfill=i(B,j,x,b,_.length,A)}return[N]};var y=.01,x=[[-1,0],[1,0],[0,-1],[0,1]]},{"../../components/colorscale/calc":505,"../../lib":583,"../../plots/cartesian/axes":607,"../../plots/plots":663,"../histogram2d/calc":734,"./convert_column_xyz":724,"./has_columns":726, "./max_row_length":729,"fast-isnumeric":99}],723:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),o=t("../../lib"),a=t("../../plots/plots"),s=t("../../components/colorscale/get_scale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,u="cb"+r.uid,c=s(r.colorscale),h=r.zmin,f=r.zmax;if(i(h)||(h=o.aggNums(Math.min,null,r.z)),i(f)||(f=o.aggNums(Math.max,null,r.z)),t._fullLayout._infolayer.selectAll("."+u).remove(),!r.showscale)return void a.autoMargin(t,u);var p=e[0].t.cb=l(t,u);p.fillcolor(n.scale.linear().domain(c.map(function(t){return h+t[0]*(f-h)})).range(c.map(function(t){return t[1]}))).filllevels({start:h,end:f,size:(f-h)/254}).options(r.colorbar)()}},{"../../components/colorbar/draw":501,"../../components/colorscale/get_scale":510,"../../lib":583,"../../plots/plots":663,d3:90,"fast-isnumeric":99}],724:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r){var i,o=t.x.slice(),a=t.y.slice(),s=t.z,l=t.text,u=Math.min(o.length,a.length,s.length),c=void 0!==l&&!Array.isArray(l[0]);for(ui;i++)o[i]=e.d2c(o[i]),a[i]=r.d2c(a[i]);var h,f,p,d=n.distinctVals(o),m=d.vals,g=n.distinctVals(a),v=g.vals,y=n.init2dArray(v.length,m.length);for(c&&(p=n.init2dArray(v.length,m.length)),i=0;u>i;i++)h=n.findBin(o[i]+d.minDiff/2,m),f=n.findBin(a[i]+g.minDiff/2,v),y[f][h]=s[i],c&&(p[f][h]=l[i]);t.x=m,t.y=v,t.z=y,c&&(t.text=p)}},{"../../lib":583}],725:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./has_columns"),o=t("./xyz_defaults"),a=t("../../components/colorscale/defaults"),s=t("./attributes");e.exports=function(t,e,r,l){function u(r,i){return n.coerce(t,e,s,r,i)}var c=o(t,e,u);return c?(u("text"),u("zsmooth"),u("connectgaps",i(e)&&e.zsmooth!==!1),void a(t,e,l,u,{prefix:"",cLetter:"z"})):void(e.visible=!1)}},{"../../components/colorscale/defaults":508,"../../lib":583,"./attributes":721,"./has_columns":726,"./xyz_defaults":732}],726:[function(t,e,r){"use strict";e.exports=function(t){return!Array.isArray(t.z[0])}},{}],727:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/graph_interact"),i=t("../../lib"),o=t("../../plots/cartesian/constants").MAXDIST;e.exports=function(t,e,r,a,s){if(!(t.distancec||c>=y[0].length||0>h||h>y.length)return}else{if(n.inbox(e-g[0],e-g[g.length-1])>o||n.inbox(r-v[0],r-v[v.length-1])>o)return;if(s){var M;for(b=[2*g[0]-g[1]],M=1;M0;)_=g.c2p(z[k]),k--;for(b>_&&(w=_,_=b,b=w,O=!0),k=0;void 0===M&&k0;)A=v.c2p(I[k]),k--;if(M>A&&(w=M,M=A,A=w,j=!0),P&&(z=r[0].xfill,I=r[0].yfill),"fast"!==C){var F="best"===C?0:.5;b=Math.max(-F*g._length,b),_=Math.min((1+F)*g._length,_),M=Math.max(-F*v._length,M),A=Math.min((1+F)*v._length,A)}var N=Math.round(_-b),B=Math.round(A-M),U=0>=N||0>=B,V=e.plot.select(".imagelayer").selectAll("g.hm."+x).data(U?[]:[0]);if(V.enter().append("g").classed("hm",!0).classed(x,!0),V.exit().remove(),!U){var q,G;"fast"===C?(q=D,G=R):(q=N,G=B);var H=document.createElement("canvas");H.width=q,H.height=G;var X,Y,W=H.getContext("2d"),Z=i.scale.linear().domain(L.map(function(t){return t[0]})).range(L.map(function(t){var e=o(t[1]).toRgb();return[e.r,e.g,e.b,e.a]})).clamp(!0);"fast"===C?(X=O?function(t){return D-1-t}:a.identity,Y=j?function(t){return R-1-t}:a.identity):(X=function(t){return a.constrain(Math.round(g.c2p(z[t])-b),0,N)},Y=function(t){return a.constrain(Math.round(v.c2p(I[t])-M),0,B)});var Q,K,$,J,tt,et,rt=Y(0),nt=[rt,rt],it=O?0:1,ot=j?0:1,at=0,st=0,lt=0,ut=0;if(C){var ct=0,ht=new Uint8Array(N*B*4);if("best"===C){var ft,pt,dt,mt=new Array(z.length),gt=new Array(I.length),vt=new Array(N);for(k=0;kk;k++)vt[k]=n(k,mt);for(K=0;B>K;K++)for(ft=n(K,gt),pt=T[ft.bin0],dt=T[ft.bin1],k=0;N>k;k++,ct+=4)et=p(pt,dt,vt[k],ft),f(ht,ct,et)}else for(K=0;R>K;K++)for(tt=T[K],nt=Y(K),k=0;N>k;k++)et=h(tt[k],1),ct=4*(nt*N+X(k)),f(ht,ct,et);var yt=W.createImageData(N,B);yt.data.set(ht),W.putImageData(yt,0,0)}else for(K=0;R>K;K++)if(tt=T[K],nt.reverse(),nt[ot]=Y(K+1),nt[0]!==nt[1]&&void 0!==nt[0]&&void 0!==nt[1])for($=X(0),Q=[$,$],k=0;D>k;k++)Q.reverse(),Q[it]=X(k+1),Q[0]!==Q[1]&&void 0!==Q[0]&&void 0!==Q[1]&&(J=tt[k],et=h(J,(Q[1]-Q[0])*(nt[1]-nt[0])),W.fillStyle="rgba("+et.join(",")+")",W.fillRect(Q[0],nt[0],Q[1]-Q[0],nt[1]-nt[0]));st=Math.round(st/at),lt=Math.round(lt/at),ut=Math.round(ut/at);var xt=o("rgb("+st+","+lt+","+ut+")");t._hmpixcount=(t._hmpixcount||0)+at,t._hmlumcount=(t._hmlumcount||0)+at*xt.getLuminance();var bt=V.selectAll("image").data(r);bt.enter().append("svg:image").attr({xmlns:u.svg,preserveAspectRatio:"none"}),bt.attr({height:B,width:N,x:b,y:M,"xlink:href":H.toDataURL("image/png")}),bt.exit().remove()}}var i=t("d3"),o=t("tinycolor2"),a=t("../../lib"),s=t("../../plots/plots"),l=t("../../components/colorscale/get_scale"),u=t("../../constants/xmlns_namespaces"),c=t("./max_row_length");e.exports=function(t,e,r){for(var i=0;i0&&(n=!0);for(var s=0;sv&&d.splice(v,d.length-v),g.length>v&&g.splice(v,g.length-v),!e.autobinx&&"xbins"in e||(e.xbins=i.autoBin(d,p,e.nbinsx,"2d"),"histogram2dcontour"===e.type&&(e.xbins.start-=e.xbins.size,e.xbins.end+=e.xbins.size),e._input.xbins=e.xbins),!e.autobiny&&"ybins"in e||(e.ybins=i.autoBin(g,m,e.nbinsy,"2d"),"histogram2dcontour"===e.type&&(e.ybins.start-=e.ybins.size,e.ybins.end+=e.ybins.size),e._input.ybins=e.ybins),h=[];var y,x,b=[],_=[],w="string"==typeof e.xbins.size?[]:e.xbins,M="string"==typeof e.xbins.size?[]:e.ybins,A=0,k=[],T=e.histnorm,E=e.histfunc,S=-1!==T.indexOf("density"),L="max"===E||"min"===E,z=L?null:0,I=o.count,P=a[T],C=!1,R=[],D=[],O="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";O&&"count"!==E&&(C="avg"===E,I=o[E]);var j=e.xbins,F=j.end+(j.start-i.tickIncrement(j.start,j.size))/1e6;for(f=j.start;F>f;f=i.tickIncrement(f,j.size))b.push(z),Array.isArray(w)&&w.push(f),C&&_.push(0);Array.isArray(w)&&w.push(f);var N=b.length;for(r=e.xbins.start,l=(f-r)/N,r+=l/2,j=e.ybins,F=j.end+(j.start-i.tickIncrement(j.start,j.size))/1e6,f=j.start;F>f;f=i.tickIncrement(f,j.size))h.push(b.concat()),Array.isArray(M)&&M.push(f),C&&k.push(_.concat());Array.isArray(M)&&M.push(f);var B=h.length;for(u=e.ybins.start,c=(f-u)/B,u+=c/2,S&&(R=b.map(function(t,e){return Array.isArray(w)?1/(w[e+1]-w[e]):1/l}),D=h.map(function(t,e){return Array.isArray(M)?1/(M[e+1]-M[e]):1/c})),f=0;v>f;f++)y=n.findBin(d[f],w),x=n.findBin(g[f],M),y>=0&&N>y&&x>=0&&B>x&&(A+=I(y,f,h[x],O,k[x]));if(C)for(x=0;B>x;x++)A+=s(h[x],k[x]);if(P)for(x=0;B>x;x++)P(h[x],A,R,D[x]);return{x:d,x0:r,dx:l,y:g,y0:u,dy:c,z:h}}},{"../../lib":583,"../../plots/cartesian/axes":607,"../histogram/average":742,"../histogram/bin_functions":744,"../histogram/norm_functions":748}],735:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./sample_defaults"),o=t("../../components/colorscale/defaults"),a=t("./attributes");e.exports=function(t,e,r){function s(r,i){return n.coerce(t,e,a,r,i)}i(t,e,s),s("zsmooth"),o(t,e,r,s,{prefix:"",cLetter:"z"})}},{"../../components/colorscale/defaults":508,"../../lib":583,"./attributes":733,"./sample_defaults":737}],736:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("../heatmap/calc"),n.plot=t("../heatmap/plot"),n.colorbar=t("../heatmap/colorbar"),n.style=t("../heatmap/style"),n.hoverPoints=t("../heatmap/hover"),n.moduleType="trace",n.name="histogram2d",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","2dMap","histogram"],n.meta={},e.exports=n},{"../../plots/cartesian":615,"../heatmap/calc":722,"../heatmap/colorbar":723,"../heatmap/hover":727,"../heatmap/plot":730,"../heatmap/style":731,"./attributes":733,"./defaults":735}],737:[function(t,e,r){"use strict";var n=t("../histogram/bin_defaults");e.exports=function(t,e,r){var i=r("x"),o=r("y");if(!(i&&i.length&&o&&o.length))return void(e.visible=!1);var a=r("z")||r("marker.color");a&&r("histfunc");var s=["x","y"];n(t,e,r,s)}},{"../histogram/bin_defaults":743}],738:[function(t,e,r){"use strict";var n=t("../histogram2d/attributes"),i=t("../contour/attributes"),o=t("../../components/colorscale/attributes"),a=t("../../lib/extend").extendFlat;e.exports=a({},{x:n.x,y:n.y,z:n.z,marker:n.marker,histnorm:n.histnorm,histfunc:n.histfunc,autobinx:n.autobinx,nbinsx:n.nbinsx,xbins:n.xbins,autobiny:n.autobiny,nbinsy:n.nbinsy,ybins:n.ybins,autocontour:i.autocontour,ncontours:i.ncontours,contours:i.contours,line:i.line,_nestedModules:{colorbar:"Colorbar"}},o)},{"../../components/colorscale/attributes":504,"../../lib/extend":578,"../contour/attributes":711,"../histogram2d/attributes":733}],739:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../histogram2d/sample_defaults"),o=t("../contour/style_defaults"),a=t("./attributes");e.exports=function(t,e,r,s){function l(r,i){return n.coerce(t,e,a,r,i)}i(t,e,l);var u=n.coerce2(t,e,a,"contours.start"),c=n.coerce2(t,e,a,"contours.end"),h=l("autocontour",!(u&&c));l(h?"ncontours":"contours.size"),o(t,e,l,s)}},{"../../lib":583,"../contour/style_defaults":720,"../histogram2d/sample_defaults":737,"./attributes":738}],740:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("../contour/calc"),n.plot=t("../contour/plot"),n.style=t("../contour/style"),n.colorbar=t("../contour/colorbar"),n.hoverPoints=t("../contour/hover"),n.moduleType="trace",n.name="histogram2dcontour",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","2dMap","contour","histogram"],n.meta={},e.exports=n},{"../../plots/cartesian":615,"../contour/calc":712,"../contour/colorbar":713,"../contour/hover":715,"../contour/plot":718,"../contour/style":719,"./attributes":738,"./defaults":739}],741:[function(t,e,r){"use strict";function n(t){return{start:{valType:"number",dflt:null},end:{valType:"number",dflt:null},size:{valType:"any",dflt:1}}}var i=t("../bar/attributes");e.exports={x:{valType:"data_array"},y:{valType:"data_array"},text:i.text,orientation:i.orientation,histfunc:{valType:"enumerated",values:["count","sum","avg","min","max"],dflt:"count"},histnorm:{valType:"enumerated",values:["","percent","probability","density","probability density"],dflt:""},autobinx:{valType:"boolean",dflt:!0},nbinsx:{valType:"integer",min:0,dflt:0},xbins:n("x"),autobiny:{valType:"boolean",dflt:!0},nbinsy:{valType:"integer",min:0,dflt:0},ybins:n("y"),marker:i.marker,_nestedModules:{error_y:"ErrorBars",error_x:"ErrorBars","marker.colorbar":"Colorbar"},_deprecated:{bardir:i._deprecated.bardir}}},{"../bar/attributes":685}],742:[function(t,e,r){"use strict";e.exports=function(t,e){for(var r=t.length,n=0,i=0;r>i;i++)e[i]?(t[i]/=e[i],n+=t[i]):t[i]=null;return n}},{}],743:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){return r("histnorm"),n.forEach(function(t){var e=r(t+"bins.start"),n=r(t+"bins.end"),i=r("autobin"+t,!(e&&n));r(i?"nbins"+t:t+"bins.size")}),e}},{}],744:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports={count:function(t,e,r){return r[t]++,1},sum:function(t,e,r,i){var o=i[e];return n(o)?(o=Number(o),r[t]+=o,o):0},avg:function(t,e,r,i,o){var a=i[e];return n(a)&&(a=Number(a),r[t]+=a,o[t]++),0},min:function(t,e,r,i){var o=i[e];if(n(o)){if(o=Number(o),!n(r[t]))return r[t]=o,o;if(r[t]>o)return r[t]=o,o-r[t]}return 0},max:function(t,e,r,i){var o=i[e];if(n(o)){if(o=Number(o),!n(r[t]))return r[t]=o,o;if(r[t]r&&u.length<5e3;)m=o.tickIncrement(r,x.size),u.push((r+m)/2),c.push(L),b&&_.push(r),E&&w.push(1/(m-r)),P&&M.push(0),r=m;var C=c.length;for(r=0;r=0&&C>v&&(A+=z(v,r,c,y,M));P&&(A=l(c,M)),I&&I(c,A,w);var R=Math.min(u.length,c.length),D=[],O=0,j=R-1;for(r=0;R>r;r++)if(c[r]){O=r;break}for(r=R-1;r>O;r--)if(c[r]){j=r;break}for(r=O;j>=r;r++)n(u[r])&&n(c[r])&&D.push({p:u[r],s:c[r],b:0});return D}}},{"../../lib":583,"../../plots/cartesian/axes":607,"./average":742,"./bin_functions":744,"./norm_functions":748,"fast-isnumeric":99}],746:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/color"),o=t("./bin_defaults"),a=t("../bar/style_defaults"),s=t("../../components/errorbars/defaults"),l=t("./attributes");e.exports=function(t,e,r,u){function c(r,i){return n.coerce(t,e,l,r,i)}var h=c("x"),f=c("y");c("text");var p=c("orientation",f&&!h?"h":"v"),d=e["v"===p?"x":"y"];if(!d||!d.length)return void(e.visible=!1);var m=e["h"===p?"x":"y"];m&&c("histfunc");var g="h"===p?["y"]:["x"];o(t,e,c,g),a(t,e,c,r,u),s(t,e,i.defaultLine,{axis:"y"}),s(t,e,i.defaultLine,{axis:"x",inherit:"y"})}},{"../../components/color":498,"../../components/errorbars/defaults":526,"../../lib":583,"../bar/style_defaults":695,"./attributes":741,"./bin_defaults":743}],747:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.layoutAttributes=t("../bar/layout_attributes"),n.supplyDefaults=t("./defaults"),n.supplyLayoutDefaults=t("../bar/layout_defaults"),n.calc=t("./calc"),n.setPositions=t("../bar/set_positions"),n.plot=t("../bar/plot"),n.style=t("../bar/style"),n.colorbar=t("../scatter/colorbar"),n.hoverPoints=t("../bar/hover"),n.moduleType="trace",n.name="histogram",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","bar","histogram","oriented","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":615,"../bar/hover":688,"../bar/layout_attributes":690,"../bar/layout_defaults":691,"../bar/plot":692,"../bar/set_positions":693,"../bar/style":694,"../scatter/colorbar":774,"./attributes":741,"./calc":745,"./defaults":746}],748:[function(t,e,r){"use strict";e.exports={percent:function(t,e){for(var r=t.length,n=100/e,i=0;r>i;i++)t[i]*=n},probability:function(t,e){for(var r=t.length,n=0;r>n;n++)t[n]/=e},density:function(t,e,r,n){var i=t.length;n=n||1;for(var o=0;i>o;o++)t[o]*=r[o]*n},"probability density":function(t,e,r,n){var i=t.length;n&&(e/=n);for(var o=0;i>o;o++)t[o]*=r[o]/e}}},{}],749:[function(t,e,r){"use strict";var n=t("../../components/colorscale/attributes"),i=t("../surface/attributes"),o=t("../../lib/extend").extendFlat;e.exports={x:{valType:"data_array"},y:{valType:"data_array"},z:{valType:"data_array"},i:{valType:"data_array"},j:{valType:"data_array"},k:{valType:"data_array"},delaunayaxis:{valType:"enumerated",values:["x","y","z"],dflt:"z"},alphahull:{valType:"number",dflt:-1},intensity:{valType:"data_array"},color:{valType:"color"},vertexcolor:{valType:"data_array"},facecolor:{valType:"data_array"},opacity:o({},i.opacity),flatshading:{valType:"boolean",dflt:!1},contour:{show:o({},i.contours.x.show,{}),color:o({},i.contours.x.color),width:o({},i.contours.x.width)},colorscale:n.colorscale,reversescale:n.reversescale,showscale:n.showscale,lightposition:{x:o({},i.lightposition.x,{dflt:1e5}),y:o({},i.lightposition.y,{dflt:1e5}),z:o({},i.lightposition.z,{dflt:0})},lighting:o({},{vertexnormalsepsilon:{valType:"number",min:0,max:1,dflt:1e-12},facenormalsepsilon:{valType:"number",min:0,max:1,dflt:1e-6}},i.lighting),_nestedModules:{colorbar:"Colorbar"}}},{"../../components/colorscale/attributes":504,"../../lib/extend":578,"../surface/attributes":817}],750:[function(t,e,r){"use strict";function n(t,e,r){this.scene=t,this.uid=r,this.mesh=e,this.name="",this.color="#fff",this.data=null,this.showContour=!1}function i(t){return t.map(function(t){var e=t[0],r=u(t[1]),n=r.toRgb();return{index:e,rgb:[n.r,n.g,n.b,1]}})}function o(t){return t.map(p)}function a(t,e,r){for(var n=new Array(t.length),i=0;i0)s=h(t.alphahull,l);else{var u=["x","y","z"].indexOf(t.delaunayaxis);s=c(l.map(function(t){return[t[(u+1)%3],t[(u+2)%3]]}))}var d={positions:l,cells:s,lightPosition:[t.lightposition.x,t.lightposition.y,t.lightposition.z],ambient:t.lighting.ambient,diffuse:t.lighting.diffuse,specular:t.lighting.specular,roughness:t.lighting.roughness,fresnel:t.lighting.fresnel,vertexNormalsEpsilon:t.lighting.vertexnormalsepsilon,faceNormalsEpsilon:t.lighting.facenormalsepsilon,opacity:t.opacity,contourEnable:t.contour.show,contourColor:p(t.contour.color).slice(0,3),contourWidth:t.contour.width,useFacetNormals:t.flatshading};t.intensity?(this.color="#fff",d.vertexIntensity=t.intensity,d.colormap=i(t.colorscale)):t.vertexcolor?(this.color=t.vertexcolors[0],d.vertexColors=o(t.vertexcolor)):t.facecolor?(this.color=t.facecolor[0],d.cellColors=o(t.facecolor)):(this.color=t.color,d.meshColor=p(t.color)),this.mesh.update(d)},d.dispose=function(){this.scene.glplot.remove(this.mesh),this.mesh.dispose()},e.exports=s},{"../../lib/str2rgbarray":595,"alpha-shape":27,"convex-hull":79,"delaunay-triangulate":91,"gl-mesh3d":167,tinycolor2:461}],751:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/colorbar/defaults"),o=t("./attributes");e.exports=function(t,e,r,a){function s(r,i){return n.coerce(t,e,o,r,i)}function l(t){var e=t.map(function(t){var e=s(t);return e&&Array.isArray(e)?e:null});return e.every(function(t){return t&&t.length===e[0].length})&&e}var u=l(["x","y","z"]),c=l(["i","j","k"]);return u?(c&&c.forEach(function(t){for(var e=0;el||(u=d[r],void 0!==u&&""!==u||(u=r),u=String(u),void 0===y[u]&&(y[u]=!0,c=o(e.marker.colors[r]),c.isValid()?(c=a.addOpacity(c,c.getAlpha()),v[u]||(v[u]=c)):v[u]?c=v[u]:(c=!1,x=!0),h=-1!==_.indexOf(u),h||(b+=l),m.push({v:l,label:u,color:c,i:r,hidden:h}))));if(e.sort&&m.sort(function(t,e){return e.v-t.v}),x)for(r=0;r")}return m};var l},{"../../components/color":498,"./helpers":757,"fast-isnumeric":99,tinycolor2:461}],756:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes");e.exports=function(t,e,r,o){function a(r,o){return n.coerce(t,e,i,r,o)}var s=n.coerceFont,l=a("values");if(!Array.isArray(l)||!l.length)return void(e.visible=!1);var u=a("labels");Array.isArray(u)||(a("label0"),a("dlabel"));var c=a("marker.line.width");c&&a("marker.line.color");var h=a("marker.colors");Array.isArray(h)||(e.marker.colors=[]),a("scalegroup");var f=a("text"),p=a("textinfo",Array.isArray(f)?"text+percent":"percent");if(a("hoverinfo",1===o._dataLength?"label+text+value+percent":void 0),p&&"none"!==p){var d=a("textposition"),m=Array.isArray(d)||"auto"===d,g=m||"inside"===d,v=m||"outside"===d;if(g||v){var y=s(a,"textfont",o.font);g&&s(a,"insidetextfont",y),v&&s(a,"outsidetextfont",y)}}a("domain.x"),a("domain.y"),a("hole"),a("sort"),a("direction"),a("rotation"),a("pull")}},{"../../lib":583,"./attributes":753}],757:[function(t,e,r){"use strict";var n=t("../../lib");r.formatPiePercent=function(t,e){var r=(100*t).toPrecision(3);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)+"%"},r.formatPieValue=function(t,e){var r=t.toPrecision(10);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)}},{"../../lib":583}],758:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.supplyLayoutDefaults=t("./layout_defaults"),n.layoutAttributes=t("./layout_attributes"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style"),n.styleOne=t("./style_one"),n.moduleType="trace",n.name="pie",n.basePlotModule=t("./base_plot"),n.categories=["pie","showLegend"],n.meta={},e.exports=n},{"./attributes":753,"./base_plot":754,"./calc":755,"./defaults":756,"./layout_attributes":759,"./layout_defaults":760,"./plot":761,"./style":762,"./style_one":763}],759:[function(t,e,r){"use strict";e.exports={hiddenlabels:{valType:"data_array"}}},{}],760:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./layout_attributes");e.exports=function(t,e){function r(r,o){return n.coerce(t,e,i,r,o)}r("hiddenlabels")}},{"../../lib":583,"./layout_attributes":759}],761:[function(t,e,r){"use strict";function n(t,e,r){var n=Math.sqrt(t.width*t.width+t.height*t.height),o=t.width/t.height,a=Math.PI*Math.min(e.v/r.vTotal,.5),s=1-r.trace.hole,l=i(e,r),u={scale:l*r.r*2/n,rCenter:1-l,rotate:0};if(u.scale>=1)return u;var c=o+1/(2*Math.tan(a)),h=r.r*Math.min(1/(Math.sqrt(c*c+.5)+c),s/(Math.sqrt(o*o+s/2)+o)),f={scale:2*h/t.height,rCenter:Math.cos(h/r.r)-h*o/r.r,rotate:(180/Math.PI*e.midangle+720)%180-90},p=1/o,d=p+1/(2*Math.tan(a)),m=r.r*Math.min(1/(Math.sqrt(d*d+.5)+d),s/(Math.sqrt(p*p+s/2)+p)),g={scale:2*m/t.width,rCenter:Math.cos(m/r.r)-m/o/r.r,rotate:(180/Math.PI*e.midangle+810)%180-90},v=g.scale>f.scale?g:f;return u.scale<1&&v.scale>u.scale?v:u}function i(t,e){if(t.v===e.vTotal&&!e.trace.hole)return 1;var r=Math.PI*Math.min(t.v/e.vTotal,.5);return Math.min(1/(1+1/Math.sin(r)),(1-e.trace.hole)/2)}function o(t,e){var r=e.pxmid[0],n=e.pxmid[1],i=t.width/2,o=t.height/2;return 0>r&&(i*=-1),0>n&&(o*=-1),{scale:1,rCenter:1,rotate:0,x:i+Math.abs(o)*(i>0?1:-1)/2,y:o/(1+r*r/(n*n)),outside:!0}}function a(t,e){function r(t,e){return t.pxmid[1]-e.pxmid[1]}function n(t,e){return e.pxmid[1]-t.pxmid[1]}function i(t,r){r||(r={});var n,i,o,s,f,p,m=r.labelExtraY+(a?r.yLabelMax:r.yLabelMin),g=a?t.yLabelMin:t.yLabelMax,v=a?t.yLabelMax:t.yLabelMin,y=t.cyFinal+u(t.px0[1],t.px1[1]),x=m-g;if(x*h>0&&(t.labelExtraY=x),Array.isArray(e.pull))for(i=0;i=e.pull[o.i]||((t.pxmid[1]-o.pxmid[1])*h>0?(s=o.cyFinal+u(o.px0[1],o.px1[1]),x=s-g-t.labelExtraY,x*h>0&&(t.labelExtraY+=x)):(v+t.labelExtraY-y)*h>0&&(n=3*c*Math.abs(i-d.indexOf(t)), -f=o.cxFinal+l(o.px0[0],o.px1[0]),p=f+n-(t.cxFinal+t.pxmid[0])-t.labelExtraX,p*c>0&&(t.labelExtraX+=p)))}var o,a,s,l,u,c,h,f,p,d,m,g,v;for(a=0;2>a;a++)for(s=a?r:n,u=a?Math.max:Math.min,h=a?1:-1,o=0;2>o;o++){for(l=o?Math.max:Math.min,c=o?1:-1,f=t[a][o],f.sort(s),p=t[1-a][o],d=p.concat(f),g=[],m=0;mc&&(c=s.pull[o]);a.r=Math.min(r/u(s.tilt,Math.sin(l),s.depth),n/u(s.tilt,Math.cos(l),s.depth))/(2+2*c),a.cx=e.l+e.w*(s.domain.x[1]+s.domain.x[0])/2,a.cy=e.t+e.h*(2-s.domain.y[1]-s.domain.y[0])/2,s.scalegroup&&-1===p.indexOf(s.scalegroup)&&p.push(s.scalegroup)}for(o=0;oh.vTotal/2?1:0)}function u(t,e,r){if(!t)return 1;var n=Math.sin(t*Math.PI/180);return Math.max(.01,r*n*Math.abs(e)+2*Math.sqrt(1-n*n*e*e))}var c=t("d3"),h=t("../../plots/cartesian/graph_interact"),f=t("../../components/color"),p=t("../../components/drawing"),d=t("../../lib/svg_text_utils"),m=t("./helpers");e.exports=function(t,e){var r=t._fullLayout;s(e,r._size);var u=r._pielayer.selectAll("g.trace").data(e);u.enter().append("g").attr({"stroke-linejoin":"round","class":"trace"}),u.exit().remove(),u.order(),u.each(function(e){var s=c.select(this),u=e[0],g=u.trace,v=0,y=(g.depth||0)*u.r*Math.sin(v)/2,x=g.tiltaxis||0,b=x*Math.PI/180,_=[y*Math.sin(b),y*Math.cos(b)],w=u.r*Math.cos(v),M=s.selectAll("g.part").data(g.tilt?["top","sides"]:["top"]);M.enter().append("g").attr("class",function(t){return t+" part"}),M.exit().remove(),M.order(),l(e),s.selectAll(".top").each(function(){var s=c.select(this).selectAll("g.slice").data(e);s.enter().append("g").classed("slice",!0),s.exit().remove();var l=[[[],[]],[[],[]]],v=!1;s.each(function(a){function s(e){var n=t._fullLayout,o=t._fullData[g.index],s=o.hoverinfo;if("all"===s&&(s="label+text+value+percent+name"),!t._dragging&&n.hovermode!==!1&&"none"!==s&&s){var l=i(a,u),c=M+a.pxmid[0]*(1-l),f=A+a.pxmid[1]*(1-l),p=r.separators,d=[];-1!==s.indexOf("label")&&d.push(a.label),o.text&&o.text[a.i]&&-1!==s.indexOf("text")&&d.push(o.text[a.i]),-1!==s.indexOf("value")&&d.push(m.formatPieValue(a.v,p)),-1!==s.indexOf("percent")&&d.push(m.formatPiePercent(a.v/u.vTotal,p)),h.loneHover({x0:c-l*u.r,x1:c+l*u.r,y:f,text:d.join("
"),name:-1!==s.indexOf("name")?o.name:void 0,color:a.color,idealAlign:a.pxmid[0]<0?"left":"right"},{container:n._hoverlayer.node(),outerContainer:n._paper.node()}),h.hover(t,e,"pie"),E=!0}}function f(e){t.emit("plotly_unhover",{points:[e]}),E&&(h.loneUnhover(r._hoverlayer.node()),E=!1)}function y(){t._hoverdata=[a],t._hoverdata.trace=e.trace,h.click(t,{target:!0})}function b(t,e,r,n){return"a"+n*u.r+","+n*w+" "+x+" "+a.largeArc+(r?" 1 ":" 0 ")+n*(e[0]-t[0])+","+n*(e[1]-t[1])}if(a.hidden)return void c.select(this).selectAll("path,g").remove();l[a.pxmid[1]<0?0:1][a.pxmid[0]<0?0:1].push(a);var M=u.cx+_[0],A=u.cy+_[1],k=c.select(this),T=k.selectAll("path.surface").data([a]),E=!1;if(T.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),k.select("path.textline").remove(),k.on("mouseover",s).on("mouseout",f).on("click",y).on("contextmenu",y),g.pull){var S=+(Array.isArray(g.pull)?g.pull[a.i]:g.pull)||0;S>0&&(M+=S*a.pxmid[0],A+=S*a.pxmid[1])}a.cxFinal=M,a.cyFinal=A;var L=g.hole;if(a.v===u.vTotal){var z="M"+(M+a.px0[0])+","+(A+a.px0[1])+b(a.px0,a.pxmid,!0,1)+b(a.pxmid,a.px0,!0,1)+"Z";L?T.attr("d","M"+(M+L*a.px0[0])+","+(A+L*a.px0[1])+b(a.px0,a.pxmid,!1,L)+b(a.pxmid,a.px0,!1,L)+"Z"+z):T.attr("d",z)}else{var I=b(a.px0,a.px1,!0,1);if(L){var P=1-L;T.attr("d","M"+(M+L*a.px1[0])+","+(A+L*a.px1[1])+b(a.px1,a.px0,!1,L)+"l"+P*a.px0[0]+","+P*a.px0[1]+I+"Z")}else T.attr("d","M"+M+","+A+"l"+a.px0[0]+","+a.px0[1]+I+"Z")}var C=Array.isArray(g.textposition)?g.textposition[a.i]:g.textposition,R=k.selectAll("g.slicetext").data(a.text&&"none"!==C?[0]:[]);R.enter().append("g").classed("slicetext",!0),R.exit().remove(),R.each(function(){var t=c.select(this).selectAll("text").data([0]);t.enter().append("text").attr("data-notex",1),t.exit().remove(),t.text(a.text).attr({"class":"slicetext",transform:"","data-bb":"","text-anchor":"middle",x:0,y:0}).call(p.font,"outside"===C?g.outsidetextfont:g.insidetextfont).call(d.convertToTspans),t.selectAll("tspan.line").attr({x:0,y:0});var e,r=p.bBox(t.node());"outside"===C?e=o(r,a):(e=n(r,a,u),"auto"===C&&e.scale<1&&(t.call(p.font,g.outsidetextfont),g.outsidetextfont.family===g.insidetextfont.family&&g.outsidetextfont.size===g.insidetextfont.size||(t.attr({"data-bb":""}),r=p.bBox(t.node())),e=o(r,a)));var i=M+a.pxmid[0]*e.rCenter+(e.x||0),s=A+a.pxmid[1]*e.rCenter+(e.y||0);e.outside&&(a.yLabelMin=s-r.height/2,a.yLabelMid=s,a.yLabelMax=s+r.height/2,a.labelExtraX=0,a.labelExtraY=0,v=!0),t.attr("transform","translate("+i+","+s+")"+(e.scale<1?"scale("+e.scale+")":"")+(e.rotate?"rotate("+e.rotate+")":"")+"translate("+-(r.left+r.right)/2+","+-(r.top+r.bottom)/2+")")})}),v&&a(l,g),s.each(function(t){if(t.labelExtraX||t.labelExtraY){var e=c.select(this),r=e.select("g.slicetext text");r.attr("transform","translate("+t.labelExtraX+","+t.labelExtraY+")"+r.attr("transform"));var n=t.cxFinal+t.pxmid[0],i=t.cyFinal+t.pxmid[1],o="M"+n+","+i,a=(t.yLabelMax-t.yLabelMin)*(t.pxmid[0]<0?-1:1)/4;if(t.labelExtraX){var s=t.labelExtraX*t.pxmid[1]/t.pxmid[0],l=t.yLabelMid+t.labelExtraY-(t.cyFinal+t.pxmid[1]);o+=Math.abs(s)>Math.abs(l)?"l"+l*t.pxmid[0]/t.pxmid[1]+","+l+"H"+(n+t.labelExtraX+a):"l"+t.labelExtraX+","+s+"v"+(l-s)+"h"+a}else o+="V"+(t.yLabelMid+t.labelExtraY)+"h"+a;e.append("path").classed("textline",!0).call(f.stroke,g.outsidetextfont.color).attr({"stroke-width":Math.min(2,g.outsidetextfont.size/8),d:o,fill:"none"})}})})}),setTimeout(function(){u.selectAll("tspan").each(function(){var t=c.select(this);t.attr("dy")&&t.attr("dy",t.attr("dy"))})},0)}},{"../../components/color":498,"../../components/drawing":521,"../../lib/svg_text_utils":596,"../../plots/cartesian/graph_interact":614,"./helpers":757,d3:90}],762:[function(t,e,r){"use strict";var n=t("d3"),i=t("./style_one");e.exports=function(t){t._fullLayout._pielayer.selectAll(".trace").each(function(t){var e=t[0],r=e.trace,o=n.select(this);o.style({opacity:r.opacity}),o.selectAll(".top path.surface").each(function(t){n.select(this).call(i,t,r)})})}},{"./style_one":763,d3:90}],763:[function(t,e,r){"use strict";var n=t("../../components/color");e.exports=function(t,e,r){var i=r.marker.line.color;Array.isArray(i)&&(i=i[e.i]||n.defaultLine);var o=r.marker.line.width||0;Array.isArray(o)&&(o=o[e.i]||0),t.style({"stroke-width":o,fill:e.color}).call(n.stroke,i)}},{"../../components/color":498}],764:[function(t,e,r){"use strict";function n(t){return{show:{valType:"boolean",dflt:!1},opacity:{valType:"number",min:0,max:1,dflt:1},scale:{valType:"number",min:0,max:10,dflt:2/3}}}var i=t("../scatter/attributes"),o=t("../../components/colorscale/color_attributes"),a=t("../../constants/gl_markers"),s=t("../../lib/extend").extendFlat,l=i.line,u=i.marker,c=u.line;e.exports={x:{valType:"data_array"},y:{valType:"data_array"},z:{valType:"data_array"},text:s({},i.text,{}),mode:s({},i.mode,{dflt:"lines+markers"}),surfaceaxis:{valType:"enumerated",values:[-1,0,1,2],dflt:-1},surfacecolor:{valType:"color"},projection:{x:n("x"),y:n("y"),z:n("z")},connectgaps:i.connectgaps,line:s({},{width:l.width,dash:l.dash,showscale:{valType:"boolean",dflt:!1}},o("line")),marker:s({},{symbol:{valType:"enumerated",values:Object.keys(a),dflt:"circle",arrayOk:!0},size:s({},u.size,{dflt:8}),sizeref:u.sizeref,sizemin:u.sizemin,sizemode:u.sizemode,opacity:s({},u.opacity,{arrayOk:!1}),showscale:u.showscale,line:s({},{width:s({},c.width,{arrayOk:!1})},o("marker.line"))},o("marker")),textposition:s({},i.textposition,{dflt:"top center"}),textfont:i.textfont,_nestedModules:{error_x:"ErrorBars",error_y:"ErrorBars",error_z:"ErrorBars","marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":506,"../../constants/gl_markers":569,"../../lib/extend":578,"../scatter/attributes":771}],765:[function(t,e,r){"use strict";var n=t("../scatter/arrays_to_calcdata"),i=t("../scatter/colorscale_calc");e.exports=function(t,e){var r=[{x:!1,y:!1,trace:e,t:{}}];return n(r),i(e),r}},{"../scatter/arrays_to_calcdata":770,"../scatter/colorscale_calc":775}],766:[function(t,e,r){"use strict";function n(t,e,r){if(!e||!e.visible)return null;for(var n=a(e),i=new Array(t.length),o=0;os;s++){for(var l=[[0,0,0],[0,0,0]],u=0;3>u;u++)if(r[u])for(var c=0;2>c;c++)l[c][u]=r[u][s][c];a[s]=l}return a}var a=t("../../components/errorbars/compute_error");e.exports=o},{"../../components/errorbars/compute_error":525}],767:[function(t,e,r){"use strict";function n(t,e){this.scene=t,this.uid=e,this.linePlot=null,this.scatterPlot=null,this.errorBars=null,this.textMarkers=null,this.delaunayMesh=null,this.color=null,this.mode="",this.dataPoints=[],this.axesBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.textLabels=null,this.data=null}function i(t,e,r){var n,i=(r+1)%3,o=(r+2)%3,a=[],s=[];for(n=0;ni;i++){var o=t[i];o&&o.copy_zstyle!==!1&&(o=t[2]),o&&(e[i]=o.width/2,r[i]=x(o.color),n=o.thickness)}return{capSize:e,color:r,lineWidth:n}}function a(t){var e=[0,0];return Array.isArray(t)?[0,-1]:(t.indexOf("bottom")>=0&&(e[1]+=1),t.indexOf("top")>=0&&(e[1]-=1),t.indexOf("left")>=0&&(e[0]-=1),t.indexOf("right")>=0&&(e[0]+=1),e)}function s(t,e){return e(4*t)}function l(t){return M[t]}function u(t,e,r,n,i){var o=null;if(Array.isArray(t)){o=[];for(var a=0;e>a;a++)void 0===t[a]?o[a]=n:o[a]=r(t[a],i)}else o=r(t,y.identity);return o}function c(t,e){var r,n,i,c,h,f,p=[],d=t.fullSceneLayout,m=t.dataScale,g=d.xaxis,v=d.yaxis,w=d.zaxis,M=e.marker,k=e.line,T=e.x||[],E=e.y||[],S=e.z||[],L=T.length;for(n=0;L>n;n++)i=g.d2l(T[n])*m[0],c=v.d2l(E[n])*m[1],h=w.d2l(S[n])*m[2],p[n]=[i,c,h];if(Array.isArray(e.text))f=e.text;else if(void 0!==e.text)for(f=new Array(L),n=0;L>n;n++)f[n]=e.text;if(r={position:p,mode:e.mode,text:f},"line"in e&&(r.lineColor=b(k,1,L),r.lineWidth=k.width,r.lineDashes=k.dash),"marker"in e){var z=_(e);r.scatterColor=b(M,1,L),r.scatterSize=u(M.size,L,s,20,z),r.scatterMarker=u(M.symbol,L,l,"\u25cf"),r.scatterLineWidth=M.line.width,r.scatterLineColor=b(M.line,1,L),r.scatterAngle=0}"textposition"in e&&(r.textOffset=a(e.textposition),r.textColor=b(e.textfont,1,L),r.textSize=u(e.textfont.size,L,y.identity,12),r.textFont=e.textfont.family,r.textAngle=0);var I=["x","y","z"];for(r.project=[!1,!1,!1],r.projectScale=[1,1,1],r.projectOpacity=[1,1,1],n=0;3>n;++n){var P=e.projection[I[n]];(r.project[n]=P.show)&&(r.projectOpacity[n]=P.opacity,r.projectScale[n]=P.scale)}r.errorBounds=A(e,m);var C=o([e.error_x,e.error_y,e.error_z]);return r.errorColor=C.color,r.errorLineWidth=C.lineWidth,r.errorCapSize=C.capSize,r.delaunayAxis=e.surfaceaxis,r.delaunayColor=x(e.surfacecolor),r}function h(t){if(Array.isArray(t)){var e=t[0];return Array.isArray(e)&&(t=e),"rgb("+t.slice(0,3).map(function(t){return Math.round(255*t)})+")"}return null}function f(t,e){var r=new n(t,e.uid);return r.update(e),r}var p=t("gl-line3d"),d=t("gl-scatter3d"),m=t("gl-error3d"),g=t("gl-mesh3d"),v=t("delaunay-triangulate"),y=t("../../lib"),x=t("../../lib/str2rgbarray"),b=t("../../lib/gl_format_color"),_=t("../scatter/make_bubble_size_func"),w=t("../../constants/gl3d_dashes"),M=t("../../constants/gl_markers"),A=t("./calc_errors"),k=n.prototype;k.handlePick=function(t){if(t.object&&(t.object===this.linePlot||t.object===this.delaunayMesh||t.object===this.textMarkers||t.object===this.scatterPlot)){t.object.highlight&&t.object.highlight(null),this.scatterPlot&&(t.object=this.scatterPlot,this.scatterPlot.highlight(t.data)),this.textLabels&&void 0!==this.textLabels[t.data.index]?t.textLabel=this.textLabels[t.data.index]:t.textLabel="";var e=t.data.index;return t.traceCoordinate=[this.data.x[e],this.data.y[e],this.data.z[e]],!0}},k.update=function(t){var e,r,n,o,a=this.scene.glplot.gl,s=w.solid;this.data=t;var l=c(this.scene,t);"mode"in l&&(this.mode=l.mode),"lineDashes"in l&&l.lineDashes in w&&(s=w[l.lineDashes]),this.color=h(l.scatterColor)||h(l.lineColor),this.dataPoints=l.position,e={gl:a,position:l.position,color:l.lineColor,lineWidth:l.lineWidth||1,dashes:s[0],dashScale:s[1],opacity:t.opacity,connectGaps:t.connectgaps},-1!==this.mode.indexOf("lines")?this.linePlot?this.linePlot.update(e):(this.linePlot=p(e),this.scene.glplot.add(this.linePlot)):this.linePlot&&(this.scene.glplot.remove(this.linePlot),this.linePlot.dispose(),this.linePlot=null);var u=t.opacity;if(t.marker&&t.marker.opacity&&(u*=t.marker.opacity),r={gl:a,position:l.position,color:l.scatterColor,size:l.scatterSize,glyph:l.scatterMarker,opacity:u,orthographic:!0,lineWidth:l.scatterLineWidth,lineColor:l.scatterLineColor,project:l.project,projectScale:l.projectScale,projectOpacity:l.projectOpacity},-1!==this.mode.indexOf("markers")?this.scatterPlot?this.scatterPlot.update(r):(this.scatterPlot=d(r),this.scatterPlot.highlightScale=1,this.scene.glplot.add(this.scatterPlot)):this.scatterPlot&&(this.scene.glplot.remove(this.scatterPlot),this.scatterPlot.dispose(),this.scatterPlot=null),o={gl:a,position:l.position,glyph:l.text,color:l.textColor,size:l.textSize,angle:l.textAngle,alignment:l.textOffset,font:l.textFont,orthographic:!0,lineWidth:0,project:!1,opacity:t.opacity},this.textLabels=l.text,-1!==this.mode.indexOf("text")?this.textMarkers?this.textMarkers.update(o):(this.textMarkers=d(o),this.textMarkers.highlightScale=1,this.scene.glplot.add(this.textMarkers)):this.textMarkers&&(this.scene.glplot.remove(this.textMarkers),this.textMarkers.dispose(),this.textMarkers=null),n={gl:a,position:l.position,color:l.errorColor,error:l.errorBounds,lineWidth:l.errorLineWidth,capSize:l.errorCapSize,opacity:t.opacity},this.errorBars?l.errorBounds?this.errorBars.update(n):(this.scene.glplot.remove(this.errorBars),this.errorBars.dispose(),this.errorBars=null):l.errorBounds&&(this.errorBars=m(n),this.scene.glplot.add(this.errorBars)),l.delaunayAxis>=0){var f=i(l.position,l.delaunayColor,l.delaunayAxis);f.opacity=t.opacity,this.delaunayMesh?this.delaunayMesh.update(f):(f.gl=a,this.delaunayMesh=g(f),this.scene.glplot.add(this.delaunayMesh))}else this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose(),this.delaunayMesh=null)},k.dispose=function(){this.linePlot&&(this.scene.glplot.remove(this.linePlot),this.linePlot.dispose()),this.scatterPlot&&(this.scene.glplot.remove(this.scatterPlot),this.scatterPlot.dispose()),this.errorBars&&(this.scene.glplot.remove(this.errorBars),this.errorBars.dispose()),this.textMarkers&&(this.scene.glplot.remove(this.textMarkers),this.textMarkers.dispose()),this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose())},e.exports=f},{"../../constants/gl3d_dashes":568,"../../constants/gl_markers":569,"../../lib":583,"../../lib/gl_format_color":581,"../../lib/str2rgbarray":595,"../scatter/make_bubble_size_func":785,"./calc_errors":766,"delaunay-triangulate":91,"gl-error3d":127,"gl-line3d":134,"gl-mesh3d":167,"gl-scatter3d":187}],768:[function(t,e,r){"use strict";function n(t,e,r){var n=0,i=r("x"),o=r("y"),a=r("z");return i&&o&&a&&(n=Math.min(i.length,o.length,a.length),n=0&&f("surfacecolor",d||m);for(var g=["x","y","z"],v=0;3>v;++v){var y="projection."+g[v];f(y+".show")&&(f(y+".opacity"),f(y+".scale"))}u(t,e,r,{axis:"z"}),u(t,e,r,{axis:"y",inherit:"z"}),u(t,e,r,{axis:"x",inherit:"z"})}},{"../../components/errorbars/defaults":526,"../../lib":583,"../scatter/line_defaults":782,"../scatter/marker_defaults":786,"../scatter/subtypes":790,"../scatter/text_defaults":791,"./attributes":764}],769:[function(t,e,r){"use strict";var n={};n.plot=t("./convert"),n.attributes=t("./attributes"),n.markerSymbols=t("../../constants/gl_markers"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.moduleType="trace",n.name="scatter3d",n.basePlotModule=t("../../plots/gl3d"),n.categories=["gl3d","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../constants/gl_markers":569,"../../plots/gl3d":643,"../scatter/colorbar":774,"./attributes":764,"./calc":765,"./convert":767,"./defaults":768}],770:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t){var e=t[0].trace,r=e.marker;if(n.mergeArray(e.text,t,"tx"),n.mergeArray(e.textposition,t,"tp"),e.textfont&&(n.mergeArray(e.textfont.size,t,"ts"),n.mergeArray(e.textfont.color,t,"tc"),n.mergeArray(e.textfont.family,t,"tf")),r&&r.line){var i=r.line;n.mergeArray(r.opacity,t,"mo"),n.mergeArray(r.symbol,t,"mx"),n.mergeArray(r.color,t,"mc"),n.mergeArray(i.color,t,"mlc"),n.mergeArray(i.width,t,"mlw")}}},{"../../lib":583}],771:[function(t,e,r){"use strict";var n=t("../../components/colorscale/color_attributes"),i=t("../../components/drawing"),o=(t("./constants"),t("../../lib/extend").extendFlat);e.exports={x:{valType:"data_array"},x0:{valType:"any",dflt:0},dx:{valType:"number",dflt:1},y:{valType:"data_array"},y0:{valType:"any",dflt:0},dy:{valType:"number",dflt:1},text:{valType:"string",dflt:"",arrayOk:!0},mode:{valType:"flaglist",flags:["lines","markers","text"],extras:["none"]},hoveron:{valType:"flaglist",flags:["points","fills"]},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2},shape:{valType:"enumerated",values:["linear","spline","hv","vh","hvh","vhv"],dflt:"linear"},smoothing:{valType:"number",min:0,max:1.3,dflt:1},dash:{valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"}},connectgaps:{valType:"boolean",dflt:!1},fill:{valType:"enumerated",values:["none","tozeroy","tozerox","tonexty","tonextx","toself","tonext"],dflt:"none"},fillcolor:{valType:"color"},marker:o({},{symbol:{valType:"enumerated",values:i.symbolList,dflt:"circle",arrayOk:!0},opacity:{valType:"number",min:0,max:1,arrayOk:!0},size:{valType:"number",min:0,dflt:6,arrayOk:!0},maxdisplayed:{valType:"number",min:0,dflt:0},sizeref:{valType:"number",dflt:1},sizemin:{valType:"number",min:0,dflt:0},sizemode:{valType:"enumerated",values:["diameter","area"],dflt:"diameter"},showscale:{valType:"boolean",dflt:!1},line:o({},{width:{valType:"number",min:0,arrayOk:!0}},n("marker.line"))},n("marker")),textposition:{valType:"enumerated",values:["top left","top center","top right","middle left","middle center","middle right","bottom left","bottom center","bottom right"],dflt:"middle center",arrayOk:!0},textfont:{family:{valType:"string",noBlank:!0,strict:!0,arrayOk:!0},size:{valType:"number",min:1,arrayOk:!0},color:{valType:"color",arrayOk:!0}},r:{valType:"data_array"},t:{valType:"data_array"},_nestedModules:{error_y:"ErrorBars",error_x:"ErrorBars","marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":506,"../../components/drawing":521,"../../lib/extend":578,"./constants":776}],772:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/cartesian/axes"),o=t("../../lib"),a=t("./subtypes"),s=t("./colorscale_calc");e.exports=function(t,e){var r,l,u,c=i.getFromId(t,e.xaxis||"x"),h=i.getFromId(t,e.yaxis||"y"),f=c.makeCalcdata(e,"x"),p=h.makeCalcdata(e,"y"),d=Math.min(f.length,p.length);c._minDtick=0,h._minDtick=0,f.length>d&&f.splice(d,f.length-d),p.length>d&&p.splice(d,p.length-d);var m={padded:!0},g={padded:!0};if(a.hasMarkers(e)){if(r=e.marker,l=r.size,Array.isArray(l)){var v={type:"linear"};i.setConvert(v),l=v.makeCalcdata(e.marker,"size"),l.length>d&&l.splice(d,l.length-d)}var y,x=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/x),3)}:function(t){return Math.max((t||0)/x,3)},m.ppad=g.ppad=Array.isArray(l)?l.map(y):y(l)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||f[0]===f[d-1]&&p[0]===p[d-1]?e.error_y.visible||-1===["tonexty","tozeroy"].indexOf(e.fill)&&(a.hasMarkers(e)||a.hasText(e))||(m.padded=!1,m.ppad=0):m.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||f[0]===f[d-1]&&p[0]===p[d-1]?-1!==["tonextx","tozerox"].indexOf(e.fill)&&(g.padded=!1):g.tozero=!0,i.expand(c,f,m),i.expand(h,p,g);var b=new Array(d);for(u=0;d>u;u++)b[u]=n(f[u])&&n(p[u])?{x:f[u],y:p[u]}:{x:!1,y:!1};return void 0!==typeof l&&o.mergeArray(l,b,"ms"),t.firstscatter=!1,b}},{"../../lib":583,"../../plots/cartesian/axes":607,"./colorscale_calc":775,"./subtypes":790,"fast-isnumeric":99}],773:[function(t,e,r){"use strict";e.exports=function(t){var e,r,n,i,o;for(e=0;e=0;i--)if(o=t[i],"scatter"===o.type&&o.xaxis===r.xaxis&&o.yaxis===r.yaxis){o.opacity=void 0;break}}},{}],774:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),o=t("../../lib"),a=t("../../plots/plots"),s=t("../../components/colorscale/get_scale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,u=r.marker,c="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+c).remove(),void 0===u||!u.showscale)return void a.autoMargin(t,c);var h=s(u.colorscale),f=u.color,p=u.cmin,d=u.cmax;i(p)||(p=o.aggNums(Math.min,null,f)),i(d)||(d=o.aggNums(Math.max,null,f));var m=e[0].t.cb=l(t,c);m.fillcolor(n.scale.linear().domain(h.map(function(t){return p+t[0]*(d-p)})).range(h.map(function(t){return t[1]}))).filllevels({start:p,end:d,size:(d-p)/254}).options(u.colorbar)()}},{"../../components/colorbar/draw":501,"../../components/colorscale/get_scale":510,"../../lib":583,"../../plots/plots":663,d3:90,"fast-isnumeric":99}],775:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/calc"),o=t("./subtypes");e.exports=function(t){o.hasLines(t)&&n(t,"line")&&i(t,t.line.color,"line","c"),o.hasMarkers(t)&&(n(t,"marker")&&i(t,t.marker.color,"marker","c"),n(t,"marker.line")&&i(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":505,"../../components/colorscale/has_colorscale":511,"./subtypes":790}],776:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],777:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),o=t("./constants"),a=t("./subtypes"),s=t("./xy_defaults"),l=t("./marker_defaults"),u=t("./line_defaults"),c=t("./line_shape_defaults"),h=t("./text_defaults"),f=t("./fillcolor_defaults"),p=t("../../components/errorbars/defaults");e.exports=function(t,e,r,d){function m(r,o){return n.coerce(t,e,i,r,o)}var g=s(t,e,m),v=gU!=C>=U&&(z=S[T-1][0],I=S[T][0],L=z+(I-z)*(U-P)/(C-P),j=Math.min(j,L),F=Math.max(F,L));j=Math.max(j,0),F=Math.min(F,f._length);var V=l.defaultLine;return l.opacity(h.fillcolor)?V=h.fillcolor:l.opacity((h.line||{}).color)&&(V=h.line.color),n.extendFlat(t,{distance:o.MAXDIST+10,x0:j,x1:F,y0:U,y1:U,color:V}),delete t.index,h.text&&!Array.isArray(h.text)?t.text=String(h.text):t.text=h.name,[t]}}}},{"../../components/color":498,"../../components/errorbars":527,"../../lib":583,"../../plots/cartesian/constants":612,"../../plots/cartesian/graph_interact":614,"./get_trace_color":779}],781:[function(t,e,r){"use strict";var n={},i=t("./subtypes");n.hasLines=i.hasLines,n.hasMarkers=i.hasMarkers,n.hasText=i.hasText,n.isBubble=i.isBubble,n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.cleanData=t("./clean_data"),n.calc=t("./calc"),n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.moduleType="trace",n.name="scatter",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":615,"./arrays_to_calcdata":770,"./attributes":771,"./calc":772,"./clean_data":773,"./colorbar":774,"./defaults":777,"./hover":780,"./plot":787,"./select":788,"./style":789,"./subtypes":790}],782:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/defaults");e.exports=function(t,e,r,o,a){var s=(t.marker||{}).color;if(a("line.color",r),n(t,"line"))i(t,e,o,a,{prefix:"line.",cLetter:"c"});else{var l=(Array.isArray(s)?!1:s)||r;a("line.color",l)}a("line.width"),a("line.dash")}},{"../../components/colorscale/defaults":508,"../../components/colorscale/has_colorscale":511}],783:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes");e.exports=function(t,e){function r(e){var r=w.c2p(t[e].x),n=M.c2p(t[e].y);return r===S||n===S?!1:[r,n]}function i(t){var e=t[0]/w._length,r=t[1]/M._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*k}function o(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}var a,s,l,u,c,h,f,p,d,m,g,v,y,x,b,_,w=e.xaxis,M=e.yaxis,A=e.connectGaps,k=e.baseTolerance,T=e.linear,E=[],S=n.BADNUM,L=.2,z=new Array(t.length),I=0;for(a=0;ai(h))break;l=h,y=m[0]*d[0]+m[1]*d[1],y>g?(g=y,u=h,p=!1):v>y&&(v=y,c=h,p=!0)}if(p?(z[I++]=u,l!==c&&(z[I++]=c)):(c!==s&&(z[I++]=c),l!==u&&(z[I++]=u)),z[I++]=l,a>=t.length||!h)break;z[I++]=h,s=h}}else z[I++]=u}E.push(z.slice(0,I))}return E}},{"../../plots/cartesian/axes":607}],784:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=r("line.shape");"spline"===n&&r("line.smoothing")}},{}],785:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t){var e=t.marker,r=e.sizeref||1,i=e.sizemin||0,o="area"===e.sizemode?function(t){return Math.sqrt(t/r)}:function(t){return t/r};return function(t){var e=o(t/2);return n(e)&&e>0?Math.max(e,i):0}}},{"fast-isnumeric":99}],786:[function(t,e,r){"use strict";var n=t("../../components/color"),i=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults"),a=t("./subtypes");e.exports=function(t,e,r,s,l){var u,c=a.isBubble(t),h=(t.line||{}).color;h&&(r=h),l("marker.symbol"),l("marker.opacity",c?.7:1),l("marker.size"),l("marker.color",r),i(t,"marker")&&o(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u=h&&!Array.isArray(h)&&e.marker.color!==h?h:c?n.background:n.defaultLine,l("marker.line.color",u),i(t,"marker.line")&&o(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",c?1:0),c&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode"))}},{"../../components/color":498,"../../components/colorscale/defaults":508,"../../components/colorscale/has_colorscale":511,"./subtypes":790}],787:[function(t,e,r){"use strict";function n(t,e,r){var n=e.x(),o=e.y(),a=i.extent(n.range.map(n.l2c)),s=i.extent(o.range.map(o.l2c));r.forEach(function(t,e){ -var n=t[0].trace;if(u.hasMarkers(n)){var i=n.marker.maxdisplayed;if(0!==i){var o=t.filter(function(t){return t.x>=a[0]&&t.x<=a[1]&&t.y>=s[0]&&t.y<=s[1]}),l=Math.ceil(o.length/i),c=0;r.forEach(function(t,r){var n=t[0].trace;u.hasMarkers(n)&&n.marker.maxdisplayed>0&&e>r&&c++});var h=Math.round(c*l/3+Math.floor(c/3)*l/7.1);t.forEach(function(t){delete t.vis}),o.forEach(function(t,e){0===Math.round((e+h)%l)&&(t.vis=!0)})}}})}var i=t("d3"),o=t("../../lib"),a=t("../../components/drawing"),s=t("../../components/errorbars"),l=t("../../lib/polygon").tester,u=t("./subtypes"),c=t("./arrays_to_calcdata"),h=t("./line_points");e.exports=function(t,e,r){function f(t){return t.filter(function(t){return t.vis})}n(t,e,r);var p=e.x(),d=e.y(),m=e.plot.select(".scatterlayer").selectAll("g.trace.scatter").data(r);m.enter().append("g").attr("class","trace scatter").style("stroke-miterlimit",2),m.call(s.plot,e);var g,v,y,x,b="",_=[];m.each(function(t){var e=t[0].trace,r=e.line,n=i.select(this);if(e.visible===!0&&(v=e.fill.charAt(e.fill.length-1),"x"!==v&&"y"!==v&&(v=""),t[0].node3=n,c(t),u.hasLines(e)||"none"!==e.fill)){var o,s,f,m,w,M="",A="";g="tozero"===e.fill.substr(0,6)||"toself"===e.fill||"to"===e.fill.substr(0,2)&&!b?n.append("path").classed("js-fill",!0):null,x&&(y=x.datum(t)),x=n.append("path").classed("js-fill",!0),-1!==["hv","vh","hvh","vhv"].indexOf(r.shape)?(f=a.steps(r.shape),m=a.steps(r.shape.split("").reverse().join(""))):f=m="spline"===r.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?a.smoothclosed(t.slice(1),r.smoothing):a.smoothopen(t,r.smoothing)}:function(t){return"M"+t.join("L")},w=function(t){return m(t.reverse())};var k,T=h(t,{xaxis:p,yaxis:d,connectGaps:e.connectgaps,baseTolerance:Math.max(r.width||1,3)/4,linear:"linear"===r.shape}),E=e._polygons=new Array(T.length);for(k=0;k1&&n.append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").attr("d",o)}g?S&&z&&(v?("y"===v?S[1]=z[1]=d.c2p(0,!0):"x"===v&&(S[0]=z[0]=p.c2p(0,!0)),g.attr("d",M+"L"+z+"L"+S+"Z")):g.attr("d",M+"Z")):"tonext"===e.fill.substr(0,6)&&M&&b&&("tonext"===e.fill?y.attr("d",M+"Z"+b+"Z"):y.attr("d",M+"L"+b.substr(1)+"Z"),e._polygons=e._polygons.concat(_)),b=A,_=E}}}),m.selectAll("path:not([d])").remove(),m.append("g").attr("class","points").each(function(t){var e=t[0].trace,r=i.select(this),n=u.hasMarkers(e),s=u.hasText(e);!n&&!s||e.visible!==!0?r.remove():(n&&r.selectAll("path.point").data(e.marker.maxdisplayed?f:o.identity).enter().append("path").classed("point",!0).call(a.translatePoints,p,d),s&&r.selectAll("g").data(e.marker.maxdisplayed?f:o.identity).enter().append("g").append("text").call(a.translatePoints,p,d))})}},{"../../components/drawing":521,"../../components/errorbars":527,"../../lib":583,"../../lib/polygon":589,"./arrays_to_calcdata":770,"./line_points":783,"./subtypes":790,d3:90}],788:[function(t,e,r){"use strict";var n=t("./subtypes"),i=.2;e.exports=function(t,e){var r,o,a,s,l=t.cd,u=t.xaxis,c=t.yaxis,h=[],f=l[0].trace,p=f.index,d=f.marker,m=!n.hasMarkers(f)&&!n.hasText(f);if(f.visible===!0&&!m){var g=Array.isArray(d.opacity)?1:d.opacity;if(e===!1)for(r=0;rn;n++)r[n]=[t.lon[n],t.lat[n]];return{type:"LineString",coordinates:r,trace:t}}function o(t,e){function r(e){var r=t.mockAxis;return u.tickText(r,r.c2l(e),"hover").text+"\xb0"}var n=e.hoverinfo;if("none"===n)return function(t){delete t.textLabel};var i="all"===n?g.hoverinfo.flags:n.split("+"),o=-1!==i.indexOf("location")&&Array.isArray(e.locations),a=-1!==i.indexOf("lon"),s=-1!==i.indexOf("lat"),l=-1!==i.indexOf("text");return function(t){var n=[];o?n.push(t.location):a&&s?n.push("("+r(t.lon)+", "+r(t.lat)+")"):a?n.push("lon: "+r(t.lon)):s&&n.push("lat: "+r(t.lat)),l&&n.push(t.tx||e.text),t.textLabel=n.join("
")}}function a(t){var e=Array.isArray(t.locations);return function(r,n){return{points:[{data:t._input,fullData:t,curveNumber:t.index,pointNumber:n,lon:r.lon,lat:r.lat,location:e?r.location:null}]}}}var s=t("d3"),l=t("../../plots/cartesian/graph_interact"),u=t("../../plots/cartesian/axes"),c=t("../../lib/topojson_utils").getTopojsonFeatures,h=t("../../lib/geo_location_utils").locationToFeature,f=t("../../lib/array_to_calc_item"),p=t("../../components/color"),d=t("../../components/drawing"),m=t("../scatter/subtypes"),g=t("./attributes"),v=e.exports={};v.calcGeoJSON=function(t,e){var r,i,o,a,s=[],l=Array.isArray(t.locations);l?(a=t.locations,r=a.length,i=c(t,e),o=function(t,e){var r=h(t.locationmode,a[e],i);return void 0!==r?r.properties.ct:void 0}):(r=t.lon.length,o=function(t,e){return[t.lon[e],t.lat[e]]});for(var u=0;r>u;u++){var f=o(t,u);if(f){var p={lon:f[0],lat:f[1],location:l?t.locations[u]:null};n(t,p,u),s.push(p)}}return s.length>0&&(s[0].trace=t),s},v.plot=function(t,e){var r=t.framework.select(".scattergeolayer").selectAll("g.trace.scattergeo").data(e,function(t){return t.uid});r.enter().append("g").attr("class","trace scattergeo"),r.exit().remove(),r.selectAll("*").remove(),r.each(function(t){var e=s.select(this);m.hasLines(t)&&e.selectAll("path.js-line").data([i(t)]).enter().append("path").classed("js-line",!0)}),r.each(function(e){function r(r,n){if(t.showHover){var i=t.projection([r.lon,r.lat]);f(r),l.loneHover({x:i[0],y:i[1],name:g?e.name:void 0,text:r.textLabel,color:r.mc||(e.marker||{}).color},{container:t.hoverContainer.node()}),y=p(r,n),t.graphDiv.emit("plotly_hover",y)}}function n(e,r){t.graphDiv.emit("plotly_click",p(e,r))}var i=s.select(this),u=m.hasMarkers(e),c=m.hasText(e);if(u||c){var h=v.calcGeoJSON(e,t.topojson),f=o(t,e),p=a(e),d=e.hoverinfo,g="all"===d||-1!==d.indexOf("name"),y=null;u&&i.selectAll("path.point").data(h).enter().append("path").classed("point",!0).on("mouseover",r).on("click",n).on("mouseout",function(){l.loneUnhover(t.hoverContainer),t.graphDiv.emit("plotly_unhover",y)}).on("mousedown",function(){l.loneUnhover(t.hoverContainer)}).on("mouseup",r),c&&i.selectAll("g").data(h).enter().append("g").append("text")}}),v.style(t)},v.style=function(t){var e=t.framework.selectAll("g.trace.scattergeo");e.style("opacity",function(t){return t.opacity}),e.each(function(t){s.select(this).selectAll("path.point").call(d.pointStyle,t),s.select(this).selectAll("text").call(d.textPointStyle,t)}),e.selectAll("path.js-line").style("fill","none").each(function(t){var e=t.trace,r=e.line||{};s.select(this).call(p.stroke,r.color).call(d.dashLine,r.dash||"",r.width||0)})}},{"../../components/color":498,"../../components/drawing":521,"../../lib/array_to_calc_item":574,"../../lib/geo_location_utils":580,"../../lib/topojson_utils":597,"../../plots/cartesian/axes":607,"../../plots/cartesian/graph_interact":614,"../scatter/subtypes":790,"./attributes":793,d3:90}],798:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../components/colorscale/color_attributes"),o=t("../../constants/gl2d_dashes"),a=t("../../constants/gl_markers"),s=t("../../lib/extend").extendFlat,l=t("../../lib/extend").extendDeep,u=n.line,c=n.marker,h=c.line;e.exports={x:n.x,x0:n.x0,dx:n.dx,y:n.y,y0:n.y0,dy:n.dy,text:s({},n.text,{}),mode:{valType:"flaglist",flags:["lines","markers"],extras:["none"]},line:{color:u.color,width:u.width,dash:{valType:"enumerated",values:Object.keys(o),dflt:"solid"}},marker:l({},i("marker"),{symbol:{valType:"enumerated",values:Object.keys(a),dflt:"circle",arrayOk:!0},size:c.size,sizeref:c.sizeref,sizemin:c.sizemin,sizemode:c.sizemode,opacity:c.opacity,showscale:c.showscale,line:l({},i("marker.line"),{width:h.width})}),connectgaps:n.connectgaps,fill:s({},n.fill,{values:["none","tozeroy","tozerox"]}),fillcolor:n.fillcolor,_nestedModules:{error_x:"ErrorBars",error_y:"ErrorBars","marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":506,"../../constants/gl2d_dashes":567,"../../constants/gl_markers":569,"../../lib/extend":578,"../scatter/attributes":771}],799:[function(t,e,r){"use strict";function n(t,e){this.scene=t,this.uid=e,this.type="scattergl",this.pickXData=[],this.pickYData=[],this.xData=[],this.yData=[],this.textLabels=[],this.color="rgb(0, 0, 0)",this.name="",this.hoverinfo="all",this.connectgaps=!0,this.idToIndex=[],this.bounds=[0,0,0,0],this.hasLines=!1,this.lineOptions={positions:new Float32Array(0),color:[0,0,0,1],width:1,fill:[!1,!1,!1,!1],fillColor:[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],dashes:[1]},this.line=p(t.glplot,this.lineOptions),this.line._trace=this,this.hasErrorX=!1,this.errorXOptions={positions:new Float32Array(0),errors:new Float32Array(0),lineWidth:1,capSize:0,color:[0,0,0,1]},this.errorX=d(t.glplot,this.errorXOptions),this.errorX._trace=this,this.hasErrorY=!1,this.errorYOptions={positions:new Float32Array(0),errors:new Float32Array(0),lineWidth:1,capSize:0,color:[0,0,0,1]},this.errorY=d(t.glplot,this.errorYOptions),this.errorY._trace=this,this.hasMarkers=!1,this.scatterOptions={positions:new Float32Array(0),sizes:[],colors:[],glyphs:[],borderWidths:[],borderColors:[],size:12,color:[0,0,0,1],borderSize:1,borderColor:[0,0,0,1]},this.scatter=h(t.glplot,this.scatterOptions),this.scatter._trace=this,this.fancyScatter=f(t.glplot,this.scatterOptions),this.fancyScatter._trace=this}function i(t,e,r){return Array.isArray(e)||(e=[e]),o(t,e,r)}function o(t,e,r){for(var n=new Array(r),i=e[0],o=0;r>o;++o)n[o]=t(o>=e.length?i:e[o]);return n}function a(t,e,r){return l(L(t,r),S(e,r),r)}function s(t,e,r,n){var i=b(t,e,n);return i=Array.isArray(i[0])?i:o(g.identity,[i],n),l(i,S(r,n),n)}function l(t,e,r){for(var n=new Array(4*r),i=0;r>i;++i){for(var o=0;3>o;++o)n[4*i+o]=t[i][o];n[4*i+3]=t[i][3]*e[i]}return n}function u(t,e){if(void 0===Float32Array.slice){for(var r=new Float32Array(e),n=0;e>n;n++)r[n]=t[n];return r}return t.slice(0,e)}function c(t,e){var r=new n(t,e.uid);return r.update(e),r}var h=t("gl-scatter2d"),f=t("gl-scatter2d-fancy"),p=t("gl-line2d"),d=t("gl-error2d"),m=t("fast-isnumeric"),g=t("../../lib"),v=t("../../plots/cartesian/axes"),y=t("../../components/errorbars"),x=t("../../lib/str2rgbarray"),b=t("../../lib/gl_format_color"),_=t("../scatter/subtypes"),w=t("../scatter/make_bubble_size_func"),M=t("../scatter/get_trace_color"),A=t("../../constants/gl_markers"),k=t("../../constants/gl2d_dashes"),T=["xaxis","yaxis"],E=n.prototype;E.handlePick=function(t){var e=t.pointId;return(t.object!==this.line||this.connectgaps)&&(e=this.idToIndex[t.pointId]),{trace:this,dataCoord:t.dataCoord,traceCoord:[this.pickXData[e],this.pickYData[e]],textLabel:Array.isArray(this.textLabels)?this.textLabels[e]:this.textLabels,color:Array.isArray(this.color)?this.color[e]:this.color,name:this.name,hoverinfo:this.hoverinfo}},E.isFancy=function(t){if("linear"!==this.scene.xaxis.type)return!0;if("linear"!==this.scene.yaxis.type)return!0;if(!t.x||!t.y)return!0;if(this.hasMarkers){var e=t.marker||{};if(Array.isArray(e.symbol)||"circle"!==e.symbol||Array.isArray(e.size)||Array.isArray(e.color)||Array.isArray(e.line.width)||Array.isArray(e.line.color)||Array.isArray(e.opacity))return!0}return this.hasLines&&!this.connectgaps?!0:this.hasErrorX?!0:!!this.hasErrorY};var S=i.bind(null,function(t){return+t}),L=i.bind(null,x),z=i.bind(null,function(t){return A[t]||"\u25cf"});E.update=function(t){t.visible!==!0?(this.hasLines=!1,this.hasErrorX=!1,this.hasErrorY=!1,this.hasMarkers=!1):(this.hasLines=_.hasLines(t),this.hasErrorX=t.error_x.visible===!0,this.hasErrorY=t.error_y.visible===!0,this.hasMarkers=_.hasMarkers(t)),this.textLabels=t.text,this.name=t.name,this.hoverinfo=t.hoverinfo,this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.connectgaps=!!t.connectgaps,this.isFancy(t)?this.updateFancy(t):this.updateFast(t),this.color=M(t,{})},E.updateFast=function(t){for(var e,r,n=this.xData=this.pickXData=t.x,i=this.yData=this.pickYData=t.y,o=n.length,a=new Array(o),s=new Float32Array(2*o),l=this.bounds,c=0,h=0,f=0;o>f;++f)e=n[f],r=i[f],m(e)&&m(r)&&(a[c++]=f,s[h++]=e,s[h++]=r,l[0]=Math.min(l[0],e),l[1]=Math.min(l[1],r),l[2]=Math.max(l[2],e),l[3]=Math.max(l[3],r));s=u(s,h),this.idToIndex=a,this.updateLines(t,s),this.updateError("X",t),this.updateError("Y",t);var p;if(this.hasMarkers){this.scatterOptions.positions=s;var d=x(t.marker.color),g=x(t.marker.line.color),v=t.opacity*t.marker.opacity;d[3]*=v,this.scatterOptions.color=d,g[3]*=v,this.scatterOptions.borderColor=g,p=t.marker.size,this.scatterOptions.size=p,this.scatterOptions.borderSize=t.marker.line.width,this.scatter.update(this.scatterOptions)}else this.scatterOptions.positions=new Float32Array(0),this.scatterOptions.glyphs=[],this.scatter.update(this.scatterOptions);this.scatterOptions.positions=new Float32Array(0),this.scatterOptions.glyphs=[],this.fancyScatter.update(this.scatterOptions),this.expandAxesFast(l,p)},E.updateFancy=function(t){var e=this.scene,r=e.xaxis,n=e.yaxis,o=this.bounds,a=this.pickXData=r.makeCalcdata(t,"x").slice(),l=this.pickYData=n.makeCalcdata(t,"y").slice();this.xData=a.slice(),this.yData=l.slice();var c,h,f,p,d,m,g,v,x=y.calcFromTrace(t,e.fullLayout),b=a.length,_=new Array(b),M=new Float32Array(2*b),A=new Float32Array(4*b),k=new Float32Array(4*b),T=0,E=0,L=0,I=0,P="log"===r.type?function(t){return r.d2l(t)}:function(t){return t},C="log"===n.type?function(t){return n.d2l(t)}:function(t){return t};for(c=0;b>c;++c)this.xData[c]=f=P(a[c]),this.yData[c]=p=C(l[c]),isNaN(f)||isNaN(p)||(_[T++]=c,M[E++]=f,M[E++]=p,d=A[L++]=f-x[c].xs||0,m=A[L++]=x[c].xh-f||0,A[L++]=0,A[L++]=0,k[I++]=0,k[I++]=0,g=k[I++]=p-x[c].ys||0,v=k[I++]=x[c].yh-p||0,o[0]=Math.min(o[0],f-d),o[1]=Math.min(o[1],p-g),o[2]=Math.max(o[2],f+m),o[3]=Math.max(o[3],p+v));M=u(M,E),this.idToIndex=_,this.updateLines(t,M),this.updateError("X",t,M,A),this.updateError("Y",t,M,k);var R;if(this.hasMarkers){this.scatterOptions.positions=M,this.scatterOptions.sizes=new Array(T),this.scatterOptions.glyphs=new Array(T),this.scatterOptions.borderWidths=new Array(T),this.scatterOptions.colors=new Array(4*T),this.scatterOptions.borderColors=new Array(4*T);var D,O=w(t),j=t.marker,F=j.opacity,N=t.opacity,B=s(j,F,N,b),U=z(j.symbol,b),V=S(j.line.width,b),q=s(j.line,F,N,b);for(R=i(O,j.size,b),c=0;T>c;++c)for(D=_[c],this.scatterOptions.sizes[c]=4*R[D],this.scatterOptions.glyphs[c]=U[D],this.scatterOptions.borderWidths[c]=.5*V[D],h=0;4>h;++h)this.scatterOptions.colors[4*c+h]=B[4*D+h],this.scatterOptions.borderColors[4*c+h]=q[4*D+h];this.fancyScatter.update(this.scatterOptions)}else this.scatterOptions.positions=new Float32Array(0),this.scatterOptions.glyphs=[],this.fancyScatter.update(this.scatterOptions);this.scatterOptions.positions=new Float32Array(0),this.scatterOptions.glyphs=[],this.scatter.update(this.scatterOptions),this.expandAxesFancy(a,l,R)},E.updateLines=function(t,e){var r;if(this.hasLines){var n=e;if(!t.connectgaps){var i=0,o=this.xData,s=this.yData;for(n=new Float32Array(2*o.length),r=0;ra;a++)r=this.scene[T[a]],n=r._min,n||(n=[]),n.push({val:t[a],pad:o}),i=r._max,i||(i=[]),i.push({val:t[a+2],pad:o})},E.expandAxesFancy=function(t,e,r){var n=this.scene,i={padded:!0,ppad:r};v.expand(n.xaxis,t,i),v.expand(n.yaxis,e,i)},E.dispose=function(){this.line.dispose(),this.errorX.dispose(),this.errorY.dispose(),this.scatter.dispose(),this.fancyScatter.dispose()},e.exports=c},{"../../components/errorbars":527,"../../constants/gl2d_dashes":567,"../../constants/gl_markers":569,"../../lib":583,"../../lib/gl_format_color":581,"../../lib/str2rgbarray":595,"../../plots/cartesian/axes":607,"../scatter/get_trace_color":779,"../scatter/make_bubble_size_func":785,"../scatter/subtypes":790,"fast-isnumeric":99,"gl-error2d":125,"gl-line2d":132,"gl-scatter2d":184,"gl-scatter2d-fancy":179}],800:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../scatter/constants"),o=t("../scatter/subtypes"),a=t("../scatter/xy_defaults"),s=t("../scatter/marker_defaults"),l=t("../scatter/line_defaults"),u=t("../scatter/fillcolor_defaults"),c=t("../../components/errorbars/defaults"),h=t("./attributes");e.exports=function(t,e,r,f){function p(r,i){return n.coerce(t,e,h,r,i)}var d=a(t,e,p);return d?(p("text"),p("mode",db;b++){var _=e.lon[b],w=e.lat[b];if(n(_)&&n(w)){var M={};if(x++,M.lonlat=[+_,+w],h){if(f){var A=c.color[b];M.mc=A,M.mcc=g(A)}if(p){var k=c.size[b];M.ms=k,M.mrc=v(k)}if(d){var T=c.symbol[b];M.mx="string"==typeof T?T:"circle"}}if(m){var E=e.text[b];M.tx="string"==typeof E?E:""}y.push(M)}else x>0&&(y[x-1].gapAfter=!0)}return y}},{"../../components/colorscale/has_colorscale":511,"../../components/colorscale/make_scale_function":515,"../../lib":583,"../scatter/colorscale_calc":775,"../scatter/make_bubble_size_func":785,"../scatter/subtypes":790,"fast-isnumeric":99}],804:[function(t,e,r){"use strict";function n(){return{geojson:i(),layout:{visibility:"none"},paint:{}}}function i(){return{type:"Point",coordinates:[]}}function o(t,e){if(1===e.length)return{type:"Polygon",coordinates:e};for(var r=new Array(e.length),n=0;n0&&(n.push(i),i=[])}return n.push(i),n}function f(t){return Array.isArray(t)?function(t){return t}:t?function(){return t}:p}function p(){return""}var d=t("../../lib"),m=t("../scatter/subtypes"),g=t("../../plots/mapbox/convert_text_opts"),v="circle-color",y="circle-radius";e.exports=function(t){var e=t[0].trace,r=e.visible===!0,i="none"!==e.fill,f=m.hasLines(e),p=m.hasMarkers(e),x=m.hasText(e),b=p&&"circle"===e.marker.symbol,_=p&&"circle"!==e.marker.symbol,w=n(),M=n(),A=n(),k=n(),T={fill:w,line:M,circle:A,symbol:k};if(!r)return T;var E;if((i||f)&&(E=h(t)),i&&(w.geojson=o(t,E),w.layout.visibility="visible",d.extendFlat(w.paint,{"fill-color":e.fillcolor})),f&&(M.geojson=a(t,E),M.layout.visibility="visible",d.extendFlat(M.paint,{"line-width":e.line.width,"line-color":e.line.color,"line-opacity":e.opacity})),b){var S={};S[v]={},S[y]={},A.geojson=s(t,S),A.layout.visibility="visible",d.extendFlat(A.paint,{"circle-opacity":e.opacity*e.marker.opacity,"circle-color":u(e,S),"circle-radius":c(e,S)})}if((_||x)&&(k.geojson=l(t),d.extendFlat(k.layout,{visibility:"visible","icon-image":"{symbol}-15","text-field":"{text}"}),_&&(d.extendFlat(k.layout,{"icon-size":e.marker.size/10}),d.extendFlat(k.paint,{"icon-opacity":e.opacity*e.marker.opacity,"icon-color":e.marker.color})),x)){var L=(e.marker||{}).size,z=g(e.textposition,L);d.extendFlat(k.layout,{"text-size":e.textfont.size,"text-anchor":z.anchor,"text-offset":z.offset}),d.extendFlat(k.paint,{"text-color":e.textfont.color,"text-opacity":e.opacity})}return T}},{"../../lib":583,"../../plots/mapbox/convert_text_opts":657,"../scatter/subtypes":790}],805:[function(t,e,r){"use strict";function n(t,e,r){var n=r("lon")||[],i=r("lat")||[],o=Math.min(n.length,i.length);return o")}var i=t("../../plots/cartesian/graph_interact"),o=t("../scatter/get_trace_color");e.exports=function(t,e,r){function a(t){var e=t.lonlat,n=Math.abs(u.c2p(e)-u.c2p([p,e[1]])),i=Math.abs(c.c2p(e)-c.c2p([e[0],r])),o=Math.max(3,t.mrc||0);return Math.max(Math.sqrt(n*n+i*i)-o,1-3/o)}var s=t.cd,l=s[0].trace,u=t.xa,c=t.ya,h=e>=0?Math.floor((e+180)/360):Math.ceil((e-180)/360),f=360*h,p=e-f;if(i.getClosest(s,a,t),t.index!==!1){var d=s[t.index],m=d.lonlat,g=[m[0]+f,m[1]],v=u.c2p(g),y=c.c2p(g),x=d.mrc||1;return t.x0=v-x,t.x1=v+x,t.y0=y-x,t.y1=y+x,t.color=o(l,d),t.extraText=n(l,d),[t]}}},{"../../plots/cartesian/graph_interact":614,"../scatter/get_trace_color":779}],807:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.hoverPoints=t("./hover"),n.plot=t("./plot"),n.moduleType="trace",n.name="scattermapbox",n.basePlotModule=t("../../plots/mapbox"),n.categories=["mapbox","gl","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../plots/mapbox":658,"../scatter/colorbar":774,"./attributes":802,"./calc":803,"./defaults":805,"./hover":806,"./plot":808}],808:[function(t,e,r){"use strict";function n(t,e){this.mapbox=t,this.map=t.map,this.uid=e,this.idSourceFill=e+"-source-fill",this.idSourceLine=e+"-source-line",this.idSourceCircle=e+"-source-circle",this.idSourceSymbol=e+"-source-symbol",this.idLayerFill=e+"-layer-fill",this.idLayerLine=e+"-layer-line",this.idLayerCircle=e+"-layer-circle",this.idLayerSymbol=e+"-layer-symbol",this.mapbox.initSource(this.idSourceFill),this.mapbox.initSource(this.idSourceLine),this.mapbox.initSource(this.idSourceCircle),this.mapbox.initSource(this.idSourceSymbol),this.map.addLayer({id:this.idLayerFill,source:this.idSourceFill,type:"fill"}),this.map.addLayer({id:this.idLayerLine,source:this.idSourceLine,type:"line"}),this.map.addLayer({id:this.idLayerCircle,source:this.idSourceCircle, -type:"circle"}),this.map.addLayer({id:this.idLayerSymbol,source:this.idSourceSymbol,type:"symbol"})}function i(t){return"visible"===t.layout.visibility}var o=t("./convert"),a=n.prototype;a.update=function(t){var e=this.mapbox,r=o(t);e.setOptions(this.idLayerFill,"setLayoutProperty",r.fill.layout),e.setOptions(this.idLayerLine,"setLayoutProperty",r.line.layout),e.setOptions(this.idLayerCircle,"setLayoutProperty",r.circle.layout),e.setOptions(this.idLayerSymbol,"setLayoutProperty",r.symbol.layout),i(r.fill)&&(e.setSourceData(this.idSourceFill,r.fill.geojson),e.setOptions(this.idLayerFill,"setPaintProperty",r.fill.paint)),i(r.line)&&(e.setSourceData(this.idSourceLine,r.line.geojson),e.setOptions(this.idLayerLine,"setPaintProperty",r.line.paint)),i(r.circle)&&(e.setSourceData(this.idSourceCircle,r.circle.geojson),e.setOptions(this.idLayerCircle,"setPaintProperty",r.circle.paint)),i(r.symbol)&&(e.setSourceData(this.idSourceSymbol,r.symbol.geojson),e.setOptions(this.idLayerSymbol,"setPaintProperty",r.symbol.paint))},a.dispose=function(){var t=this.map;t.removeLayer(this.idLayerFill),t.removeLayer(this.idLayerLine),t.removeLayer(this.idLayerCircle),t.removeLayer(this.idLayerSymbol),t.removeSource(this.idSourceFill),t.removeSource(this.idSourceLine),t.removeSource(this.idSourceCircle),t.removeSource(this.idSourceSymbol)},e.exports=function(t,e){var r=e[0].trace,i=new n(t,r.uid);return i.update(e),i}},{"./convert":804}],809:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../plots/attributes"),o=t("../../components/colorscale/color_attributes"),a=t("../../lib/extend").extendFlat,s=n.marker,l=n.line,u=s.line;e.exports={a:{valType:"data_array"},b:{valType:"data_array"},c:{valType:"data_array"},sum:{valType:"number",dflt:0,min:0},mode:a({},n.mode,{dflt:"markers"}),text:a({},n.text,{}),line:{color:l.color,width:l.width,dash:l.dash,shape:a({},l.shape,{values:["linear","spline"]}),smoothing:l.smoothing},connectgaps:n.connectgaps,fill:a({},n.fill,{values:["none","toself","tonext"]}),fillcolor:n.fillcolor,marker:a({},{symbol:s.symbol,opacity:s.opacity,maxdisplayed:s.maxdisplayed,size:s.size,sizeref:s.sizeref,sizemin:s.sizemin,sizemode:s.sizemode,showscale:s.showscale,line:a({},{width:u.width},o("marker".line))},o("marker")),textfont:n.textfont,textposition:n.textposition,hoverinfo:a({},i.hoverinfo,{flags:["a","b","c","text","name"]}),hoveron:n.hoveron,_nestedModules:{"marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":506,"../../lib/extend":578,"../../plots/attributes":605,"../scatter/attributes":771}],810:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/cartesian/axes"),o=t("../../lib"),a=t("../scatter/subtypes"),s=t("../scatter/colorscale_calc"),l=["a","b","c"],u={a:["b","c"],b:["a","c"],c:["a","b"]};e.exports=function(t,e){var r,c,h,f,p,d,m=t._fullLayout[e.subplot],g=m.sum,v=e.sum||g;for(r=0;rr;r++)y=e.a[r],x=e.b[r],b=e.c[r],n(y)&&n(x)&&n(b)?(y=+y,x=+x,b=+b,_=g/(y+x+b),1!==_&&(y*=_,x*=_,b*=_),M=y,w=b-x,k[r]={x:w,y:M,a:y,b:x,c:b}):k[r]={x:!1,y:!1};var T,E;if(a.hasMarkers(e)&&(T=e.marker,E=T.size,Array.isArray(E))){var S={type:"linear"};i.setConvert(S),E=S.makeCalcdata(e.marker,"size"),E.length>A&&E.splice(A,E.length-A)}return s(e),void 0!==typeof E&&o.mergeArray(E,k,"ms"),k}},{"../../lib":583,"../../plots/cartesian/axes":607,"../scatter/colorscale_calc":775,"../scatter/subtypes":790,"fast-isnumeric":99}],811:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../scatter/constants"),o=t("../scatter/subtypes"),a=t("../scatter/marker_defaults"),s=t("../scatter/line_defaults"),l=t("../scatter/line_shape_defaults"),u=t("../scatter/text_defaults"),c=t("../scatter/fillcolor_defaults"),h=t("./attributes");e.exports=function(t,e,r,f){function p(r,i){return n.coerce(t,e,h,r,i)}var d,m=p("a"),g=p("b"),v=p("c");if(m?(d=m.length,g?(d=Math.min(d,g.length),v&&(d=Math.min(d,v.length))):d=v?Math.min(d,v.length):0):g&&v&&(d=Math.min(g.length,v.length)),!d)return void(e.visible=!1);m&&d"),s}}},{"../../plots/cartesian/axes":607,"../scatter/hover":780}],813:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.moduleType="trace",n.name="scatterternary",n.basePlotModule=t("../../plots/ternary"),n.categories=["ternary","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../plots/ternary":670,"../scatter/colorbar":774,"./attributes":809,"./calc":810,"./defaults":811,"./hover":812,"./plot":814,"./select":815,"./style":816}],814:[function(t,e,r){"use strict";var n=t("../scatter/plot");e.exports=function(t,e){var r=t.plotContainer;r.select(".scatterlayer").selectAll("*").remove();for(var i={x:function(){return t.xaxis},y:function(){return t.yaxis},plot:r},o=new Array(e.length),a=t.graphDiv.calcdata,s=0;se){for(var r=m/e,n=[0|Math.floor(t[0].shape[0]*r+1),0|Math.floor(t[0].shape[1]*r+1)],i=n[0]*n[1],a=0;ar;++r)this.showContour[r]&&(e=!0,t[r]=this.scene.contourLevels[r]);e&&this.surface.update({levels:t})},g.update=function(t){var e,r=this.scene,n=r.fullSceneLayout,o=this.surface,s=t.opacity,l=i(t.colorscale,s),c=t.z,f=t.x,p=t.y,m=n.xaxis,g=n.yaxis,v=n.zaxis,y=r.dataScale,x=c[0].length,b=c.length,_=[u(new Float32Array(x*b),[x,b]),u(new Float32Array(x*b),[x,b]),u(new Float32Array(x*b),[x,b])],w=_[0],M=_[1],A=r.contourLevels;this.data=t,h(_[2],function(t,e){return v.d2l(c[e][t])*y[2]}),Array.isArray(f[0])?h(w,function(t,e){return m.d2l(f[e][t])*y[0]}):h(w,function(t){return m.d2l(f[t])*y[0]}),Array.isArray(p[0])?h(M,function(t,e){return g.d2l(p[e][t])*y[1]}):h(M,function(t,e){return g.d2l(p[e])*y[1]});var k={colormap:l,levels:[[],[],[]],showContour:[!0,!0,!0],showSurface:!t.hidesurface,contourProject:[[!1,!1,!1],[!1,!1,!1],[!1,!1,!1]],contourWidth:[1,1,1],contourColor:[[1,1,1,1],[1,1,1,1],[1,1,1,1]],contourTint:[1,1,1],dynamicColor:[[1,1,1,1],[1,1,1,1],[1,1,1,1]],dynamicWidth:[1,1,1],dynamicTint:[1,1,1],opacity:1};if(k.intensityBounds=[t.cmin,t.cmax],t.surfacecolor){var T=u(new Float32Array(x*b),[x,b]);h(T,function(e,r){return t.surfacecolor[r][e]}),_.push(T)}else k.intensityBounds[0]*=y[2],k.intensityBounds[1]*=y[2];this.dataScale=a(_),t.surfacecolor&&(k.intensity=_.pop()),"opacity"in t&&t.opacity<1&&(k.opacity=.25*t.opacity);var E=[!0,!0,!0],S=["x","y","z"];for(e=0;3>e;++e){var L=t.contours[S[e]];E[e]=L.highlight,k.showContour[e]=L.show||L.highlight,k.showContour[e]&&(k.contourProject[e]=[L.project.x,L.project.y,L.project.z],L.show?(this.showContour[e]=!0,k.levels[e]=A[e],o.highlightColor[e]=k.contourColor[e]=d(L.color),L.usecolormap?o.highlightTint[e]=k.contourTint[e]=0:o.highlightTint[e]=k.contourTint[e]=1,k.contourWidth[e]=L.width):this.showContour[e]=!1,L.highlight&&(k.dynamicColor[e]=d(L.highlightcolor),k.dynamicWidth[e]=L.highlightwidth))}k.coords=_,o.update(k),o.visible=t.visible,o.enableDynamic=E,o.snapToData=!0,"lighting"in t&&(o.ambientLight=t.lighting.ambient,o.diffuseLight=t.lighting.diffuse,o.specularLight=t.lighting.specular,o.roughness=t.lighting.roughness,o.fresnel=t.lighting.fresnel),"lightposition"in t&&(o.lightPosition=[t.lightposition.x,t.lightposition.y,t.lightposition.z]),s&&1>s&&(o.supportsTransparency=!0)},g.dispose=function(){this.scene.glplot.remove(this.surface),this.surface.dispose()},e.exports=s},{"../../lib/str2rgbarray":595,"gl-surface3d":202,ndarray:399,"ndarray-fill":389,"ndarray-homography":391,"ndarray-ops":393,tinycolor2:461}],821:[function(t,e,r){"use strict";function n(t,e,r){e in t&&!(r in t)&&(t[r]=t[e])}var i=t("../../lib"),o=t("../../components/colorscale/defaults"),a=t("./attributes");e.exports=function(t,e,r,s){function l(r,n){return i.coerce(t,e,a,r,n)}var u,c,h=l("z");if(!h)return void(e.visible=!1);var f=h[0].length,p=h.length;if(l("x"),l("y"),!Array.isArray(e.x))for(e.x=[],u=0;f>u;++u)e.x[u]=u;if(l("text"),!Array.isArray(e.y))for(e.y=[],u=0;p>u;++u)e.y[u]=u;["lighting.ambient","lighting.diffuse","lighting.specular","lighting.roughness","lighting.fresnel","lightposition.x","lightposition.y","lightposition.z","hidesurface","opacity"].forEach(function(t){l(t)});var d=l("surfacecolor");l("colorscale");var m=["x","y","z"];for(u=0;3>u;++u){var g="contours."+m[u],v=l(g+".show"),y=l(g+".highlight");if(v||y)for(c=0;3>c;++c)l(g+".project."+m[c]);v&&(l(g+".color"),l(g+".width"),l(g+".usecolormap")),y&&(l(g+".highlightcolor"),l(g+".highlightwidth"))}d||(n(t,"zmin","cmin"),n(t,"zmax","cmax"),n(t,"zauto","cauto")),o(t,e,s,l,{prefix:"",cLetter:"c"})}},{"../../components/colorscale/defaults":508,"../../lib":583,"./attributes":817}],822:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("./colorbar"),n.calc=t("./calc"),n.plot=t("./convert"),n.moduleType="trace",n.name="surface",n.basePlotModule=t("../../plots/gl3d"),n.categories=["gl3d","noOpacity"],n.meta={},e.exports=n},{"../../plots/gl3d":643,"./attributes":817,"./calc":818,"./colorbar":819,"./convert":820,"./defaults":821}]},{},[12])(12)}); \ No newline at end of file +f=o.cxFinal+l(o.px0[0],o.px1[0]),p=f+n-(t.cxFinal+t.pxmid[0])-t.labelExtraX,p*c>0&&(t.labelExtraX+=p)))}var o,a,s,l,u,c,h,f,p,d,m,g,v;for(a=0;2>a;a++)for(s=a?r:n,u=a?Math.max:Math.min,h=a?1:-1,o=0;2>o;o++){for(l=o?Math.max:Math.min,c=o?1:-1,f=t[a][o],f.sort(s),p=t[1-a][o],d=p.concat(f),g=[],m=0;mc&&(c=s.pull[o]);a.r=Math.min(r/u(s.tilt,Math.sin(l),s.depth),n/u(s.tilt,Math.cos(l),s.depth))/(2+2*c),a.cx=e.l+e.w*(s.domain.x[1]+s.domain.x[0])/2,a.cy=e.t+e.h*(2-s.domain.y[1]-s.domain.y[0])/2,s.scalegroup&&-1===p.indexOf(s.scalegroup)&&p.push(s.scalegroup)}for(o=0;oh.vTotal/2?1:0)}function u(t,e,r){if(!t)return 1;var n=Math.sin(t*Math.PI/180);return Math.max(.01,r*n*Math.abs(e)+2*Math.sqrt(1-n*n*e*e))}var c=t("d3"),h=t("../../plots/cartesian/graph_interact"),f=t("../../components/color"),p=t("../../components/drawing"),d=t("../../lib/svg_text_utils"),m=t("./helpers");e.exports=function(t,e){var r=t._fullLayout;s(e,r._size);var u=r._pielayer.selectAll("g.trace").data(e);u.enter().append("g").attr({"stroke-linejoin":"round","class":"trace"}),u.exit().remove(),u.order(),u.each(function(e){var s=c.select(this),u=e[0],g=u.trace,v=0,y=(g.depth||0)*u.r*Math.sin(v)/2,x=g.tiltaxis||0,b=x*Math.PI/180,_=[y*Math.sin(b),y*Math.cos(b)],w=u.r*Math.cos(v),M=s.selectAll("g.part").data(g.tilt?["top","sides"]:["top"]);M.enter().append("g").attr("class",function(t){return t+" part"}),M.exit().remove(),M.order(),l(e),s.selectAll(".top").each(function(){var s=c.select(this).selectAll("g.slice").data(e);s.enter().append("g").classed("slice",!0),s.exit().remove();var l=[[[],[]],[[],[]]],v=!1;s.each(function(a){function s(e){var n=t._fullLayout,o=t._fullData[g.index],s=o.hoverinfo;if("all"===s&&(s="label+text+value+percent+name"),!t._dragging&&n.hovermode!==!1&&"none"!==s&&s){var l=i(a,u),c=M+a.pxmid[0]*(1-l),f=A+a.pxmid[1]*(1-l),p=r.separators,d=[];-1!==s.indexOf("label")&&d.push(a.label),o.text&&o.text[a.i]&&-1!==s.indexOf("text")&&d.push(o.text[a.i]),-1!==s.indexOf("value")&&d.push(m.formatPieValue(a.v,p)),-1!==s.indexOf("percent")&&d.push(m.formatPiePercent(a.v/u.vTotal,p)),h.loneHover({x0:c-l*u.r,x1:c+l*u.r,y:f,text:d.join("
"),name:-1!==s.indexOf("name")?o.name:void 0,color:a.color,idealAlign:a.pxmid[0]<0?"left":"right"},{container:n._hoverlayer.node(),outerContainer:n._paper.node()}),h.hover(t,e,"pie"),E=!0}}function f(e){t.emit("plotly_unhover",{points:[e]}),E&&(h.loneUnhover(r._hoverlayer.node()),E=!1)}function y(){t._hoverdata=[a],a.curveNumber=e[0].trace.index,t._hoverdata.trace=e[0].trace,h.click(t,{target:!0})}function b(t,e,r,n){return"a"+n*u.r+","+n*w+" "+x+" "+a.largeArc+(r?" 1 ":" 0 ")+n*(e[0]-t[0])+","+n*(e[1]-t[1])}if(a.hidden)return void c.select(this).selectAll("path,g").remove();l[a.pxmid[1]<0?0:1][a.pxmid[0]<0?0:1].push(a);var M=u.cx+_[0],A=u.cy+_[1],k=c.select(this),T=k.selectAll("path.surface").data([a]),E=!1;if(T.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),k.select("path.textline").remove(),k.on("mouseover",s).on("mouseout",f).on("click",y).on("contextmenu",y),g.pull){var S=+(Array.isArray(g.pull)?g.pull[a.i]:g.pull)||0;S>0&&(M+=S*a.pxmid[0],A+=S*a.pxmid[1])}a.cxFinal=M,a.cyFinal=A;var L=g.hole;if(a.v===u.vTotal){var z="M"+(M+a.px0[0])+","+(A+a.px0[1])+b(a.px0,a.pxmid,!0,1)+b(a.pxmid,a.px0,!0,1)+"Z";L?T.attr("d","M"+(M+L*a.px0[0])+","+(A+L*a.px0[1])+b(a.px0,a.pxmid,!1,L)+b(a.pxmid,a.px0,!1,L)+"Z"+z):T.attr("d",z)}else{var I=b(a.px0,a.px1,!0,1);if(L){var P=1-L;T.attr("d","M"+(M+L*a.px1[0])+","+(A+L*a.px1[1])+b(a.px1,a.px0,!1,L)+"l"+P*a.px0[0]+","+P*a.px0[1]+I+"Z")}else T.attr("d","M"+M+","+A+"l"+a.px0[0]+","+a.px0[1]+I+"Z")}var C=Array.isArray(g.textposition)?g.textposition[a.i]:g.textposition,R=k.selectAll("g.slicetext").data(a.text&&"none"!==C?[0]:[]);R.enter().append("g").classed("slicetext",!0),R.exit().remove(),R.each(function(){var t=c.select(this).selectAll("text").data([0]);t.enter().append("text").attr("data-notex",1),t.exit().remove(),t.text(a.text).attr({"class":"slicetext",transform:"","data-bb":"","text-anchor":"middle",x:0,y:0}).call(p.font,"outside"===C?g.outsidetextfont:g.insidetextfont).call(d.convertToTspans),t.selectAll("tspan.line").attr({x:0,y:0});var e,r=p.bBox(t.node());"outside"===C?e=o(r,a):(e=n(r,a,u),"auto"===C&&e.scale<1&&(t.call(p.font,g.outsidetextfont),g.outsidetextfont.family===g.insidetextfont.family&&g.outsidetextfont.size===g.insidetextfont.size||(t.attr({"data-bb":""}),r=p.bBox(t.node())),e=o(r,a)));var i=M+a.pxmid[0]*e.rCenter+(e.x||0),s=A+a.pxmid[1]*e.rCenter+(e.y||0);e.outside&&(a.yLabelMin=s-r.height/2,a.yLabelMid=s,a.yLabelMax=s+r.height/2,a.labelExtraX=0,a.labelExtraY=0,v=!0),t.attr("transform","translate("+i+","+s+")"+(e.scale<1?"scale("+e.scale+")":"")+(e.rotate?"rotate("+e.rotate+")":"")+"translate("+-(r.left+r.right)/2+","+-(r.top+r.bottom)/2+")")})}),v&&a(l,g),s.each(function(t){if(t.labelExtraX||t.labelExtraY){var e=c.select(this),r=e.select("g.slicetext text");r.attr("transform","translate("+t.labelExtraX+","+t.labelExtraY+")"+r.attr("transform"));var n=t.cxFinal+t.pxmid[0],i=t.cyFinal+t.pxmid[1],o="M"+n+","+i,a=(t.yLabelMax-t.yLabelMin)*(t.pxmid[0]<0?-1:1)/4;if(t.labelExtraX){var s=t.labelExtraX*t.pxmid[1]/t.pxmid[0],l=t.yLabelMid+t.labelExtraY-(t.cyFinal+t.pxmid[1]);o+=Math.abs(s)>Math.abs(l)?"l"+l*t.pxmid[0]/t.pxmid[1]+","+l+"H"+(n+t.labelExtraX+a):"l"+t.labelExtraX+","+s+"v"+(l-s)+"h"+a}else o+="V"+(t.yLabelMid+t.labelExtraY)+"h"+a;e.append("path").classed("textline",!0).call(f.stroke,g.outsidetextfont.color).attr({"stroke-width":Math.min(2,g.outsidetextfont.size/8),d:o,fill:"none"})}})})}),setTimeout(function(){u.selectAll("tspan").each(function(){var t=c.select(this);t.attr("dy")&&t.attr("dy",t.attr("dy"))})},0)}},{"../../components/color":498,"../../components/drawing":521,"../../lib/svg_text_utils":596,"../../plots/cartesian/graph_interact":614,"./helpers":757,d3:90}],762:[function(t,e,r){"use strict";var n=t("d3"),i=t("./style_one");e.exports=function(t){t._fullLayout._pielayer.selectAll(".trace").each(function(t){var e=t[0],r=e.trace,o=n.select(this);o.style({opacity:r.opacity}),o.selectAll(".top path.surface").each(function(t){n.select(this).call(i,t,r)})})}},{"./style_one":763,d3:90}],763:[function(t,e,r){"use strict";var n=t("../../components/color");e.exports=function(t,e,r){var i=r.marker.line.color;Array.isArray(i)&&(i=i[e.i]||n.defaultLine);var o=r.marker.line.width||0;Array.isArray(o)&&(o=o[e.i]||0),t.style({"stroke-width":o,fill:e.color}).call(n.stroke,i)}},{"../../components/color":498}],764:[function(t,e,r){"use strict";function n(t){return{show:{valType:"boolean",dflt:!1},opacity:{valType:"number",min:0,max:1,dflt:1},scale:{valType:"number",min:0,max:10,dflt:2/3}}}var i=t("../scatter/attributes"),o=t("../../components/colorscale/color_attributes"),a=t("../../constants/gl_markers"),s=t("../../lib/extend").extendFlat,l=i.line,u=i.marker,c=u.line;e.exports={x:{valType:"data_array"},y:{valType:"data_array"},z:{valType:"data_array"},text:s({},i.text,{}),mode:s({},i.mode,{dflt:"lines+markers"}),surfaceaxis:{valType:"enumerated",values:[-1,0,1,2],dflt:-1},surfacecolor:{valType:"color"},projection:{x:n("x"),y:n("y"),z:n("z")},connectgaps:i.connectgaps,line:s({},{width:l.width,dash:l.dash,showscale:{valType:"boolean",dflt:!1}},o("line")),marker:s({},{symbol:{valType:"enumerated",values:Object.keys(a),dflt:"circle",arrayOk:!0},size:s({},u.size,{dflt:8}),sizeref:u.sizeref,sizemin:u.sizemin,sizemode:u.sizemode,opacity:s({},u.opacity,{arrayOk:!1}),showscale:u.showscale,line:s({},{width:s({},c.width,{arrayOk:!1})},o("marker.line"))},o("marker")),textposition:s({},i.textposition,{dflt:"top center"}),textfont:i.textfont,_nestedModules:{error_x:"ErrorBars",error_y:"ErrorBars",error_z:"ErrorBars","marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":506,"../../constants/gl_markers":569,"../../lib/extend":578,"../scatter/attributes":771}],765:[function(t,e,r){"use strict";var n=t("../scatter/arrays_to_calcdata"),i=t("../scatter/colorscale_calc");e.exports=function(t,e){var r=[{x:!1,y:!1,trace:e,t:{}}];return n(r),i(e),r}},{"../scatter/arrays_to_calcdata":770,"../scatter/colorscale_calc":775}],766:[function(t,e,r){"use strict";function n(t,e,r){if(!e||!e.visible)return null;for(var n=a(e),i=new Array(t.length),o=0;os;s++){for(var l=[[0,0,0],[0,0,0]],u=0;3>u;u++)if(r[u])for(var c=0;2>c;c++)l[c][u]=r[u][s][c];a[s]=l}return a}var a=t("../../components/errorbars/compute_error");e.exports=o},{"../../components/errorbars/compute_error":525}],767:[function(t,e,r){"use strict";function n(t,e){this.scene=t,this.uid=e,this.linePlot=null,this.scatterPlot=null,this.errorBars=null,this.textMarkers=null,this.delaunayMesh=null,this.color=null,this.mode="",this.dataPoints=[],this.axesBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.textLabels=null,this.data=null}function i(t,e,r){var n,i=(r+1)%3,o=(r+2)%3,a=[],s=[];for(n=0;ni;i++){var o=t[i];o&&o.copy_zstyle!==!1&&(o=t[2]),o&&(e[i]=o.width/2,r[i]=x(o.color),n=o.thickness)}return{capSize:e,color:r,lineWidth:n}}function a(t){var e=[0,0];return Array.isArray(t)?[0,-1]:(t.indexOf("bottom")>=0&&(e[1]+=1),t.indexOf("top")>=0&&(e[1]-=1),t.indexOf("left")>=0&&(e[0]-=1),t.indexOf("right")>=0&&(e[0]+=1),e)}function s(t,e){return e(4*t)}function l(t){return M[t]}function u(t,e,r,n,i){var o=null;if(Array.isArray(t)){o=[];for(var a=0;e>a;a++)void 0===t[a]?o[a]=n:o[a]=r(t[a],i)}else o=r(t,y.identity);return o}function c(t,e){var r,n,i,c,h,f,p=[],d=t.fullSceneLayout,m=t.dataScale,g=d.xaxis,v=d.yaxis,w=d.zaxis,M=e.marker,k=e.line,T=e.x||[],E=e.y||[],S=e.z||[],L=T.length;for(n=0;L>n;n++)i=g.d2l(T[n])*m[0],c=v.d2l(E[n])*m[1],h=w.d2l(S[n])*m[2],p[n]=[i,c,h];if(Array.isArray(e.text))f=e.text;else if(void 0!==e.text)for(f=new Array(L),n=0;L>n;n++)f[n]=e.text;if(r={position:p,mode:e.mode,text:f},"line"in e&&(r.lineColor=b(k,1,L),r.lineWidth=k.width,r.lineDashes=k.dash),"marker"in e){var z=_(e);r.scatterColor=b(M,1,L),r.scatterSize=u(M.size,L,s,20,z),r.scatterMarker=u(M.symbol,L,l,"\u25cf"),r.scatterLineWidth=M.line.width,r.scatterLineColor=b(M.line,1,L),r.scatterAngle=0}"textposition"in e&&(r.textOffset=a(e.textposition),r.textColor=b(e.textfont,1,L),r.textSize=u(e.textfont.size,L,y.identity,12),r.textFont=e.textfont.family,r.textAngle=0);var I=["x","y","z"];for(r.project=[!1,!1,!1],r.projectScale=[1,1,1],r.projectOpacity=[1,1,1],n=0;3>n;++n){var P=e.projection[I[n]];(r.project[n]=P.show)&&(r.projectOpacity[n]=P.opacity,r.projectScale[n]=P.scale)}r.errorBounds=A(e,m);var C=o([e.error_x,e.error_y,e.error_z]);return r.errorColor=C.color,r.errorLineWidth=C.lineWidth,r.errorCapSize=C.capSize,r.delaunayAxis=e.surfaceaxis,r.delaunayColor=x(e.surfacecolor),r}function h(t){if(Array.isArray(t)){var e=t[0];return Array.isArray(e)&&(t=e),"rgb("+t.slice(0,3).map(function(t){return Math.round(255*t)})+")"}return null}function f(t,e){var r=new n(t,e.uid);return r.update(e),r}var p=t("gl-line3d"),d=t("gl-scatter3d"),m=t("gl-error3d"),g=t("gl-mesh3d"),v=t("delaunay-triangulate"),y=t("../../lib"),x=t("../../lib/str2rgbarray"),b=t("../../lib/gl_format_color"),_=t("../scatter/make_bubble_size_func"),w=t("../../constants/gl3d_dashes"),M=t("../../constants/gl_markers"),A=t("./calc_errors"),k=n.prototype;k.handlePick=function(t){if(t.object&&(t.object===this.linePlot||t.object===this.delaunayMesh||t.object===this.textMarkers||t.object===this.scatterPlot)){t.object.highlight&&t.object.highlight(null),this.scatterPlot&&(t.object=this.scatterPlot,this.scatterPlot.highlight(t.data)),this.textLabels&&void 0!==this.textLabels[t.data.index]?t.textLabel=this.textLabels[t.data.index]:t.textLabel="";var e=t.data.index;return t.traceCoordinate=[this.data.x[e],this.data.y[e],this.data.z[e]],!0}},k.update=function(t){var e,r,n,o,a=this.scene.glplot.gl,s=w.solid;this.data=t;var l=c(this.scene,t);"mode"in l&&(this.mode=l.mode),"lineDashes"in l&&l.lineDashes in w&&(s=w[l.lineDashes]),this.color=h(l.scatterColor)||h(l.lineColor),this.dataPoints=l.position,e={gl:a,position:l.position,color:l.lineColor,lineWidth:l.lineWidth||1,dashes:s[0],dashScale:s[1],opacity:t.opacity,connectGaps:t.connectgaps},-1!==this.mode.indexOf("lines")?this.linePlot?this.linePlot.update(e):(this.linePlot=p(e),this.scene.glplot.add(this.linePlot)):this.linePlot&&(this.scene.glplot.remove(this.linePlot),this.linePlot.dispose(),this.linePlot=null);var u=t.opacity;if(t.marker&&t.marker.opacity&&(u*=t.marker.opacity),r={gl:a,position:l.position,color:l.scatterColor,size:l.scatterSize,glyph:l.scatterMarker,opacity:u,orthographic:!0,lineWidth:l.scatterLineWidth,lineColor:l.scatterLineColor,project:l.project,projectScale:l.projectScale,projectOpacity:l.projectOpacity},-1!==this.mode.indexOf("markers")?this.scatterPlot?this.scatterPlot.update(r):(this.scatterPlot=d(r),this.scatterPlot.highlightScale=1,this.scene.glplot.add(this.scatterPlot)):this.scatterPlot&&(this.scene.glplot.remove(this.scatterPlot),this.scatterPlot.dispose(),this.scatterPlot=null),o={gl:a,position:l.position,glyph:l.text,color:l.textColor,size:l.textSize,angle:l.textAngle,alignment:l.textOffset,font:l.textFont,orthographic:!0,lineWidth:0,project:!1,opacity:t.opacity},this.textLabels=l.text,-1!==this.mode.indexOf("text")?this.textMarkers?this.textMarkers.update(o):(this.textMarkers=d(o),this.textMarkers.highlightScale=1,this.scene.glplot.add(this.textMarkers)):this.textMarkers&&(this.scene.glplot.remove(this.textMarkers),this.textMarkers.dispose(),this.textMarkers=null),n={gl:a,position:l.position,color:l.errorColor,error:l.errorBounds,lineWidth:l.errorLineWidth,capSize:l.errorCapSize,opacity:t.opacity},this.errorBars?l.errorBounds?this.errorBars.update(n):(this.scene.glplot.remove(this.errorBars),this.errorBars.dispose(),this.errorBars=null):l.errorBounds&&(this.errorBars=m(n),this.scene.glplot.add(this.errorBars)),l.delaunayAxis>=0){var f=i(l.position,l.delaunayColor,l.delaunayAxis);f.opacity=t.opacity,this.delaunayMesh?this.delaunayMesh.update(f):(f.gl=a,this.delaunayMesh=g(f),this.scene.glplot.add(this.delaunayMesh))}else this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose(),this.delaunayMesh=null)},k.dispose=function(){this.linePlot&&(this.scene.glplot.remove(this.linePlot),this.linePlot.dispose()),this.scatterPlot&&(this.scene.glplot.remove(this.scatterPlot),this.scatterPlot.dispose()),this.errorBars&&(this.scene.glplot.remove(this.errorBars),this.errorBars.dispose()),this.textMarkers&&(this.scene.glplot.remove(this.textMarkers),this.textMarkers.dispose()),this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose())},e.exports=f},{"../../constants/gl3d_dashes":568,"../../constants/gl_markers":569,"../../lib":583,"../../lib/gl_format_color":581,"../../lib/str2rgbarray":595,"../scatter/make_bubble_size_func":785,"./calc_errors":766,"delaunay-triangulate":91,"gl-error3d":127,"gl-line3d":134,"gl-mesh3d":167,"gl-scatter3d":187}],768:[function(t,e,r){"use strict";function n(t,e,r){var n=0,i=r("x"),o=r("y"),a=r("z");return i&&o&&a&&(n=Math.min(i.length,o.length,a.length),n=0&&f("surfacecolor",d||m);for(var g=["x","y","z"],v=0;3>v;++v){var y="projection."+g[v];f(y+".show")&&(f(y+".opacity"),f(y+".scale"))}u(t,e,r,{axis:"z"}),u(t,e,r,{axis:"y",inherit:"z"}),u(t,e,r,{axis:"x",inherit:"z"})}},{"../../components/errorbars/defaults":526,"../../lib":583,"../scatter/line_defaults":782,"../scatter/marker_defaults":786,"../scatter/subtypes":790,"../scatter/text_defaults":791,"./attributes":764}],769:[function(t,e,r){"use strict";var n={};n.plot=t("./convert"),n.attributes=t("./attributes"),n.markerSymbols=t("../../constants/gl_markers"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.moduleType="trace",n.name="scatter3d",n.basePlotModule=t("../../plots/gl3d"),n.categories=["gl3d","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../constants/gl_markers":569,"../../plots/gl3d":643,"../scatter/colorbar":774,"./attributes":764,"./calc":765,"./convert":767,"./defaults":768}],770:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t){var e=t[0].trace,r=e.marker;if(n.mergeArray(e.text,t,"tx"),n.mergeArray(e.textposition,t,"tp"),e.textfont&&(n.mergeArray(e.textfont.size,t,"ts"),n.mergeArray(e.textfont.color,t,"tc"),n.mergeArray(e.textfont.family,t,"tf")),r&&r.line){var i=r.line;n.mergeArray(r.opacity,t,"mo"),n.mergeArray(r.symbol,t,"mx"),n.mergeArray(r.color,t,"mc"),n.mergeArray(i.color,t,"mlc"),n.mergeArray(i.width,t,"mlw")}}},{"../../lib":583}],771:[function(t,e,r){"use strict";var n=t("../../components/colorscale/color_attributes"),i=t("../../components/drawing"),o=(t("./constants"),t("../../lib/extend").extendFlat);e.exports={x:{valType:"data_array"},x0:{valType:"any",dflt:0},dx:{valType:"number",dflt:1},y:{valType:"data_array"},y0:{valType:"any",dflt:0},dy:{valType:"number",dflt:1},text:{valType:"string",dflt:"",arrayOk:!0},mode:{valType:"flaglist",flags:["lines","markers","text"],extras:["none"]},hoveron:{valType:"flaglist",flags:["points","fills"]},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2},shape:{valType:"enumerated",values:["linear","spline","hv","vh","hvh","vhv"],dflt:"linear"},smoothing:{valType:"number",min:0,max:1.3,dflt:1},dash:{valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"}},connectgaps:{valType:"boolean",dflt:!1},fill:{valType:"enumerated",values:["none","tozeroy","tozerox","tonexty","tonextx","toself","tonext"],dflt:"none"},fillcolor:{valType:"color"},marker:o({},{symbol:{valType:"enumerated",values:i.symbolList,dflt:"circle",arrayOk:!0},opacity:{valType:"number",min:0,max:1,arrayOk:!0},size:{valType:"number",min:0,dflt:6,arrayOk:!0},maxdisplayed:{valType:"number",min:0,dflt:0},sizeref:{valType:"number",dflt:1},sizemin:{valType:"number",min:0,dflt:0},sizemode:{valType:"enumerated",values:["diameter","area"],dflt:"diameter"},showscale:{valType:"boolean",dflt:!1},line:o({},{width:{valType:"number",min:0,arrayOk:!0}},n("marker.line"))},n("marker")),textposition:{valType:"enumerated",values:["top left","top center","top right","middle left","middle center","middle right","bottom left","bottom center","bottom right"],dflt:"middle center",arrayOk:!0},textfont:{family:{valType:"string",noBlank:!0,strict:!0,arrayOk:!0},size:{valType:"number",min:1,arrayOk:!0},color:{valType:"color",arrayOk:!0}},r:{valType:"data_array"},t:{valType:"data_array"},_nestedModules:{error_y:"ErrorBars",error_x:"ErrorBars","marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":506,"../../components/drawing":521,"../../lib/extend":578,"./constants":776}],772:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/cartesian/axes"),o=t("../../lib"),a=t("./subtypes"),s=t("./colorscale_calc");e.exports=function(t,e){var r,l,u,c=i.getFromId(t,e.xaxis||"x"),h=i.getFromId(t,e.yaxis||"y"),f=c.makeCalcdata(e,"x"),p=h.makeCalcdata(e,"y"),d=Math.min(f.length,p.length);c._minDtick=0,h._minDtick=0,f.length>d&&f.splice(d,f.length-d),p.length>d&&p.splice(d,p.length-d);var m={padded:!0},g={padded:!0};if(a.hasMarkers(e)){if(r=e.marker,l=r.size,Array.isArray(l)){var v={type:"linear"};i.setConvert(v),l=v.makeCalcdata(e.marker,"size"),l.length>d&&l.splice(d,l.length-d)}var y,x=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/x),3)}:function(t){return Math.max((t||0)/x,3)},m.ppad=g.ppad=Array.isArray(l)?l.map(y):y(l)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||f[0]===f[d-1]&&p[0]===p[d-1]?e.error_y.visible||-1===["tonexty","tozeroy"].indexOf(e.fill)&&(a.hasMarkers(e)||a.hasText(e))||(m.padded=!1,m.ppad=0):m.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||f[0]===f[d-1]&&p[0]===p[d-1]?-1!==["tonextx","tozerox"].indexOf(e.fill)&&(g.padded=!1):g.tozero=!0,i.expand(c,f,m),i.expand(h,p,g);var b=new Array(d);for(u=0;d>u;u++)b[u]=n(f[u])&&n(p[u])?{x:f[u],y:p[u]}:{x:!1,y:!1};return void 0!==typeof l&&o.mergeArray(l,b,"ms"),t.firstscatter=!1,b}},{"../../lib":583,"../../plots/cartesian/axes":607,"./colorscale_calc":775,"./subtypes":790,"fast-isnumeric":99}],773:[function(t,e,r){"use strict";e.exports=function(t){var e,r,n,i,o;for(e=0;e=0;i--)if(o=t[i],"scatter"===o.type&&o.xaxis===r.xaxis&&o.yaxis===r.yaxis){o.opacity=void 0;break}}},{}],774:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),o=t("../../lib"),a=t("../../plots/plots"),s=t("../../components/colorscale/get_scale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,u=r.marker,c="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+c).remove(),void 0===u||!u.showscale)return void a.autoMargin(t,c);var h=s(u.colorscale),f=u.color,p=u.cmin,d=u.cmax;i(p)||(p=o.aggNums(Math.min,null,f)),i(d)||(d=o.aggNums(Math.max,null,f));var m=e[0].t.cb=l(t,c);m.fillcolor(n.scale.linear().domain(h.map(function(t){return p+t[0]*(d-p)})).range(h.map(function(t){return t[1]}))).filllevels({start:p,end:d,size:(d-p)/254}).options(u.colorbar)()}},{"../../components/colorbar/draw":501,"../../components/colorscale/get_scale":510,"../../lib":583,"../../plots/plots":663,d3:90,"fast-isnumeric":99}],775:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/calc"),o=t("./subtypes");e.exports=function(t){o.hasLines(t)&&n(t,"line")&&i(t,t.line.color,"line","c"),o.hasMarkers(t)&&(n(t,"marker")&&i(t,t.marker.color,"marker","c"),n(t,"marker.line")&&i(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":505,"../../components/colorscale/has_colorscale":511,"./subtypes":790}],776:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],777:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),o=t("./constants"),a=t("./subtypes"),s=t("./xy_defaults"),l=t("./marker_defaults"),u=t("./line_defaults"),c=t("./line_shape_defaults"),h=t("./text_defaults"),f=t("./fillcolor_defaults"),p=t("../../components/errorbars/defaults");e.exports=function(t,e,r,d){function m(r,o){return n.coerce(t,e,i,r,o)}var g=s(t,e,m),v=gU!=C>=U&&(z=S[T-1][0],I=S[T][0],L=z+(I-z)*(U-P)/(C-P),j=Math.min(j,L),F=Math.max(F,L));j=Math.max(j,0),F=Math.min(F,f._length);var V=l.defaultLine;return l.opacity(h.fillcolor)?V=h.fillcolor:l.opacity((h.line||{}).color)&&(V=h.line.color),n.extendFlat(t,{distance:o.MAXDIST+10,x0:j,x1:F,y0:U,y1:U,color:V}),delete t.index,h.text&&!Array.isArray(h.text)?t.text=String(h.text):t.text=h.name,[t]}}}},{"../../components/color":498,"../../components/errorbars":527,"../../lib":583,"../../plots/cartesian/constants":612,"../../plots/cartesian/graph_interact":614,"./get_trace_color":779}],781:[function(t,e,r){"use strict";var n={},i=t("./subtypes");n.hasLines=i.hasLines,n.hasMarkers=i.hasMarkers,n.hasText=i.hasText,n.isBubble=i.isBubble,n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.cleanData=t("./clean_data"),n.calc=t("./calc"),n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.moduleType="trace",n.name="scatter",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":615,"./arrays_to_calcdata":770,"./attributes":771,"./calc":772,"./clean_data":773,"./colorbar":774,"./defaults":777,"./hover":780,"./plot":787,"./select":788,"./style":789,"./subtypes":790}],782:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/defaults");e.exports=function(t,e,r,o,a){var s=(t.marker||{}).color;if(a("line.color",r),n(t,"line"))i(t,e,o,a,{prefix:"line.",cLetter:"c"});else{var l=(Array.isArray(s)?!1:s)||r;a("line.color",l)}a("line.width"),a("line.dash")}},{"../../components/colorscale/defaults":508,"../../components/colorscale/has_colorscale":511}],783:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes");e.exports=function(t,e){function r(e){var r=w.c2p(t[e].x),n=M.c2p(t[e].y);return r===S||n===S?!1:[r,n]}function i(t){var e=t[0]/w._length,r=t[1]/M._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*k}function o(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}var a,s,l,u,c,h,f,p,d,m,g,v,y,x,b,_,w=e.xaxis,M=e.yaxis,A=e.connectGaps,k=e.baseTolerance,T=e.linear,E=[],S=n.BADNUM,L=.2,z=new Array(t.length),I=0;for(a=0;ai(h))break;l=h,y=m[0]*d[0]+m[1]*d[1],y>g?(g=y,u=h,p=!1):v>y&&(v=y,c=h,p=!0)}if(p?(z[I++]=u,l!==c&&(z[I++]=c)):(c!==s&&(z[I++]=c),l!==u&&(z[I++]=u)),z[I++]=l,a>=t.length||!h)break;z[I++]=h,s=h}}else z[I++]=u}E.push(z.slice(0,I))}return E}},{"../../plots/cartesian/axes":607}],784:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=r("line.shape");"spline"===n&&r("line.smoothing")}},{}],785:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t){var e=t.marker,r=e.sizeref||1,i=e.sizemin||0,o="area"===e.sizemode?function(t){return Math.sqrt(t/r)}:function(t){return t/r};return function(t){var e=o(t/2);return n(e)&&e>0?Math.max(e,i):0}}},{"fast-isnumeric":99}],786:[function(t,e,r){"use strict";var n=t("../../components/color"),i=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults"),a=t("./subtypes");e.exports=function(t,e,r,s,l){var u,c=a.isBubble(t),h=(t.line||{}).color;h&&(r=h),l("marker.symbol"),l("marker.opacity",c?.7:1),l("marker.size"),l("marker.color",r),i(t,"marker")&&o(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u=h&&!Array.isArray(h)&&e.marker.color!==h?h:c?n.background:n.defaultLine,l("marker.line.color",u),i(t,"marker.line")&&o(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",c?1:0),c&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode"))}},{"../../components/color":498,"../../components/colorscale/defaults":508,"../../components/colorscale/has_colorscale":511,"./subtypes":790}],787:[function(t,e,r){"use strict";function n(t,e,r){var n=e.x(),o=e.y(),a=i.extent(n.range.map(n.l2c)),s=i.extent(o.range.map(o.l2c)); +r.forEach(function(t,e){var n=t[0].trace;if(u.hasMarkers(n)){var i=n.marker.maxdisplayed;if(0!==i){var o=t.filter(function(t){return t.x>=a[0]&&t.x<=a[1]&&t.y>=s[0]&&t.y<=s[1]}),l=Math.ceil(o.length/i),c=0;r.forEach(function(t,r){var n=t[0].trace;u.hasMarkers(n)&&n.marker.maxdisplayed>0&&e>r&&c++});var h=Math.round(c*l/3+Math.floor(c/3)*l/7.1);t.forEach(function(t){delete t.vis}),o.forEach(function(t,e){0===Math.round((e+h)%l)&&(t.vis=!0)})}}})}var i=t("d3"),o=t("../../lib"),a=t("../../components/drawing"),s=t("../../components/errorbars"),l=t("../../lib/polygon").tester,u=t("./subtypes"),c=t("./arrays_to_calcdata"),h=t("./line_points");e.exports=function(t,e,r){function f(t){return t.filter(function(t){return t.vis})}n(t,e,r);var p=e.x(),d=e.y(),m=e.plot.select(".scatterlayer").selectAll("g.trace.scatter").data(r);m.enter().append("g").attr("class","trace scatter").style("stroke-miterlimit",2),m.call(s.plot,e);var g,v,y,x,b="",_=[];m.each(function(t){var e=t[0].trace,r=e.line,n=i.select(this);if(e.visible===!0&&(v=e.fill.charAt(e.fill.length-1),"x"!==v&&"y"!==v&&(v=""),t[0].node3=n,c(t),u.hasLines(e)||"none"!==e.fill)){var o,s,f,m,w,M="",A="";g="tozero"===e.fill.substr(0,6)||"toself"===e.fill||"to"===e.fill.substr(0,2)&&!b?n.append("path").classed("js-fill",!0):null,x&&(y=x.datum(t)),x=n.append("path").classed("js-fill",!0),-1!==["hv","vh","hvh","vhv"].indexOf(r.shape)?(f=a.steps(r.shape),m=a.steps(r.shape.split("").reverse().join(""))):f=m="spline"===r.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?a.smoothclosed(t.slice(1),r.smoothing):a.smoothopen(t,r.smoothing)}:function(t){return"M"+t.join("L")},w=function(t){return m(t.reverse())};var k,T=h(t,{xaxis:p,yaxis:d,connectGaps:e.connectgaps,baseTolerance:Math.max(r.width||1,3)/4,linear:"linear"===r.shape}),E=e._polygons=new Array(T.length);for(k=0;k1&&n.append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").attr("d",o)}g?S&&z&&(v?("y"===v?S[1]=z[1]=d.c2p(0,!0):"x"===v&&(S[0]=z[0]=p.c2p(0,!0)),g.attr("d",M+"L"+z+"L"+S+"Z")):g.attr("d",M+"Z")):"tonext"===e.fill.substr(0,6)&&M&&b&&("tonext"===e.fill?y.attr("d",M+"Z"+b+"Z"):y.attr("d",M+"L"+b.substr(1)+"Z"),e._polygons=e._polygons.concat(_)),b=A,_=E}}}),m.selectAll("path:not([d])").remove(),m.append("g").attr("class","points").each(function(t){var e=t[0].trace,r=i.select(this),n=u.hasMarkers(e),s=u.hasText(e);!n&&!s||e.visible!==!0?r.remove():(n&&r.selectAll("path.point").data(e.marker.maxdisplayed?f:o.identity).enter().append("path").classed("point",!0).call(a.translatePoints,p,d),s&&r.selectAll("g").data(e.marker.maxdisplayed?f:o.identity).enter().append("g").append("text").call(a.translatePoints,p,d))})}},{"../../components/drawing":521,"../../components/errorbars":527,"../../lib":583,"../../lib/polygon":589,"./arrays_to_calcdata":770,"./line_points":783,"./subtypes":790,d3:90}],788:[function(t,e,r){"use strict";var n=t("./subtypes"),i=.2;e.exports=function(t,e){var r,o,a,s,l=t.cd,u=t.xaxis,c=t.yaxis,h=[],f=l[0].trace,p=f.index,d=f.marker,m=!n.hasMarkers(f)&&!n.hasText(f);if(f.visible===!0&&!m){var g=Array.isArray(d.opacity)?1:d.opacity;if(e===!1)for(r=0;rn;n++)r[n]=[t.lon[n],t.lat[n]];return{type:"LineString",coordinates:r,trace:t}}function o(t,e){function r(e){var r=t.mockAxis;return u.tickText(r,r.c2l(e),"hover").text+"\xb0"}var n=e.hoverinfo;if("none"===n)return function(t){delete t.textLabel};var i="all"===n?g.hoverinfo.flags:n.split("+"),o=-1!==i.indexOf("location")&&Array.isArray(e.locations),a=-1!==i.indexOf("lon"),s=-1!==i.indexOf("lat"),l=-1!==i.indexOf("text");return function(t){var n=[];o?n.push(t.location):a&&s?n.push("("+r(t.lon)+", "+r(t.lat)+")"):a?n.push("lon: "+r(t.lon)):s&&n.push("lat: "+r(t.lat)),l&&n.push(t.tx||e.text),t.textLabel=n.join("
")}}function a(t){var e=Array.isArray(t.locations);return function(r,n){return{points:[{data:t._input,fullData:t,curveNumber:t.index,pointNumber:n,lon:r.lon,lat:r.lat,location:e?r.location:null}]}}}var s=t("d3"),l=t("../../plots/cartesian/graph_interact"),u=t("../../plots/cartesian/axes"),c=t("../../lib/topojson_utils").getTopojsonFeatures,h=t("../../lib/geo_location_utils").locationToFeature,f=t("../../lib/array_to_calc_item"),p=t("../../components/color"),d=t("../../components/drawing"),m=t("../scatter/subtypes"),g=t("./attributes"),v=e.exports={};v.calcGeoJSON=function(t,e){var r,i,o,a,s=[],l=Array.isArray(t.locations);l?(a=t.locations,r=a.length,i=c(t,e),o=function(t,e){var r=h(t.locationmode,a[e],i);return void 0!==r?r.properties.ct:void 0}):(r=t.lon.length,o=function(t,e){return[t.lon[e],t.lat[e]]});for(var u=0;r>u;u++){var f=o(t,u);if(f){var p={lon:f[0],lat:f[1],location:l?t.locations[u]:null};n(t,p,u),s.push(p)}}return s.length>0&&(s[0].trace=t),s},v.plot=function(t,e){var r=t.framework.select(".scattergeolayer").selectAll("g.trace.scattergeo").data(e,function(t){return t.uid});r.enter().append("g").attr("class","trace scattergeo"),r.exit().remove(),r.selectAll("*").remove(),r.each(function(t){var e=s.select(this);m.hasLines(t)&&e.selectAll("path.js-line").data([i(t)]).enter().append("path").classed("js-line",!0)}),r.each(function(e){function r(r,n){if(t.showHover){var i=t.projection([r.lon,r.lat]);f(r),l.loneHover({x:i[0],y:i[1],name:g?e.name:void 0,text:r.textLabel,color:r.mc||(e.marker||{}).color},{container:t.hoverContainer.node()}),y=p(r,n),t.graphDiv.emit("plotly_hover",y)}}function n(e,r){t.graphDiv.emit("plotly_click",p(e,r))}var i=s.select(this),u=m.hasMarkers(e),c=m.hasText(e);if(u||c){var h=v.calcGeoJSON(e,t.topojson),f=o(t,e),p=a(e),d=e.hoverinfo,g="all"===d||-1!==d.indexOf("name"),y=null;u&&i.selectAll("path.point").data(h).enter().append("path").classed("point",!0).on("mouseover",r).on("click",n).on("mouseout",function(){l.loneUnhover(t.hoverContainer),t.graphDiv.emit("plotly_unhover",y)}).on("mousedown",function(){l.loneUnhover(t.hoverContainer)}).on("mouseup",r),c&&i.selectAll("g").data(h).enter().append("g").append("text")}}),v.style(t)},v.style=function(t){var e=t.framework.selectAll("g.trace.scattergeo");e.style("opacity",function(t){return t.opacity}),e.each(function(t){s.select(this).selectAll("path.point").call(d.pointStyle,t),s.select(this).selectAll("text").call(d.textPointStyle,t)}),e.selectAll("path.js-line").style("fill","none").each(function(t){var e=t.trace,r=e.line||{};s.select(this).call(p.stroke,r.color).call(d.dashLine,r.dash||"",r.width||0)})}},{"../../components/color":498,"../../components/drawing":521,"../../lib/array_to_calc_item":574,"../../lib/geo_location_utils":580,"../../lib/topojson_utils":597,"../../plots/cartesian/axes":607,"../../plots/cartesian/graph_interact":614,"../scatter/subtypes":790,"./attributes":793,d3:90}],798:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../components/colorscale/color_attributes"),o=t("../../constants/gl2d_dashes"),a=t("../../constants/gl_markers"),s=t("../../lib/extend").extendFlat,l=t("../../lib/extend").extendDeep,u=n.line,c=n.marker,h=c.line;e.exports={x:n.x,x0:n.x0,dx:n.dx,y:n.y,y0:n.y0,dy:n.dy,text:s({},n.text,{}),mode:{valType:"flaglist",flags:["lines","markers"],extras:["none"]},line:{color:u.color,width:u.width,dash:{valType:"enumerated",values:Object.keys(o),dflt:"solid"}},marker:l({},i("marker"),{symbol:{valType:"enumerated",values:Object.keys(a),dflt:"circle",arrayOk:!0},size:c.size,sizeref:c.sizeref,sizemin:c.sizemin,sizemode:c.sizemode,opacity:c.opacity,showscale:c.showscale,line:l({},i("marker.line"),{width:h.width})}),connectgaps:n.connectgaps,fill:s({},n.fill,{values:["none","tozeroy","tozerox"]}),fillcolor:n.fillcolor,_nestedModules:{error_x:"ErrorBars",error_y:"ErrorBars","marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":506,"../../constants/gl2d_dashes":567,"../../constants/gl_markers":569,"../../lib/extend":578,"../scatter/attributes":771}],799:[function(t,e,r){"use strict";function n(t,e){this.scene=t,this.uid=e,this.type="scattergl",this.pickXData=[],this.pickYData=[],this.xData=[],this.yData=[],this.textLabels=[],this.color="rgb(0, 0, 0)",this.name="",this.hoverinfo="all",this.connectgaps=!0,this.idToIndex=[],this.bounds=[0,0,0,0],this.hasLines=!1,this.lineOptions={positions:new Float32Array(0),color:[0,0,0,1],width:1,fill:[!1,!1,!1,!1],fillColor:[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],dashes:[1]},this.line=p(t.glplot,this.lineOptions),this.line._trace=this,this.hasErrorX=!1,this.errorXOptions={positions:new Float32Array(0),errors:new Float32Array(0),lineWidth:1,capSize:0,color:[0,0,0,1]},this.errorX=d(t.glplot,this.errorXOptions),this.errorX._trace=this,this.hasErrorY=!1,this.errorYOptions={positions:new Float32Array(0),errors:new Float32Array(0),lineWidth:1,capSize:0,color:[0,0,0,1]},this.errorY=d(t.glplot,this.errorYOptions),this.errorY._trace=this,this.hasMarkers=!1,this.scatterOptions={positions:new Float32Array(0),sizes:[],colors:[],glyphs:[],borderWidths:[],borderColors:[],size:12,color:[0,0,0,1],borderSize:1,borderColor:[0,0,0,1]},this.scatter=h(t.glplot,this.scatterOptions),this.scatter._trace=this,this.fancyScatter=f(t.glplot,this.scatterOptions),this.fancyScatter._trace=this}function i(t,e,r){return Array.isArray(e)||(e=[e]),o(t,e,r)}function o(t,e,r){for(var n=new Array(r),i=e[0],o=0;r>o;++o)n[o]=t(o>=e.length?i:e[o]);return n}function a(t,e,r){return l(L(t,r),S(e,r),r)}function s(t,e,r,n){var i=b(t,e,n);return i=Array.isArray(i[0])?i:o(g.identity,[i],n),l(i,S(r,n),n)}function l(t,e,r){for(var n=new Array(4*r),i=0;r>i;++i){for(var o=0;3>o;++o)n[4*i+o]=t[i][o];n[4*i+3]=t[i][3]*e[i]}return n}function u(t,e){if(void 0===Float32Array.slice){for(var r=new Float32Array(e),n=0;e>n;n++)r[n]=t[n];return r}return t.slice(0,e)}function c(t,e){var r=new n(t,e.uid);return r.update(e),r}var h=t("gl-scatter2d"),f=t("gl-scatter2d-fancy"),p=t("gl-line2d"),d=t("gl-error2d"),m=t("fast-isnumeric"),g=t("../../lib"),v=t("../../plots/cartesian/axes"),y=t("../../components/errorbars"),x=t("../../lib/str2rgbarray"),b=t("../../lib/gl_format_color"),_=t("../scatter/subtypes"),w=t("../scatter/make_bubble_size_func"),M=t("../scatter/get_trace_color"),A=t("../../constants/gl_markers"),k=t("../../constants/gl2d_dashes"),T=["xaxis","yaxis"],E=n.prototype;E.handlePick=function(t){var e=t.pointId;return(t.object!==this.line||this.connectgaps)&&(e=this.idToIndex[t.pointId]),{trace:this,dataCoord:t.dataCoord,traceCoord:[this.pickXData[e],this.pickYData[e]],textLabel:Array.isArray(this.textLabels)?this.textLabels[e]:this.textLabels,color:Array.isArray(this.color)?this.color[e]:this.color,name:this.name,hoverinfo:this.hoverinfo}},E.isFancy=function(t){if("linear"!==this.scene.xaxis.type)return!0;if("linear"!==this.scene.yaxis.type)return!0;if(!t.x||!t.y)return!0;if(this.hasMarkers){var e=t.marker||{};if(Array.isArray(e.symbol)||"circle"!==e.symbol||Array.isArray(e.size)||Array.isArray(e.color)||Array.isArray(e.line.width)||Array.isArray(e.line.color)||Array.isArray(e.opacity))return!0}return this.hasLines&&!this.connectgaps?!0:this.hasErrorX?!0:!!this.hasErrorY};var S=i.bind(null,function(t){return+t}),L=i.bind(null,x),z=i.bind(null,function(t){return A[t]||"\u25cf"});E.update=function(t){t.visible!==!0?(this.hasLines=!1,this.hasErrorX=!1,this.hasErrorY=!1,this.hasMarkers=!1):(this.hasLines=_.hasLines(t),this.hasErrorX=t.error_x.visible===!0,this.hasErrorY=t.error_y.visible===!0,this.hasMarkers=_.hasMarkers(t)),this.textLabels=t.text,this.name=t.name,this.hoverinfo=t.hoverinfo,this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.connectgaps=!!t.connectgaps,this.isFancy(t)?this.updateFancy(t):this.updateFast(t),this.color=M(t,{})},E.updateFast=function(t){for(var e,r,n=this.xData=this.pickXData=t.x,i=this.yData=this.pickYData=t.y,o=n.length,a=new Array(o),s=new Float32Array(2*o),l=this.bounds,c=0,h=0,f=0;o>f;++f)e=n[f],r=i[f],m(e)&&m(r)&&(a[c++]=f,s[h++]=e,s[h++]=r,l[0]=Math.min(l[0],e),l[1]=Math.min(l[1],r),l[2]=Math.max(l[2],e),l[3]=Math.max(l[3],r));s=u(s,h),this.idToIndex=a,this.updateLines(t,s),this.updateError("X",t),this.updateError("Y",t);var p;if(this.hasMarkers){this.scatterOptions.positions=s;var d=x(t.marker.color),g=x(t.marker.line.color),v=t.opacity*t.marker.opacity;d[3]*=v,this.scatterOptions.color=d,g[3]*=v,this.scatterOptions.borderColor=g,p=t.marker.size,this.scatterOptions.size=p,this.scatterOptions.borderSize=t.marker.line.width,this.scatter.update(this.scatterOptions)}else this.scatterOptions.positions=new Float32Array(0),this.scatterOptions.glyphs=[],this.scatter.update(this.scatterOptions);this.scatterOptions.positions=new Float32Array(0),this.scatterOptions.glyphs=[],this.fancyScatter.update(this.scatterOptions),this.expandAxesFast(l,p)},E.updateFancy=function(t){var e=this.scene,r=e.xaxis,n=e.yaxis,o=this.bounds,a=this.pickXData=r.makeCalcdata(t,"x").slice(),l=this.pickYData=n.makeCalcdata(t,"y").slice();this.xData=a.slice(),this.yData=l.slice();var c,h,f,p,d,m,g,v,x=y.calcFromTrace(t,e.fullLayout),b=a.length,_=new Array(b),M=new Float32Array(2*b),A=new Float32Array(4*b),k=new Float32Array(4*b),T=0,E=0,L=0,I=0,P="log"===r.type?function(t){return r.d2l(t)}:function(t){return t},C="log"===n.type?function(t){return n.d2l(t)}:function(t){return t};for(c=0;b>c;++c)this.xData[c]=f=P(a[c]),this.yData[c]=p=C(l[c]),isNaN(f)||isNaN(p)||(_[T++]=c,M[E++]=f,M[E++]=p,d=A[L++]=f-x[c].xs||0,m=A[L++]=x[c].xh-f||0,A[L++]=0,A[L++]=0,k[I++]=0,k[I++]=0,g=k[I++]=p-x[c].ys||0,v=k[I++]=x[c].yh-p||0,o[0]=Math.min(o[0],f-d),o[1]=Math.min(o[1],p-g),o[2]=Math.max(o[2],f+m),o[3]=Math.max(o[3],p+v));M=u(M,E),this.idToIndex=_,this.updateLines(t,M),this.updateError("X",t,M,A),this.updateError("Y",t,M,k);var R;if(this.hasMarkers){this.scatterOptions.positions=M,this.scatterOptions.sizes=new Array(T),this.scatterOptions.glyphs=new Array(T),this.scatterOptions.borderWidths=new Array(T),this.scatterOptions.colors=new Array(4*T),this.scatterOptions.borderColors=new Array(4*T);var D,O=w(t),j=t.marker,F=j.opacity,N=t.opacity,B=s(j,F,N,b),U=z(j.symbol,b),V=S(j.line.width,b),q=s(j.line,F,N,b);for(R=i(O,j.size,b),c=0;T>c;++c)for(D=_[c],this.scatterOptions.sizes[c]=4*R[D],this.scatterOptions.glyphs[c]=U[D],this.scatterOptions.borderWidths[c]=.5*V[D],h=0;4>h;++h)this.scatterOptions.colors[4*c+h]=B[4*D+h],this.scatterOptions.borderColors[4*c+h]=q[4*D+h];this.fancyScatter.update(this.scatterOptions)}else this.scatterOptions.positions=new Float32Array(0),this.scatterOptions.glyphs=[],this.fancyScatter.update(this.scatterOptions);this.scatterOptions.positions=new Float32Array(0),this.scatterOptions.glyphs=[],this.scatter.update(this.scatterOptions),this.expandAxesFancy(a,l,R)},E.updateLines=function(t,e){var r;if(this.hasLines){var n=e;if(!t.connectgaps){var i=0,o=this.xData,s=this.yData;for(n=new Float32Array(2*o.length),r=0;ra;a++)r=this.scene[T[a]],n=r._min,n||(n=[]),n.push({val:t[a],pad:o}),i=r._max,i||(i=[]),i.push({val:t[a+2],pad:o})},E.expandAxesFancy=function(t,e,r){var n=this.scene,i={padded:!0,ppad:r};v.expand(n.xaxis,t,i),v.expand(n.yaxis,e,i)},E.dispose=function(){this.line.dispose(),this.errorX.dispose(),this.errorY.dispose(),this.scatter.dispose(),this.fancyScatter.dispose()},e.exports=c},{"../../components/errorbars":527,"../../constants/gl2d_dashes":567,"../../constants/gl_markers":569,"../../lib":583,"../../lib/gl_format_color":581,"../../lib/str2rgbarray":595,"../../plots/cartesian/axes":607,"../scatter/get_trace_color":779,"../scatter/make_bubble_size_func":785,"../scatter/subtypes":790,"fast-isnumeric":99,"gl-error2d":125,"gl-line2d":132,"gl-scatter2d":184,"gl-scatter2d-fancy":179}],800:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../scatter/constants"),o=t("../scatter/subtypes"),a=t("../scatter/xy_defaults"),s=t("../scatter/marker_defaults"),l=t("../scatter/line_defaults"),u=t("../scatter/fillcolor_defaults"),c=t("../../components/errorbars/defaults"),h=t("./attributes");e.exports=function(t,e,r,f){function p(r,i){return n.coerce(t,e,h,r,i)}var d=a(t,e,p);return d?(p("text"),p("mode",db;b++){var _=e.lon[b],w=e.lat[b];if(n(_)&&n(w)){var M={};if(x++,M.lonlat=[+_,+w],h){if(f){var A=c.color[b];M.mc=A,M.mcc=g(A)}if(p){var k=c.size[b];M.ms=k,M.mrc=v(k)}if(d){var T=c.symbol[b];M.mx="string"==typeof T?T:"circle"}}if(m){var E=e.text[b];M.tx="string"==typeof E?E:""}y.push(M)}else x>0&&(y[x-1].gapAfter=!0)}return y}},{"../../components/colorscale/has_colorscale":511,"../../components/colorscale/make_scale_function":515,"../../lib":583,"../scatter/colorscale_calc":775,"../scatter/make_bubble_size_func":785,"../scatter/subtypes":790,"fast-isnumeric":99}],804:[function(t,e,r){"use strict";function n(){return{geojson:i(),layout:{visibility:"none"},paint:{}}}function i(){return{type:"Point",coordinates:[]}}function o(t,e){if(1===e.length)return{type:"Polygon",coordinates:e};for(var r=new Array(e.length),n=0;n0&&(n.push(i),i=[])}return n.push(i),n}function f(t){return Array.isArray(t)?function(t){return t}:t?function(){return t}:p}function p(){return""}var d=t("../../lib"),m=t("../scatter/subtypes"),g=t("../../plots/mapbox/convert_text_opts"),v="circle-color",y="circle-radius";e.exports=function(t){var e=t[0].trace,r=e.visible===!0,i="none"!==e.fill,f=m.hasLines(e),p=m.hasMarkers(e),x=m.hasText(e),b=p&&"circle"===e.marker.symbol,_=p&&"circle"!==e.marker.symbol,w=n(),M=n(),A=n(),k=n(),T={fill:w,line:M,circle:A,symbol:k};if(!r)return T;var E;if((i||f)&&(E=h(t)),i&&(w.geojson=o(t,E),w.layout.visibility="visible",d.extendFlat(w.paint,{"fill-color":e.fillcolor})),f&&(M.geojson=a(t,E),M.layout.visibility="visible",d.extendFlat(M.paint,{"line-width":e.line.width,"line-color":e.line.color,"line-opacity":e.opacity})),b){var S={};S[v]={},S[y]={},A.geojson=s(t,S),A.layout.visibility="visible",d.extendFlat(A.paint,{"circle-opacity":e.opacity*e.marker.opacity,"circle-color":u(e,S),"circle-radius":c(e,S)})}if((_||x)&&(k.geojson=l(t),d.extendFlat(k.layout,{visibility:"visible","icon-image":"{symbol}-15","text-field":"{text}"}),_&&(d.extendFlat(k.layout,{"icon-size":e.marker.size/10}),d.extendFlat(k.paint,{"icon-opacity":e.opacity*e.marker.opacity,"icon-color":e.marker.color})),x)){var L=(e.marker||{}).size,z=g(e.textposition,L);d.extendFlat(k.layout,{"text-size":e.textfont.size,"text-anchor":z.anchor,"text-offset":z.offset}),d.extendFlat(k.paint,{"text-color":e.textfont.color,"text-opacity":e.opacity})}return T}},{"../../lib":583,"../../plots/mapbox/convert_text_opts":657,"../scatter/subtypes":790}],805:[function(t,e,r){"use strict";function n(t,e,r){var n=r("lon")||[],i=r("lat")||[],o=Math.min(n.length,i.length);return o")}var i=t("../../plots/cartesian/graph_interact"),o=t("../scatter/get_trace_color");e.exports=function(t,e,r){function a(t){var e=t.lonlat,n=Math.abs(u.c2p(e)-u.c2p([p,e[1]])),i=Math.abs(c.c2p(e)-c.c2p([e[0],r])),o=Math.max(3,t.mrc||0);return Math.max(Math.sqrt(n*n+i*i)-o,1-3/o)}var s=t.cd,l=s[0].trace,u=t.xa,c=t.ya,h=e>=0?Math.floor((e+180)/360):Math.ceil((e-180)/360),f=360*h,p=e-f;if(i.getClosest(s,a,t),t.index!==!1){var d=s[t.index],m=d.lonlat,g=[m[0]+f,m[1]],v=u.c2p(g),y=c.c2p(g),x=d.mrc||1;return t.x0=v-x,t.x1=v+x,t.y0=y-x,t.y1=y+x,t.color=o(l,d),t.extraText=n(l,d),[t]}}},{"../../plots/cartesian/graph_interact":614,"../scatter/get_trace_color":779}],807:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.hoverPoints=t("./hover"),n.plot=t("./plot"),n.moduleType="trace",n.name="scattermapbox",n.basePlotModule=t("../../plots/mapbox"),n.categories=["mapbox","gl","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../plots/mapbox":658,"../scatter/colorbar":774,"./attributes":802,"./calc":803,"./defaults":805,"./hover":806,"./plot":808}],808:[function(t,e,r){"use strict";function n(t,e){this.mapbox=t,this.map=t.map,this.uid=e,this.idSourceFill=e+"-source-fill",this.idSourceLine=e+"-source-line",this.idSourceCircle=e+"-source-circle",this.idSourceSymbol=e+"-source-symbol",this.idLayerFill=e+"-layer-fill",this.idLayerLine=e+"-layer-line",this.idLayerCircle=e+"-layer-circle",this.idLayerSymbol=e+"-layer-symbol",this.mapbox.initSource(this.idSourceFill),this.mapbox.initSource(this.idSourceLine),this.mapbox.initSource(this.idSourceCircle),this.mapbox.initSource(this.idSourceSymbol),this.map.addLayer({id:this.idLayerFill,source:this.idSourceFill,type:"fill"}),this.map.addLayer({id:this.idLayerLine,source:this.idSourceLine,type:"line"}),this.map.addLayer({id:this.idLayerCircle, +source:this.idSourceCircle,type:"circle"}),this.map.addLayer({id:this.idLayerSymbol,source:this.idSourceSymbol,type:"symbol"})}function i(t){return"visible"===t.layout.visibility}var o=t("./convert"),a=n.prototype;a.update=function(t){var e=this.mapbox,r=o(t);e.setOptions(this.idLayerFill,"setLayoutProperty",r.fill.layout),e.setOptions(this.idLayerLine,"setLayoutProperty",r.line.layout),e.setOptions(this.idLayerCircle,"setLayoutProperty",r.circle.layout),e.setOptions(this.idLayerSymbol,"setLayoutProperty",r.symbol.layout),i(r.fill)&&(e.setSourceData(this.idSourceFill,r.fill.geojson),e.setOptions(this.idLayerFill,"setPaintProperty",r.fill.paint)),i(r.line)&&(e.setSourceData(this.idSourceLine,r.line.geojson),e.setOptions(this.idLayerLine,"setPaintProperty",r.line.paint)),i(r.circle)&&(e.setSourceData(this.idSourceCircle,r.circle.geojson),e.setOptions(this.idLayerCircle,"setPaintProperty",r.circle.paint)),i(r.symbol)&&(e.setSourceData(this.idSourceSymbol,r.symbol.geojson),e.setOptions(this.idLayerSymbol,"setPaintProperty",r.symbol.paint))},a.dispose=function(){var t=this.map;t.removeLayer(this.idLayerFill),t.removeLayer(this.idLayerLine),t.removeLayer(this.idLayerCircle),t.removeLayer(this.idLayerSymbol),t.removeSource(this.idSourceFill),t.removeSource(this.idSourceLine),t.removeSource(this.idSourceCircle),t.removeSource(this.idSourceSymbol)},e.exports=function(t,e){var r=e[0].trace,i=new n(t,r.uid);return i.update(e),i}},{"./convert":804}],809:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../plots/attributes"),o=t("../../components/colorscale/color_attributes"),a=t("../../lib/extend").extendFlat,s=n.marker,l=n.line,u=s.line;e.exports={a:{valType:"data_array"},b:{valType:"data_array"},c:{valType:"data_array"},sum:{valType:"number",dflt:0,min:0},mode:a({},n.mode,{dflt:"markers"}),text:a({},n.text,{}),line:{color:l.color,width:l.width,dash:l.dash,shape:a({},l.shape,{values:["linear","spline"]}),smoothing:l.smoothing},connectgaps:n.connectgaps,fill:a({},n.fill,{values:["none","toself","tonext"]}),fillcolor:n.fillcolor,marker:a({},{symbol:s.symbol,opacity:s.opacity,maxdisplayed:s.maxdisplayed,size:s.size,sizeref:s.sizeref,sizemin:s.sizemin,sizemode:s.sizemode,showscale:s.showscale,line:a({},{width:u.width},o("marker".line))},o("marker")),textfont:n.textfont,textposition:n.textposition,hoverinfo:a({},i.hoverinfo,{flags:["a","b","c","text","name"]}),hoveron:n.hoveron,_nestedModules:{"marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":506,"../../lib/extend":578,"../../plots/attributes":605,"../scatter/attributes":771}],810:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/cartesian/axes"),o=t("../../lib"),a=t("../scatter/subtypes"),s=t("../scatter/colorscale_calc"),l=["a","b","c"],u={a:["b","c"],b:["a","c"],c:["a","b"]};e.exports=function(t,e){var r,c,h,f,p,d,m=t._fullLayout[e.subplot],g=m.sum,v=e.sum||g;for(r=0;rr;r++)y=e.a[r],x=e.b[r],b=e.c[r],n(y)&&n(x)&&n(b)?(y=+y,x=+x,b=+b,_=g/(y+x+b),1!==_&&(y*=_,x*=_,b*=_),M=y,w=b-x,k[r]={x:w,y:M,a:y,b:x,c:b}):k[r]={x:!1,y:!1};var T,E;if(a.hasMarkers(e)&&(T=e.marker,E=T.size,Array.isArray(E))){var S={type:"linear"};i.setConvert(S),E=S.makeCalcdata(e.marker,"size"),E.length>A&&E.splice(A,E.length-A)}return s(e),void 0!==typeof E&&o.mergeArray(E,k,"ms"),k}},{"../../lib":583,"../../plots/cartesian/axes":607,"../scatter/colorscale_calc":775,"../scatter/subtypes":790,"fast-isnumeric":99}],811:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../scatter/constants"),o=t("../scatter/subtypes"),a=t("../scatter/marker_defaults"),s=t("../scatter/line_defaults"),l=t("../scatter/line_shape_defaults"),u=t("../scatter/text_defaults"),c=t("../scatter/fillcolor_defaults"),h=t("./attributes");e.exports=function(t,e,r,f){function p(r,i){return n.coerce(t,e,h,r,i)}var d,m=p("a"),g=p("b"),v=p("c");if(m?(d=m.length,g?(d=Math.min(d,g.length),v&&(d=Math.min(d,v.length))):d=v?Math.min(d,v.length):0):g&&v&&(d=Math.min(g.length,v.length)),!d)return void(e.visible=!1);m&&d"),s}}},{"../../plots/cartesian/axes":607,"../scatter/hover":780}],813:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.moduleType="trace",n.name="scatterternary",n.basePlotModule=t("../../plots/ternary"),n.categories=["ternary","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../plots/ternary":670,"../scatter/colorbar":774,"./attributes":809,"./calc":810,"./defaults":811,"./hover":812,"./plot":814,"./select":815,"./style":816}],814:[function(t,e,r){"use strict";var n=t("../scatter/plot");e.exports=function(t,e){var r=t.plotContainer;r.select(".scatterlayer").selectAll("*").remove();for(var i={x:function(){return t.xaxis},y:function(){return t.yaxis},plot:r},o=new Array(e.length),a=t.graphDiv.calcdata,s=0;se){for(var r=m/e,n=[0|Math.floor(t[0].shape[0]*r+1),0|Math.floor(t[0].shape[1]*r+1)],i=n[0]*n[1],a=0;ar;++r)this.showContour[r]&&(e=!0,t[r]=this.scene.contourLevels[r]);e&&this.surface.update({levels:t})},g.update=function(t){var e,r=this.scene,n=r.fullSceneLayout,o=this.surface,s=t.opacity,l=i(t.colorscale,s),c=t.z,f=t.x,p=t.y,m=n.xaxis,g=n.yaxis,v=n.zaxis,y=r.dataScale,x=c[0].length,b=c.length,_=[u(new Float32Array(x*b),[x,b]),u(new Float32Array(x*b),[x,b]),u(new Float32Array(x*b),[x,b])],w=_[0],M=_[1],A=r.contourLevels;this.data=t,h(_[2],function(t,e){return v.d2l(c[e][t])*y[2]}),Array.isArray(f[0])?h(w,function(t,e){return m.d2l(f[e][t])*y[0]}):h(w,function(t){return m.d2l(f[t])*y[0]}),Array.isArray(p[0])?h(M,function(t,e){return g.d2l(p[e][t])*y[1]}):h(M,function(t,e){return g.d2l(p[e])*y[1]});var k={colormap:l,levels:[[],[],[]],showContour:[!0,!0,!0],showSurface:!t.hidesurface,contourProject:[[!1,!1,!1],[!1,!1,!1],[!1,!1,!1]],contourWidth:[1,1,1],contourColor:[[1,1,1,1],[1,1,1,1],[1,1,1,1]],contourTint:[1,1,1],dynamicColor:[[1,1,1,1],[1,1,1,1],[1,1,1,1]],dynamicWidth:[1,1,1],dynamicTint:[1,1,1],opacity:1};if(k.intensityBounds=[t.cmin,t.cmax],t.surfacecolor){var T=u(new Float32Array(x*b),[x,b]);h(T,function(e,r){return t.surfacecolor[r][e]}),_.push(T)}else k.intensityBounds[0]*=y[2],k.intensityBounds[1]*=y[2];this.dataScale=a(_),t.surfacecolor&&(k.intensity=_.pop()),"opacity"in t&&t.opacity<1&&(k.opacity=.25*t.opacity);var E=[!0,!0,!0],S=["x","y","z"];for(e=0;3>e;++e){var L=t.contours[S[e]];E[e]=L.highlight,k.showContour[e]=L.show||L.highlight,k.showContour[e]&&(k.contourProject[e]=[L.project.x,L.project.y,L.project.z],L.show?(this.showContour[e]=!0,k.levels[e]=A[e],o.highlightColor[e]=k.contourColor[e]=d(L.color),L.usecolormap?o.highlightTint[e]=k.contourTint[e]=0:o.highlightTint[e]=k.contourTint[e]=1,k.contourWidth[e]=L.width):this.showContour[e]=!1,L.highlight&&(k.dynamicColor[e]=d(L.highlightcolor),k.dynamicWidth[e]=L.highlightwidth))}k.coords=_,o.update(k),o.visible=t.visible,o.enableDynamic=E,o.snapToData=!0,"lighting"in t&&(o.ambientLight=t.lighting.ambient,o.diffuseLight=t.lighting.diffuse,o.specularLight=t.lighting.specular,o.roughness=t.lighting.roughness,o.fresnel=t.lighting.fresnel),"lightposition"in t&&(o.lightPosition=[t.lightposition.x,t.lightposition.y,t.lightposition.z]),s&&1>s&&(o.supportsTransparency=!0)},g.dispose=function(){this.scene.glplot.remove(this.surface),this.surface.dispose()},e.exports=s},{"../../lib/str2rgbarray":595,"gl-surface3d":202,ndarray:399,"ndarray-fill":389,"ndarray-homography":391,"ndarray-ops":393,tinycolor2:461}],821:[function(t,e,r){"use strict";function n(t,e,r){e in t&&!(r in t)&&(t[r]=t[e])}var i=t("../../lib"),o=t("../../components/colorscale/defaults"),a=t("./attributes");e.exports=function(t,e,r,s){function l(r,n){return i.coerce(t,e,a,r,n)}var u,c,h=l("z");if(!h)return void(e.visible=!1);var f=h[0].length,p=h.length;if(l("x"),l("y"),!Array.isArray(e.x))for(e.x=[],u=0;f>u;++u)e.x[u]=u;if(l("text"),!Array.isArray(e.y))for(e.y=[],u=0;p>u;++u)e.y[u]=u;["lighting.ambient","lighting.diffuse","lighting.specular","lighting.roughness","lighting.fresnel","lightposition.x","lightposition.y","lightposition.z","hidesurface","opacity"].forEach(function(t){l(t)});var d=l("surfacecolor");l("colorscale");var m=["x","y","z"];for(u=0;3>u;++u){var g="contours."+m[u],v=l(g+".show"),y=l(g+".highlight");if(v||y)for(c=0;3>c;++c)l(g+".project."+m[c]);v&&(l(g+".color"),l(g+".width"),l(g+".usecolormap")),y&&(l(g+".highlightcolor"),l(g+".highlightwidth"))}d||(n(t,"zmin","cmin"),n(t,"zmax","cmax"),n(t,"zauto","cauto")),o(t,e,s,l,{prefix:"",cLetter:"c"})}},{"../../components/colorscale/defaults":508,"../../lib":583,"./attributes":817}],822:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("./colorbar"),n.calc=t("./calc"),n.plot=t("./convert"),n.moduleType="trace",n.name="surface",n.basePlotModule=t("../../plots/gl3d"),n.categories=["gl3d","noOpacity"],n.meta={},e.exports=n},{"../../plots/gl3d":643,"./attributes":817,"./calc":818,"./colorbar":819,"./convert":820,"./defaults":821}]},{},[12])(12)}); \ No newline at end of file diff --git a/package.json b/package.json index 9a8d4f84816..cf2288c8e41 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "plotly.js", - "version": "1.16.3-d15", + "version": "1.16.3-d16", "description": "The open source javascript graphing library that powers plotly", "license": "MIT", "main": "./lib/index.js", diff --git a/src/assets/geo_assets.js b/src/assets/geo_assets.js index 222218aa367..1191900d1f7 100644 --- a/src/assets/geo_assets.js +++ b/src/assets/geo_assets.js @@ -12,6 +12,6 @@ var saneTopojson = require('sane-topojson'); // package version injected by `npm run preprocess` -exports.version = '1.16.3-d15'; +exports.version = '1.16.3-d16'; exports.topojson = saneTopojson; diff --git a/src/core.js b/src/core.js index 5bdf4d0ab64..5eef1a6e4c2 100644 --- a/src/core.js +++ b/src/core.js @@ -15,7 +15,7 @@ var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.16.3-d15'; +exports.version = '1.16.3-d16'; // plot api exports.plot = Plotly.plot;