wavelib/js/plotly.min.js
2016-05-29 17:31:40 +05:30

44 lines
1.1 MiB

/**
* plotly.js v1.5.0
* Copyright 2012-2016, Plotly, Inc.
* All rights reserved.
* Licensed under the MIT license
*/
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Plotly=t()}}(function(){var t;return function e(t,r,n){function i(a,s){if(!r[a]){if(!t[a]){var l="function"==typeof require&&require;if(!s&&l)return l(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var u=r[a]={exports:{}};t[a][0].call(u.exports,function(e){var r=t[a][1][e];return i(r?r:e)},u,u.exports,e,t,r,n)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;a<n.length;a++)i(n[a]);return i}({1:[function(t,e,r){"use strict";var n=t("../src/plotly"),i={"X,X div":"font-family:'Open Sans', verdana, arial, sans-serif;margin:0;padding:0;","X input,X button":"font-family:'Open Sans', verdana, arial, sans-serif;","X input:focus,X button:focus":"outline:none;","X a":"text-decoration:none;","X a:hover":"text-decoration:none;","X .crisp":"shape-rendering:crispEdges;","X svg a":"fill:#447adb;","X svg a:hover":"fill:#3c6dc5;","X .main-svg":"position:absolute;top:0;left:0;pointer-events:none;","X .main-svg .draglayer":"pointer-events:all;","X .cursor-pointer":"cursor:pointer;","X .cursor-crosshair":"cursor:crosshair;","X .cursor-move":"cursor:move;","X .cursor-col-resize":"cursor:col-resize;","X .cursor-row-resize":"cursor:row-resize;","X .cursor-ns-resize":"cursor:ns-resize;","X .cursor-ew-resize":"cursor:ew-resize;","X .cursor-sw-resize":"cursor:sw-resize;","X .cursor-s-resize":"cursor:s-resize;","X .cursor-se-resize":"cursor:se-resize;","X .cursor-w-resize":"cursor:w-resize;","X .cursor-e-resize":"cursor:e-resize;","X .cursor-nw-resize":"cursor:nw-resize;","X .cursor-n-resize":"cursor:n-resize;","X .cursor-ne-resize":"cursor:ne-resize;","X .modebar":"position:absolute;top:2px;right:2px;z-index:1001;background:rgba(255,255,255,0.7);","X .modebar--hover":"opacity:0;-webkit-transition:opacity 0.3s ease 0s;-moz-transition:opacity 0.3s ease 0s;-ms-transition:opacity 0.3s ease 0s;-o-transition:opacity 0.3s ease 0s;transition:opacity 0.3s ease 0s;","X:hover .modebar--hover":"opacity:1;","X .modebar-group":"float:left;display:inline-block;box-sizing:border-box;margin-left:8px;position:relative;vertical-align:middle;white-space:nowrap;","X .modebar-group:first-child":"margin-left:0px;","X .modebar-btn":"position:relative;font-size:16px;padding:3px 4px;cursor:pointer;line-height:normal;box-sizing:border-box;","X .modebar-btn svg":"position:relative;top:2px;","X .modebar-btn path":"fill:rgba(0,31,95,0.3);","X .modebar-btn.active path,X .modebar-btn:hover path":"fill:rgba(0,22,72,0.5);","X .modebar-btn.modebar-btn--logo":"padding:3px 1px;","X .modebar-btn.modebar-btn--logo path":"fill:#447adb !important;","X [data-title]:before,X [data-title]:after":"position:absolute;-webkit-transform:translate3d(0, 0, 0);-moz-transform:translate3d(0, 0, 0);-ms-transform:translate3d(0, 0, 0);-o-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0);display:none;opacity:0;z-index:1001;pointer-events:none;top:110%;right:50%;","X [data-title]:hover:before,X [data-title]:hover:after":"display:block;opacity:1;","X [data-title]:before":"content:'';position:absolute;background:transparent;border:6px solid transparent;z-index:1002;margin-top:-12px;border-bottom-color:#69738a;margin-right:-6px;","X [data-title]:after":"content:attr(data-title);background:#69738a;color:white;padding:8px 10px;font-size:12px;line-height:12px;white-space:nowrap;margin-right:-18px;border-radius:2px;","X .select-outline":"fill:none;stroke-width:1;shape-rendering:crispEdges;","X .select-outline-1":"stroke:white;","X .select-outline-2":"stroke:black;stroke-dasharray:2px 2px;",Y:"font-family:'Open Sans';position:fixed;top:50px;right:20px;z-index:10000;font-size:10pt;max-width:180px;","Y p":"margin:0;","Y .notifier-note":"min-width:180px;max-width:250px;border:1px solid #fff;z-index:3000;margin:0;background-color:#8c97af;background-color:rgba(140,151,175,0.9);color:#fff;padding:10px;","Y .notifier-close":"color:#fff;opacity:0.8;float:right;padding:0 5px;background:none;border:none;font-size:20px;font-weight:bold;line-height:20px;","Y .notifier-close:hover":"color:#444;text-decoration:none;cursor:pointer;"};for(var o in i){var a=o.replace(/^,/," ,").replace(/X/g,".js-plotly-plot .plotly").replace(/Y/g,".plotly-notifier");n.Lib.addStyleRule(a,i[o])}},{"../src/plotly":365}],2:[function(t,e,r){"use strict";e.exports={undo:{width:857.1,path:"m857 350q0-87-34-166t-91-137-137-92-166-34q-96 0-183 41t-147 114q-4 6-4 13t5 11l76 77q6 5 14 5 9-1 13-7 41-53 100-82t126-29q58 0 110 23t92 61 61 91 22 111-22 111-61 91-92 61-110 23q-55 0-105-20t-90-57l77-77q17-16 8-38-10-23-33-23h-250q-15 0-25 11t-11 25v250q0 24 22 33 22 10 39-8l72-72q60 57 137 88t159 31q87 0 166-34t137-92 91-137 34-166z",ascent:850,descent:-150},home:{width:928.6,path:"m786 296v-267q0-15-11-26t-25-10h-214v214h-143v-214h-214q-15 0-25 10t-11 26v267q0 1 0 2t0 2l321 264 321-264q1-1 1-4z m124 39l-34-41q-5-5-12-6h-2q-7 0-12 3l-386 322-386-322q-7-4-13-4-7 2-12 7l-35 41q-4 5-3 13t6 12l401 334q18 15 42 15t43-15l136-114v109q0 8 5 13t13 5h107q8 0 13-5t5-13v-227l122-102q5-5 6-12t-4-13z",ascent:850,descent:-150},"camera-retro":{width:1e3,path:"m518 386q0 8-5 13t-13 5q-37 0-63-27t-26-63q0-8 5-13t13-5 12 5 5 13q0 23 16 38t38 16q8 0 13 5t5 13z m125-73q0-59-42-101t-101-42-101 42-42 101 42 101 101 42 101-42 42-101z m-572-320h858v71h-858v-71z m643 320q0 89-62 152t-152 62-151-62-63-152 63-151 151-63 152 63 62 151z m-571 358h214v72h-214v-72z m-72-107h858v143h-462l-36-71h-360v-72z m929 143v-714q0-30-21-51t-50-21h-858q-29 0-50 21t-21 51v714q0 30 21 51t50 21h858q29 0 50-21t21-51z",ascent:850,descent:-150},zoombox:{width:1e3,path:"m1000-25l-250 251c40 63 63 138 63 218 0 224-182 406-407 406-224 0-406-182-406-406s183-406 407-406c80 0 155 22 218 62l250-250 125 125z m-812 250l0 438 437 0 0-438-437 0z m62 375l313 0 0-312-313 0 0 312z",ascent:850,descent:-150},pan:{width:1e3,path:"m1000 350l-187 188 0-125-250 0 0 250 125 0-188 187-187-187 125 0 0-250-250 0 0 125-188-188 186-187 0 125 252 0 0-250-125 0 187-188 188 188-125 0 0 250 250 0 0-126 187 188z",ascent:850,descent:-150},zoom_plus:{width:1e3,path:"m1 787l0-875 875 0 0 875-875 0z m687-500l-187 0 0-187-125 0 0 187-188 0 0 125 188 0 0 187 125 0 0-187 187 0 0-125z",ascent:850,descent:-150},zoom_minus:{width:1e3,path:"m0 788l0-876 875 0 0 876-875 0z m688-500l-500 0 0 125 500 0 0-125z",ascent:850,descent:-150},autoscale:{width:1e3,path:"m250 850l-187 0-63 0 0-62 0-188 63 0 0 188 187 0 0 62z m688 0l-188 0 0-62 188 0 0-188 62 0 0 188 0 62-62 0z m-875-938l0 188-63 0 0-188 0-62 63 0 187 0 0 62-187 0z m875 188l0-188-188 0 0-62 188 0 62 0 0 62 0 188-62 0z m-125 188l-1 0-93-94-156 156 156 156 92-93 2 0 0 250-250 0 0-2 93-92-156-156-156 156 94 92 0 2-250 0 0-250 0 0 93 93 157-156-157-156-93 94 0 0 0-250 250 0 0 0-94 93 156 157 156-157-93-93 0 0 250 0 0 250z",ascent:850,descent:-150},tooltip_basic:{width:1500,path:"m375 725l0 0-375-375 375-374 0-1 1125 0 0 750-1125 0z",ascent:850,descent:-150},tooltip_compare:{width:1125,path:"m187 786l0 2-187-188 188-187 0 0 937 0 0 373-938 0z m0-499l0 1-187-188 188-188 0 0 937 0 0 376-938-1z",ascent:850,descent:-150},plotlylogo:{width:1542,path:"m0-10h182v-140h-182v140z m228 146h183v-286h-183v286z m225 714h182v-1000h-182v1000z m225-285h182v-715h-182v715z m225 142h183v-857h-183v857z m231-428h182v-429h-182v429z m225-291h183v-138h-183v138z",ascent:850,descent:-150},"z-axis":{width:1e3,path:"m833 5l-17 108v41l-130-65 130-66c0 0 0 38 0 39 0-1 36-14 39-25 4-15-6-22-16-30-15-12-39-16-56-20-90-22-187-23-279-23-261 0-341 34-353 59 3 60 228 110 228 110-140-8-351-35-351-116 0-120 293-142 474-142 155 0 477 22 477 142 0 50-74 79-163 96z m-374 94c-58-5-99-21-99-40 0-24 65-43 144-43 79 0 143 19 143 43 0 19-42 34-98 40v216h87l-132 135-133-135h88v-216z m167 515h-136v1c16 16 31 34 46 52l84 109v54h-230v-71h124v-1c-16-17-28-32-44-51l-89-114v-51h245v72z",ascent:850,descent:-150},"3d_rotate":{width:1e3,path:"m922 660c-5 4-9 7-14 11-359 263-580-31-580-31l-102 28 58-400c0 1 1 1 2 2 118 108 351 249 351 249s-62 27-100 42c88 83 222 183 347 122 16-8 30-17 44-27-2 1-4 2-6 4z m36-329c0 0 64 229-88 296-62 27-124 14-175-11 157-78 225-208 249-266 8-19 11-31 11-31 2 5 6 15 11 32-5-13-8-20-8-20z m-775-239c70-31 117-50 198-32-121 80-199 346-199 346l-96-15-58-12c0 0 55-226 155-287z m603 133l-317-139c0 0 4-4 19-14 7-5 24-15 24-15s-177-147-389 4c235-287 536-112 536-112l31-22 100 299-4-1z m-298-153c6-4 14-9 24-15 0 0-17 10-24 15z",ascent:850,descent:-150},camera:{width:1e3,path:"m500 450c-83 0-150-67-150-150 0-83 67-150 150-150 83 0 150 67 150 150 0 83-67 150-150 150z m400 150h-120c-16 0-34 13-39 29l-31 93c-6 15-23 28-40 28h-340c-16 0-34-13-39-28l-31-94c-6-15-23-28-40-28h-120c-55 0-100-45-100-100v-450c0-55 45-100 100-100h800c55 0 100 45 100 100v450c0 55-45 100-100 100z m-400-550c-138 0-250 112-250 250 0 138 112 250 250 250 138 0 250-112 250-250 0-138-112-250-250-250z m365 380c-19 0-35 16-35 35 0 19 16 35 35 35 19 0 35-16 35-35 0-19-16-35-35-35z",ascent:850,descent:-150},movie:{width:1e3,path:"m938 413l-188-125c0 37-17 71-44 94 64 38 107 107 107 187 0 121-98 219-219 219-121 0-219-98-219-219 0-61 25-117 66-156h-115c30 33 49 76 49 125 0 103-84 187-187 187s-188-84-188-187c0-57 26-107 65-141-38-22-65-62-65-109v-250c0-70 56-126 125-126h500c69 0 125 56 125 126l188-126c34 0 62 28 62 63v375c0 35-28 63-62 63z m-750 0c-69 0-125 56-125 125s56 125 125 125 125-56 125-125-56-125-125-125z m406-1c-87 0-157 70-157 157 0 86 70 156 157 156s156-70 156-156-70-157-156-157z",ascent:850,descent:-150},question:{width:857.1,path:"m500 82v107q0 8-5 13t-13 5h-107q-8 0-13-5t-5-13v-107q0-8 5-13t13-5h107q8 0 13 5t5 13z m143 375q0 49-31 91t-77 65-95 23q-136 0-207-119-9-14 4-24l74-55q4-4 10-4 9 0 14 7 30 38 48 51 19 14 48 14 27 0 48-15t21-33q0-21-11-34t-38-25q-35-16-65-48t-29-70v-20q0-8 5-13t13-5h107q8 0 13 5t5 13q0 10 12 27t30 28q18 10 28 16t25 19 25 27 16 34 7 45z m214-107q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z",ascent:850,descent:-150},disk:{width:857.1,path:"m214-7h429v214h-429v-214z m500 0h72v500q0 8-6 21t-11 20l-157 156q-5 6-19 12t-22 5v-232q0-22-15-38t-38-16h-322q-22 0-37 16t-16 38v232h-72v-714h72v232q0 22 16 38t37 16h465q22 0 38-16t15-38v-232z m-214 518v178q0 8-5 13t-13 5h-107q-7 0-13-5t-5-13v-178q0-8 5-13t13-5h107q7 0 13 5t5 13z m357-18v-518q0-22-15-38t-38-16h-750q-23 0-38 16t-16 38v750q0 22 16 38t38 16h517q23 0 50-12t42-26l156-157q16-15 27-42t11-49z",ascent:850,descent:-150},lasso:{width:1031,path:"m1018 538c-36 207-290 336-568 286-277-48-473-256-436-463 10-57 36-108 76-151-13-66 11-137 68-183 34-28 75-41 114-42l-55-70 0 0c-2-1-3-2-4-3-10-14-8-34 5-45 14-11 34-8 45 4 1 1 2 3 2 5l0 0 113 140c16 11 31 24 45 40 4 3 6 7 8 11 48-3 100 0 151 9 278 48 473 255 436 462z m-624-379c-80 14-149 48-197 96 42 42 109 47 156 9 33-26 47-66 41-105z m-187-74c-19 16-33 37-39 60 50-32 109-55 174-68-42-25-95-24-135 8z m360 75c-34-7-69-9-102-8 8 62-16 128-68 170-73 59-175 54-244-5-9 20-16 40-20 61-28 159 121 317 333 354s407-60 434-217c28-159-121-318-333-355z",ascent:850,descent:-150},selectbox:{width:1e3,path:"m0 850l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z m285 0l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z m-857-286l0-143 143 0 0 143-143 0z m857 0l0-143 143 0 0 143-143 0z m-857-285l0-143 143 0 0 143-143 0z m857 0l0-143 143 0 0 143-143 0z m-857-286l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z m285 0l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z",ascent:850,descent:-150}}},{}],3:[function(t,e,r){e.exports=t("../src/traces/bar")},{"../src/traces/bar":420}],4:[function(t,e,r){e.exports=t("../src/traces/box")},{"../src/traces/box":431}],5:[function(t,e,r){e.exports=t("../src/traces/choropleth")},{"../src/traces/choropleth":439}],6:[function(t,e,r){e.exports=t("../src/traces/contour")},{"../src/traces/contour":446}],7:[function(t,e,r){e.exports=t("../src/core")},{"../src/core":338}],8:[function(t,e,r){e.exports=t("../src/traces/heatmap")},{"../src/traces/heatmap":457}],9:[function(t,e,r){e.exports=t("../src/traces/histogram")},{"../src/traces/histogram":468}],10:[function(t,e,r){e.exports=t("../src/traces/histogram2d")},{"../src/traces/histogram2d":473}],11:[function(t,e,r){e.exports=t("../src/traces/histogram2dcontour")},{"../src/traces/histogram2dcontour":477}],12:[function(t,e,r){"use strict";var n=t("./core");n.register([t("./bar"),t("./box"),t("./heatmap"),t("./histogram"),t("./histogram2d"),t("./histogram2dcontour"),t("./pie"),t("./contour"),t("./scatter3d"),t("./surface"),t("./mesh3d"),t("./scattergeo"),t("./choropleth"),t("./scattergl")]),e.exports=n},{"./bar":3,"./box":4,"./choropleth":5,"./contour":6,"./core":7,"./heatmap":8,"./histogram":9,"./histogram2d":10,"./histogram2dcontour":11,"./mesh3d":13,"./pie":14,"./scatter3d":15,"./scattergeo":16,"./scattergl":17,"./surface":18}],13:[function(t,e,r){e.exports=t("../src/traces/mesh3d")},{"../src/traces/mesh3d":481}],14:[function(t,e,r){e.exports=t("../src/traces/pie")},{"../src/traces/pie":486}],15:[function(t,e,r){e.exports=t("../src/traces/scatter3d")},{"../src/traces/scatter3d":519}],16:[function(t,e,r){e.exports=t("../src/traces/scattergeo")},{"../src/traces/scattergeo":523}],17:[function(t,e,r){e.exports=t("../src/traces/scattergl")},{"../src/traces/scattergl":528}],18:[function(t,e,r){e.exports=t("../src/traces/surface")},{"../src/traces/surface":533}],19:[function(t,e,r){"use strict";function n(t,e,r){return Math.min(e,Math.max(t,r))}function i(t,e,r){this.dimension=t.length,this.bounds=[new Array(this.dimension),new Array(this.dimension)];for(var n=0;n<this.dimension;++n)this.bounds[0][n]=-(1/0),this.bounds[1][n]=1/0;this._state=t.slice().reverse(),this._velocity=e.slice().reverse(),this._time=[r],this._scratch=[t.slice(),t.slice(),t.slice(),t.slice(),t.slice()]}function o(t){for(var e=new Array(t),r=0;t>r;++r)e[r]=0;return e}function a(t,e,r){switch(arguments.length){case 0:return new i([0],[0],0);case 1:if("number"==typeof t){var n=o(t);return new i(n,n,0)}return new i(t,o(t.length),0);case 2:if("number"==typeof e){var n=o(t.length);return new i(t,n,+e)}r=0;case 3:if(t.length!==e.length)throw new Error("state and velocity lengths must match");return new i(t,e,r)}}e.exports=a;var s=t("cubic-hermite"),l=t("binary-search-bounds"),c=i.prototype;c.flush=function(t){var e=l.gt(this._time,t)-1;0>=e||(this._time.splice(0,e),this._state.splice(0,e*this.dimension),this._velocity.splice(0,e*this.dimension))},c.curve=function(t){var e=this._time,r=e.length,i=l.le(e,t),o=this._scratch[0],a=this._state,c=this._velocity,u=this.dimension,h=this.bounds;if(0>i)for(var f=u-1,d=0;u>d;++d,--f)o[d]=a[f];else if(i>=r-1)for(var f=a.length-1,p=t-e[r-1],d=0;u>d;++d,--f)o[d]=a[f]+p*c[f];else{for(var f=u*(i+1)-1,g=e[i],v=e[i+1],m=v-g||1,y=this._scratch[1],b=this._scratch[2],x=this._scratch[3],_=this._scratch[4],w=!0,d=0;u>d;++d,--f)y[d]=a[f],x[d]=c[f]*m,b[d]=a[f+u],_[d]=c[f+u]*m,w=w&&y[d]===b[d]&&x[d]===_[d]&&0===x[d];if(w)for(var d=0;u>d;++d)o[d]=y[d];else s(y,x,b,_,(t-g)/m,o)}for(var k=h[0],A=h[1],d=0;u>d;++d)o[d]=n(k[d],A[d],o[d]);return o},c.dcurve=function(t){var e=this._time,r=e.length,n=l.le(e,t),i=this._scratch[0],o=this._state,a=this._velocity,c=this.dimension;if(n>=r-1)for(var u=o.length-1,h=(t-e[r-1],0);c>h;++h,--u)i[h]=a[u];else{for(var u=c*(n+1)-1,f=e[n],d=e[n+1],p=d-f||1,g=this._scratch[1],v=this._scratch[2],m=this._scratch[3],y=this._scratch[4],b=!0,h=0;c>h;++h,--u)g[h]=o[u],m[h]=a[u]*p,v[h]=o[u+c],y[h]=a[u+c]*p,b=b&&g[h]===v[h]&&m[h]===y[h]&&0===m[h];if(b)for(var h=0;c>h;++h)i[h]=0;else{s.derivative(g,m,v,y,(t-f)/p,i);for(var h=0;c>h;++h)i[h]/=p}}return i},c.lastT=function(){var t=this._time;return t[t.length-1]},c.stable=function(){for(var t=this._velocity,e=t.length,r=this.dimension-1;r>=0;--r)if(t[--e])return!1;return!0},c.jump=function(t){var e=this.lastT(),r=this.dimension;if(!(e>t||arguments.length!==r+1)){var i=this._state,o=this._velocity,a=i.length-this.dimension,s=this.bounds,l=s[0],c=s[1];this._time.push(e,t);for(var u=0;2>u;++u)for(var h=0;r>h;++h)i.push(i[a++]),o.push(0);this._time.push(t);for(var h=r;h>0;--h)i.push(n(l[h-1],c[h-1],arguments[h])),o.push(0)}},c.push=function(t){var e=this.lastT(),r=this.dimension;if(!(e>t||arguments.length!==r+1)){var i=this._state,o=this._velocity,a=i.length-this.dimension,s=t-e,l=this.bounds,c=l[0],u=l[1],h=s>1e-6?1/s:0;this._time.push(t);for(var f=r;f>0;--f){var d=n(c[f-1],u[f-1],arguments[f]);i.push(d),o.push((d-i[a++])*h)}}},c.set=function(t){var e=this.dimension;if(!(t<this.lastT()||arguments.length!==e+1)){var r=this._state,i=this._velocity,o=this.bounds,a=o[0],s=o[1];this._time.push(t);for(var l=e;l>0;--l)r.push(n(a[l-1],s[l-1],arguments[l])),i.push(0)}},c.move=function(t){var e=this.lastT(),r=this.dimension;if(!(e>=t||arguments.length!==r+1)){var i=this._state,o=this._velocity,a=i.length-this.dimension,s=this.bounds,l=s[0],c=s[1],u=t-e,h=u>1e-6?1/u:0;this._time.push(t);for(var f=r;f>0;--f){var d=arguments[f];i.push(n(l[f-1],c[f-1],i[a++]+d)),o.push(d*h)}}},c.idle=function(t){var e=this.lastT();if(!(e>t)){var r=this.dimension,i=this._state,o=this._velocity,a=i.length-r,s=this.bounds,l=s[0],c=s[1],u=t-e;this._time.push(t);for(var h=r-1;h>=0;--h)i.push(n(l[h],c[h],i[a]+u*o[a])),o.push(0),a+=1}}},{"binary-search-bounds":20,"cubic-hermite":21}],20:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){var a=["function ",t,"(a,l,h,",n.join(","),"){",o?"":"var i=",r?"l-1":"h+1",";while(l<=h){var m=(l+h)>>>1,x=a",i?".get(m)":"[m]"];return o?e.indexOf("c")<0?a.push(";if(x===y){return m}else if(x<=y){"):a.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"):a.push(";if(",e,"){i=m;"),r?a.push("l=m+1}else{h=m-1}"):a.push("h=m-1}else{l=m+1}"),a.push("}"),o?a.push("return -1};"):a.push("return i};"),a.join("")}function i(t,e,r,i){var o=new Function([n("A","x"+t+"y",e,["y"],!1,i),n("B","x"+t+"y",e,["y"],!0,i),n("P","c(x,y)"+t+"0",e,["y","c"],!1,i),n("Q","c(x,y)"+t+"0",e,["y","c"],!0,i),"function dispatchBsearch",r,"(a,y,c,l,h){if(a.shape){if(typeof(c)==='function'){return Q(a,(l===undefined)?0:l|0,(h===undefined)?a.shape[0]-1:h|0,y,c)}else{return B(a,(c===undefined)?0:c|0,(l===undefined)?a.shape[0]-1:l|0,y)}}else{if(typeof(c)==='function'){return P(a,(l===undefined)?0:l|0,(h===undefined)?a.length-1:h|0,y,c)}else{return A(a,(c===undefined)?0:c|0,(l===undefined)?a.length-1:l|0,y)}}}return dispatchBsearch",r].join(""));return o()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],21:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){var a=6*i*i-6*i,s=3*i*i-4*i+1,l=-6*i*i+6*i,c=3*i*i-2*i;if(t.length){o||(o=new Array(t.length));for(var u=t.length-1;u>=0;--u)o[u]=a*t[u]+s*e[u]+l*r[u]+c*n[u];return o}return a*t+s*e+l*r[u]+c*n}function i(t,e,r,n,i,o){var a=i-1,s=i*i,l=a*a,c=(1+2*i)*l,u=i*l,h=s*(3-2*i),f=s*a;if(t.length){o||(o=new Array(t.length));for(var d=t.length-1;d>=0;--d)o[d]=c*t[d]+u*e[d]+h*r[d]+f*n[d];return o}return c*t+u*e+h*r+f*n}e.exports=i,e.exports.derivative=n},{}],22:[function(t,e,r){function n(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}e.exports=n},{}],23:[function(t,e,r){function n(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}e.exports=n},{}],24:[function(t,e,r){function n(t){var e=t[0],r=t[1],n=t[2];return Math.sqrt(e*e+r*r+n*n)}e.exports=n},{}],25:[function(t,e,r){function n(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}e.exports=n},{}],26:[function(t,e,r){function n(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}e.exports=n},{}],27:[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"),c=t("gl-mat4/rotateY"),u=t("gl-mat4/rotateZ"),h=t("gl-mat4/lookAt"),f=t("gl-mat4/translate"),d=(t("gl-mat4/scale"),t("gl-vec3/normalize")),p=[0,0,0];e.exports=i;var g=n.prototype;g.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,c=0;16>c;++c)n[c]=i[l++];else{for(var u=e[r+1]-e[r],l=16*r,h=this.prevMatrix,f=!0,c=0;16>c;++c)h[c]=i[l++];for(var p=this.nextMatrix,c=0;16>c;++c)p[c]=i[l++],f=f&&h[c]===p[c];if(1e-6>u||f)for(var c=0;16>c;++c)n[c]=h[c];else a(n,h,p,(t-e[r])/u)}var g=this.computedUp;g[0]=n[1],g[1]=n[5],g[2]=n[6],d(g,g);var v=this.computedInverse;s(v,n);var m=this.computedEye,y=v[15];m[0]=v[12]/y,m[1]=v[13]/y,m[2]=v[14]/y;for(var b=this.computedCenter,x=Math.exp(this.computedRadius[0]),c=0;3>c;++c)b[c]=m[c]-n[2+4*c]*x}},g.idle=function(t){if(!(t<this.lastT())){for(var e=this._components,r=e.length-16,n=0;16>n;++n)e.push(e[r++]);this._time.push(t)}},g.flush=function(t){var e=o.gt(this._time,t)-2;0>e||(this._time.slice(0,e),this._components.slice(0,16*e))},g.lastT=function(){return this._time[this._time.length-1]},g.lookAt=function(t,e,r,n){this.recalcMatrix(t),e=e||this.computedEye,r=r||p,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},g.rotate=function(t,e,r,n){this.recalcMatrix(t);var i=this.computedInverse;e&&c(i,i,e),r&&l(i,i,r),n&&u(i,i,n),this.setMatrix(t,s(this.computedMatrix,i))};var v=[0,0,0];g.pan=function(t,e,r,n){v[0]=-(e||0),v[1]=-(r||0),v[2]=-(n||0),this.recalcMatrix(t);var i=this.computedInverse;f(i,i,v),this.setMatrix(t,s(i,i))},g.translate=function(t,e,r,n){v[0]=e||0,v[1]=r||0,v[2]=n||0,this.recalcMatrix(t);var i=this.computedMatrix;f(i,i,v),this.setMatrix(t,i)},g.setMatrix=function(t,e){if(!(t<this.lastT())){this._time.push(t);for(var r=0;16>r;++r)this._components.push(e[r])}},g.setDistance=function(t,e){this.computedRadius[0]=e},g.setDistanceLimits=function(t,e){var r=this._limits;r[0]=t,r[1]=e},g.getDistanceLimits=function(t){var e=this._limits;return t?(t[0]=e[0],t[1]=e[1],t):e}},{"binary-search-bounds":28,"gl-mat4/invert":94,"gl-mat4/lookAt":95,"gl-mat4/rotateX":99,"gl-mat4/rotateY":100,"gl-mat4/rotateZ":101,"gl-mat4/scale":102,"gl-mat4/translate":103,"gl-vec3/normalize":26,"mat4-interpolate":29}],28:[function(t,e,r){arguments[4][20][0].apply(r,arguments)},{dup:20}],29:[function(t,e,r){function n(t,e,r,n){if(0===u(e)||0===u(r))return!1;var i=c(e,f.translate,f.scale,f.skew,f.perspective,f.quaternion),o=c(r,d.translate,d.scale,d.skew,d.perspective,d.quaternion);return i&&o?(s(p.translate,f.translate,d.translate,n),s(p.skew,f.skew,d.skew,n),s(p.scale,f.scale,d.scale,n),s(p.perspective,f.perspective,d.perspective,n),h(p.quaternion,f.quaternion,d.quaternion,n),l(t,p.translate,p.scale,p.skew,p.perspective,p.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"),c=t("mat4-decompose"),u=t("gl-mat4/determinant"),h=t("quat-slerp"),f=i(),d=i(),p=i();e.exports=n},{"gl-mat4/determinant":90,"gl-vec3/lerp":25,"mat4-decompose":30,"mat4-recompose":32,"quat-slerp":33}],30:[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"),c=t("gl-mat4/determinant"),u=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")},d=s(),p=s(),g=[0,0,0,0],v=[[0,0,0],[0,0,0],[0,0,0]],m=[0,0,0];e.exports=function(t,e,r,s,y,b){if(e||(e=[0,0,0]),r||(r=[0,0,0]),s||(s=[0,0,0]),y||(y=[0,0,0,1]),b||(b=[0,0,0,1]),!a(d,t))return!1;if(l(p,d),p[3]=0,p[7]=0,p[11]=0,p[15]=1,Math.abs(c(p)<1e-8))return!1;var x=d[3],_=d[7],w=d[11],k=d[12],A=d[13],M=d[14],T=d[15];if(0!==x||0!==_||0!==w){g[0]=x,g[1]=_,g[2]=w,g[3]=T;var E=u(p,p);if(!E)return!1;h(p,p),n(y,g,p)}else y[0]=y[1]=y[2]=0,y[3]=1;if(e[0]=k,e[1]=A,e[2]=M,i(v,d),r[0]=f.length(v[0]),f.normalize(v[0],v[0]),s[0]=f.dot(v[0],v[1]),o(v[1],v[1],v[0],1,-s[0]),r[1]=f.length(v[1]),f.normalize(v[1],v[1]),s[0]/=r[1],s[1]=f.dot(v[0],v[2]),o(v[2],v[2],v[0],1,-s[1]),s[2]=f.dot(v[1],v[2]),o(v[2],v[2],v[1],1,-s[2]),r[2]=f.length(v[2]),f.normalize(v[2],v[2]),s[1]/=r[2],s[2]/=r[2],f.cross(m,v[1],v[2]),f.dot(v[0],m)<0)for(var L=0;3>L;L++)r[L]*=-1,v[L][0]*=-1,v[L][1]*=-1,v[L][2]*=-1;return b[0]=.5*Math.sqrt(Math.max(1+v[0][0]-v[1][1]-v[2][2],0)),b[1]=.5*Math.sqrt(Math.max(1-v[0][0]+v[1][1]-v[2][2],0)),b[2]=.5*Math.sqrt(Math.max(1-v[0][0]-v[1][1]+v[2][2],0)),b[3]=.5*Math.sqrt(Math.max(1+v[0][0]+v[1][1]+v[2][2],0)),v[2][1]>v[1][2]&&(b[0]=-b[0]),v[0][2]>v[2][0]&&(b[1]=-b[1]),v[1][0]>v[0][1]&&(b[2]=-b[2]),!0}},{"./normalize":31,"gl-mat4/clone":88,"gl-mat4/create":89,"gl-mat4/determinant":90,"gl-mat4/invert":94,"gl-mat4/transpose":104,"gl-vec3/cross":22,"gl-vec3/dot":23,"gl-vec3/length":24,"gl-vec3/normalize":26}],31:[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}},{}],32:[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":89,"gl-mat4/fromRotationTranslation":92,"gl-mat4/identity":93,"gl-mat4/multiply":96,"gl-mat4/scale":102,"gl-mat4/translate":103}],33:[function(t,e,r){e.exports=t("gl-quat/slerp")},{"gl-quat/slerp":34}],34:[function(t,e,r){function n(t,e,r,n){var i,o,a,s,l,c=e[0],u=e[1],h=e[2],f=e[3],d=r[0],p=r[1],g=r[2],v=r[3];return o=c*d+u*p+h*g+f*v,0>o&&(o=-o,d=-d,p=-p,g=-g,v=-v),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*c+l*d,t[1]=s*u+l*p,t[2]=s*h+l*g,t[3]=s*f+l*v,t}e.exports=n},{}],35:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a,s,l,c){var u=e+o+c;if(h>0){var h=Math.sqrt(u+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,c),h=Math.sqrt(2*f-u+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},{}],36:[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"),c=t("gl-mat4/lookAt"),u=t("gl-mat4/fromQuat"),h=t("gl-mat4/invert"),f=t("./lib/quatFromFrame"),d=a.prototype;d.lastT=function(){return Math.max(this.radius.lastT(),this.center.lastT(),this.rotation.lastT())},d.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;u(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 c=0,h=0;3>h;++h)c+=r[l+4*h]*i[h];r[12+l]=-c}},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},d.idle=function(t){this.center.idle(t),this.radius.idle(t),this.rotation.idle(t)},d.flush=function(t){this.center.flush(t),this.radius.flush(t),this.rotation.flush(t)},d.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],c=n(a,s,l);a/=c,s/=c,l/=c;var u=o[0],h=o[4],f=o[8],d=u*a+h*s+f*l;u-=a*d,h-=s*d,f-=l*d;var p=n(u,h,f);u/=p,h/=p,f/=p;var g=o[2],v=o[6],m=o[10],y=g*a+v*s+m*l,b=g*u+v*h+m*f;g-=y*a+b*u,v-=y*s+b*h,m-=y*l+b*f;var x=n(g,v,m);g/=x,v/=x,m/=x;var _=u*e+a*r,w=h*e+s*r,k=f*e+l*r;this.center.move(t,_,w,k);var A=Math.exp(this.computedRadius[0]);A=Math.max(1e-4,A+i),this.radius.set(t,Math.log(A))},d.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],c=a[8],u=a[1],h=a[5],f=a[9],d=a[2],p=a[6],g=a[10],v=e*s+r*u,m=e*l+r*h,y=e*c+r*f,b=-(p*y-g*m),x=-(g*v-d*y),_=-(d*m-p*v),w=Math.sqrt(Math.max(0,1-Math.pow(b,2)-Math.pow(x,2)-Math.pow(_,2))),k=i(b,x,_,w);k>1e-6?(b/=k,x/=k,_/=k,w/=k):(b=x=_=0,w=1);var A=this.computedRotation,M=A[0],T=A[1],E=A[2],L=A[3],S=M*w+L*b+T*_-E*x,C=T*w+L*x+E*b-M*_,z=E*w+L*_+M*x-T*b,j=L*w-M*b-T*x-E*_;if(o){b=d,x=p,_=g;var P=Math.sin(o)/n(b,x,_);b*=P,x*=P,_*=P,w=Math.cos(e),S=S*w+j*b+C*_-z*x,C=C*w+j*x+z*b-S*_,z=z*w+j*_+S*x-C*b,j=j*w-S*b-C*x-z*_}var I=i(S,C,z,j);I>1e-6?(S/=I,C/=I,z/=I,j/=I):(S=C=z=0,j=1),this.rotation.set(t,S,C,z,j)},d.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;c(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])},d.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},d.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 c=Math.exp(this.computedRadius[0]);this.center.set(t,a-n[2]*c,s-n[6]*c,l-n[10]*c),this.radius.idle(t)}else this.center.idle(t),this.radius.idle(t)},d.setDistance=function(t,e){e>0&&this.radius.set(t,Math.log(e))},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;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.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]}},d.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":35,"filtered-vector":19,"gl-mat4/fromQuat":91,"gl-mat4/invert":94,"gl-mat4/lookAt":95}],37:[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){return Math.min(1,Math.max(-1,t))}function o(t){var e=Math.abs(t[0]),r=Math.abs(t[1]),n=Math.abs(t[2]),i=[0,0,0];e>Math.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 c=0;16>c;++c)this.computedMatrix[c]=.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,c=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 u=t.eye,p=[u[0]-e[0],u[1]-e[1],u[2]-e[2]];h(i,p,r),n(i[0],i[1],i[2])<1e-6?i=o(r):f(i,i),s=n(p[0],p[1],p[2]);var g=d(r,p)/s,v=d(i,p)/s;c=Math.acos(g),l=Math.acos(v)}return s=Math.log(s),new a(t.zoomMin,t.zoomMax,e,r,i,s,l,c)}e.exports=s;var l=t("filtered-vector"),c=t("gl-mat4/invert"),u=t("gl-mat4/rotate"),h=t("gl-vec3/cross"),f=t("gl-vec3/normalize"),d=t("gl-vec3/dot"),p=a.prototype;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[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])]},p.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 c=Math.sqrt(l),a=0;3>a;++a)r[a]/=c;var u=this.computedToward;h(u,e,r),f(u,u);for(var d=Math.exp(this.computedRadius[0]),p=this.computedAngle[0],g=this.computedAngle[1],v=Math.cos(p),m=Math.sin(p),y=Math.cos(g),b=Math.sin(g),x=this.computedCenter,_=v*y,w=m*y,k=b,A=-v*b,M=-m*b,T=y,E=this.computedEye,L=this.computedMatrix,a=0;3>a;++a){var S=_*r[a]+w*u[a]+k*e[a];L[4*a+1]=A*r[a]+M*u[a]+T*e[a],L[4*a+2]=S,L[4*a+3]=0}var C=L[1],z=L[5],j=L[9],P=L[2],I=L[6],R=L[10],O=z*R-j*I,N=j*P-C*R,D=C*I-z*P,F=n(O,N,D);O/=F,N/=F,D/=F,L[0]=O,L[4]=N,L[8]=D;for(var a=0;3>a;++a)E[a]=x[a]+L[2+4*a]*d;for(var a=0;3>a;++a){for(var l=0,B=0;3>B;++B)l+=L[a+4*B]*E[B];L[12+a]=-l}L[15]=1},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};var g=[0,0,0];p.rotate=function(t,e,r,n){if(this.angle.move(t,e,r),n){this.recalcMatrix(t);var i=this.computedMatrix;g[0]=i[2],g[1]=i[6],g[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];u(i,i,n,g);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])}},p.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],c=n(a,s,l);a/=c,s/=c,l/=c;var u=o[0],h=o[4],f=o[8],d=u*a+h*s+f*l;u-=a*d,h-=s*d,f-=l*d;var p=n(u,h,f);u/=p,h/=p,f/=p;var g=u*e+a*r,v=h*e+s*r,m=f*e+l*r;this.center.move(t,g,v,m);var y=Math.exp(this.computedRadius[0]);y=Math.max(1e-4,y+i),this.radius.set(t,Math.log(y))},p.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},p.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],u=e[a+4],h=e[a+8];if(o){var f=Math.abs(l),d=Math.abs(u),p=Math.abs(h),g=Math.max(f,d,p);f===g?(l=0>l?-1:1,u=h=0):p===g?(h=0>h?-1:1,l=u=0):(u=0>u?-1:1,l=h=0)}else{var v=n(l,u,h);l/=v,u/=v,h/=v}var m=e[s],y=e[s+4],b=e[s+8],x=m*l+y*u+b*h;m-=l*x,y-=u*x,b-=h*x;var _=n(m,y,b);m/=_,y/=_,b/=_;var w=u*b-h*y,k=h*m-l*b,A=l*y-u*m,M=n(w,k,A);w/=M,k/=M,A/=M,this.center.jump(t,H,G,Y),this.radius.idle(t),this.up.jump(t,l,u,h),this.right.jump(t,m,y,b);var T,E;if(2===a){var L=e[1],S=e[5],C=e[9],z=L*m+S*y+C*b,j=L*w+S*k+C*A;T=0>O?-Math.PI/2:Math.PI/2,E=Math.atan2(j,z)}else{var P=e[2],I=e[6],R=e[10],O=P*l+I*u+R*h,N=P*m+I*y+R*b,D=P*w+I*k+R*A;T=Math.asin(i(O)),E=Math.atan2(D,N)}this.angle.jump(t,E,T),this.recalcMatrix(t);var F=e[2],B=e[6],U=e[10],V=this.computedMatrix;c(V,e);var q=V[15],H=V[12]/q,G=V[13]/q,Y=V[14]/q,X=Math.exp(this.computedRadius[0]);this.center.jump(t,H-F*X,G-B*X,Y-U*X)},p.lastT=function(){return Math.max(this.center.lastT(),this.up.lastT(),this.right.lastT(),this.radius.lastT(),this.angle.lastT())},p.idle=function(t){this.center.idle(t),this.up.idle(t),this.right.idle(t),this.radius.idle(t),this.angle.idle(t)},p.flush=function(t){this.center.flush(t),this.up.flush(t),this.right.flush(t),this.radius.flush(t),this.angle.flush(t)},p.setDistance=function(t,e){e>0&&this.radius.set(t,Math.log(e))},p.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],c=n(a,s,l);if(!(1e-6>c)){a/=c,s/=c,l/=c;var u=e[0]-r[0],h=e[1]-r[1],f=e[2]-r[2],d=n(u,h,f);if(!(1e-6>d)){u/=d,h/=d,f/=d;var p=this.computedRight,g=p[0],v=p[1],m=p[2],y=a*g+s*v+l*m;g-=y*a,v-=y*s,m-=y*l;var b=n(g,v,m);if(!(.01>b&&(g=s*f-l*h,v=l*u-a*f,m=a*h-s*u,b=n(g,v,m),1e-6>b))){g/=b,v/=b,m/=b,this.up.set(t,a,s,l),this.right.set(t,g,v,m),this.center.set(t,r[0],r[1],r[2]),this.radius.set(t,Math.log(d));var x=s*m-l*v,_=l*g-a*m,w=a*v-s*g,k=n(x,_,w);x/=k,_/=k,w/=k;var A=a*u+s*h+l*f,M=g*u+v*h+m*f,T=x*u+_*h+w*f,E=Math.asin(i(A)),L=Math.atan2(T,M),S=this.angle._state,C=S[S.length-1],z=S[S.length-2];C%=2*Math.PI;var j=Math.abs(C+2*Math.PI-L),P=Math.abs(C-L),I=Math.abs(C-2*Math.PI-L);P>j&&(C+=2*Math.PI),P>I&&(C-=2*Math.PI),this.angle.jump(this.angle.lastT(),C,z),this.angle.set(t,L,E)}}}}},{"filtered-vector":19,"gl-mat4/invert":94,"gl-mat4/rotate":98,"gl-vec3/cross":22,"gl-vec3/dot":23,"gl-vec3/normalize":26}],38:[function(t,e,r){"use strict";function n(t,e){this._controllerNames=Object.keys(t),this._controllerList=this._controllerNames.map(function(e){return t[e]}),this._mode=e,this._active=t[e],this._active||(this._mode="turntable",this._active=t.turntable),this.modes=this._controllerNames,this.computedMatrix=this._active.computedMatrix,this.computedEye=this._active.computedEye,this.computedUp=this._active.computedUp,this.computedCenter=this._active.computedCenter,this.computedRadius=this._active.computedRadius}function i(t){t=t||{};var e=t.eye||[0,0,1],r=t.center||[0,0,0],i=t.up||[0,1,0],l=t.distanceLimits||[0,1/0],c=t.mode||"turntable",u=o(),h=a(),f=s();return u.setDistanceLimits(l[0],l[1]),u.lookAt(0,e,r,i),h.setDistanceLimits(l[0],l[1]),h.lookAt(0,e,r,i),f.setDistanceLimits(l[0],l[1]),f.lookAt(0,e,r,i),new n({turntable:u,orbit:h,matrix:f},c)}e.exports=i;var o=t("turntable-camera-controller"),a=t("orbit-camera-controller"),s=t("matrix-camera-controller"),l=n.prototype,c=[["flush",1],["idle",1],["lookAt",4],["rotate",4],["pan",4],["translate",4],["setMatrix",2],["setDistanceLimits",2],["setDistance",2]];c.forEach(function(t){for(var e=t[0],r=[],n=0;n<t[1];++n)r.push("a"+n);var i="var cc=this._controllerList;for(var i=0;i<cc.length;++i){cc[i]."+t[0]+"("+r.join()+")}";l[e]=Function.apply(null,r.concat(i))}),l.recalcMatrix=function(t){this._active.recalcMatrix(t)},l.getDistance=function(t){return this._active.getDistance(t)},l.getDistanceLimits=function(t){return this._active.getDistanceLimits(t)},l.lastT=function(){return this._active.lastT()},l.setMode=function(t){if(t!==this._mode){var e=this._controllerNames.indexOf(t);if(!(0>e)){var r=this._active,n=this._controllerList[e],i=Math.max(r.lastT(),n.lastT());r.recalcMatrix(i),n.setMatrix(i,r.computedMatrix),this._active=n,this._mode=t,this.computedMatrix=this._active.computedMatrix,this.computedEye=this._active.computedEye,this.computedUp=this._active.computedUp,this.computedCenter=this._active.computedCenter,this.computedRadius=this._active.computedRadius}}},l.getMode=function(){return this._mode}},{"matrix-camera-controller":27,"orbit-camera-controller":36,"turntable-camera-controller":37}],39:[function(t,e,r){function n(t,e){return o(i(t,e))}e.exports=n;var i=t("alpha-complex"),o=t("simplicial-complex-boundary")},{"alpha-complex":40,"simplicial-complex-boundary":43}],40:[function(t,e,r){"use strict";function n(t,e){return i(e).filter(function(r){for(var n=new Array(r.length),i=0;i<r.length;++i)n[i]=e[r[i]];return o(n)*t<1})}e.exports=n;var i=t("delaunay-triangulate"),o=t("circumradius")},{circumradius:41,"delaunay-triangulate":71}],41:[function(t,e,r){function n(t){for(var e=i(t),r=0,n=0;n<t.length;++n)for(var o=t[n],a=0;a<e.length;++a)r+=Math.pow(o[a]-e[a],2);return Math.sqrt(r/t.length)}e.exports=n;var i=t("circumcenter")},{circumcenter:42}],42:[function(t,e,r){"use strict";function n(t,e){for(var r=0,n=t.length,i=0;n>i;++i)r+=t[i]*e[i];return r}function i(t){var e=t.length;if(0===e)return[];var r=(t[0].length,a([t.length+1,t.length+1],1)),i=a([t.length+1],1);r[e][e]=0;for(var o=0;e>o;++o){for(var l=0;o>=l;++l)r[l][o]=r[o][l]=2*n(t[o],t[l]);i[o]=n(t[o],t[o])}for(var c=s(r,i),u=0,h=c[e+1],o=0;o<h.length;++o)u+=h[o];for(var f=new Array(e),o=0;e>o;++o){for(var h=c[o],d=0,l=0;l<h.length;++l)d+=h[l];f[o]=d/u}return f}function o(t){if(0===t.length)return[];for(var e=t[0].length,r=a([e]),n=i(t),o=0;o<t.length;++o)for(var s=0;e>s;++s)r[s]+=t[o][s]*n[o];return r}var a=t("dup"),s=t("robust-linear-solve");o.barycenetric=i,e.exports=o},{dup:72,"robust-linear-solve":211}],43:[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":44,"reduce-simplicial-complex":47}],44:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=0,n=0;e>n;++n)r+=t[n].length;for(var i=new Array(r),o=0,n=0;e>n;++n)for(var a=t[n],s=a.length,l=0;s>l;++l)for(var c=i[o++]=new Array(s-1),u=1;s>u;++u)c[u-1]=a[(l+u)%s];return i}e.exports=n},{}],45:[function(t,e,r){"use strict";function n(t){for(var e=1,r=1;r<t.length;++r)for(var n=0;r>n;++n)if(t[r]<t[n])e=-e;else if(t[n]===t[r])return 0;return e}e.exports=n},{}],46:[function(t,e,r){"use strict";function n(t,e){return i(t,e)||o(t)-o(e)}var i=t("compare-cell"),o=t("cell-orientation");e.exports=n},{"cell-orientation":45,"compare-cell":59}],47:[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 c=t[r-1];if(0===i(s,c)&&a(c)!==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":45,"compare-cell":59,"compare-oriented-cell":46}],48:[function(t,e,r){"use strict";var n=function(){function t(t){return!Array.isArray(t)&&null!==t&&"object"==typeof t}function e(t,e,r){for(var n=(e-t)/Math.max(r-1,1),i=[],o=0;r>o;o++)i.push(t+o*n);return i}function r(){for(var t=[].slice.call(arguments),e=t.map(function(t){return t.length}),r=Math.min.apply(null,e),n=[],i=0;r>i;i++){n[i]=[];for(var o=0;o<t.length;++o)n[i][o]=t[o][i]}return n}function n(t,e,r){for(var n=Math.min.apply(null,[t.length,e.length,r.length]),i=[],o=0;n>o;o++)i.push([t[o],e[o],r[o]]);return i}function i(t){function e(t){for(var n=0;n<t.length;n++)Array.isArray(t[n])?e(t[n],r):r+=t[n]}var r=0;return e(t,r),r}function o(t){for(var e=[],r=0;r<t.length;++r){e[r]=[];for(var n=0;n<t[r].length;++n)e[r][n]=t[r][n]}return e}function a(t){for(var e=[],r=0;r<t.length;++r)e[r]=t[r];return e}function s(t,e){if(t.length!==e.length)return!1;for(var r=t.length;r--;)if(t[r]!==e[r])return!1;return!0}function l(t,e){var r,n;if("string"!=typeof t)return t;if(r=[],"#"===t[0]?(t=t.substr(1),3===t.length&&(t+=t),n=parseInt(t,16),r[0]=n>>16&255,r[1]=n>>8&255,r[2]=255&n):h.test(t)&&(n=t.match(f),r[0]=parseInt(n[1]),r[1]=parseInt(n[2]),r[2]=parseInt(n[3])),!e)for(var i=0;3>i;++i)r[i]=r[i]/255;return r}function c(t,e){var r,n;if("string"!=typeof t)return t;if(r=[],"#"===t[0]?(t=t.substr(1),3===t.length&&(t+=t),n=parseInt(t,16),r[0]=n>>16&255,r[1]=n>>8&255,r[2]=255&n):h.test(t)&&(n=t.match(f),r[0]=parseInt(n[1]),r[1]=parseInt(n[2]),r[2]=parseInt(n[3]),n[4]?r[3]=parseFloat(n[4]):r[3]=1),!e)for(var i=0;3>i;++i)r[i]=r[i]/255;return r}var u={},h=/^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(,.*)?\)$/,f=/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,?\s*(.*)?\)$/;return u.isPlainObject=t,u.linspace=e,u.zip3=n,u.sum=i,u.zip=r,u.isEqual=s,u.copy2D=o,u.copy1D=a,u.str2RgbArray=l,u.str2RgbaArray=c,u};e.exports=n()},{}],49:[function(t,e,r){"use strict";"use restrict";function n(t){var e=32;return t&=-t,t&&e--,65535&t&&(e-=16),16711935&t&&(e-=8),252645135&t&&(e-=4),858993459&t&&(e-=2),1431655765&t&&(e-=1),e}var i=32;r.INT_BITS=i,r.INT_MAX=2147483647,r.INT_MIN=-1<<i-1,r.sign=function(t){return(t>0)-(0>t)},r.abs=function(t){var e=t>>i-1;return(t^e)-e},r.min=function(t,e){return e^(t^e)&-(e>t)},r.max=function(t,e){return t^(t^e)&-(e>t)},r.isPow2=function(t){return!(t&t-1||!t)},r.log2=function(t){var e,r;return e=(t>65535)<<4,t>>>=e,r=(t>255)<<3,t>>>=r,e|=r,r=(t>15)<<2,t>>>=r,e|=r,r=(t>3)<<1,t>>>=r,e|=r,e|t>>1},r.log10=function(t){return t>=1e9?9:t>=1e8?8:t>=1e7?7:t>=1e6?6:t>=1e5?5:t>=1e4?4:t>=1e3?3:t>=100?2:t>=10?1:0},r.popCount=function(t){return t-=t>>>1&1431655765,t=(858993459&t)+(t>>>2&858993459),16843009*(t+(t>>>4)&252645135)>>>24},r.countTrailingZeros=n,r.nextPow2=function(t){return t+=0===t,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t+1},r.prevPow2=function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t-(t>>>1)},r.parity=function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,t&=15,27030>>>t&1};var o=new Array(256);!function(t){for(var e=0;256>e;++e){var r=e,n=e,i=7;for(r>>>=1;r;r>>>=1)n<<=1,n|=1&r,--i;t[e]=n<<i&255}}(o),r.reverse=function(t){return o[255&t]<<24|o[t>>>8&255]<<16|o[t>>>16&255]<<8|o[t>>>24&255]},r.interleave2=function(t,e){return t&=65535,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e&=65535,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t|e<<1},r.deinterleave2=function(t,e){return t=t>>>e&1431655765,t=858993459&(t|t>>>1),t=252645135&(t|t>>>2),t=16711935&(t|t>>>4),t=65535&(t|t>>>16),t<<16>>16},r.interleave3=function(t,e,r){return t&=1023,t=4278190335&(t|t<<16),t=251719695&(t|t<<8),t=3272356035&(t|t<<4),t=1227133513&(t|t<<2),e&=1023,e=4278190335&(e|e<<16),e=251719695&(e|e<<8),e=3272356035&(e|e<<4),e=1227133513&(e|e<<2),t|=e<<1,r&=1023,r=4278190335&(r|r<<16),r=251719695&(r|r<<8),r=3272356035&(r|r<<4),r=1227133513&(r|r<<2),t|r<<2},r.deinterleave3=function(t,e){return t=t>>>e&1227133513,t=3272356035&(t|t>>>2),t=251719695&(t|t>>>4),t=4278190335&(t|t>>>8),t=1023&(t|t>>>16),t<<22>>22},r.nextCombination=function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>n(t)+1}},{}],50:[function(t,e,r){(function(e){"use strict";function n(){try{var t=new Uint8Array(1);return t.foo=function(){return 42},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(e){return!1}}function i(){return o.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(t){return this instanceof o?(o.TYPED_ARRAY_SUPPORT||(this.length=0,this.parent=void 0),"number"==typeof t?a(this,t):"string"==typeof t?s(this,t,arguments.length>1?arguments[1]:"utf8"):l(this,t)):arguments.length>1?new o(t,arguments[1]):new o(t)}function a(t,e){if(t=g(t,0>e?0:0|v(e)),!o.TYPED_ARRAY_SUPPORT)for(var r=0;e>r;r++)t[r]=0;return t}function s(t,e,r){("string"!=typeof r||""===r)&&(r="utf8");var n=0|y(e,r);return t=g(t,n),t.write(e,r),t}function l(t,e){if(o.isBuffer(e))return c(t,e);if(Q(e))return u(t,e);if(null==e)throw new TypeError("must start with number, buffer, array or string");if("undefined"!=typeof ArrayBuffer){if(e.buffer instanceof ArrayBuffer)return h(t,e);if(e instanceof ArrayBuffer)return f(t,e)}return e.length?d(t,e):p(t,e)}function c(t,e){var r=0|v(e.length);return t=g(t,r),e.copy(t,0,0,r),t}function u(t,e){var r=0|v(e.length);t=g(t,r);for(var n=0;r>n;n+=1)t[n]=255&e[n];return t}function h(t,e){var r=0|v(e.length);t=g(t,r);for(var n=0;r>n;n+=1)t[n]=255&e[n];return t}function f(t,e){return e.byteLength,o.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=o.prototype):t=h(t,new Uint8Array(e)),t}function d(t,e){var r=0|v(e.length);t=g(t,r);for(var n=0;r>n;n+=1)t[n]=255&e[n];return t}function p(t,e){var r,n=0;"Buffer"===e.type&&Q(e.data)&&(r=e.data,n=0|v(r.length)),t=g(t,n);for(var i=0;n>i;i+=1)t[i]=255&r[i];return t}function g(t,e){o.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=o.prototype):t.length=e;var r=0!==e&&e<=o.poolSize>>>1;return r&&(t.parent=$),t}function v(t){if(t>=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|t}function m(t,e){if(!(this instanceof m))return new m(t,e);var r=new o(t,e);return delete r.parent,r}function y(t,e){"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"binary":case"raw":case"raws":return r;case"utf8":case"utf-8":return q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Y(t).length;default:if(n)return q(t).length;e=(""+e).toLowerCase(),n=!0}}function b(t,e,r){var n=!1;if(e=0|e,r=void 0===r||r===1/0?this.length:0|r,t||(t="utf8"),0>e&&(e=0),r>this.length&&(r=this.length),e>=r)return"";for(;;)switch(t){case"hex":return z(this,e,r);case"utf8":case"utf-8":return E(this,e,r);case"ascii":return S(this,e,r);case"binary":return C(this,e,r);case"base64":return T(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function x(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var o=e.length;if(o%2!==0)throw new Error("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;n>a;a++){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))throw new Error("Invalid hex string");t[r+a]=s}return a}function _(t,e,r,n){return X(q(e,t.length-r),t,r,n)}function w(t,e,r,n){return X(H(e),t,r,n)}function k(t,e,r,n){return w(t,e,r,n)}function A(t,e,r,n){return X(Y(e),t,r,n)}function M(t,e,r,n){return X(G(e,t.length-r),t,r,n)}function T(t,e,r){return 0===e&&r===t.length?W.fromByteArray(t):W.fromByteArray(t.slice(e,r))}function E(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;r>i;){var o=t[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(r>=i+s){var l,c,u,h;switch(s){case 1:128>o&&(a=o);break;case 2:l=t[i+1],128===(192&l)&&(h=(31&o)<<6|63&l,h>127&&(a=h));break;case 3:l=t[i+1],c=t[i+2],128===(192&l)&&128===(192&c)&&(h=(15&o)<<12|(63&l)<<6|63&c,h>2047&&(55296>h||h>57343)&&(a=h));break;case 4:l=t[i+1],c=t[i+2],u=t[i+3],128===(192&l)&&128===(192&c)&&128===(192&u)&&(h=(15&o)<<18|(63&l)<<12|(63&c)<<6|63&u,h>65535&&1114112>h&&(a=h))}}null===a?(a=65533,s=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=s}return L(n)}function L(t){var e=t.length;if(K>=e)return String.fromCharCode.apply(String,t);for(var r="",n=0;e>n;)r+=String.fromCharCode.apply(String,t.slice(n,n+=K));return r}function S(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;r>i;i++)n+=String.fromCharCode(127&t[i]);return n}function C(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;r>i;i++)n+=String.fromCharCode(t[i]);return n}function z(t,e,r){var n=t.length;(!e||0>e)&&(e=0),(!r||0>r||r>n)&&(r=n);for(var i="",o=e;r>o;o++)i+=V(t[o]);return i}function j(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function P(t,e,r){if(t%1!==0||0>t)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function I(t,e,r,n,i,a){if(!o.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");if(e>i||a>e)throw new RangeError("value is out of bounds");if(r+n>t.length)throw new RangeError("index out of range")}function R(t,e,r,n){0>e&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);o>i;i++)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function O(t,e,r,n){0>e&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);o>i;i++)t[r+i]=e>>>8*(n?i:3-i)&255}function N(t,e,r,n,i,o){if(e>i||o>e)throw new RangeError("value is out of bounds");if(r+n>t.length)throw new RangeError("index out of range");if(0>r)throw new RangeError("index out of range")}function D(t,e,r,n,i){return i||N(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),Z.write(t,e,r,n,23,4),r+4}function F(t,e,r,n,i){return i||N(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),Z.write(t,e,r,n,52,8),r+8}function B(t){if(t=U(t).replace(J,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function U(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function V(t){return 16>t?"0"+t.toString(16):t.toString(16)}function q(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],a=0;n>a;a++){if(r=t.charCodeAt(a),r>55295&&57344>r){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(56320>r){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,128>r){if((e-=1)<0)break;o.push(r)}else if(2048>r){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(65536>r){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(1114112>r))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function H(t){for(var e=[],r=0;r<t.length;r++)e.push(255&t.charCodeAt(r));return e}function G(t,e){for(var r,n,i,o=[],a=0;a<t.length&&!((e-=2)<0);a++)r=t.charCodeAt(a),n=r>>8,i=r%256,o.push(i),o.push(n);return o}function Y(t){return W.toByteArray(B(t))}function X(t,e,r,n){for(var i=0;n>i&&!(i+r>=e.length||i>=t.length);i++)e[i+r]=t[i];return i}var W=t("base64-js"),Z=t("ieee754"),Q=t("isarray");r.Buffer=o,r.SlowBuffer=m,r.INSPECT_MAX_BYTES=50,o.poolSize=8192;var $={};o.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:n(),o.TYPED_ARRAY_SUPPORT?(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array):(o.prototype.length=void 0,o.prototype.parent=void 0),o.isBuffer=function(t){return!(null==t||!t._isBuffer)},o.compare=function(t,e){if(!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,a=Math.min(r,n);a>i&&t[i]===e[i];)++i;return i!==a&&(r=t[i],n=e[i]),n>r?-1:r>n?1:0},o.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(t,e){if(!Q(t))throw new TypeError("list argument must be an Array of Buffers.");if(0===t.length)return new o(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;r++)e+=t[r].length;var n=new o(e),i=0;for(r=0;r<t.length;r++){var a=t[r];a.copy(n,i),i+=a.length}return n},o.byteLength=y,o.prototype._isBuffer=!0,o.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?E(this,0,t):b.apply(this,arguments)},o.prototype.equals=function(t){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:0===o.compare(this,t)},o.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),"<Buffer "+t+">"},o.prototype.compare=function(t){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?0:o.compare(this,t)},o.prototype.indexOf=function(t,e){function r(t,e,r){for(var n=-1,i=0;r+i<t.length;i++)if(t[r+i]===e[-1===n?0:i-n]){if(-1===n&&(n=i),i-n+1===e.length)return r+n}else n=-1;return-1}if(e>2147483647?e=2147483647:-2147483648>e&&(e=-2147483648),e>>=0,0===this.length)return-1;if(e>=this.length)return-1;if(0>e&&(e=Math.max(this.length+e,0)),"string"==typeof t)return 0===t.length?-1:String.prototype.indexOf.call(this,t,e);if(o.isBuffer(t))return r(this,t,e);if("number"==typeof t)return o.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,t,e):r(this,[t],e);throw new TypeError("val must be string, number or Buffer")},o.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else if(isFinite(e))e=0|e,isFinite(r)?(r=0|r,void 0===n&&(n="utf8")):(n=r,r=void 0);else{var i=n;n=e,e=0|r,r=i}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(0>r||0>e)||e>this.length)throw new RangeError("attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return x(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return w(this,t,e,r);case"binary":return k(this,t,e,r);case"base64":return A(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var K=4096;o.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,0>t?(t+=r,0>t&&(t=0)):t>r&&(t=r),0>e?(e+=r,0>e&&(e=0)):e>r&&(e=r),t>e&&(e=t);var n;if(o.TYPED_ARRAY_SUPPORT)n=this.subarray(t,e),n.__proto__=o.prototype;else{var i=e-t;n=new o(i,void 0);for(var a=0;i>a;a++)n[a]=this[a+t]}return n.length&&(n.parent=this.parent||this),n},o.prototype.readUIntLE=function(t,e,r){t=0|t,e=0|e,r||P(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},o.prototype.readUIntBE=function(t,e,r){t=0|t,e=0|e,r||P(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},o.prototype.readUInt8=function(t,e){return e||P(t,1,this.length),this[t]},o.prototype.readUInt16LE=function(t,e){return e||P(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUInt16BE=function(t,e){return e||P(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUInt32LE=function(t,e){return e||P(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUInt32BE=function(t,e){return e||P(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,e,r){t=0|t,e=0|e,r||P(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*e)),n},o.prototype.readIntBE=function(t,e,r){t=0|t,e=0|e,r||P(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},o.prototype.readInt8=function(t,e){return e||P(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,e){e||P(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(t,e){e||P(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(t,e){return e||P(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return e||P(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,e){return e||P(t,4,this.length),Z.read(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return e||P(t,4,this.length),Z.read(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return e||P(t,8,this.length),Z.read(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return e||P(t,8,this.length),Z.read(this,t,!1,52,8)},o.prototype.writeUIntLE=function(t,e,r,n){t=+t,e=0|e,r=0|r,n||I(this,t,e,r,Math.pow(2,8*r),0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},o.prototype.writeUIntBE=function(t,e,r,n){t=+t,e=0|e,r=0|r,n||I(this,t,e,r,Math.pow(2,8*r),0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},o.prototype.writeUInt8=function(t,e,r){return t=+t,e=0|e,r||I(this,t,e,1,255,0),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},o.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=0|e,r||I(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):R(this,t,e,!0),e+2},o.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=0|e,r||I(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):R(this,t,e,!1),e+2},o.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=0|e,r||I(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):O(this,t,e,!0),e+4},o.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=0|e,r||I(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):O(this,t,e,!1),e+4},o.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e=0|e,!n){var i=Math.pow(2,8*r-1);I(this,t,e,r,i-1,-i)}var o=0,a=1,s=0>t?1:0;for(this[e]=255&t;++o<r&&(a*=256);)this[e+o]=(t/a>>0)-s&255;return e+r},o.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e=0|e,!n){var i=Math.pow(2,8*r-1);I(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0>t?1:0;for(this[e+o]=255&t;--o>=0&&(a*=256);)this[e+o]=(t/a>>0)-s&255;return e+r},o.prototype.writeInt8=function(t,e,r){return t=+t,e=0|e,r||I(this,t,e,1,127,-128),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),0>t&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,r){return t=+t,e=0|e,r||I(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):R(this,t,e,!0),e+2},o.prototype.writeInt16BE=function(t,e,r){return t=+t,e=0|e,r||I(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):R(this,t,e,!1),e+2},o.prototype.writeInt32LE=function(t,e,r){return t=+t,e=0|e,r||I(this,t,e,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):O(this,t,e,!0),e+4},o.prototype.writeInt32BE=function(t,e,r){return t=+t,e=0|e,r||I(this,t,e,4,2147483647,-2147483648),0>t&&(t=4294967295+t+1),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):O(this,t,e,!1),e+4},o.prototype.writeFloatLE=function(t,e,r){return D(this,t,e,!0,r)},o.prototype.writeFloatBE=function(t,e,r){return D(this,t,e,!1,r)},o.prototype.writeDoubleLE=function(t,e,r){return F(this,t,e,!0,r)},o.prototype.writeDoubleBE=function(t,e,r){return F(this,t,e,!1,r)},o.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&r>n&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(0>e)throw new RangeError("targetStart out of bounds");if(0>r||r>=this.length)throw new RangeError("sourceStart out of bounds");if(0>n)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i,a=n-r;if(this===t&&e>r&&n>e)for(i=a-1;i>=0;i--)t[i+e]=this[i+r];else if(1e3>a||!o.TYPED_ARRAY_SUPPORT)for(i=0;a>i;i++)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+a),e);return a},o.prototype.fill=function(t,e,r){if(t||(t=0),e||(e=0),r||(r=this.length),e>r)throw new RangeError("end < start");if(r!==e&&0!==this.length){if(0>e||e>=this.length)throw new RangeError("start out of bounds");
if(0>r||r>this.length)throw new RangeError("end out of bounds");var n;if("number"==typeof t)for(n=e;r>n;n++)this[n]=t;else{var i=q(t.toString()),o=i.length;for(n=e;r>n;n++)this[n]=i[n%o]}return this}};var J=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":51,ieee754:52,isarray:53}],51:[function(t,e,r){!function(t){"use strict";function e(t){var e=t.charCodeAt(0);return e===a||e===h?62:e===s||e===f?63:l>e?-1:l+10>e?e-l+26+26:u+26>e?e-u:c+26>e?e-c+26:void 0}function r(t){function r(t){c[h++]=t}var n,i,a,s,l,c;if(t.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var u=t.length;l="="===t.charAt(u-2)?2:"="===t.charAt(u-1)?1:0,c=new o(3*t.length/4-l),a=l>0?t.length-4:t.length;var h=0;for(n=0,i=0;a>n;n+=4,i+=3)s=e(t.charAt(n))<<18|e(t.charAt(n+1))<<12|e(t.charAt(n+2))<<6|e(t.charAt(n+3)),r((16711680&s)>>16),r((65280&s)>>8),r(255&s);return 2===l?(s=e(t.charAt(n))<<2|e(t.charAt(n+1))>>4,r(255&s)):1===l&&(s=e(t.charAt(n))<<10|e(t.charAt(n+1))<<4|e(t.charAt(n+2))>>2,r(s>>8&255),r(255&s)),c}function n(t){function e(t){return i.charAt(t)}function r(t){return e(t>>18&63)+e(t>>12&63)+e(t>>6&63)+e(63&t)}var n,o,a,s=t.length%3,l="";for(n=0,a=t.length-s;a>n;n+=3)o=(t[n]<<16)+(t[n+1]<<8)+t[n+2],l+=r(o);switch(s){case 1:o=t[t.length-1],l+=e(o>>2),l+=e(o<<4&63),l+="==";break;case 2:o=(t[t.length-2]<<8)+t[t.length-1],l+=e(o>>10),l+=e(o>>4&63),l+=e(o<<2&63),l+="="}return l}var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="+".charCodeAt(0),s="/".charCodeAt(0),l="0".charCodeAt(0),c="a".charCodeAt(0),u="A".charCodeAt(0),h="-".charCodeAt(0),f="_".charCodeAt(0);t.toByteArray=r,t.fromByteArray=n}("undefined"==typeof r?this.base64js={}:r)},{}],52:[function(t,e,r){r.read=function(t,e,r,n,i){var o,a,s=8*i-n-1,l=(1<<s)-1,c=l>>1,u=-7,h=r?i-1:0,f=r?-1:1,d=t[e+h];for(h+=f,o=d&(1<<-u)-1,d>>=-u,u+=s;u>0;o=256*o+t[e+h],h+=f,u-=8);for(a=o&(1<<-u)-1,o>>=-u,u+=n;u>0;a=256*a+t[e+h],h+=f,u-=8);if(0===o)o=1-c;else{if(o===l)return a?NaN:(d?-1:1)*(1/0);a+=Math.pow(2,n),o-=c}return(d?-1:1)*a*Math.pow(2,o-n)},r.write=function(t,e,r,n,i,o){var a,s,l,c=8*o-i-1,u=(1<<c)-1,h=u>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,g=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=u):(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>=u?(s=0,a=u):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+d]=255&s,d+=p,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;t[r+d]=255&a,d+=p,a/=256,c-=8);t[r+d-p]|=128*g}},{}],53:[function(t,e,r){var n={}.toString;e.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},{}],54:[function(t,e,r){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(t){return"function"==typeof t}function o(t){return"number"==typeof t}function a(t){return"object"==typeof t&&null!==t}function s(t){return void 0===t}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(t){if(!o(t)||0>t||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},n.prototype.emit=function(t){var e,r,n,o,l,c;if(this._events||(this._events={}),"error"===t&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;throw TypeError('Uncaught, unspecified "error" event.')}if(r=this._events[t],s(r))return!1;if(i(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:o=Array.prototype.slice.call(arguments,1),r.apply(this,o)}else if(a(r))for(o=Array.prototype.slice.call(arguments,1),c=r.slice(),n=c.length,l=0;n>l;l++)c[l].apply(this,o);return!0},n.prototype.addListener=function(t,e){var r;if(!i(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,i(e.listener)?e.listener:e),this._events[t]?a(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,a(this._events[t])&&!this._events[t].warned&&(r=s(this._maxListeners)?n.defaultMaxListeners:this._maxListeners,r&&r>0&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function r(){this.removeListener(t,r),n||(n=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var n=!1;return r.listener=e,this.on(t,r),this},n.prototype.removeListener=function(t,e){var r,n,o,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],o=r.length,n=-1,r===e||i(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(a(r)){for(s=o;s-- >0;)if(r[s]===e||r[s].listener&&r[s].listener===e){n=s;break}if(0>n)return this;1===r.length?(r.length=0,delete this._events[t]):r.splice(n,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},n.prototype.removeAllListeners=function(t){var e,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[t],i(r))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},{}],55:[function(t,e,r){function n(){u=!1,s.length?c=s.concat(c):h=-1,c.length&&i()}function i(){if(!u){var t=setTimeout(n);u=!0;for(var e=c.length;e;){for(s=c,c=[];++h<e;)s&&s[h].run();h=-1,e=c.length}s=null,u=!1,clearTimeout(t)}}function o(t,e){this.fun=t,this.array=e}function a(){}var s,l=e.exports={},c=[],u=!1,h=-1;l.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];c.push(new o(t,e)),1!==c.length||u||setTimeout(i,0)},o.prototype.run=function(){this.fun.apply(null,this.array)},l.title="browser",l.browser=!0,l.env={},l.argv=[],l.version="",l.versions={},l.on=a,l.addListener=a,l.once=a,l.off=a,l.removeListener=a,l.removeAllListeners=a,l.emit=a,l.binding=function(t){throw new Error("process.binding is not supported")},l.cwd=function(){return"/"},l.chdir=function(t){throw new Error("process.chdir is not supported")},l.umask=function(){return 0}},{}],56:[function(t,e,r){e.exports={jet:[{index:0,rgb:[0,0,131]},{index:.125,rgb:[0,60,170]},{index:.375,rgb:[5,255,255]},{index:.625,rgb:[255,255,0]},{index:.875,rgb:[250,0,0]},{index:1,rgb:[128,0,0]}],hsv:[{index:0,rgb:[255,0,0]},{index:.169,rgb:[253,255,2]},{index:.173,rgb:[247,255,2]},{index:.337,rgb:[0,252,4]},{index:.341,rgb:[0,252,10]},{index:.506,rgb:[1,249,255]},{index:.671,rgb:[2,0,253]},{index:.675,rgb:[8,0,253]},{index:.839,rgb:[255,0,251]},{index:.843,rgb:[255,0,245]},{index:1,rgb:[255,0,6]}],hot:[{index:0,rgb:[0,0,0]},{index:.3,rgb:[230,0,0]},{index:.6,rgb:[255,210,0]},{index:1,rgb:[255,255,255]}],cool:[{index:0,rgb:[0,255,255]},{index:1,rgb:[255,0,255]}],spring:[{index:0,rgb:[255,0,255]},{index:1,rgb:[255,255,0]}],summer:[{index:0,rgb:[0,128,102]},{index:1,rgb:[255,255,102]}],autumn:[{index:0,rgb:[255,0,0]},{index:1,rgb:[255,255,0]}],winter:[{index:0,rgb:[0,0,255]},{index:1,rgb:[0,255,128]}],bone:[{index:0,rgb:[0,0,0]},{index:.376,rgb:[84,84,116]},{index:.753,rgb:[169,200,200]},{index:1,rgb:[255,255,255]}],copper:[{index:0,rgb:[0,0,0]},{index:.804,rgb:[255,160,102]},{index:1,rgb:[255,199,127]}],greys:[{index:0,rgb:[0,0,0]},{index:1,rgb:[255,255,255]}],yignbu:[{index:0,rgb:[8,29,88]},{index:.125,rgb:[37,52,148]},{index:.25,rgb:[34,94,168]},{index:.375,rgb:[29,145,192]},{index:.5,rgb:[65,182,196]},{index:.625,rgb:[127,205,187]},{index:.75,rgb:[199,233,180]},{index:.875,rgb:[237,248,217]},{index:1,rgb:[255,255,217]}],greens:[{index:0,rgb:[0,68,27]},{index:.125,rgb:[0,109,44]},{index:.25,rgb:[35,139,69]},{index:.375,rgb:[65,171,93]},{index:.5,rgb:[116,196,118]},{index:.625,rgb:[161,217,155]},{index:.75,rgb:[199,233,192]},{index:.875,rgb:[229,245,224]},{index:1,rgb:[247,252,245]}],yiorrd:[{index:0,rgb:[128,0,38]},{index:.125,rgb:[189,0,38]},{index:.25,rgb:[227,26,28]},{index:.375,rgb:[252,78,42]},{index:.5,rgb:[253,141,60]},{index:.625,rgb:[254,178,76]},{index:.75,rgb:[254,217,118]},{index:.875,rgb:[255,237,160]},{index:1,rgb:[255,255,204]}],bluered:[{index:0,rgb:[0,0,255]},{index:1,rgb:[255,0,0]}],rdbu:[{index:0,rgb:[5,10,172]},{index:.35,rgb:[106,137,247]},{index:.5,rgb:[190,190,190]},{index:.6,rgb:[220,170,132]},{index:.7,rgb:[230,145,90]},{index:1,rgb:[178,10,28]}],picnic:[{index:0,rgb:[0,0,255]},{index:.1,rgb:[51,153,255]},{index:.2,rgb:[102,204,255]},{index:.3,rgb:[153,204,255]},{index:.4,rgb:[204,204,255]},{index:.5,rgb:[255,255,255]},{index:.6,rgb:[255,204,255]},{index:.7,rgb:[255,153,255]},{index:.8,rgb:[255,102,204]},{index:.9,rgb:[255,102,102]},{index:1,rgb:[255,0,0]}],rainbow:[{index:0,rgb:[150,0,90]},{index:.125,rgb:[0,0,200]},{index:.25,rgb:[0,25,255]},{index:.375,rgb:[0,152,255]},{index:.5,rgb:[44,255,150]},{index:.625,rgb:[151,255,0]},{index:.75,rgb:[255,234,0]},{index:.875,rgb:[255,111,0]},{index:1,rgb:[255,0,0]}],portland:[{index:0,rgb:[12,51,131]},{index:.25,rgb:[10,136,186]},{index:.5,rgb:[242,211,56]},{index:.75,rgb:[242,143,56]},{index:1,rgb:[217,30,30]}],blackbody:[{index:0,rgb:[0,0,0]},{index:.2,rgb:[230,0,0]},{index:.4,rgb:[230,210,0]},{index:.7,rgb:[255,255,255]},{index:1,rgb:[160,200,255]}],earth:[{index:0,rgb:[0,0,130]},{index:.1,rgb:[0,180,180]},{index:.2,rgb:[40,210,40]},{index:.4,rgb:[230,230,50]},{index:.6,rgb:[120,70,20]},{index:1,rgb:[255,255,255]}],electric:[{index:0,rgb:[0,0,0]},{index:.15,rgb:[30,0,100]},{index:.4,rgb:[120,0,100]},{index:.6,rgb:[160,90,0]},{index:.8,rgb:[230,200,0]},{index:1,rgb:[255,250,220]}],alpha:[{index:0,rgb:[255,255,255,0]},{index:0,rgb:[255,255,255,1]}]}},{}],57:[function(t,e,r){"use strict";function n(t){for(var e,r="#",n=0;3>n;++n)e=t[n],e=e.toString(16),r+=("00"+e).substr(e.length);return r}function i(t){return"rgba("+t.join(",")+")"}var o=t("arraytools"),a=t("clone"),s=t("./colorScales");e.exports=function(t){var e,r,l,c,u,h,f,d,p,g,v,m,y,b=[],x=[],_=[],w=[];if(o.isPlainObject(t)||(t={}),p=t.nshades||72,d=t.format||"hex",f=t.colormap,f||(f="jet"),"string"==typeof f){if(f=f.toLowerCase(),!s[f])throw Error(f+" not a supported colorscale");h=a(s[f])}else{if(!Array.isArray(f))throw Error("unsupported colormap option",f);h=a(f)}if(h.length>p)throw new Error(f+" map requires nshades to be at least size "+h.length);for(v=Array.isArray(t.alpha)?2!==t.alpha.length?[1,1]:a(t.alpha):"number"==typeof t.alpha?[t.alpha,t.alpha]:[1,1],e=h.map(function(t){return Math.round(t.index*p)}),v[0]<0&&(v[0]=0),v[1]<0&&(v[0]=0),v[0]>1&&(v[0]=1),v[1]>1&&(v[0]=1),y=0;y<e.length;++y)m=h[y].index,r=h[y].rgb,4===r.length&&r[3]>=0&&r[3]<=1||(r[3]=v[0]+(v[1]-v[0])*m);for(y=0;y<e.length-1;++y)u=e[y+1]-e[y],l=h[y].rgb,c=h[y+1].rgb,b=b.concat(o.linspace(l[0],c[0],u)),x=x.concat(o.linspace(l[1],c[1],u)),_=_.concat(o.linspace(l[2],c[2],u)),w=w.concat(o.linspace(l[3],c[3],u));return b=b.map(Math.round),x=x.map(Math.round),_=_.map(Math.round),g=o.zip(b,x,_,w),"hex"===d&&(g=g.map(n)),"rgbaString"===d&&(g=g.map(i)),g}},{"./colorScales":56,arraytools:48,clone:58}],58:[function(t,e,r){(function(t){var r=function(){"use strict";function e(r,n,i,o){function s(r,i){if(null===r)return null;if(0==i)return r;var l,f;if("object"!=typeof r)return r;if(e.__isArray(r))l=[];else if(e.__isRegExp(r))l=new RegExp(r.source,a(r)),r.lastIndex&&(l.lastIndex=r.lastIndex);else if(e.__isDate(r))l=new Date(r.getTime());else{if(h&&t.isBuffer(r))return l=new t(r.length),r.copy(l),l;"undefined"==typeof o?(f=Object.getPrototypeOf(r),l=Object.create(f)):(l=Object.create(o),f=o)}if(n){var d=c.indexOf(r);if(-1!=d)return u[d];c.push(r),u.push(l)}for(var p in r){var g;f&&(g=Object.getOwnPropertyDescriptor(f,p)),g&&null==g.set||(l[p]=s(r[p],i-1))}return l}var l;"object"==typeof n&&(i=n.depth,o=n.prototype,l=n.filter,n=n.circular);var c=[],u=[],h="undefined"!=typeof t;return"undefined"==typeof n&&(n=!0),"undefined"==typeof i&&(i=1/0),s(r,i)}function r(t){return Object.prototype.toString.call(t)}function n(t){return"object"==typeof t&&"[object Date]"===r(t)}function i(t){return"object"==typeof t&&"[object Array]"===r(t)}function o(t){return"object"==typeof t&&"[object RegExp]"===r(t)}function a(t){var e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}return e.clonePrototype=function(t){if(null===t)return null;var e=function(){};return e.prototype=t,new e},e.__objToStr=r,e.__isDate=n,e.__isArray=i,e.__isRegExp=o,e.__getRegExpFlags=a,e}();"object"==typeof e&&e.exports&&(e.exports=r)}).call(this,t("buffer").Buffer)},{buffer:50}],59:[function(t,e,r){function n(t,e){return t-e}function i(t,e){var r=t.length,i=t.length-e.length;if(i)return i;switch(r){case 0:return 0;case 1:return t[0]-e[0];case 2:return t[0]+t[1]-e[0]-e[1]||o(t[0],t[1])-o(e[0],e[1]);case 3:var a=t[0]+t[1],s=e[0]+e[1];if(i=a+t[2]-(s+e[2]))return i;var l=o(t[0],t[1]),c=o(e[0],e[1]);return o(l,t[2])-o(c,e[2])||o(l+t[2],a)-o(c+e[2],s);case 4:var u=t[0],h=t[1],f=t[2],d=t[3],p=e[0],g=e[1],v=e[2],m=e[3];return u+h+f+d-(p+g+v+m)||o(u,h,f,d)-o(p,g,v,m,p)||o(u+h,u+f,u+d,h+f,h+d,f+d)-o(p+g,p+v,p+m,g+v,g+m,v+m)||o(u+h+f,u+h+d,u+f+d,h+f+d)-o(p+g+v,p+g+m,p+v+m,g+v+m);default:for(var y=t.slice().sort(n),b=e.slice().sort(n),x=0;r>x;++x)if(i=y[x]-b[x])return i;return 0}}e.exports=i;var o=Math.min},{}],60:[function(t,e,r){"use strict";function n(t){var e=t.length;if(0===e)return[];if(1===e)return[[0]];var r=t[0].length;return 0===r?[]:1===r?i(t):2===r?o(t):a(t,r)}var i=t("./lib/ch1d"),o=t("./lib/ch2d"),a=t("./lib/chnd");e.exports=n},{"./lib/ch1d":61,"./lib/ch2d":62,"./lib/chnd":63}],61:[function(t,e,r){"use strict";function n(t){for(var e=0,r=0,n=1;n<t.length;++n)t[n][0]<t[e][0]&&(e=n),t[n][0]>t[r][0]&&(r=n);return r>e?[[e],[r]]:e>r?[[r],[e]]:[[e]]}e.exports=n},{}],62:[function(t,e,r){"use strict";function n(t){var e=i(t),r=e.length;if(2>=r)return[];for(var n=new Array(r),o=e[r-1],a=0;r>a;++a){var s=e[a];n[a]=[o,s],o=s}return n}e.exports=n;var i=t("monotone-convex-hull-2d")},{"monotone-convex-hull-2d":65}],63:[function(t,e,r){"use strict";function n(t,e){for(var r=t.length,n=new Array(r),i=0;i<e.length;++i)n[i]=t[e[i]];for(var o=e.length,i=0;r>i;++i)e.indexOf(i)<0&&(n[o++]=t[i]);return n}function i(t,e){for(var r=t.length,n=e.length,i=0;r>i;++i)for(var o=t[i],a=0;a<o.length;++a){var s=o[a];if(n>s)o[a]=e[s];else{s-=n;for(var l=0;n>l;++l)s>=e[l]&&(s+=1);o[a]=s}}return t}function o(t,e){try{return a(t,!0)}catch(r){var o=s(t);if(o.length<=e)return[];var l=n(t,o),c=a(l,!0);return i(c,o)}}e.exports=o;var a=t("incremental-convex-hull"),s=t("affine-hull")},{"affine-hull":64,"incremental-convex-hull":191}],64:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(e+1),n=0;n<t.length;++n)r[n]=t[n];for(var n=0;n<=t.length;++n){for(var i=t.length;e>=i;++i){for(var a=new Array(e),s=0;e>s;++s)a[s]=Math.pow(i+1-n,s);r[i]=a}var l=o.apply(void 0,r);if(l)return!0}return!1}function i(t){var e=t.length;if(0===e)return[];if(1===e)return[0];for(var r=t[0].length,i=[t[0]],o=[0],a=1;e>a;++a)if(i.push(t[a]),n(i,r)){if(o.push(a),o.length===r+1)return o}else i.pop();return o}e.exports=i;var o=t("robust-orientation")},{"robust-orientation":214}],65:[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],c=t[l],u=a.length;u>1&&i(t[a[u-2]],t[a[u-1]],c)<=0;)u-=1,a.pop();for(a.push(l),u=s.length;u>1&&i(t[s[u-2]],t[s[u-1]],c)>=0;)u-=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 d=s.length-2;d>0;--d)r[h++]=s[d];return r}e.exports=n;var i=t("robust-orientation")[3]},{"robust-orientation":214}],66:[function(t,e,r){"use strict";function n(){this.argTypes=[],this.shimArgs=[],this.arrayArgs=[],this.arrayBlockIndices=[],this.scalarArgs=[],this.offsetArgs=[],this.offsetArgIndex=[],this.indexArgs=[],this.shapeArgs=[],this.funcName="",this.pre=null,this.body=null,this.post=null,this.debug=!1}function i(t){var e=new n;e.pre=t.pre,e.body=t.body,e.post=t.post;var r=t.args.slice(0);e.argTypes=r;for(var i=0;i<r.length;++i){var a=r[i];if("array"===a||"object"==typeof a&&a.blockIndices){if(e.argTypes[i]="array",e.arrayArgs.push(i),e.arrayBlockIndices.push(a.blockIndices?a.blockIndices:0),e.shimArgs.push("array"+i),i<e.pre.args.length&&e.pre.args[i].count>0)throw new Error("cwise: pre() block may not reference array args");if(i<e.post.args.length&&e.post.args[i].count>0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===a)e.scalarArgs.push(i),e.shimArgs.push("scalar"+i);else if("index"===a){if(e.indexArgs.push(i),i<e.pre.args.length&&e.pre.args[i].count>0)throw new Error("cwise: pre() block may not reference array index");if(i<e.body.args.length&&e.body.args[i].lvalue)throw new Error("cwise: body() block may not write to array index");if(i<e.post.args.length&&e.post.args[i].count>0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===a){if(e.shapeArgs.push(i),i<e.pre.args.length&&e.pre.args[i].lvalue)throw new Error("cwise: pre() block may not write to array shape");if(i<e.body.args.length&&e.body.args[i].lvalue)throw new Error("cwise: body() block may not write to array shape");if(i<e.post.args.length&&e.post.args[i].lvalue)throw new Error("cwise: post() block may not write to array shape")}else{if("object"!=typeof a||!a.offset)throw new Error("cwise: Unknown argument type "+r[i]);e.argTypes[i]="offset",e.offsetArgs.push({array:a.array,offset:a.offset}),e.offsetArgIndex.push(i)}}if(e.arrayArgs.length<=0)throw new Error("cwise: No array arguments specified");if(e.pre.args.length>r.length)throw new Error("cwise: Too many arguments in pre() block");if(e.body.args.length>r.length)throw new Error("cwise: Too many arguments in body() block");if(e.post.args.length>r.length)throw new Error("cwise: Too many arguments in post() block");return e.debug=!!t.printCode||!!t.debug,e.funcName=t.funcName||"cwise",e.blockSize=t.blockSize||64,o(e)}var o=t("./lib/thunk.js");e.exports=i},{"./lib/thunk.js":68}],67:[function(t,e,r){"use strict";function n(t,e,r){var n,i,o=t.length,a=e.arrayArgs.length,s=e.indexArgs.length>0,l=[],c=[],u=0,h=0;for(n=0;o>n;++n)c.push(["i",n,"=0"].join(""));for(i=0;a>i;++i)for(n=0;o>n;++n)h=u,u=t[n],0===n?c.push(["d",i,"s",n,"=t",i,"p",u].join("")):c.push(["d",i,"s",n,"=(t",i,"p",u,"-s",h,"*t",i,"p",h,")"].join(""));for(l.push("var "+c.join(",")),n=o-1;n>=0;--n)u=t[n],l.push(["for(i",n,"=0;i",n,"<s",u,";++i",n,"){"].join(""));for(l.push(r),n=0;o>n;++n){for(h=u,u=t[n],i=0;a>i;++i)l.push(["p",i,"+=d",i,"s",n].join(""));s&&(n>0&&l.push(["index[",h,"]-=s",h].join("")),l.push(["++index[",u,"]"].join(""))),l.push("}")}return l.join("\n")}function i(t,e,r,i){for(var o=e.length,a=r.arrayArgs.length,s=r.blockSize,l=r.indexArgs.length>0,c=[],u=0;a>u;++u)c.push(["var offset",u,"=p",u].join(""));for(var u=t;o>u;++u)c.push(["for(var j"+u+"=SS[",e[u],"]|0;j",u,">0;){"].join("")),c.push(["if(j",u,"<",s,"){"].join("")),c.push(["s",e[u],"=j",u].join("")),c.push(["j",u,"=0"].join("")),c.push(["}else{s",e[u],"=",s].join("")),c.push(["j",u,"-=",s,"}"].join("")),l&&c.push(["index[",e[u],"]=j",u].join(""));for(var u=0;a>u;++u){for(var h=["offset"+u],f=t;o>f;++f)h.push(["j",f,"*t",u,"p",e[f]].join(""));c.push(["p",u,"=(",h.join("+"),")"].join(""))}c.push(n(e,r,i));for(var u=t;o>u;++u)c.push("}");return c.join("\n")}function o(t){for(var e=0,r=t[0].length;r>e;){for(var n=1;n<t.length;++n)if(t[n][e]!==t[0][e])return e;++e}return e}function a(t,e,r){for(var n=t.body,i=[],o=[],a=0;a<t.args.length;++a){var s=t.args[a];if(!(s.count<=0)){var l=new RegExp(s.name,"g"),c="",u=e.arrayArgs.indexOf(a);switch(e.argTypes[a]){case"offset":var h=e.offsetArgIndex.indexOf(a),f=e.offsetArgs[h];u=f.array,c="+q"+h;case"array":c="p"+u+c;var d="l"+a,p="a"+u;if(0===e.arrayBlockIndices[u])1===s.count?"generic"===r[u]?s.lvalue?(i.push(["var ",d,"=",p,".get(",c,")"].join("")),n=n.replace(l,d),o.push([p,".set(",c,",",d,")"].join(""))):n=n.replace(l,[p,".get(",c,")"].join("")):n=n.replace(l,[p,"[",c,"]"].join("")):"generic"===r[u]?(i.push(["var ",d,"=",p,".get(",c,")"].join("")),n=n.replace(l,d),s.lvalue&&o.push([p,".set(",c,",",d,")"].join(""))):(i.push(["var ",d,"=",p,"[",c,"]"].join("")),n=n.replace(l,d),s.lvalue&&o.push([p,"[",c,"]=",d].join("")));else{for(var g=[s.name],v=[c],m=0;m<Math.abs(e.arrayBlockIndices[u]);m++)g.push("\\s*\\[([^\\]]+)\\]"),v.push("$"+(m+1)+"*t"+u+"b"+m);if(l=new RegExp(g.join(""),"g"),c=v.join("+"),"generic"===r[u])throw new Error("cwise: Generic arrays not supported in combination with blocks!");n=n.replace(l,[p,"[",c,"]"].join(""))}break;case"scalar":n=n.replace(l,"Y"+e.scalarArgs.indexOf(a));break;case"index":n=n.replace(l,"index");break;case"shape":n=n.replace(l,"shape")}}}return[i.join("\n"),n,o.join("\n")].join("\n").trim()}function s(t){for(var e=new Array(t.length),r=!0,n=0;n<t.length;++n){var i=t[n],o=i.match(/\d+/);o=o?o[0]:"",0===i.charAt(0)?e[n]="u"+i.charAt(1)+o:e[n]=i.charAt(0)+o,n>0&&(r=r&&e[n]===e[n-1])}return r?e[0]:e.join("")}function l(t,e){for(var r=e[1].length-Math.abs(t.arrayBlockIndices[0])|0,l=new Array(t.arrayArgs.length),u=new Array(t.arrayArgs.length),h=0;h<t.arrayArgs.length;++h)u[h]=e[2*h],l[h]=e[2*h+1];for(var f=[],d=[],p=[],g=[],v=[],h=0;h<t.arrayArgs.length;++h){t.arrayBlockIndices[h]<0?(p.push(0),g.push(r),f.push(r),d.push(r+t.arrayBlockIndices[h])):(p.push(t.arrayBlockIndices[h]),g.push(t.arrayBlockIndices[h]+r),f.push(0),d.push(t.arrayBlockIndices[h]));for(var m=[],y=0;y<l[h].length;y++)p[h]<=l[h][y]&&l[h][y]<g[h]&&m.push(l[h][y]-p[h]);v.push(m)}for(var b=["SS"],x=["'use strict'"],_=[],y=0;r>y;++y)_.push(["s",y,"=SS[",y,"]"].join(""));for(var h=0;h<t.arrayArgs.length;++h){b.push("a"+h),b.push("t"+h),b.push("p"+h);for(var y=0;r>y;++y)_.push(["t",h,"p",y,"=t",h,"[",p[h]+y,"]"].join(""));for(var y=0;y<Math.abs(t.arrayBlockIndices[h]);++y)_.push(["t",h,"b",y,"=t",h,"[",f[h]+y,"]"].join(""))}for(var h=0;h<t.scalarArgs.length;++h)b.push("Y"+h);if(t.shapeArgs.length>0&&_.push("shape=SS.slice(0)"),t.indexArgs.length>0){for(var w=new Array(r),h=0;r>h;++h)w[h]="0";_.push(["index=[",w.join(","),"]"].join(""))}for(var h=0;h<t.offsetArgs.length;++h){for(var k=t.offsetArgs[h],A=[],y=0;y<k.offset.length;++y)0!==k.offset[y]&&(1===k.offset[y]?A.push(["t",k.array,"p",y].join("")):A.push([k.offset[y],"*t",k.array,"p",y].join("")));0===A.length?_.push("q"+h+"=0"):_.push(["q",h,"=",A.join("+")].join(""))}var M=c([].concat(t.pre.thisVars).concat(t.body.thisVars).concat(t.post.thisVars));_=_.concat(M),x.push("var "+_.join(","));for(var h=0;h<t.arrayArgs.length;++h)x.push("p"+h+"|=0");t.pre.body.length>3&&x.push(a(t.pre,t,u));var T=a(t.body,t,u),E=o(v);r>E?x.push(i(E,v[0],t,T)):x.push(n(v[0],t,T)),t.post.body.length>3&&x.push(a(t.post,t,u)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+x.join("\n")+"\n----------");var L=[t.funcName||"unnamed","_cwise_loop_",l[0].join("s"),"m",E,s(u)].join(""),S=new Function(["function ",L,"(",b.join(","),"){",x.join("\n"),"} return ",L].join(""));return S()}var c=t("uniq");e.exports=l},{uniq:234}],68:[function(t,e,r){"use strict";function n(t){var e=["'use strict'","var CACHED={}"],r=[],n=t.funcName+"_cwise_thunk";e.push(["return function ",n,"(",t.shimArgs.join(","),"){"].join(""));for(var o=[],a=[],s=[["array",t.arrayArgs[0],".shape.slice(",Math.max(0,t.arrayBlockIndices[0]),t.arrayBlockIndices[0]<0?","+t.arrayBlockIndices[0]+")":")"].join("")],l=[],c=[],u=0;u<t.arrayArgs.length;++u){var h=t.arrayArgs[u];r.push(["t",h,"=array",h,".dtype,","r",h,"=array",h,".order"].join("")),o.push("t"+h),o.push("r"+h),a.push("t"+h),a.push("r"+h+".join()"),s.push("array"+h+".data"),s.push("array"+h+".stride"),s.push("array"+h+".offset|0"),u>0&&(l.push("array"+t.arrayArgs[0]+".shape.length===array"+h+".shape.length+"+(Math.abs(t.arrayBlockIndices[0])-Math.abs(t.arrayBlockIndices[u]))),c.push("array"+t.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[0])+"]===array"+h+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[u])+"]"))}t.arrayArgs.length>1&&(e.push("if (!("+l.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),e.push("for(var shapeIndex=array"+t.arrayArgs[0]+".shape.length-"+Math.abs(t.arrayBlockIndices[0])+"; shapeIndex-->0;) {"),e.push("if (!("+c.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),e.push("}"));for(var u=0;u<t.scalarArgs.length;++u)s.push("scalar"+t.scalarArgs[u]);r.push(["type=[",a.join(","),"].join()"].join("")),r.push("proc=CACHED[type]"),e.push("var "+r.join(",")),e.push(["if(!proc){","CACHED[type]=proc=compile([",o.join(","),"])}","return proc(",s.join(","),")}"].join("")),t.debug&&console.log("-----Generated thunk:\n"+e.join("\n")+"\n----------");var f=new Function("compile",e.join("\n"));return f(i.bind(void 0,t))}var i=t("./compile.js");e.exports=n},{"./compile.js":67}],69:[function(t,e,r){e.exports=t("cwise-compiler")},{"cwise-compiler":66}],70:[function(e,r,n){!function(){function e(t){return t&&(t.ownerDocument||t.document||t).documentElement}function n(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}function i(t,e){return e>t?-1:t>e?1:t>=e?0:NaN}function o(t){return null===t?NaN:+t}function a(t){return!isNaN(t)}function s(t){return{left:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);i>n;){var o=n+i>>>1;t(e[o],r)<0?n=o+1:i=o}return n},right:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);i>n;){var o=n+i>>>1;t(e[o],r)>0?i=o:n=o+1}return n}}}function l(t){return t.length}function c(t){for(var e=1;t*e%1;)e*=10;return e}function u(t,e){for(var r in e)Object.defineProperty(t.prototype,r,{value:e[r],enumerable:!1})}function h(){this._=Object.create(null)}function f(t){return(t+="")===ka||t[0]===Aa?Aa+t:t}function d(t){return(t+="")[0]===Aa?t.slice(1):t}function p(t){return f(t)in this._}function g(t){return(t=f(t))in this._&&delete this._[t]}function v(){var t=[];for(var e in this._)t.push(d(e));return t}function m(){var t=0;for(var e in this._)++t;return t}function y(){for(var t in this._)return!1;return!0}function b(){this._=Object.create(null)}function x(t){return t}function _(t,e,r){return function(){var n=r.apply(e,arguments);return n===e?t:n}}function w(t,e){if(e in t)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(var r=0,n=Ma.length;n>r;++r){var i=Ma[r]+e;if(i in t)return i}}function k(){}function A(){}function M(t){function e(){for(var e,n=r,i=-1,o=n.length;++i<o;)(e=n[i].on)&&e.apply(this,arguments);return t}var r=[],n=new h;return e.on=function(e,i){var o,a=n.get(e);return arguments.length<2?a&&a.on:(a&&(a.on=null,r=r.slice(0,o=r.indexOf(a)).concat(r.slice(o+1)),n.remove(e)),i&&r.push(n.set(e,{on:i})),t)},e}function T(){ua.event.preventDefault()}function E(){for(var t,e=ua.event;t=e.sourceEvent;)e=t;return e}function L(t){for(var e=new A,r=0,n=arguments.length;++r<n;)e[arguments[r]]=M(e);return e.of=function(r,n){return function(i){try{var o=i.sourceEvent=ua.event;i.target=t,ua.event=i,e[i.type].apply(r,n)}finally{ua.event=o}}},e}function S(t){return Ea(t,za),t}function C(t){return"function"==typeof t?t:function(){return La(t,this)}}function z(t){return"function"==typeof t?t:function(){return Sa(t,this)}}function j(t,e){function r(){this.removeAttribute(t)}function n(){this.removeAttributeNS(t.space,t.local)}function i(){this.setAttribute(t,e)}function o(){this.setAttributeNS(t.space,t.local,e)}function a(){var r=e.apply(this,arguments);null==r?this.removeAttribute(t):this.setAttribute(t,r)}function s(){var r=e.apply(this,arguments);null==r?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,r)}return t=ua.ns.qualify(t),null==e?t.local?n:r:"function"==typeof e?t.local?s:a:t.local?o:i}function P(t){return t.trim().replace(/\s+/g," ")}function I(t){return new RegExp("(?:^|\\s+)"+ua.requote(t)+"(?:\\s+|$)","g")}function R(t){return(t+"").trim().split(/^|\s+/)}function O(t,e){function r(){for(var r=-1;++r<i;)t[r](this,e)}function n(){for(var r=-1,n=e.apply(this,arguments);++r<i;)t[r](this,n)}t=R(t).map(N);var i=t.length;return"function"==typeof e?n:r}function N(t){var e=I(t);return function(r,n){if(i=r.classList)return n?i.add(t):i.remove(t);var i=r.getAttribute("class")||"";n?(e.lastIndex=0,e.test(i)||r.setAttribute("class",P(i+" "+t))):r.setAttribute("class",P(i.replace(e," ")))}}function D(t,e,r){function n(){this.style.removeProperty(t)}function i(){this.style.setProperty(t,e,r)}function o(){var n=e.apply(this,arguments);null==n?this.style.removeProperty(t):this.style.setProperty(t,n,r)}return null==e?n:"function"==typeof e?o:i}function F(t,e){function r(){delete this[t]}function n(){this[t]=e}function i(){var r=e.apply(this,arguments);null==r?delete this[t]:this[t]=r}return null==e?r:"function"==typeof e?i:n}function B(t){function e(){var e=this.ownerDocument,r=this.namespaceURI;return r?e.createElementNS(r,t):e.createElement(t)}function r(){return this.ownerDocument.createElementNS(t.space,t.local)}return"function"==typeof t?t:(t=ua.ns.qualify(t)).local?r:e}function U(){var t=this.parentNode;t&&t.removeChild(this)}function V(t){return{__data__:t}}function q(t){return function(){return Ca(this,t)}}function H(t){return arguments.length||(t=i),function(e,r){return e&&r?t(e.__data__,r.__data__):!e-!r}}function G(t,e){for(var r=0,n=t.length;n>r;r++)for(var i,o=t[r],a=0,s=o.length;s>a;a++)(i=o[a])&&e(i,a,r);return t}function Y(t){return Ea(t,Pa),t}function X(t){var e,r;return function(n,i,o){var a,s=t[o].update,l=s.length;for(o!=r&&(r=o,e=0),i>=e&&(e=i+1);!(a=s[e])&&++e<l;);return a}}function W(t,e,r){function n(){var e=this[a];e&&(this.removeEventListener(t,e,e.$),delete this[a])}function i(){var i=l(e,fa(arguments));n.call(this),this.addEventListener(t,this[a]=i,i.$=r),i._=e}function o(){var e,r=new RegExp("^__on([^.]+)"+ua.requote(t)+"$");for(var n in this)if(e=n.match(r)){var i=this[n];this.removeEventListener(e[1],i,i.$),delete this[n]}}var a="__on"+t,s=t.indexOf("."),l=Z;s>0&&(t=t.slice(0,s));var c=Ia.get(t);return c&&(t=c,l=Q),s?e?i:n:e?k:o}function Z(t,e){return function(r){var n=ua.event;ua.event=r,e[0]=this.__data__;try{t.apply(this,e)}finally{ua.event=n}}}function Q(t,e){var r=Z(t,e);return function(t){var e=this,n=t.relatedTarget;n&&(n===e||8&n.compareDocumentPosition(e))||r.call(e,t)}}function $(t){var r=".dragsuppress-"+ ++Oa,i="click"+r,o=ua.select(n(t)).on("touchmove"+r,T).on("dragstart"+r,T).on("selectstart"+r,T);if(null==Ra&&(Ra="onselectstart"in t?!1:w(t.style,"userSelect")),Ra){var a=e(t).style,s=a[Ra];a[Ra]="none"}return function(t){
if(o.on(r,null),Ra&&(a[Ra]=s),t){var e=function(){o.on(i,null)};o.on(i,function(){T(),e()},!0),setTimeout(e,0)}}}function K(t,e){e.changedTouches&&(e=e.changedTouches[0]);var r=t.ownerSVGElement||t;if(r.createSVGPoint){var i=r.createSVGPoint();if(0>Na){var o=n(t);if(o.scrollX||o.scrollY){r=ua.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var a=r[0][0].getScreenCTM();Na=!(a.f||a.e),r.remove()}}return Na?(i.x=e.pageX,i.y=e.pageY):(i.x=e.clientX,i.y=e.clientY),i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}function J(){return ua.event.changedTouches[0].identifier}function tt(t){return t>0?1:0>t?-1:0}function et(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(e[1]-t[1])*(r[0]-t[0])}function rt(t){return t>1?0:-1>t?Ba:Math.acos(t)}function nt(t){return t>1?qa:-1>t?-qa:Math.asin(t)}function it(t){return((t=Math.exp(t))-1/t)/2}function ot(t){return((t=Math.exp(t))+1/t)/2}function at(t){return((t=Math.exp(2*t))-1)/(t+1)}function st(t){return(t=Math.sin(t/2))*t}function lt(){}function ct(t,e,r){return this instanceof ct?(this.h=+t,this.s=+e,void(this.l=+r)):arguments.length<2?t instanceof ct?new ct(t.h,t.s,t.l):kt(""+t,At,ct):new ct(t,e,r)}function ut(t,e,r){function n(t){return t>360?t-=360:0>t&&(t+=360),60>t?o+(a-o)*t/60:180>t?a:240>t?o+(a-o)*(240-t)/60:o}function i(t){return Math.round(255*n(t))}var o,a;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:0>e?0:e>1?1:e,r=0>r?0:r>1?1:r,a=.5>=r?r*(1+e):r+e-r*e,o=2*r-a,new bt(i(t+120),i(t),i(t-120))}function ht(t,e,r){return this instanceof ht?(this.h=+t,this.c=+e,void(this.l=+r)):arguments.length<2?t instanceof ht?new ht(t.h,t.c,t.l):t instanceof dt?gt(t.l,t.a,t.b):gt((t=Mt((t=ua.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new ht(t,e,r)}function ft(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new dt(r,Math.cos(t*=Ha)*e,Math.sin(t)*e)}function dt(t,e,r){return this instanceof dt?(this.l=+t,this.a=+e,void(this.b=+r)):arguments.length<2?t instanceof dt?new dt(t.l,t.a,t.b):t instanceof ht?ft(t.h,t.c,t.l):Mt((t=bt(t)).r,t.g,t.b):new dt(t,e,r)}function pt(t,e,r){var n=(t+16)/116,i=n+e/500,o=n-r/200;return i=vt(i)*es,n=vt(n)*rs,o=vt(o)*ns,new bt(yt(3.2404542*i-1.5371385*n-.4985314*o),yt(-.969266*i+1.8760108*n+.041556*o),yt(.0556434*i-.2040259*n+1.0572252*o))}function gt(t,e,r){return t>0?new ht(Math.atan2(r,e)*Ga,Math.sqrt(e*e+r*r),t):new ht(NaN,NaN,t)}function vt(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function mt(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function yt(t){return Math.round(255*(.00304>=t?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function bt(t,e,r){return this instanceof bt?(this.r=~~t,this.g=~~e,void(this.b=~~r)):arguments.length<2?t instanceof bt?new bt(t.r,t.g,t.b):kt(""+t,bt,ut):new bt(t,e,r)}function xt(t){return new bt(t>>16,t>>8&255,255&t)}function _t(t){return xt(t)+""}function wt(t){return 16>t?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function kt(t,e,r){var n,i,o,a=0,s=0,l=0;if(n=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(i=n[2].split(","),n[1]){case"hsl":return r(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return e(Et(i[0]),Et(i[1]),Et(i[2]))}return(o=as.get(t))?e(o.r,o.g,o.b):(null==t||"#"!==t.charAt(0)||isNaN(o=parseInt(t.slice(1),16))||(4===t.length?(a=(3840&o)>>4,a=a>>4|a,s=240&o,s=s>>4|s,l=15&o,l=l<<4|l):7===t.length&&(a=(16711680&o)>>16,s=(65280&o)>>8,l=255&o)),e(a,s,l))}function At(t,e,r){var n,i,o=Math.min(t/=255,e/=255,r/=255),a=Math.max(t,e,r),s=a-o,l=(a+o)/2;return s?(i=.5>l?s/(a+o):s/(2-a-o),n=t==a?(e-r)/s+(r>e?6:0):e==a?(r-t)/s+2:(t-e)/s+4,n*=60):(n=NaN,i=l>0&&1>l?0:n),new ct(n,i,l)}function Mt(t,e,r){t=Tt(t),e=Tt(e),r=Tt(r);var n=mt((.4124564*t+.3575761*e+.1804375*r)/es),i=mt((.2126729*t+.7151522*e+.072175*r)/rs),o=mt((.0193339*t+.119192*e+.9503041*r)/ns);return dt(116*i-16,500*(n-i),200*(i-o))}function Tt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Et(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}function Lt(t){return"function"==typeof t?t:function(){return t}}function St(t){return function(e,r,n){return 2===arguments.length&&"function"==typeof r&&(n=r,r=null),Ct(e,r,t,n)}}function Ct(t,e,r,n){function i(){var t,e=l.status;if(!e&&jt(l)||e>=200&&300>e||304===e){try{t=r.call(o,l)}catch(n){return void a.error.call(o,n)}a.load.call(o,t)}else a.error.call(o,l)}var o={},a=ua.dispatch("beforesend","progress","load","error"),s={},l=new XMLHttpRequest,c=null;return!this.XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(t)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=i:l.onreadystatechange=function(){l.readyState>3&&i()},l.onprogress=function(t){var e=ua.event;ua.event=t;try{a.progress.call(o,l)}finally{ua.event=e}},o.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?s[t]:(null==e?delete s[t]:s[t]=e+"",o)},o.mimeType=function(t){return arguments.length?(e=null==t?null:t+"",o):e},o.responseType=function(t){return arguments.length?(c=t,o):c},o.response=function(t){return r=t,o},["get","post"].forEach(function(t){o[t]=function(){return o.send.apply(o,[t].concat(fa(arguments)))}}),o.send=function(r,n,i){if(2===arguments.length&&"function"==typeof n&&(i=n,n=null),l.open(r,t,!0),null==e||"accept"in s||(s.accept=e+",*/*"),l.setRequestHeader)for(var u in s)l.setRequestHeader(u,s[u]);return null!=e&&l.overrideMimeType&&l.overrideMimeType(e),null!=c&&(l.responseType=c),null!=i&&o.on("error",i).on("load",function(t){i(null,t)}),a.beforesend.call(o,l),l.send(null==n?null:n),o},o.abort=function(){return l.abort(),o},ua.rebind(o,a,"on"),null==n?o:o.get(zt(n))}function zt(t){return 1===t.length?function(e,r){t(null==e?r:null)}:t}function jt(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function Pt(t,e,r){var n=arguments.length;2>n&&(e=0),3>n&&(r=Date.now());var i=r+e,o={c:t,t:i,n:null};return ls?ls.n=o:ss=o,ls=o,cs||(us=clearTimeout(us),cs=1,hs(It)),o}function It(){var t=Rt(),e=Ot()-t;e>24?(isFinite(e)&&(clearTimeout(us),us=setTimeout(It,e)),cs=0):(cs=1,hs(It))}function Rt(){for(var t=Date.now(),e=ss;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Ot(){for(var t,e=ss,r=1/0;e;)e.c?(e.t<r&&(r=e.t),e=(t=e).n):e=t?t.n=e.n:ss=e.n;return ls=t,r}function Nt(t,e){return e-(t?Math.ceil(Math.log(t)/Math.LN10):1)}function Dt(t,e){var r=Math.pow(10,3*wa(8-e));return{scale:e>8?function(t){return t/r}:function(t){return t*r},symbol:t}}function Ft(t){var e=t.decimal,r=t.thousands,n=t.grouping,i=t.currency,o=n&&r?function(t,e){for(var i=t.length,o=[],a=0,s=n[0],l=0;i>0&&s>0&&(l+s+1>e&&(s=Math.max(1,e-l)),o.push(t.substring(i-=s,i+s)),!((l+=s+1)>e));)s=n[a=(a+1)%n.length];return o.reverse().join(r)}:x;return function(t){var r=ds.exec(t),n=r[1]||" ",a=r[2]||">",s=r[3]||"-",l=r[4]||"",c=r[5],u=+r[6],h=r[7],f=r[8],d=r[9],p=1,g="",v="",m=!1,y=!0;switch(f&&(f=+f.substring(1)),(c||"0"===n&&"="===a)&&(c=n="0",a="="),d){case"n":h=!0,d="g";break;case"%":p=100,v="%",d="f";break;case"p":p=100,v="%",d="r";break;case"b":case"o":case"x":case"X":"#"===l&&(g="0"+d.toLowerCase());case"c":y=!1;case"d":m=!0,f=0;break;case"s":p=-1,d="r"}"$"===l&&(g=i[0],v=i[1]),"r"!=d||f||(d="g"),null!=f&&("g"==d?f=Math.max(1,Math.min(21,f)):("e"==d||"f"==d)&&(f=Math.max(0,Math.min(20,f)))),d=ps.get(d)||Bt;var b=c&&h;return function(t){var r=v;if(m&&t%1)return"";var i=0>t||0===t&&0>1/t?(t=-t,"-"):"-"===s?"":s;if(0>p){var l=ua.formatPrefix(t,f);t=l.scale(t),r=l.symbol+v}else t*=p;t=d(t,f);var x,_,w=t.lastIndexOf(".");if(0>w){var k=y?t.lastIndexOf("e"):-1;0>k?(x=t,_=""):(x=t.substring(0,k),_=t.substring(k))}else x=t.substring(0,w),_=e+t.substring(w+1);!c&&h&&(x=o(x,1/0));var A=g.length+x.length+_.length+(b?0:i.length),M=u>A?new Array(A=u-A+1).join(n):"";return b&&(x=o(M+x,M.length?u-_.length:1/0)),i+=g,t=x+_,("<"===a?i+t+M:">"===a?M+i+t:"^"===a?M.substring(0,A>>=1)+i+t+M.substring(A):i+(b?t:M+t))+r}}}function Bt(t){return t+""}function Ut(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Vt(t,e,r){function n(e){var r=t(e),n=o(r,1);return n-e>e-r?r:n}function i(r){return e(r=t(new vs(r-1)),1),r}function o(t,r){return e(t=new vs(+t),r),t}function a(t,n,o){var a=i(t),s=[];if(o>1)for(;n>a;)r(a)%o||s.push(new Date(+a)),e(a,1);else for(;n>a;)s.push(new Date(+a)),e(a,1);return s}function s(t,e,r){try{vs=Ut;var n=new Ut;return n._=t,a(n,e,r)}finally{vs=Date}}t.floor=t,t.round=n,t.ceil=i,t.offset=o,t.range=a;var l=t.utc=qt(t);return l.floor=l,l.round=qt(n),l.ceil=qt(i),l.offset=qt(o),l.range=s,t}function qt(t){return function(e,r){try{vs=Ut;var n=new Ut;return n._=e,t(n,r)._}finally{vs=Date}}}function Ht(t){function e(t){function e(e){for(var r,i,o,a=[],s=-1,l=0;++s<n;)37===t.charCodeAt(s)&&(a.push(t.slice(l,s)),null!=(i=ys[r=t.charAt(++s)])&&(r=t.charAt(++s)),(o=L[r])&&(r=o(e,null==i?"e"===r?" ":"0":i)),a.push(r),l=s+1);return a.push(t.slice(l,s)),a.join("")}var n=t.length;return e.parse=function(e){var n={y:1900,m:0,d:1,H:0,M:0,S:0,L:0,Z:null},i=r(n,t,e,0);if(i!=e.length)return null;"p"in n&&(n.H=n.H%12+12*n.p);var o=null!=n.Z&&vs!==Ut,a=new(o?Ut:vs);return"j"in n?a.setFullYear(n.y,0,n.j):"W"in n||"U"in n?("w"in n||(n.w="W"in n?1:0),a.setFullYear(n.y,0,1),a.setFullYear(n.y,0,"W"in n?(n.w+6)%7+7*n.W-(a.getDay()+5)%7:n.w+7*n.U-(a.getDay()+6)%7)):a.setFullYear(n.y,n.m,n.d),a.setHours(n.H+(n.Z/100|0),n.M+n.Z%100,n.S,n.L),o?a._:a},e.toString=function(){return t},e}function r(t,e,r,n){for(var i,o,a,s=0,l=e.length,c=r.length;l>s;){if(n>=c)return-1;if(i=e.charCodeAt(s++),37===i){if(a=e.charAt(s++),o=S[a in ys?e.charAt(s++):a],!o||(n=o(t,r,n))<0)return-1}else if(i!=r.charCodeAt(n++))return-1}return n}function n(t,e,r){w.lastIndex=0;var n=w.exec(e.slice(r));return n?(t.w=k.get(n[0].toLowerCase()),r+n[0].length):-1}function i(t,e,r){x.lastIndex=0;var n=x.exec(e.slice(r));return n?(t.w=_.get(n[0].toLowerCase()),r+n[0].length):-1}function o(t,e,r){T.lastIndex=0;var n=T.exec(e.slice(r));return n?(t.m=E.get(n[0].toLowerCase()),r+n[0].length):-1}function a(t,e,r){A.lastIndex=0;var n=A.exec(e.slice(r));return n?(t.m=M.get(n[0].toLowerCase()),r+n[0].length):-1}function s(t,e,n){return r(t,L.c.toString(),e,n)}function l(t,e,n){return r(t,L.x.toString(),e,n)}function c(t,e,n){return r(t,L.X.toString(),e,n)}function u(t,e,r){var n=b.get(e.slice(r,r+=2).toLowerCase());return null==n?-1:(t.p=n,r)}var h=t.dateTime,f=t.date,d=t.time,p=t.periods,g=t.days,v=t.shortDays,m=t.months,y=t.shortMonths;e.utc=function(t){function r(t){try{vs=Ut;var e=new vs;return e._=t,n(e)}finally{vs=Date}}var n=e(t);return r.parse=function(t){try{vs=Ut;var e=n.parse(t);return e&&e._}finally{vs=Date}},r.toString=n.toString,r},e.multi=e.utc.multi=ue;var b=ua.map(),x=Yt(g),_=Xt(g),w=Yt(v),k=Xt(v),A=Yt(m),M=Xt(m),T=Yt(y),E=Xt(y);p.forEach(function(t,e){b.set(t.toLowerCase(),e)});var L={a:function(t){return v[t.getDay()]},A:function(t){return g[t.getDay()]},b:function(t){return y[t.getMonth()]},B:function(t){return m[t.getMonth()]},c:e(h),d:function(t,e){return Gt(t.getDate(),e,2)},e:function(t,e){return Gt(t.getDate(),e,2)},H:function(t,e){return Gt(t.getHours(),e,2)},I:function(t,e){return Gt(t.getHours()%12||12,e,2)},j:function(t,e){return Gt(1+gs.dayOfYear(t),e,3)},L:function(t,e){return Gt(t.getMilliseconds(),e,3)},m:function(t,e){return Gt(t.getMonth()+1,e,2)},M:function(t,e){return Gt(t.getMinutes(),e,2)},p:function(t){return p[+(t.getHours()>=12)]},S:function(t,e){return Gt(t.getSeconds(),e,2)},U:function(t,e){return Gt(gs.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Gt(gs.mondayOfYear(t),e,2)},x:e(f),X:e(d),y:function(t,e){return Gt(t.getFullYear()%100,e,2)},Y:function(t,e){return Gt(t.getFullYear()%1e4,e,4)},Z:le,"%":function(){return"%"}},S={a:n,A:i,b:o,B:a,c:s,d:re,e:re,H:ie,I:ie,j:ne,L:se,m:ee,M:oe,p:u,S:ae,U:Zt,w:Wt,W:Qt,x:l,X:c,y:Kt,Y:$t,Z:Jt,"%":ce};return e}function Gt(t,e,r){var n=0>t?"-":"",i=(n?-t:t)+"",o=i.length;return n+(r>o?new Array(r-o+1).join(e)+i:i)}function Yt(t){return new RegExp("^(?:"+t.map(ua.requote).join("|")+")","i")}function Xt(t){for(var e=new h,r=-1,n=t.length;++r<n;)e.set(t[r].toLowerCase(),r);return e}function Wt(t,e,r){bs.lastIndex=0;var n=bs.exec(e.slice(r,r+1));return n?(t.w=+n[0],r+n[0].length):-1}function Zt(t,e,r){bs.lastIndex=0;var n=bs.exec(e.slice(r));return n?(t.U=+n[0],r+n[0].length):-1}function Qt(t,e,r){bs.lastIndex=0;var n=bs.exec(e.slice(r));return n?(t.W=+n[0],r+n[0].length):-1}function $t(t,e,r){bs.lastIndex=0;var n=bs.exec(e.slice(r,r+4));return n?(t.y=+n[0],r+n[0].length):-1}function Kt(t,e,r){bs.lastIndex=0;var n=bs.exec(e.slice(r,r+2));return n?(t.y=te(+n[0]),r+n[0].length):-1}function Jt(t,e,r){return/^[+-]\d{4}$/.test(e=e.slice(r,r+5))?(t.Z=-e,r+5):-1}function te(t){return t+(t>68?1900:2e3)}function ee(t,e,r){bs.lastIndex=0;var n=bs.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function re(t,e,r){bs.lastIndex=0;var n=bs.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function ne(t,e,r){bs.lastIndex=0;var n=bs.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function ie(t,e,r){bs.lastIndex=0;var n=bs.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function oe(t,e,r){bs.lastIndex=0;var n=bs.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function ae(t,e,r){bs.lastIndex=0;var n=bs.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function se(t,e,r){bs.lastIndex=0;var n=bs.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function le(t){var e=t.getTimezoneOffset(),r=e>0?"-":"+",n=wa(e)/60|0,i=wa(e)%60;return r+Gt(n,"0",2)+Gt(i,"0",2)}function ce(t,e,r){xs.lastIndex=0;var n=xs.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function ue(t){for(var e=t.length,r=-1;++r<e;)t[r][0]=this(t[r][0]);return function(e){for(var r=0,n=t[r];!n[1](e);)n=t[++r];return n[0](e)}}function he(){}function fe(t,e,r){var n=r.s=t+e,i=n-t,o=n-i;r.t=t-o+(e-i)}function de(t,e){t&&As.hasOwnProperty(t.type)&&As[t.type](t,e)}function pe(t,e,r){var n,i=-1,o=t.length-r;for(e.lineStart();++i<o;)n=t[i],e.point(n[0],n[1],n[2]);e.lineEnd()}function ge(t,e){var r=-1,n=t.length;for(e.polygonStart();++r<n;)pe(t[r],e,1);e.polygonEnd()}function ve(){function t(t,e){t*=Ha,e=e*Ha/2+Ba/4;var r=t-n,a=r>=0?1:-1,s=a*r,l=Math.cos(e),c=Math.sin(e),u=o*c,h=i*l+u*Math.cos(s),f=u*a*Math.sin(s);Ts.add(Math.atan2(f,h)),n=t,i=l,o=c}var e,r,n,i,o;Es.point=function(a,s){Es.point=t,n=(e=a)*Ha,i=Math.cos(s=(r=s)*Ha/2+Ba/4),o=Math.sin(s)},Es.lineEnd=function(){t(e,r)}}function me(t){var e=t[0],r=t[1],n=Math.cos(r);return[n*Math.cos(e),n*Math.sin(e),Math.sin(r)]}function ye(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function be(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function xe(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function _e(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function we(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function ke(t){return[Math.atan2(t[1],t[0]),nt(t[2])]}function Ae(t,e){return wa(t[0]-e[0])<Da&&wa(t[1]-e[1])<Da}function Me(t,e){t*=Ha;var r=Math.cos(e*=Ha);Te(r*Math.cos(t),r*Math.sin(t),Math.sin(e))}function Te(t,e,r){++Ls,Cs+=(t-Cs)/Ls,zs+=(e-zs)/Ls,js+=(r-js)/Ls}function Ee(){function t(t,i){t*=Ha;var o=Math.cos(i*=Ha),a=o*Math.cos(t),s=o*Math.sin(t),l=Math.sin(i),c=Math.atan2(Math.sqrt((c=r*l-n*s)*c+(c=n*a-e*l)*c+(c=e*s-r*a)*c),e*a+r*s+n*l);Ss+=c,Ps+=c*(e+(e=a)),Is+=c*(r+(r=s)),Rs+=c*(n+(n=l)),Te(e,r,n)}var e,r,n;Fs.point=function(i,o){i*=Ha;var a=Math.cos(o*=Ha);e=a*Math.cos(i),r=a*Math.sin(i),n=Math.sin(o),Fs.point=t,Te(e,r,n)}}function Le(){Fs.point=Me}function Se(){function t(t,e){t*=Ha;var r=Math.cos(e*=Ha),a=r*Math.cos(t),s=r*Math.sin(t),l=Math.sin(e),c=i*l-o*s,u=o*a-n*l,h=n*s-i*a,f=Math.sqrt(c*c+u*u+h*h),d=n*a+i*s+o*l,p=f&&-rt(d)/f,g=Math.atan2(f,d);Os+=p*c,Ns+=p*u,Ds+=p*h,Ss+=g,Ps+=g*(n+(n=a)),Is+=g*(i+(i=s)),Rs+=g*(o+(o=l)),Te(n,i,o)}var e,r,n,i,o;Fs.point=function(a,s){e=a,r=s,Fs.point=t,a*=Ha;var l=Math.cos(s*=Ha);n=l*Math.cos(a),i=l*Math.sin(a),o=Math.sin(s),Te(n,i,o)},Fs.lineEnd=function(){t(e,r),Fs.lineEnd=Le,Fs.point=Me}}function Ce(t,e){function r(r,n){return r=t(r,n),e(r[0],r[1])}return t.invert&&e.invert&&(r.invert=function(r,n){return r=e.invert(r,n),r&&t.invert(r[0],r[1])}),r}function ze(){return!0}function je(t,e,r,n,i){var o=[],a=[];if(t.forEach(function(t){if(!((e=t.length-1)<=0)){var e,r=t[0],n=t[e];if(Ae(r,n)){i.lineStart();for(var s=0;e>s;++s)i.point((r=t[s])[0],r[1]);return void i.lineEnd()}var l=new Ie(r,t,null,!0),c=new Ie(r,null,l,!1);l.o=c,o.push(l),a.push(c),l=new Ie(n,t,null,!1),c=new Ie(n,null,l,!0),l.o=c,o.push(l),a.push(c)}}),a.sort(e),Pe(o),Pe(a),o.length){for(var s=0,l=r,c=a.length;c>s;++s)a[s].e=l=!l;for(var u,h,f=o[0];;){for(var d=f,p=!0;d.v;)if((d=d.n)===f)return;u=d.z,i.lineStart();do{if(d.v=d.o.v=!0,d.e){if(p)for(var s=0,c=u.length;c>s;++s)i.point((h=u[s])[0],h[1]);else n(d.x,d.n.x,1,i);d=d.n}else{if(p){u=d.p.z;for(var s=u.length-1;s>=0;--s)i.point((h=u[s])[0],h[1])}else n(d.x,d.p.x,-1,i);d=d.p}d=d.o,u=d.z,p=!p}while(!d.v);i.lineEnd()}}}function Pe(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n<e;)i.n=r=t[n],r.p=i,i=r;i.n=r=t[0],r.p=i}}function Ie(t,e,r,n){this.x=t,this.z=e,this.o=r,this.e=n,this.v=!1,this.n=this.p=null}function Re(t,e,r,n){return function(i,o){function a(e,r){var n=i(e,r);t(e=n[0],r=n[1])&&o.point(e,r)}function s(t,e){var r=i(t,e);v.point(r[0],r[1])}function l(){y.point=s,v.lineStart()}function c(){y.point=a,v.lineEnd()}function u(t,e){g.push([t,e]);var r=i(t,e);x.point(r[0],r[1])}function h(){x.lineStart(),g=[]}function f(){u(g[0][0],g[0][1]),x.lineEnd();var t,e=x.clean(),r=b.buffer(),n=r.length;if(g.pop(),p.push(g),g=null,n)if(1&e){t=r[0];var i,n=t.length-1,a=-1;if(n>0){for(_||(o.polygonStart(),_=!0),o.lineStart();++a<n;)o.point((i=t[a])[0],i[1]);o.lineEnd()}}else n>1&&2&e&&r.push(r.pop().concat(r.shift())),d.push(r.filter(Oe))}var d,p,g,v=e(o),m=i.invert(n[0],n[1]),y={point:a,lineStart:l,lineEnd:c,polygonStart:function(){y.point=u,y.lineStart=h,y.lineEnd=f,d=[],p=[]},polygonEnd:function(){y.point=a,y.lineStart=l,y.lineEnd=c,d=ua.merge(d);var t=Ve(m,p);d.length?(_||(o.polygonStart(),_=!0),je(d,De,t,r,o)):t&&(_||(o.polygonStart(),_=!0),o.lineStart(),r(null,null,1,o),o.lineEnd()),_&&(o.polygonEnd(),_=!1),d=p=null},sphere:function(){o.polygonStart(),o.lineStart(),r(null,null,1,o),o.lineEnd(),o.polygonEnd()}},b=Ne(),x=e(b),_=!1;return y}}function Oe(t){return t.length>1}function Ne(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,r){t.push([e,r])},lineEnd:k,buffer:function(){var r=e;return e=[],t=null,r},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function De(t,e){return((t=t.x)[0]<0?t[1]-qa-Da:qa-t[1])-((e=e.x)[0]<0?e[1]-qa-Da:qa-e[1])}function Fe(t){var e,r=NaN,n=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,a){var s=o>0?Ba:-Ba,l=wa(o-r);wa(l-Ba)<Da?(t.point(r,n=(n+a)/2>0?qa:-qa),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(o,n),e=0):i!==s&&l>=Ba&&(wa(r-i)<Da&&(r-=i*Da),wa(o-s)<Da&&(o-=s*Da),n=Be(r,n,o,a),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),e=0),t.point(r=o,n=a),i=s},lineEnd:function(){t.lineEnd(),r=n=NaN},clean:function(){return 2-e}}}function Be(t,e,r,n){var i,o,a=Math.sin(t-r);return wa(a)>Da?Math.atan((Math.sin(e)*(o=Math.cos(n))*Math.sin(r)-Math.sin(n)*(i=Math.cos(e))*Math.sin(t))/(i*o*a)):(e+n)/2}function Ue(t,e,r,n){var i;if(null==t)i=r*qa,n.point(-Ba,i),n.point(0,i),n.point(Ba,i),n.point(Ba,0),n.point(Ba,-i),n.point(0,-i),n.point(-Ba,-i),n.point(-Ba,0),n.point(-Ba,i);else if(wa(t[0]-e[0])>Da){var o=t[0]<e[0]?Ba:-Ba;i=r*o/2,n.point(-o,i),n.point(0,i),n.point(o,i)}else n.point(e[0],e[1])}function Ve(t,e){var r=t[0],n=t[1],i=[Math.sin(r),-Math.cos(r),0],o=0,a=0;Ts.reset();for(var s=0,l=e.length;l>s;++s){var c=e[s],u=c.length;if(u)for(var h=c[0],f=h[0],d=h[1]/2+Ba/4,p=Math.sin(d),g=Math.cos(d),v=1;;){v===u&&(v=0),t=c[v];var m=t[0],y=t[1]/2+Ba/4,b=Math.sin(y),x=Math.cos(y),_=m-f,w=_>=0?1:-1,k=w*_,A=k>Ba,M=p*b;if(Ts.add(Math.atan2(M*w*Math.sin(k),g*x+M*Math.cos(k))),o+=A?_+w*Ua:_,A^f>=r^m>=r){var T=be(me(h),me(t));we(T);var E=be(i,T);we(E);var L=(A^_>=0?-1:1)*nt(E[2]);(n>L||n===L&&(T[0]||T[1]))&&(a+=A^_>=0?1:-1)}if(!v++)break;f=m,p=b,g=x,h=t}}return(-Da>o||Da>o&&0>Ts)^1&a}function qe(t){function e(t,e){return Math.cos(t)*Math.cos(e)>o}function r(t){var r,o,l,c,u;return{lineStart:function(){c=l=!1,u=1},point:function(h,f){var d,p=[h,f],g=e(h,f),v=a?g?0:i(h,f):g?i(h+(0>h?Ba:-Ba),f):0;if(!r&&(c=l=g)&&t.lineStart(),g!==l&&(d=n(r,p),(Ae(r,d)||Ae(p,d))&&(p[0]+=Da,p[1]+=Da,g=e(p[0],p[1]))),g!==l)u=0,g?(t.lineStart(),d=n(p,r),t.point(d[0],d[1])):(d=n(r,p),t.point(d[0],d[1]),t.lineEnd()),r=d;else if(s&&r&&a^g){var m;v&o||!(m=n(p,r,!0))||(u=0,a?(t.lineStart(),t.point(m[0][0],m[0][1]),t.point(m[1][0],m[1][1]),t.lineEnd()):(t.point(m[1][0],m[1][1]),t.lineEnd(),t.lineStart(),t.point(m[0][0],m[0][1])))}!g||r&&Ae(r,p)||t.point(p[0],p[1]),r=p,l=g,o=v},lineEnd:function(){l&&t.lineEnd(),r=null},clean:function(){return u|(c&&l)<<1}}}function n(t,e,r){var n=me(t),i=me(e),a=[1,0,0],s=be(n,i),l=ye(s,s),c=s[0],u=l-c*c;if(!u)return!r&&t;var h=o*l/u,f=-o*c/u,d=be(a,s),p=_e(a,h),g=_e(s,f);xe(p,g);var v=d,m=ye(p,v),y=ye(v,v),b=m*m-y*(ye(p,p)-1);if(!(0>b)){var x=Math.sqrt(b),_=_e(v,(-m-x)/y);if(xe(_,p),_=ke(_),!r)return _;var w,k=t[0],A=e[0],M=t[1],T=e[1];k>A&&(w=k,k=A,A=w);var E=A-k,L=wa(E-Ba)<Da,S=L||Da>E;if(!L&&M>T&&(w=M,M=T,T=w),S?L?M+T>0^_[1]<(wa(_[0]-k)<Da?M:T):M<=_[1]&&_[1]<=T:E>Ba^(k<=_[0]&&_[0]<=A)){var C=_e(v,(-m+x)/y);return xe(C,p),[_,ke(C)]}}}function i(e,r){var n=a?t:Ba-t,i=0;return-n>e?i|=1:e>n&&(i|=2),-n>r?i|=4:r>n&&(i|=8),i}var o=Math.cos(t),a=o>0,s=wa(o)>Da,l=vr(t,6*Ha);return Re(e,r,l,a?[0,-t]:[-Ba,t-Ba])}function He(t,e,r,n){return function(i){var o,a=i.a,s=i.b,l=a.x,c=a.y,u=s.x,h=s.y,f=0,d=1,p=u-l,g=h-c;if(o=t-l,p||!(o>0)){if(o/=p,0>p){if(f>o)return;d>o&&(d=o)}else if(p>0){if(o>d)return;o>f&&(f=o)}if(o=r-l,p||!(0>o)){if(o/=p,0>p){if(o>d)return;o>f&&(f=o)}else if(p>0){if(f>o)return;d>o&&(d=o)}if(o=e-c,g||!(o>0)){if(o/=g,0>g){if(f>o)return;d>o&&(d=o)}else if(g>0){if(o>d)return;o>f&&(f=o)}if(o=n-c,g||!(0>o)){if(o/=g,0>g){if(o>d)return;o>f&&(f=o)}else if(g>0){if(f>o)return;d>o&&(d=o)}return f>0&&(i.a={x:l+f*p,y:c+f*g}),1>d&&(i.b={x:l+d*p,y:c+d*g}),i}}}}}}function Ge(t,e,r,n){function i(n,i){return wa(n[0]-t)<Da?i>0?0:3:wa(n[0]-r)<Da?i>0?2:1:wa(n[1]-e)<Da?i>0?1:0:i>0?3:2}function o(t,e){return a(t.x,e.x)}function a(t,e){var r=i(t,1),n=i(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}return function(s){function l(t){for(var e=0,r=v.length,n=t[1],i=0;r>i;++i)for(var o,a=1,s=v[i],l=s.length,c=s[0];l>a;++a)o=s[a],c[1]<=n?o[1]>n&&et(c,o,t)>0&&++e:o[1]<=n&&et(c,o,t)<0&&--e,c=o;return 0!==e}function c(o,s,l,c){var u=0,h=0;if(null==o||(u=i(o,l))!==(h=i(s,l))||a(o,s)<0^l>0){do c.point(0===u||3===u?t:r,u>1?n:e);while((u=(u+l+4)%4)!==h)}else c.point(s[0],s[1])}function u(i,o){return i>=t&&r>=i&&o>=e&&n>=o}function h(t,e){u(t,e)&&s.point(t,e)}function f(){S.point=p,v&&v.push(m=[]),A=!0,k=!1,_=w=NaN}function d(){g&&(p(y,b),x&&k&&E.rejoin(),g.push(E.buffer())),S.point=h,k&&s.lineEnd()}function p(t,e){t=Math.max(-Us,Math.min(Us,t)),e=Math.max(-Us,Math.min(Us,e));var r=u(t,e);if(v&&m.push([t,e]),A)y=t,b=e,x=r,A=!1,r&&(s.lineStart(),s.point(t,e));else if(r&&k)s.point(t,e);else{var n={a:{x:_,y:w},b:{x:t,y:e}};L(n)?(k||(s.lineStart(),s.point(n.a.x,n.a.y)),s.point(n.b.x,n.b.y),r||s.lineEnd(),M=!1):r&&(s.lineStart(),s.point(t,e),M=!1)}_=t,w=e,k=r}var g,v,m,y,b,x,_,w,k,A,M,T=s,E=Ne(),L=He(t,e,r,n),S={point:h,lineStart:f,lineEnd:d,polygonStart:function(){s=E,g=[],v=[],M=!0},polygonEnd:function(){s=T,g=ua.merge(g);var e=l([t,n]),r=M&&e,i=g.length;(r||i)&&(s.polygonStart(),r&&(s.lineStart(),c(null,null,1,s),s.lineEnd()),i&&je(g,o,e,c,s),s.polygonEnd()),g=v=m=null}};return S}}function Ye(t){var e=0,r=Ba/3,n=lr(t),i=n(e,r);return i.parallels=function(t){return arguments.length?n(e=t[0]*Ba/180,r=t[1]*Ba/180):[e/Ba*180,r/Ba*180]},i}function Xe(t,e){function r(t,e){var r=Math.sqrt(o-2*i*Math.sin(e))/i;return[r*Math.sin(t*=i),a-r*Math.cos(t)]}var n=Math.sin(t),i=(n+Math.sin(e))/2,o=1+n*(2*i-n),a=Math.sqrt(o)/i;return r.invert=function(t,e){var r=a-e;return[Math.atan2(t,r)/i,nt((o-(t*t+r*r)*i*i)/(2*i))]},r}function We(){function t(t,e){qs+=i*t-n*e,n=t,i=e}var e,r,n,i;Ws.point=function(o,a){Ws.point=t,e=n=o,r=i=a},Ws.lineEnd=function(){t(e,r)}}function Ze(t,e){Hs>t&&(Hs=t),t>Ys&&(Ys=t),Gs>e&&(Gs=e),e>Xs&&(Xs=e)}function Qe(){function t(t,e){a.push("M",t,",",e,o)}function e(t,e){a.push("M",t,",",e),s.point=r}function r(t,e){a.push("L",t,",",e)}function n(){s.point=t}function i(){a.push("Z")}var o=$e(4.5),a=[],s={point:t,lineStart:function(){s.point=e},lineEnd:n,polygonStart:function(){s.lineEnd=i},polygonEnd:function(){s.lineEnd=n,s.point=t},pointRadius:function(t){return o=$e(t),s},result:function(){if(a.length){var t=a.join("");return a=[],t}}};return s}function $e(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Ke(t,e){Cs+=t,zs+=e,++js}function Je(){function t(t,n){var i=t-e,o=n-r,a=Math.sqrt(i*i+o*o);Ps+=a*(e+t)/2,Is+=a*(r+n)/2,Rs+=a,Ke(e=t,r=n)}var e,r;Qs.point=function(n,i){Qs.point=t,Ke(e=n,r=i)}}function tr(){Qs.point=Ke}function er(){function t(t,e){var r=t-n,o=e-i,a=Math.sqrt(r*r+o*o);Ps+=a*(n+t)/2,Is+=a*(i+e)/2,Rs+=a,a=i*t-n*e,Os+=a*(n+t),Ns+=a*(i+e),Ds+=3*a,Ke(n=t,i=e)}var e,r,n,i;Qs.point=function(o,a){Qs.point=t,Ke(e=n=o,r=i=a)},Qs.lineEnd=function(){t(e,r)}}function rr(t){function e(e,r){t.moveTo(e+a,r),t.arc(e,r,a,0,Ua)}function r(e,r){t.moveTo(e,r),s.point=n}function n(e,r){t.lineTo(e,r)}function i(){s.point=e}function o(){t.closePath()}var a=4.5,s={point:e,lineStart:function(){s.point=r},lineEnd:i,polygonStart:function(){s.lineEnd=o},polygonEnd:function(){s.lineEnd=i,s.point=e},pointRadius:function(t){return a=t,s},result:k};return s}function nr(t){function e(t){return(s?n:r)(t)}function r(e){return ar(e,function(r,n){r=t(r,n),e.point(r[0],r[1])})}function n(e){function r(r,n){r=t(r,n),e.point(r[0],r[1])}function n(){b=NaN,A.point=o,e.lineStart()}function o(r,n){var o=me([r,n]),a=t(r,n);i(b,x,y,_,w,k,b=a[0],x=a[1],y=r,_=o[0],w=o[1],k=o[2],s,e),e.point(b,x)}function a(){A.point=r,e.lineEnd()}function l(){n(),A.point=c,A.lineEnd=u}function c(t,e){o(h=t,f=e),d=b,p=x,g=_,v=w,m=k,A.point=o}function u(){i(b,x,y,_,w,k,d,p,h,g,v,m,s,e),A.lineEnd=a,a()}var h,f,d,p,g,v,m,y,b,x,_,w,k,A={point:r,lineStart:n,lineEnd:a,polygonStart:function(){e.polygonStart(),A.lineStart=l},polygonEnd:function(){e.polygonEnd(),A.lineStart=n}};return A}function i(e,r,n,s,l,c,u,h,f,d,p,g,v,m){var y=u-e,b=h-r,x=y*y+b*b;if(x>4*o&&v--){var _=s+d,w=l+p,k=c+g,A=Math.sqrt(_*_+w*w+k*k),M=Math.asin(k/=A),T=wa(wa(k)-1)<Da||wa(n-f)<Da?(n+f)/2:Math.atan2(w,_),E=t(T,M),L=E[0],S=E[1],C=L-e,z=S-r,j=b*C-y*z;(j*j/x>o||wa((y*C+b*z)/x-.5)>.3||a>s*d+l*p+c*g)&&(i(e,r,n,s,l,c,L,S,T,_/=A,w/=A,k,v,m),m.point(L,S),i(L,S,T,_,w,k,u,h,f,d,p,g,v,m))}}var o=.5,a=Math.cos(30*Ha),s=16;return e.precision=function(t){return arguments.length?(s=(o=t*t)>0&&16,e):Math.sqrt(o)},e}function ir(t){var e=nr(function(e,r){return t([e*Ga,r*Ga])});return function(t){return cr(e(t))}}function or(t){this.stream=t}function ar(t,e){return{point:e,sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function sr(t){return lr(function(){return t})()}function lr(t){function e(t){return t=s(t[0]*Ha,t[1]*Ha),[t[0]*f+l,c-t[1]*f]}function r(t){return t=s.invert((t[0]-l)/f,(c-t[1])/f),t&&[t[0]*Ga,t[1]*Ga]}function n(){s=Ce(a=fr(m,y,b),o);var t=o(g,v);return l=d-t[0]*f,c=p+t[1]*f,i()}function i(){return u&&(u.valid=!1,u=null),e}var o,a,s,l,c,u,h=nr(function(t,e){return t=o(t,e),[t[0]*f+l,c-t[1]*f]}),f=150,d=480,p=250,g=0,v=0,m=0,y=0,b=0,_=Bs,w=x,k=null,A=null;return e.stream=function(t){return u&&(u.valid=!1),u=cr(_(a,h(w(t)))),u.valid=!0,u},e.clipAngle=function(t){return arguments.length?(_=null==t?(k=t,Bs):qe((k=+t)*Ha),i()):k},e.clipExtent=function(t){return arguments.length?(A=t,w=t?Ge(t[0][0],t[0][1],t[1][0],t[1][1]):x,i()):A},e.scale=function(t){return arguments.length?(f=+t,n()):f},e.translate=function(t){return arguments.length?(d=+t[0],p=+t[1],n()):[d,p]},e.center=function(t){return arguments.length?(g=t[0]%360*Ha,v=t[1]%360*Ha,n()):[g*Ga,v*Ga]},e.rotate=function(t){return arguments.length?(m=t[0]%360*Ha,y=t[1]%360*Ha,b=t.length>2?t[2]%360*Ha:0,n()):[m*Ga,y*Ga,b*Ga]},ua.rebind(e,h,"precision"),function(){return o=t.apply(this,arguments),e.invert=o.invert&&r,n()}}function cr(t){return ar(t,function(e,r){t.point(e*Ha,r*Ha)})}function ur(t,e){return[t,e]}function hr(t,e){return[t>Ba?t-Ua:-Ba>t?t+Ua:t,e]}function fr(t,e,r){return t?e||r?Ce(pr(t),gr(e,r)):pr(t):e||r?gr(e,r):hr}function dr(t){return function(e,r){return e+=t,[e>Ba?e-Ua:-Ba>e?e+Ua:e,r]}}function pr(t){var e=dr(t);return e.invert=dr(-t),e}function gr(t,e){function r(t,e){var r=Math.cos(e),s=Math.cos(t)*r,l=Math.sin(t)*r,c=Math.sin(e),u=c*n+s*i;return[Math.atan2(l*o-u*a,s*n-c*i),nt(u*o+l*a)]}var n=Math.cos(t),i=Math.sin(t),o=Math.cos(e),a=Math.sin(e);return r.invert=function(t,e){var r=Math.cos(e),s=Math.cos(t)*r,l=Math.sin(t)*r,c=Math.sin(e),u=c*o-l*a;return[Math.atan2(l*o+c*a,s*n+u*i),nt(u*n-s*i)]},r}function vr(t,e){var r=Math.cos(t),n=Math.sin(t);return function(i,o,a,s){var l=a*e;null!=i?(i=mr(r,i),o=mr(r,o),(a>0?o>i:i>o)&&(i+=a*Ua)):(i=t+a*Ua,o=t-.5*l);for(var c,u=i;a>0?u>o:o>u;u-=l)s.point((c=ke([r,-n*Math.cos(u),-n*Math.sin(u)]))[0],c[1])}}function mr(t,e){var r=me(e);r[0]-=t,we(r);var n=rt(-r[1]);return((-r[2]<0?-n:n)+2*Math.PI-Da)%(2*Math.PI)}function yr(t,e,r){var n=ua.range(t,e-Da,r).concat(e);return function(t){return n.map(function(e){return[t,e]})}}function br(t,e,r){var n=ua.range(t,e-Da,r).concat(e);return function(t){return n.map(function(e){return[e,t]})}}function xr(t){return t.source}function _r(t){return t.target}function wr(t,e,r,n){var i=Math.cos(e),o=Math.sin(e),a=Math.cos(n),s=Math.sin(n),l=i*Math.cos(t),c=i*Math.sin(t),u=a*Math.cos(r),h=a*Math.sin(r),f=2*Math.asin(Math.sqrt(st(n-e)+i*a*st(r-t))),d=1/Math.sin(f),p=f?function(t){var e=Math.sin(t*=f)*d,r=Math.sin(f-t)*d,n=r*l+e*u,i=r*c+e*h,a=r*o+e*s;return[Math.atan2(i,n)*Ga,Math.atan2(a,Math.sqrt(n*n+i*i))*Ga]}:function(){return[t*Ga,e*Ga]};return p.distance=f,p}function kr(){function t(t,i){var o=Math.sin(i*=Ha),a=Math.cos(i),s=wa((t*=Ha)-e),l=Math.cos(s);$s+=Math.atan2(Math.sqrt((s=a*Math.sin(s))*s+(s=n*o-r*a*l)*s),r*o+n*a*l),e=t,r=o,n=a}var e,r,n;Ks.point=function(i,o){e=i*Ha,r=Math.sin(o*=Ha),n=Math.cos(o),Ks.point=t},Ks.lineEnd=function(){Ks.point=Ks.lineEnd=k}}function Ar(t,e){function r(e,r){var n=Math.cos(e),i=Math.cos(r),o=t(n*i);return[o*i*Math.sin(e),o*Math.sin(r)]}return r.invert=function(t,r){var n=Math.sqrt(t*t+r*r),i=e(n),o=Math.sin(i),a=Math.cos(i);return[Math.atan2(t*o,n*a),Math.asin(n&&r*o/n)]},r}function Mr(t,e){function r(t,e){a>0?-qa+Da>e&&(e=-qa+Da):e>qa-Da&&(e=qa-Da);var r=a/Math.pow(i(e),o);return[r*Math.sin(o*t),a-r*Math.cos(o*t)]}var n=Math.cos(t),i=function(t){return Math.tan(Ba/4+t/2)},o=t===e?Math.sin(t):Math.log(n/Math.cos(e))/Math.log(i(e)/i(t)),a=n*Math.pow(i(t),o)/o;return o?(r.invert=function(t,e){var r=a-e,n=tt(o)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/o,2*Math.atan(Math.pow(a/n,1/o))-qa]},r):Er}function Tr(t,e){function r(t,e){var r=o-e;return[r*Math.sin(i*t),o-r*Math.cos(i*t)]}var n=Math.cos(t),i=t===e?Math.sin(t):(n-Math.cos(e))/(e-t),o=n/i+t;return wa(i)<Da?ur:(r.invert=function(t,e){var r=o-e;return[Math.atan2(t,r)/i,o-tt(i)*Math.sqrt(t*t+r*r)]},r)}function Er(t,e){return[t,Math.log(Math.tan(Ba/4+e/2))]}function Lr(t){var e,r=sr(t),n=r.scale,i=r.translate,o=r.clipExtent;return r.scale=function(){var t=n.apply(r,arguments);return t===r?e?r.clipExtent(null):r:t},r.translate=function(){var t=i.apply(r,arguments);return t===r?e?r.clipExtent(null):r:t;
},r.clipExtent=function(t){var a=o.apply(r,arguments);if(a===r){if(e=null==t){var s=Ba*n(),l=i();o([[l[0]-s,l[1]-s],[l[0]+s,l[1]+s]])}}else e&&(a=null);return a},r.clipExtent(null)}function Sr(t,e){return[Math.log(Math.tan(Ba/4+e/2)),-t]}function Cr(t){return t[0]}function zr(t){return t[1]}function jr(t){for(var e=t.length,r=[0,1],n=2,i=2;e>i;i++){for(;n>1&&et(t[r[n-2]],t[r[n-1]],t[i])<=0;)--n;r[n++]=i}return r.slice(0,n)}function Pr(t,e){return t[0]-e[0]||t[1]-e[1]}function Ir(t,e,r){return(r[0]-e[0])*(t[1]-e[1])<(r[1]-e[1])*(t[0]-e[0])}function Rr(t,e,r,n){var i=t[0],o=r[0],a=e[0]-i,s=n[0]-o,l=t[1],c=r[1],u=e[1]-l,h=n[1]-c,f=(s*(l-c)-h*(i-o))/(h*a-s*u);return[i+f*a,l+f*u]}function Or(t){var e=t[0],r=t[t.length-1];return!(e[0]-r[0]||e[1]-r[1])}function Nr(){on(this),this.edge=this.site=this.circle=null}function Dr(t){var e=ul.pop()||new Nr;return e.site=t,e}function Fr(t){Zr(t),sl.remove(t),ul.push(t),on(t)}function Br(t){var e=t.circle,r=e.x,n=e.cy,i={x:r,y:n},o=t.P,a=t.N,s=[t];Fr(t);for(var l=o;l.circle&&wa(r-l.circle.x)<Da&&wa(n-l.circle.cy)<Da;)o=l.P,s.unshift(l),Fr(l),l=o;s.unshift(l),Zr(l);for(var c=a;c.circle&&wa(r-c.circle.x)<Da&&wa(n-c.circle.cy)<Da;)a=c.N,s.push(c),Fr(c),c=a;s.push(c),Zr(c);var u,h=s.length;for(u=1;h>u;++u)c=s[u],l=s[u-1],en(c.edge,l.site,c.site,i);l=s[0],c=s[h-1],c.edge=Jr(l.site,c.site,null,i),Wr(l),Wr(c)}function Ur(t){for(var e,r,n,i,o=t.x,a=t.y,s=sl._;s;)if(n=Vr(s,a)-o,n>Da)s=s.L;else{if(i=o-qr(s,a),!(i>Da)){n>-Da?(e=s.P,r=s):i>-Da?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=Dr(t);if(sl.insert(e,l),e||r){if(e===r)return Zr(e),r=Dr(e.site),sl.insert(l,r),l.edge=r.edge=Jr(e.site,l.site),Wr(e),void Wr(r);if(!r)return void(l.edge=Jr(e.site,l.site));Zr(e),Zr(r);var c=e.site,u=c.x,h=c.y,f=t.x-u,d=t.y-h,p=r.site,g=p.x-u,v=p.y-h,m=2*(f*v-d*g),y=f*f+d*d,b=g*g+v*v,x={x:(v*y-d*b)/m+u,y:(f*b-g*y)/m+h};en(r.edge,c,p,x),l.edge=Jr(c,t,null,x),r.edge=Jr(t,p,null,x),Wr(e),Wr(r)}}function Vr(t,e){var r=t.site,n=r.x,i=r.y,o=i-e;if(!o)return n;var a=t.P;if(!a)return-(1/0);r=a.site;var s=r.x,l=r.y,c=l-e;if(!c)return s;var u=s-n,h=1/o-1/c,f=u/c;return h?(-f+Math.sqrt(f*f-2*h*(u*u/(-2*c)-l+c/2+i-o/2)))/h+n:(n+s)/2}function qr(t,e){var r=t.N;if(r)return Vr(r,e);var n=t.site;return n.y===e?n.x:1/0}function Hr(t){this.site=t,this.edges=[]}function Gr(t){for(var e,r,n,i,o,a,s,l,c,u,h=t[0][0],f=t[1][0],d=t[0][1],p=t[1][1],g=al,v=g.length;v--;)if(o=g[v],o&&o.prepare())for(s=o.edges,l=s.length,a=0;l>a;)u=s[a].end(),n=u.x,i=u.y,c=s[++a%l].start(),e=c.x,r=c.y,(wa(n-e)>Da||wa(i-r)>Da)&&(s.splice(a,0,new rn(tn(o.site,u,wa(n-h)<Da&&p-i>Da?{x:h,y:wa(e-h)<Da?r:p}:wa(i-p)<Da&&f-n>Da?{x:wa(r-p)<Da?e:f,y:p}:wa(n-f)<Da&&i-d>Da?{x:f,y:wa(e-f)<Da?r:d}:wa(i-d)<Da&&n-h>Da?{x:wa(r-d)<Da?e:h,y:d}:null),o.site,null)),++l)}function Yr(t,e){return e.angle-t.angle}function Xr(){on(this),this.x=this.y=this.arc=this.site=this.cy=null}function Wr(t){var e=t.P,r=t.N;if(e&&r){var n=e.site,i=t.site,o=r.site;if(n!==o){var a=i.x,s=i.y,l=n.x-a,c=n.y-s,u=o.x-a,h=o.y-s,f=2*(l*h-c*u);if(!(f>=-Fa)){var d=l*l+c*c,p=u*u+h*h,g=(h*d-c*p)/f,v=(l*p-u*d)/f,h=v+s,m=hl.pop()||new Xr;m.arc=t,m.site=i,m.x=g+a,m.y=h+Math.sqrt(g*g+v*v),m.cy=h,t.circle=m;for(var y=null,b=cl._;b;)if(m.y<b.y||m.y===b.y&&m.x<=b.x){if(!b.L){y=b.P;break}b=b.L}else{if(!b.R){y=b;break}b=b.R}cl.insert(y,m),y||(ll=m)}}}}function Zr(t){var e=t.circle;e&&(e.P||(ll=e.N),cl.remove(e),hl.push(e),on(e),t.circle=null)}function Qr(t){for(var e,r=ol,n=He(t[0][0],t[0][1],t[1][0],t[1][1]),i=r.length;i--;)e=r[i],(!$r(e,t)||!n(e)||wa(e.a.x-e.b.x)<Da&&wa(e.a.y-e.b.y)<Da)&&(e.a=e.b=null,r.splice(i,1))}function $r(t,e){var r=t.b;if(r)return!0;var n,i,o=t.a,a=e[0][0],s=e[1][0],l=e[0][1],c=e[1][1],u=t.l,h=t.r,f=u.x,d=u.y,p=h.x,g=h.y,v=(f+p)/2,m=(d+g)/2;if(g===d){if(a>v||v>=s)return;if(f>p){if(o){if(o.y>=c)return}else o={x:v,y:l};r={x:v,y:c}}else{if(o){if(o.y<l)return}else o={x:v,y:c};r={x:v,y:l}}}else if(n=(f-p)/(g-d),i=m-n*v,-1>n||n>1)if(f>p){if(o){if(o.y>=c)return}else o={x:(l-i)/n,y:l};r={x:(c-i)/n,y:c}}else{if(o){if(o.y<l)return}else o={x:(c-i)/n,y:c};r={x:(l-i)/n,y:l}}else if(g>d){if(o){if(o.x>=s)return}else o={x:a,y:n*a+i};r={x:s,y:n*s+i}}else{if(o){if(o.x<a)return}else o={x:s,y:n*s+i};r={x:a,y:n*a+i}}return t.a=o,t.b=r,!0}function Kr(t,e){this.l=t,this.r=e,this.a=this.b=null}function Jr(t,e,r,n){var i=new Kr(t,e);return ol.push(i),r&&en(i,t,e,r),n&&en(i,e,t,n),al[t.i].edges.push(new rn(i,t,e)),al[e.i].edges.push(new rn(i,e,t)),i}function tn(t,e,r){var n=new Kr(t,null);return n.a=e,n.b=r,ol.push(n),n}function en(t,e,r,n){t.a||t.b?t.l===r?t.b=n:t.a=n:(t.a=n,t.l=e,t.r=r)}function rn(t,e,r){var n=t.a,i=t.b;this.edge=t,this.site=e,this.angle=r?Math.atan2(r.y-e.y,r.x-e.x):t.l===e?Math.atan2(i.x-n.x,n.y-i.y):Math.atan2(n.x-i.x,i.y-n.y)}function nn(){this._=null}function on(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function an(t,e){var r=e,n=e.R,i=r.U;i?i.L===r?i.L=n:i.R=n:t._=n,n.U=i,r.U=n,r.R=n.L,r.R&&(r.R.U=r),n.L=r}function sn(t,e){var r=e,n=e.L,i=r.U;i?i.L===r?i.L=n:i.R=n:t._=n,n.U=i,r.U=n,r.L=n.R,r.L&&(r.L.U=r),n.R=r}function ln(t){for(;t.L;)t=t.L;return t}function cn(t,e){var r,n,i,o=t.sort(un).pop();for(ol=[],al=new Array(t.length),sl=new nn,cl=new nn;;)if(i=ll,o&&(!i||o.y<i.y||o.y===i.y&&o.x<i.x))(o.x!==r||o.y!==n)&&(al[o.i]=new Hr(o),Ur(o),r=o.x,n=o.y),o=t.pop();else{if(!i)break;Br(i.arc)}e&&(Qr(e),Gr(e));var a={cells:al,edges:ol};return sl=cl=ol=al=null,a}function un(t,e){return e.y-t.y||e.x-t.x}function hn(t,e,r){return(t.x-r.x)*(e.y-t.y)-(t.x-e.x)*(r.y-t.y)}function fn(t){return t.x}function dn(t){return t.y}function pn(){return{leaf:!0,nodes:[],point:null,x:null,y:null}}function gn(t,e,r,n,i,o){if(!t(e,r,n,i,o)){var a=.5*(r+i),s=.5*(n+o),l=e.nodes;l[0]&&gn(t,l[0],r,n,a,s),l[1]&&gn(t,l[1],a,n,i,s),l[2]&&gn(t,l[2],r,s,a,o),l[3]&&gn(t,l[3],a,s,i,o)}}function vn(t,e,r,n,i,o,a){var s,l=1/0;return function c(t,u,h,f,d){if(!(u>o||h>a||n>f||i>d)){if(p=t.point){var p,g=e-t.x,v=r-t.y,m=g*g+v*v;if(l>m){var y=Math.sqrt(l=m);n=e-y,i=r-y,o=e+y,a=r+y,s=p}}for(var b=t.nodes,x=.5*(u+f),_=.5*(h+d),w=e>=x,k=r>=_,A=k<<1|w,M=A+4;M>A;++A)if(t=b[3&A])switch(3&A){case 0:c(t,u,h,x,_);break;case 1:c(t,x,h,f,_);break;case 2:c(t,u,_,x,d);break;case 3:c(t,x,_,f,d)}}}(t,n,i,o,a),s}function mn(t,e){t=ua.rgb(t),e=ua.rgb(e);var r=t.r,n=t.g,i=t.b,o=e.r-r,a=e.g-n,s=e.b-i;return function(t){return"#"+wt(Math.round(r+o*t))+wt(Math.round(n+a*t))+wt(Math.round(i+s*t))}}function yn(t,e){var r,n={},i={};for(r in t)r in e?n[r]=_n(t[r],e[r]):i[r]=t[r];for(r in e)r in t||(i[r]=e[r]);return function(t){for(r in n)i[r]=n[r](t);return i}}function bn(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}function xn(t,e){var r,n,i,o=dl.lastIndex=pl.lastIndex=0,a=-1,s=[],l=[];for(t+="",e+="";(r=dl.exec(t))&&(n=pl.exec(e));)(i=n.index)>o&&(i=e.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(r=r[0])===(n=n[0])?s[a]?s[a]+=n:s[++a]=n:(s[++a]=null,l.push({i:a,x:bn(r,n)})),o=pl.lastIndex;return o<e.length&&(i=e.slice(o),s[a]?s[a]+=i:s[++a]=i),s.length<2?l[0]?(e=l[0].x,function(t){return e(t)+""}):function(){return e}:(e=l.length,function(t){for(var r,n=0;e>n;++n)s[(r=l[n]).i]=r.x(t);return s.join("")})}function _n(t,e){for(var r,n=ua.interpolators.length;--n>=0&&!(r=ua.interpolators[n](t,e)););return r}function wn(t,e){var r,n=[],i=[],o=t.length,a=e.length,s=Math.min(t.length,e.length);for(r=0;s>r;++r)n.push(_n(t[r],e[r]));for(;o>r;++r)i[r]=t[r];for(;a>r;++r)i[r]=e[r];return function(t){for(r=0;s>r;++r)i[r]=n[r](t);return i}}function kn(t){return function(e){return 0>=e?0:e>=1?1:t(e)}}function An(t){return function(e){return 1-t(1-e)}}function Mn(t){return function(e){return.5*(.5>e?t(2*e):2-t(2-2*e))}}function Tn(t){return t*t}function En(t){return t*t*t}function Ln(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)}function Sn(t){return function(e){return Math.pow(e,t)}}function Cn(t){return 1-Math.cos(t*qa)}function zn(t){return Math.pow(2,10*(t-1))}function jn(t){return 1-Math.sqrt(1-t*t)}function Pn(t,e){var r;return arguments.length<2&&(e=.45),arguments.length?r=e/Ua*Math.asin(1/t):(t=1,r=e/4),function(n){return 1+t*Math.pow(2,-10*n)*Math.sin((n-r)*Ua/e)}}function In(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function Rn(t){return 1/2.75>t?7.5625*t*t:2/2.75>t?7.5625*(t-=1.5/2.75)*t+.75:2.5/2.75>t?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function On(t,e){t=ua.hcl(t),e=ua.hcl(e);var r=t.h,n=t.c,i=t.l,o=e.h-r,a=e.c-n,s=e.l-i;return isNaN(a)&&(a=0,n=isNaN(n)?e.c:n),isNaN(o)?(o=0,r=isNaN(r)?e.h:r):o>180?o-=360:-180>o&&(o+=360),function(t){return ft(r+o*t,n+a*t,i+s*t)+""}}function Nn(t,e){t=ua.hsl(t),e=ua.hsl(e);var r=t.h,n=t.s,i=t.l,o=e.h-r,a=e.s-n,s=e.l-i;return isNaN(a)&&(a=0,n=isNaN(n)?e.s:n),isNaN(o)?(o=0,r=isNaN(r)?e.h:r):o>180?o-=360:-180>o&&(o+=360),function(t){return ut(r+o*t,n+a*t,i+s*t)+""}}function Dn(t,e){t=ua.lab(t),e=ua.lab(e);var r=t.l,n=t.a,i=t.b,o=e.l-r,a=e.a-n,s=e.b-i;return function(t){return pt(r+o*t,n+a*t,i+s*t)+""}}function Fn(t,e){return e-=t,function(r){return Math.round(t+e*r)}}function Bn(t){var e=[t.a,t.b],r=[t.c,t.d],n=Vn(e),i=Un(e,r),o=Vn(qn(r,e,-i))||0;e[0]*r[1]<r[0]*e[1]&&(e[0]*=-1,e[1]*=-1,n*=-1,i*=-1),this.rotate=(n?Math.atan2(e[1],e[0]):Math.atan2(-r[0],r[1]))*Ga,this.translate=[t.e,t.f],this.scale=[n,o],this.skew=o?Math.atan2(i,o)*Ga:0}function Un(t,e){return t[0]*e[0]+t[1]*e[1]}function Vn(t){var e=Math.sqrt(Un(t,t));return e&&(t[0]/=e,t[1]/=e),e}function qn(t,e,r){return t[0]+=r*e[0],t[1]+=r*e[1],t}function Hn(t){return t.length?t.pop()+",":""}function Gn(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var i=r.push("translate(",null,",",null,")");n.push({i:i-4,x:bn(t[0],e[0])},{i:i-2,x:bn(t[1],e[1])})}else(e[0]||e[1])&&r.push("translate("+e+")")}function Yn(t,e,r,n){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),n.push({i:r.push(Hn(r)+"rotate(",null,")")-2,x:bn(t,e)})):e&&r.push(Hn(r)+"rotate("+e+")")}function Xn(t,e,r,n){t!==e?n.push({i:r.push(Hn(r)+"skewX(",null,")")-2,x:bn(t,e)}):e&&r.push(Hn(r)+"skewX("+e+")")}function Wn(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var i=r.push(Hn(r)+"scale(",null,",",null,")");n.push({i:i-4,x:bn(t[0],e[0])},{i:i-2,x:bn(t[1],e[1])})}else(1!==e[0]||1!==e[1])&&r.push(Hn(r)+"scale("+e+")")}function Zn(t,e){var r=[],n=[];return t=ua.transform(t),e=ua.transform(e),Gn(t.translate,e.translate,r,n),Yn(t.rotate,e.rotate,r,n),Xn(t.skew,e.skew,r,n),Wn(t.scale,e.scale,r,n),t=e=null,function(t){for(var e,i=-1,o=n.length;++i<o;)r[(e=n[i]).i]=e.x(t);return r.join("")}}function Qn(t,e){return e=(e-=t=+t)||1/e,function(r){return(r-t)/e}}function $n(t,e){return e=(e-=t=+t)||1/e,function(r){return Math.max(0,Math.min(1,(r-t)/e))}}function Kn(t){for(var e=t.source,r=t.target,n=ti(e,r),i=[e];e!==n;)e=e.parent,i.push(e);for(var o=i.length;r!==n;)i.splice(o,0,r),r=r.parent;return i}function Jn(t){for(var e=[],r=t.parent;null!=r;)e.push(t),t=r,r=r.parent;return e.push(t),e}function ti(t,e){if(t===e)return t;for(var r=Jn(t),n=Jn(e),i=r.pop(),o=n.pop(),a=null;i===o;)a=i,i=r.pop(),o=n.pop();return a}function ei(t){t.fixed|=2}function ri(t){t.fixed&=-7}function ni(t){t.fixed|=4,t.px=t.x,t.py=t.y}function ii(t){t.fixed&=-5}function oi(t,e,r){var n=0,i=0;if(t.charge=0,!t.leaf)for(var o,a=t.nodes,s=a.length,l=-1;++l<s;)o=a[l],null!=o&&(oi(o,e,r),t.charge+=o.charge,n+=o.charge*o.cx,i+=o.charge*o.cy);if(t.point){t.leaf||(t.point.x+=Math.random()-.5,t.point.y+=Math.random()-.5);var c=e*r[t.point.index];t.charge+=t.pointCharge=c,n+=c*t.point.x,i+=c*t.point.y}t.cx=n/t.charge,t.cy=i/t.charge}function ai(t,e){return ua.rebind(t,e,"sort","children","value"),t.nodes=t,t.links=fi,t}function si(t,e){for(var r=[t];null!=(t=r.pop());)if(e(t),(i=t.children)&&(n=i.length))for(var n,i;--n>=0;)r.push(i[n])}function li(t,e){for(var r=[t],n=[];null!=(t=r.pop());)if(n.push(t),(o=t.children)&&(i=o.length))for(var i,o,a=-1;++a<i;)r.push(o[a]);for(;null!=(t=n.pop());)e(t)}function ci(t){return t.children}function ui(t){return t.value}function hi(t,e){return e.value-t.value}function fi(t){return ua.merge(t.map(function(t){return(t.children||[]).map(function(e){return{source:t,target:e}})}))}function di(t){return t.x}function pi(t){return t.y}function gi(t,e,r){t.y0=e,t.y=r}function vi(t){return ua.range(t.length)}function mi(t){for(var e=-1,r=t[0].length,n=[];++e<r;)n[e]=0;return n}function yi(t){for(var e,r=1,n=0,i=t[0][1],o=t.length;o>r;++r)(e=t[r][1])>i&&(n=r,i=e);return n}function bi(t){return t.reduce(xi,0)}function xi(t,e){return t+e[1]}function _i(t,e){return wi(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function wi(t,e){for(var r=-1,n=+t[0],i=(t[1]-n)/e,o=[];++r<=e;)o[r]=i*r+n;return o}function ki(t){return[ua.min(t),ua.max(t)]}function Ai(t,e){return t.value-e.value}function Mi(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function Ti(t,e){t._pack_next=e,e._pack_prev=t}function Ei(t,e){var r=e.x-t.x,n=e.y-t.y,i=t.r+e.r;return.999*i*i>r*r+n*n}function Li(t){function e(t){u=Math.min(t.x-t.r,u),h=Math.max(t.x+t.r,h),f=Math.min(t.y-t.r,f),d=Math.max(t.y+t.r,d)}if((r=t.children)&&(c=r.length)){var r,n,i,o,a,s,l,c,u=1/0,h=-(1/0),f=1/0,d=-(1/0);if(r.forEach(Si),n=r[0],n.x=-n.r,n.y=0,e(n),c>1&&(i=r[1],i.x=i.r,i.y=0,e(i),c>2))for(o=r[2],ji(n,i,o),e(o),Mi(n,o),n._pack_prev=o,Mi(o,i),i=n._pack_next,a=3;c>a;a++){ji(n,i,o=r[a]);var p=0,g=1,v=1;for(s=i._pack_next;s!==i;s=s._pack_next,g++)if(Ei(s,o)){p=1;break}if(1==p)for(l=n._pack_prev;l!==s._pack_prev&&!Ei(l,o);l=l._pack_prev,v++);p?(v>g||g==v&&i.r<n.r?Ti(n,i=s):Ti(n=l,i),a--):(Mi(n,o),i=o,e(o))}var m=(u+h)/2,y=(f+d)/2,b=0;for(a=0;c>a;a++)o=r[a],o.x-=m,o.y-=y,b=Math.max(b,o.r+Math.sqrt(o.x*o.x+o.y*o.y));t.r=b,r.forEach(Ci)}}function Si(t){t._pack_next=t._pack_prev=t}function Ci(t){delete t._pack_next,delete t._pack_prev}function zi(t,e,r,n){var i=t.children;if(t.x=e+=n*t.x,t.y=r+=n*t.y,t.r*=n,i)for(var o=-1,a=i.length;++o<a;)zi(i[o],e,r,n)}function ji(t,e,r){var n=t.r+r.r,i=e.x-t.x,o=e.y-t.y;if(n&&(i||o)){var a=e.r+r.r,s=i*i+o*o;a*=a,n*=n;var l=.5+(n-a)/(2*s),c=Math.sqrt(Math.max(0,2*a*(n+s)-(n-=s)*n-a*a))/(2*s);r.x=t.x+l*i+c*o,r.y=t.y+l*o-c*i}else r.x=t.x+n,r.y=t.y}function Pi(t,e){return t.parent==e.parent?1:2}function Ii(t){var e=t.children;return e.length?e[0]:t.t}function Ri(t){var e,r=t.children;return(e=r.length)?r[e-1]:t.t}function Oi(t,e,r){var n=r/(e.i-t.i);e.c-=n,e.s+=r,t.c+=n,e.z+=r,e.m+=r}function Ni(t){for(var e,r=0,n=0,i=t.children,o=i.length;--o>=0;)e=i[o],e.z+=r,e.m+=r,r+=e.s+(n+=e.c)}function Di(t,e,r){return t.a.parent===e.parent?t.a:r}function Fi(t){return 1+ua.max(t,function(t){return t.y})}function Bi(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}function Ui(t){var e=t.children;return e&&e.length?Ui(e[0]):t}function Vi(t){var e,r=t.children;return r&&(e=r.length)?Vi(r[e-1]):t}function qi(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function Hi(t,e){var r=t.x+e[3],n=t.y+e[0],i=t.dx-e[1]-e[3],o=t.dy-e[0]-e[2];return 0>i&&(r+=i/2,i=0),0>o&&(n+=o/2,o=0),{x:r,y:n,dx:i,dy:o}}function Gi(t){var e=t[0],r=t[t.length-1];return r>e?[e,r]:[r,e]}function Yi(t){return t.rangeExtent?t.rangeExtent():Gi(t.range())}function Xi(t,e,r,n){var i=r(t[0],t[1]),o=n(e[0],e[1]);return function(t){return o(i(t))}}function Wi(t,e){var r,n=0,i=t.length-1,o=t[n],a=t[i];return o>a&&(r=n,n=i,i=r,r=o,o=a,a=r),t[n]=e.floor(o),t[i]=e.ceil(a),t}function Zi(t){return t?{floor:function(e){return Math.floor(e/t)*t},ceil:function(e){return Math.ceil(e/t)*t}}:Ml}function Qi(t,e,r,n){var i=[],o=[],a=0,s=Math.min(t.length,e.length)-1;for(t[s]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++a<=s;)i.push(r(t[a-1],t[a])),o.push(n(e[a-1],e[a]));return function(e){var r=ua.bisect(t,e,1,s)-1;return o[r](i[r](e))}}function $i(t,e,r,n){function i(){var i=Math.min(t.length,e.length)>2?Qi:Xi,l=n?$n:Qn;return a=i(t,e,l,r),s=i(e,t,l,_n),o}function o(t){return a(t)}var a,s;return o.invert=function(t){return s(t)},o.domain=function(e){return arguments.length?(t=e.map(Number),i()):t},o.range=function(t){return arguments.length?(e=t,i()):e},o.rangeRound=function(t){return o.range(t).interpolate(Fn)},o.clamp=function(t){return arguments.length?(n=t,i()):n},o.interpolate=function(t){return arguments.length?(r=t,i()):r},o.ticks=function(e){return eo(t,e)},o.tickFormat=function(e,r){return ro(t,e,r)},o.nice=function(e){return Ji(t,e),i()},o.copy=function(){return $i(t,e,r,n)},i()}function Ki(t,e){return ua.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Ji(t,e){return Wi(t,Zi(to(t,e)[2])),Wi(t,Zi(to(t,e)[2])),t}function to(t,e){null==e&&(e=10);var r=Gi(t),n=r[1]-r[0],i=Math.pow(10,Math.floor(Math.log(n/e)/Math.LN10)),o=e/n*i;return.15>=o?i*=10:.35>=o?i*=5:.75>=o&&(i*=2),r[0]=Math.ceil(r[0]/i)*i,r[1]=Math.floor(r[1]/i)*i+.5*i,r[2]=i,r}function eo(t,e){return ua.range.apply(ua,to(t,e))}function ro(t,e,r){var n=to(t,e);if(r){var i=ds.exec(r);if(i.shift(),"s"===i[8]){var o=ua.formatPrefix(Math.max(wa(n[0]),wa(n[1])));return i[7]||(i[7]="."+no(o.scale(n[2]))),i[8]="f",r=ua.format(i.join("")),function(t){return r(o.scale(t))+o.symbol}}i[7]||(i[7]="."+io(i[8],n)),r=i.join("")}else r=",."+no(n[2])+"f";return ua.format(r)}function no(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function io(t,e){var r=no(e[2]);return t in Tl?Math.abs(r-no(Math.max(wa(e[0]),wa(e[1]))))+ +("e"!==t):r-2*("%"===t)}function oo(t,e,r,n){function i(t){return(r?Math.log(0>t?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function o(t){return r?Math.pow(e,t):-Math.pow(e,-t)}function a(e){return t(i(e))}return a.invert=function(e){return o(t.invert(e))},a.domain=function(e){return arguments.length?(r=e[0]>=0,t.domain((n=e.map(Number)).map(i)),a):n},a.base=function(r){return arguments.length?(e=+r,t.domain(n.map(i)),a):e},a.nice=function(){var e=Wi(n.map(i),r?Math:Ll);return t.domain(e),n=e.map(o),a},a.ticks=function(){var t=Gi(n),a=[],s=t[0],l=t[1],c=Math.floor(i(s)),u=Math.ceil(i(l)),h=e%1?2:e;if(isFinite(u-c)){if(r){for(;u>c;c++)for(var f=1;h>f;f++)a.push(o(c)*f);a.push(o(c))}else for(a.push(o(c));c++<u;)for(var f=h-1;f>0;f--)a.push(o(c)*f);for(c=0;a[c]<s;c++);for(u=a.length;a[u-1]>l;u--);a=a.slice(c,u)}return a},a.tickFormat=function(t,r){if(!arguments.length)return El;arguments.length<2?r=El:"function"!=typeof r&&(r=ua.format(r));var n=Math.max(1,e*t/a.ticks().length);return function(t){var a=t/o(Math.round(i(t)));return e-.5>a*e&&(a*=e),n>=a?r(t):""}},a.copy=function(){return oo(t.copy(),e,r,n)},Ki(a,t)}function ao(t,e,r){function n(e){return t(i(e))}var i=so(e),o=so(1/e);return n.invert=function(e){return o(t.invert(e))},n.domain=function(e){return arguments.length?(t.domain((r=e.map(Number)).map(i)),n):r},n.ticks=function(t){return eo(r,t)},n.tickFormat=function(t,e){return ro(r,t,e)},n.nice=function(t){return n.domain(Ji(r,t))},n.exponent=function(a){return arguments.length?(i=so(e=a),o=so(1/e),t.domain(r.map(i)),n):e},n.copy=function(){return ao(t.copy(),e,r)},Ki(n,t)}function so(t){return function(e){return 0>e?-Math.pow(-e,t):Math.pow(e,t)}}function lo(t,e){function r(r){return o[((i.get(r)||("range"===e.t?i.set(r,t.push(r)):NaN))-1)%o.length]}function n(e,r){return ua.range(t.length).map(function(t){return e+r*t})}var i,o,a;return r.domain=function(n){if(!arguments.length)return t;t=[],i=new h;for(var o,a=-1,s=n.length;++a<s;)i.has(o=n[a])||i.set(o,t.push(o));return r[e.t].apply(r,e.a)},r.range=function(t){return arguments.length?(o=t,a=0,e={t:"range",a:arguments},r):o},r.rangePoints=function(i,s){arguments.length<2&&(s=0);var l=i[0],c=i[1],u=t.length<2?(l=(l+c)/2,0):(c-l)/(t.length-1+s);return o=n(l+u*s/2,u),a=0,e={t:"rangePoints",a:arguments},r},r.rangeRoundPoints=function(i,s){arguments.length<2&&(s=0);var l=i[0],c=i[1],u=t.length<2?(l=c=Math.round((l+c)/2),0):(c-l)/(t.length-1+s)|0;return o=n(l+Math.round(u*s/2+(c-l-(t.length-1+s)*u)/2),u),a=0,e={t:"rangeRoundPoints",a:arguments},r},r.rangeBands=function(i,s,l){arguments.length<2&&(s=0),arguments.length<3&&(l=s);var c=i[1]<i[0],u=i[c-0],h=i[1-c],f=(h-u)/(t.length-s+2*l);return o=n(u+f*l,f),c&&o.reverse(),a=f*(1-s),e={t:"rangeBands",a:arguments},r},r.rangeRoundBands=function(i,s,l){arguments.length<2&&(s=0),arguments.length<3&&(l=s);var c=i[1]<i[0],u=i[c-0],h=i[1-c],f=Math.floor((h-u)/(t.length-s+2*l));return o=n(u+Math.round((h-u-(t.length-s)*f)/2),f),c&&o.reverse(),a=Math.round(f*(1-s)),e={t:"rangeRoundBands",a:arguments},r},r.rangeBand=function(){return a},r.rangeExtent=function(){return Gi(e.a[0])},r.copy=function(){return lo(t,e)},r.domain(t)}function co(t,e){function r(){var r=0,i=e.length;for(s=[];++r<i;)s[r-1]=ua.quantile(t,r/i);return n}function n(t){return isNaN(t=+t)?void 0:e[ua.bisect(s,t)]}var s;return n.domain=function(e){return arguments.length?(t=e.map(o).filter(a).sort(i),r()):t},n.range=function(t){return arguments.length?(e=t,r()):e},n.quantiles=function(){return s},n.invertExtent=function(r){return r=e.indexOf(r),0>r?[NaN,NaN]:[r>0?s[r-1]:t[0],r<s.length?s[r]:t[t.length-1]]},n.copy=function(){return co(t,e)},r()}function uo(t,e,r){function n(e){return r[Math.max(0,Math.min(a,Math.floor(o*(e-t))))]}function i(){return o=r.length/(e-t),a=r.length-1,n}var o,a;return n.domain=function(r){return arguments.length?(t=+r[0],e=+r[r.length-1],i()):[t,e]},n.range=function(t){return arguments.length?(r=t,i()):r},n.invertExtent=function(e){return e=r.indexOf(e),e=0>e?NaN:e/o+t,[e,e+1/o]},n.copy=function(){return uo(t,e,r)},i()}function ho(t,e){function r(r){return r>=r?e[ua.bisect(t,r)]:void 0}return r.domain=function(e){return arguments.length?(t=e,r):t},r.range=function(t){return arguments.length?(e=t,r):e},r.invertExtent=function(r){return r=e.indexOf(r),[t[r-1],t[r]]},r.copy=function(){return ho(t,e)},r}function fo(t){function e(t){return+t}return e.invert=e,e.domain=e.range=function(r){return arguments.length?(t=r.map(e),e):t},e.ticks=function(e){return eo(t,e)},e.tickFormat=function(e,r){return ro(t,e,r)},e.copy=function(){return fo(t)},e}function po(){return 0}function go(t){return t.innerRadius}function vo(t){return t.outerRadius}function mo(t){return t.startAngle}function yo(t){return t.endAngle}function bo(t){return t&&t.padAngle}function xo(t,e,r,n){return(t-r)*e-(e-n)*t>0?0:1}function _o(t,e,r,n,i){var o=t[0]-e[0],a=t[1]-e[1],s=(i?n:-n)/Math.sqrt(o*o+a*a),l=s*a,c=-s*o,u=t[0]+l,h=t[1]+c,f=e[0]+l,d=e[1]+c,p=(u+f)/2,g=(h+d)/2,v=f-u,m=d-h,y=v*v+m*m,b=r-n,x=u*d-f*h,_=(0>m?-1:1)*Math.sqrt(Math.max(0,b*b*y-x*x)),w=(x*m-v*_)/y,k=(-x*v-m*_)/y,A=(x*m+v*_)/y,M=(-x*v+m*_)/y,T=w-p,E=k-g,L=A-p,S=M-g;return T*T+E*E>L*L+S*S&&(w=A,k=M),[[w-l,k-c],[w*r/b,k*r/b]]}function wo(t){function e(e){function a(){c.push("M",o(t(u),s))}for(var l,c=[],u=[],h=-1,f=e.length,d=Lt(r),p=Lt(n);++h<f;)i.call(this,l=e[h],h)?u.push([+d.call(this,l,h),+p.call(this,l,h)]):u.length&&(a(),u=[]);return u.length&&a(),c.length?c.join(""):null}var r=Cr,n=zr,i=ze,o=ko,a=o.key,s=.7;return e.x=function(t){return arguments.length?(r=t,e):r},e.y=function(t){return arguments.length?(n=t,e):n},e.defined=function(t){return arguments.length?(i=t,e):i},e.interpolate=function(t){return arguments.length?(a="function"==typeof t?o=t:(o=Il.get(t)||ko).key,e):a},e.tension=function(t){return arguments.length?(s=t,e):s},e}function ko(t){return t.length>1?t.join("L"):t+"Z"}function Ao(t){return t.join("L")+"Z"}function Mo(t){for(var e=0,r=t.length,n=t[0],i=[n[0],",",n[1]];++e<r;)i.push("H",(n[0]+(n=t[e])[0])/2,"V",n[1]);return r>1&&i.push("H",n[0]),i.join("")}function To(t){for(var e=0,r=t.length,n=t[0],i=[n[0],",",n[1]];++e<r;)i.push("V",(n=t[e])[1],"H",n[0]);return i.join("")}function Eo(t){for(var e=0,r=t.length,n=t[0],i=[n[0],",",n[1]];++e<r;)i.push("H",(n=t[e])[0],"V",n[1]);return i.join("")}function Lo(t,e){return t.length<4?ko(t):t[1]+zo(t.slice(1,-1),jo(t,e))}function So(t,e){return t.length<3?Ao(t):t[0]+zo((t.push(t[0]),t),jo([t[t.length-2]].concat(t,[t[1]]),e))}function Co(t,e){return t.length<3?ko(t):t[0]+zo(t,jo(t,e))}function zo(t,e){if(e.length<1||t.length!=e.length&&t.length!=e.length+2)return ko(t);var r=t.length!=e.length,n="",i=t[0],o=t[1],a=e[0],s=a,l=1;if(r&&(n+="Q"+(o[0]-2*a[0]/3)+","+(o[1]-2*a[1]/3)+","+o[0]+","+o[1],i=t[1],l=2),e.length>1){s=e[1],o=t[l],l++,n+="C"+(i[0]+a[0])+","+(i[1]+a[1])+","+(o[0]-s[0])+","+(o[1]-s[1])+","+o[0]+","+o[1];for(var c=2;c<e.length;c++,l++)o=t[l],s=e[c],n+="S"+(o[0]-s[0])+","+(o[1]-s[1])+","+o[0]+","+o[1]}if(r){var u=t[l];n+="Q"+(o[0]+2*s[0]/3)+","+(o[1]+2*s[1]/3)+","+u[0]+","+u[1]}return n}function jo(t,e){for(var r,n=[],i=(1-e)/2,o=t[0],a=t[1],s=1,l=t.length;++s<l;)r=o,o=a,a=t[s],n.push([i*(a[0]-r[0]),i*(a[1]-r[1])]);return n}function Po(t){if(t.length<3)return ko(t);var e=1,r=t.length,n=t[0],i=n[0],o=n[1],a=[i,i,i,(n=t[1])[0]],s=[o,o,o,n[1]],l=[i,",",o,"L",No(Nl,a),",",No(Nl,s)];for(t.push(t[r-1]);++e<=r;)n=t[e],a.shift(),a.push(n[0]),s.shift(),s.push(n[1]),Do(l,a,s);return t.pop(),l.push("L",n),l.join("")}function Io(t){if(t.length<4)return ko(t);for(var e,r=[],n=-1,i=t.length,o=[0],a=[0];++n<3;)e=t[n],o.push(e[0]),a.push(e[1]);for(r.push(No(Nl,o)+","+No(Nl,a)),--n;++n<i;)e=t[n],o.shift(),o.push(e[0]),a.shift(),a.push(e[1]),Do(r,o,a);return r.join("")}function Ro(t){for(var e,r,n=-1,i=t.length,o=i+4,a=[],s=[];++n<4;)r=t[n%i],a.push(r[0]),s.push(r[1]);for(e=[No(Nl,a),",",No(Nl,s)],--n;++n<o;)r=t[n%i],a.shift(),a.push(r[0]),s.shift(),s.push(r[1]),Do(e,a,s);return e.join("")}function Oo(t,e){var r=t.length-1;if(r)for(var n,i,o=t[0][0],a=t[0][1],s=t[r][0]-o,l=t[r][1]-a,c=-1;++c<=r;)n=t[c],i=c/r,n[0]=e*n[0]+(1-e)*(o+i*s),n[1]=e*n[1]+(1-e)*(a+i*l);return Po(t)}function No(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function Do(t,e,r){t.push("C",No(Rl,e),",",No(Rl,r),",",No(Ol,e),",",No(Ol,r),",",No(Nl,e),",",No(Nl,r))}function Fo(t,e){return(e[1]-t[1])/(e[0]-t[0])}function Bo(t){for(var e=0,r=t.length-1,n=[],i=t[0],o=t[1],a=n[0]=Fo(i,o);++e<r;)n[e]=(a+(a=Fo(i=o,o=t[e+1])))/2;return n[e]=a,n}function Uo(t){for(var e,r,n,i,o=[],a=Bo(t),s=-1,l=t.length-1;++s<l;)e=Fo(t[s],t[s+1]),wa(e)<Da?a[s]=a[s+1]=0:(r=a[s]/e,n=a[s+1]/e,i=r*r+n*n,i>9&&(i=3*e/Math.sqrt(i),a[s]=i*r,a[s+1]=i*n));for(s=-1;++s<=l;)i=(t[Math.min(l,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+a[s]*a[s])),o.push([i||0,a[s]*i||0]);return o}function Vo(t){return t.length<3?ko(t):t[0]+zo(t,Uo(t))}function qo(t){for(var e,r,n,i=-1,o=t.length;++i<o;)e=t[i],r=e[0],n=e[1]-qa,e[0]=r*Math.cos(n),e[1]=r*Math.sin(n);return t}function Ho(t){function e(e){function l(){g.push("M",s(t(m),h),u,c(t(v.reverse()),h),"Z")}for(var f,d,p,g=[],v=[],m=[],y=-1,b=e.length,x=Lt(r),_=Lt(i),w=r===n?function(){return d}:Lt(n),k=i===o?function(){return p}:Lt(o);++y<b;)a.call(this,f=e[y],y)?(v.push([d=+x.call(this,f,y),p=+_.call(this,f,y)]),m.push([+w.call(this,f,y),+k.call(this,f,y)])):v.length&&(l(),v=[],m=[]);return v.length&&l(),g.length?g.join(""):null}var r=Cr,n=Cr,i=0,o=zr,a=ze,s=ko,l=s.key,c=s,u="L",h=.7;return e.x=function(t){return arguments.length?(r=n=t,e):n},e.x0=function(t){return arguments.length?(r=t,e):r},e.x1=function(t){return arguments.length?(n=t,e):n},e.y=function(t){return arguments.length?(i=o=t,e):o},e.y0=function(t){return arguments.length?(i=t,e):i},e.y1=function(t){return arguments.length?(o=t,e):o},e.defined=function(t){return arguments.length?(a=t,e):a},e.interpolate=function(t){return arguments.length?(l="function"==typeof t?s=t:(s=Il.get(t)||ko).key,c=s.reverse||s,u=s.closed?"M":"L",e):l},e.tension=function(t){return arguments.length?(h=t,e):h},e}function Go(t){return t.radius}function Yo(t){return[t.x,t.y]}function Xo(t){return function(){var e=t.apply(this,arguments),r=e[0],n=e[1]-qa;return[r*Math.cos(n),r*Math.sin(n)]}}function Wo(){return 64}function Zo(){return"circle"}function Qo(t){var e=Math.sqrt(t/Ba);return"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+-e+"A"+e+","+e+" 0 1,1 0,"+e+"Z"}function $o(t){return function(){var e,r,n;(e=this[t])&&(n=e[r=e.active])&&(n.timer.c=null,n.timer.t=NaN,--e.count?delete e[r]:delete this[t],e.active+=.5,n.event&&n.event.interrupt.call(this,this.__data__,n.index))}}function Ko(t,e,r){return Ea(t,Hl),t.namespace=e,t.id=r,t}function Jo(t,e,r,n){var i=t.id,o=t.namespace;return G(t,"function"==typeof r?function(t,a,s){t[o][i].tween.set(e,n(r.call(t,t.__data__,a,s)))}:(r=n(r),function(t){t[o][i].tween.set(e,r)}))}function ta(t){return null==t&&(t=""),function(){this.textContent=t}}function ea(t){return null==t?"__transition__":"__transition_"+t+"__"}function ra(t,e,r,n,i){function o(t){var e=g.delay;return c.t=e+l,t>=e?a(t-e):void(c.c=a)}function a(r){var i=p.active,o=p[i];o&&(o.timer.c=null,o.timer.t=NaN,--p.count,delete p[i],o.event&&o.event.interrupt.call(t,t.__data__,o.index));for(var a in p)if(n>+a){var h=p[a];h.timer.c=null,h.timer.t=NaN,--p.count,delete p[a]}c.c=s,Pt(function(){return c.c&&s(r||1)&&(c.c=null,c.t=NaN),1},0,l),p.active=n,g.event&&g.event.start.call(t,t.__data__,e),d=[],g.tween.forEach(function(r,n){(n=n.call(t,t.__data__,e))&&d.push(n)}),f=g.ease,u=g.duration}function s(i){for(var o=i/u,a=f(o),s=d.length;s>0;)d[--s].call(t,a);return o>=1?(g.event&&g.event.end.call(t,t.__data__,e),--p.count?delete p[n]:delete t[r],1):void 0}var l,c,u,f,d,p=t[r]||(t[r]={active:0,count:0}),g=p[n];g||(l=i.time,c=Pt(o,0,l),g=p[n]={tween:new h,time:l,timer:c,delay:i.delay,duration:i.duration,ease:i.ease,index:e},i=null,++p.count)}function na(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate("+(isFinite(n)?n:r(t))+",0)"})}function ia(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate(0,"+(isFinite(n)?n:r(t))+")"})}function oa(t){return t.toISOString()}function aa(t,e,r){function n(e){return t(e)}function i(t,r){var n=t[1]-t[0],i=n/r,o=ua.bisect(Jl,i);return o==Jl.length?[e.year,to(t.map(function(t){return t/31536e6}),r)[2]]:o?e[i/Jl[o-1]<Jl[o]/i?o-1:o]:[rc,to(t,r)[2]]}return n.invert=function(e){return sa(t.invert(e))},n.domain=function(e){return arguments.length?(t.domain(e),n):t.domain().map(sa)},n.nice=function(t,e){function r(r){return!isNaN(r)&&!t.range(r,sa(+r+1),e).length}var o=n.domain(),a=Gi(o),s=null==t?i(a,10):"number"==typeof t&&i(a,t);return s&&(t=s[0],e=s[1]),n.domain(Wi(o,e>1?{floor:function(e){for(;r(e=t.floor(e));)e=sa(e-1);return e},ceil:function(e){for(;r(e=t.ceil(e));)e=sa(+e+1);return e}}:t))},n.ticks=function(t,e){var r=Gi(n.domain()),o=null==t?i(r,10):"number"==typeof t?i(r,t):!t.range&&[{range:t},e];return o&&(t=o[0],e=o[1]),t.range(r[0],sa(+r[1]+1),1>e?1:e)},n.tickFormat=function(){return r},n.copy=function(){return aa(t.copy(),e,r)},Ki(n,t)}function sa(t){return new Date(t)}function la(t){return JSON.parse(t.responseText)}function ca(t){var e=da.createRange();return e.selectNode(da.body),e.createContextualFragment(t.responseText)}var ua={version:"3.5.13"},ha=[].slice,fa=function(t){return ha.call(t)},da=this.document;if(da)try{fa(da.documentElement.childNodes)[0].nodeType}catch(pa){fa=function(t){for(var e=t.length,r=new Array(e);e--;)r[e]=t[e];return r}}if(Date.now||(Date.now=function(){return+new Date}),da)try{da.createElement("DIV").style.setProperty("opacity",0,"")}catch(ga){var va=this.Element.prototype,ma=va.setAttribute,ya=va.setAttributeNS,ba=this.CSSStyleDeclaration.prototype,xa=ba.setProperty;va.setAttribute=function(t,e){ma.call(this,t,e+"")},va.setAttributeNS=function(t,e,r){ya.call(this,t,e,r+"")},ba.setProperty=function(t,e,r){xa.call(this,t,e+"",r)}}ua.ascending=i,ua.descending=function(t,e){return t>e?-1:e>t?1:e>=t?0:NaN},ua.min=function(t,e){var r,n,i=-1,o=t.length;if(1===arguments.length){for(;++i<o;)if(null!=(n=t[i])&&n>=n){r=n;break}for(;++i<o;)null!=(n=t[i])&&r>n&&(r=n)}else{for(;++i<o;)if(null!=(n=e.call(t,t[i],i))&&n>=n){r=n;break}for(;++i<o;)null!=(n=e.call(t,t[i],i))&&r>n&&(r=n)}return r},ua.max=function(t,e){var r,n,i=-1,o=t.length;if(1===arguments.length){for(;++i<o;)if(null!=(n=t[i])&&n>=n){r=n;break}for(;++i<o;)null!=(n=t[i])&&n>r&&(r=n)}else{for(;++i<o;)if(null!=(n=e.call(t,t[i],i))&&n>=n){r=n;break}for(;++i<o;)null!=(n=e.call(t,t[i],i))&&n>r&&(r=n)}return r},ua.extent=function(t,e){var r,n,i,o=-1,a=t.length;if(1===arguments.length){for(;++o<a;)if(null!=(n=t[o])&&n>=n){r=i=n;break}for(;++o<a;)null!=(n=t[o])&&(r>n&&(r=n),n>i&&(i=n))}else{for(;++o<a;)if(null!=(n=e.call(t,t[o],o))&&n>=n){
r=i=n;break}for(;++o<a;)null!=(n=e.call(t,t[o],o))&&(r>n&&(r=n),n>i&&(i=n))}return[r,i]},ua.sum=function(t,e){var r,n=0,i=t.length,o=-1;if(1===arguments.length)for(;++o<i;)a(r=+t[o])&&(n+=r);else for(;++o<i;)a(r=+e.call(t,t[o],o))&&(n+=r);return n},ua.mean=function(t,e){var r,n=0,i=t.length,s=-1,l=i;if(1===arguments.length)for(;++s<i;)a(r=o(t[s]))?n+=r:--l;else for(;++s<i;)a(r=o(e.call(t,t[s],s)))?n+=r:--l;return l?n/l:void 0},ua.quantile=function(t,e){var r=(t.length-1)*e+1,n=Math.floor(r),i=+t[n-1],o=r-n;return o?i+o*(t[n]-i):i},ua.median=function(t,e){var r,n=[],s=t.length,l=-1;if(1===arguments.length)for(;++l<s;)a(r=o(t[l]))&&n.push(r);else for(;++l<s;)a(r=o(e.call(t,t[l],l)))&&n.push(r);return n.length?ua.quantile(n.sort(i),.5):void 0},ua.variance=function(t,e){var r,n,i=t.length,s=0,l=0,c=-1,u=0;if(1===arguments.length)for(;++c<i;)a(r=o(t[c]))&&(n=r-s,s+=n/++u,l+=n*(r-s));else for(;++c<i;)a(r=o(e.call(t,t[c],c)))&&(n=r-s,s+=n/++u,l+=n*(r-s));return u>1?l/(u-1):void 0},ua.deviation=function(){var t=ua.variance.apply(this,arguments);return t?Math.sqrt(t):t};var _a=s(i);ua.bisectLeft=_a.left,ua.bisect=ua.bisectRight=_a.right,ua.bisector=function(t){return s(1===t.length?function(e,r){return i(t(e),r)}:t)},ua.shuffle=function(t,e,r){(o=arguments.length)<3&&(r=t.length,2>o&&(e=0));for(var n,i,o=r-e;o;)i=Math.random()*o--|0,n=t[o+e],t[o+e]=t[i+e],t[i+e]=n;return t},ua.permute=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},ua.pairs=function(t){for(var e,r=0,n=t.length-1,i=t[0],o=new Array(0>n?0:n);n>r;)o[r]=[e=i,i=t[++r]];return o},ua.zip=function(){if(!(n=arguments.length))return[];for(var t=-1,e=ua.min(arguments,l),r=new Array(e);++t<e;)for(var n,i=-1,o=r[t]=new Array(n);++i<n;)o[i]=arguments[i][t];return r},ua.transpose=function(t){return ua.zip.apply(ua,t)},ua.keys=function(t){var e=[];for(var r in t)e.push(r);return e},ua.values=function(t){var e=[];for(var r in t)e.push(t[r]);return e},ua.entries=function(t){var e=[];for(var r in t)e.push({key:r,value:t[r]});return e},ua.merge=function(t){for(var e,r,n,i=t.length,o=-1,a=0;++o<i;)a+=t[o].length;for(r=new Array(a);--i>=0;)for(n=t[i],e=n.length;--e>=0;)r[--a]=n[e];return r};var wa=Math.abs;ua.range=function(t,e,r){if(arguments.length<3&&(r=1,arguments.length<2&&(e=t,t=0)),(e-t)/r===1/0)throw new Error("infinite range");var n,i=[],o=c(wa(r)),a=-1;if(t*=o,e*=o,r*=o,0>r)for(;(n=t+r*++a)>e;)i.push(n/o);else for(;(n=t+r*++a)<e;)i.push(n/o);return i},ua.map=function(t,e){var r=new h;if(t instanceof h)t.forEach(function(t,e){r.set(t,e)});else if(Array.isArray(t)){var n,i=-1,o=t.length;if(1===arguments.length)for(;++i<o;)r.set(i,t[i]);else for(;++i<o;)r.set(e.call(t,n=t[i],i),n)}else for(var a in t)r.set(a,t[a]);return r};var ka="__proto__",Aa="\x00";u(h,{has:p,get:function(t){return this._[f(t)]},set:function(t,e){return this._[f(t)]=e},remove:g,keys:v,values:function(){var t=[];for(var e in this._)t.push(this._[e]);return t},entries:function(){var t=[];for(var e in this._)t.push({key:d(e),value:this._[e]});return t},size:m,empty:y,forEach:function(t){for(var e in this._)t.call(this,d(e),this._[e])}}),ua.nest=function(){function t(e,a,s){if(s>=o.length)return n?n.call(i,a):r?a.sort(r):a;for(var l,c,u,f,d=-1,p=a.length,g=o[s++],v=new h;++d<p;)(f=v.get(l=g(c=a[d])))?f.push(c):v.set(l,[c]);return e?(c=e(),u=function(r,n){c.set(r,t(e,n,s))}):(c={},u=function(r,n){c[r]=t(e,n,s)}),v.forEach(u),c}function e(t,r){if(r>=o.length)return t;var n=[],i=a[r++];return t.forEach(function(t,i){n.push({key:t,values:e(i,r)})}),i?n.sort(function(t,e){return i(t.key,e.key)}):n}var r,n,i={},o=[],a=[];return i.map=function(e,r){return t(r,e,0)},i.entries=function(r){return e(t(ua.map,r,0),0)},i.key=function(t){return o.push(t),i},i.sortKeys=function(t){return a[o.length-1]=t,i},i.sortValues=function(t){return r=t,i},i.rollup=function(t){return n=t,i},i},ua.set=function(t){var e=new b;if(t)for(var r=0,n=t.length;n>r;++r)e.add(t[r]);return e},u(b,{has:p,add:function(t){return this._[f(t+="")]=!0,t},remove:g,values:v,size:m,empty:y,forEach:function(t){for(var e in this._)t.call(this,d(e))}}),ua.behavior={},ua.rebind=function(t,e){for(var r,n=1,i=arguments.length;++n<i;)t[r=arguments[n]]=_(t,e,e[r]);return t};var Ma=["webkit","ms","moz","Moz","o","O"];ua.dispatch=function(){for(var t=new A,e=-1,r=arguments.length;++e<r;)t[arguments[e]]=M(t);return t},A.prototype.on=function(t,e){var r=t.indexOf("."),n="";if(r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),t)return arguments.length<2?this[t].on(n):this[t].on(n,e);if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(n,null);return this}},ua.event=null,ua.requote=function(t){return t.replace(Ta,"\\$&")};var Ta=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Ea={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]},La=function(t,e){return e.querySelector(t)},Sa=function(t,e){return e.querySelectorAll(t)},Ca=function(t,e){var r=t.matches||t[w(t,"matchesSelector")];return(Ca=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(La=function(t,e){return Sizzle(t,e)[0]||null},Sa=Sizzle,Ca=Sizzle.matchesSelector),ua.selection=function(){return ua.select(da.documentElement)};var za=ua.selection.prototype=[];za.select=function(t){var e,r,n,i,o=[];t=C(t);for(var a=-1,s=this.length;++a<s;){o.push(e=[]),e.parentNode=(n=this[a]).parentNode;for(var l=-1,c=n.length;++l<c;)(i=n[l])?(e.push(r=t.call(i,i.__data__,l,a)),r&&"__data__"in i&&(r.__data__=i.__data__)):e.push(null)}return S(o)},za.selectAll=function(t){var e,r,n=[];t=z(t);for(var i=-1,o=this.length;++i<o;)for(var a=this[i],s=-1,l=a.length;++s<l;)(r=a[s])&&(n.push(e=fa(t.call(r,r.__data__,s,i))),e.parentNode=r);return S(n)};var ja={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};ua.ns={prefix:ja,qualify:function(t){var e=t.indexOf(":"),r=t;return e>=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),ja.hasOwnProperty(r)?{space:ja[r],local:t}:t}},za.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node();return t=ua.ns.qualify(t),t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}for(e in t)this.each(j(e,t[e]));return this}return this.each(j(t,e))},za.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=R(t)).length,i=-1;if(e=r.classList){for(;++i<n;)if(!e.contains(t[i]))return!1}else for(e=r.getAttribute("class");++i<n;)if(!I(t[i]).test(e))return!1;return!0}for(e in t)this.each(O(e,t[e]));return this}return this.each(O(t,e))},za.style=function(t,e,r){var i=arguments.length;if(3>i){if("string"!=typeof t){2>i&&(e="");for(r in t)this.each(D(r,t[r],e));return this}if(2>i){var o=this.node();return n(o).getComputedStyle(o,null).getPropertyValue(t)}r=""}return this.each(D(t,e,r))},za.property=function(t,e){if(arguments.length<2){if("string"==typeof t)return this.node()[t];for(e in t)this.each(F(e,t[e]));return this}return this.each(F(t,e))},za.text=function(t){return arguments.length?this.each("function"==typeof t?function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}:null==t?function(){this.textContent=""}:function(){this.textContent=t}):this.node().textContent},za.html=function(t){return arguments.length?this.each("function"==typeof t?function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}:null==t?function(){this.innerHTML=""}:function(){this.innerHTML=t}):this.node().innerHTML},za.append=function(t){return t=B(t),this.select(function(){return this.appendChild(t.apply(this,arguments))})},za.insert=function(t,e){return t=B(t),e=C(e),this.select(function(){return this.insertBefore(t.apply(this,arguments),e.apply(this,arguments)||null)})},za.remove=function(){return this.each(U)},za.data=function(t,e){function r(t,r){var n,i,o,a=t.length,u=r.length,f=Math.min(a,u),d=new Array(u),p=new Array(u),g=new Array(a);if(e){var v,m=new h,y=new Array(a);for(n=-1;++n<a;)(i=t[n])&&(m.has(v=e.call(i,i.__data__,n))?g[n]=i:m.set(v,i),y[n]=v);for(n=-1;++n<u;)(i=m.get(v=e.call(r,o=r[n],n)))?i!==!0&&(d[n]=i,i.__data__=o):p[n]=V(o),m.set(v,!0);for(n=-1;++n<a;)n in y&&m.get(y[n])!==!0&&(g[n]=t[n])}else{for(n=-1;++n<f;)i=t[n],o=r[n],i?(i.__data__=o,d[n]=i):p[n]=V(o);for(;u>n;++n)p[n]=V(r[n]);for(;a>n;++n)g[n]=t[n]}p.update=d,p.parentNode=d.parentNode=g.parentNode=t.parentNode,s.push(p),l.push(d),c.push(g)}var n,i,o=-1,a=this.length;if(!arguments.length){for(t=new Array(a=(n=this[0]).length);++o<a;)(i=n[o])&&(t[o]=i.__data__);return t}var s=Y([]),l=S([]),c=S([]);if("function"==typeof t)for(;++o<a;)r(n=this[o],t.call(n,n.parentNode.__data__,o));else for(;++o<a;)r(n=this[o],t);return l.enter=function(){return s},l.exit=function(){return c},l},za.datum=function(t){return arguments.length?this.property("__data__",t):this.property("__data__")},za.filter=function(t){var e,r,n,i=[];"function"!=typeof t&&(t=q(t));for(var o=0,a=this.length;a>o;o++){i.push(e=[]),e.parentNode=(r=this[o]).parentNode;for(var s=0,l=r.length;l>s;s++)(n=r[s])&&t.call(n,n.__data__,s,o)&&e.push(n)}return S(i)},za.order=function(){for(var t=-1,e=this.length;++t<e;)for(var r,n=this[t],i=n.length-1,o=n[i];--i>=0;)(r=n[i])&&(o&&o!==r.nextSibling&&o.parentNode.insertBefore(r,o),o=r);return this},za.sort=function(t){t=H.apply(this,arguments);for(var e=-1,r=this.length;++e<r;)this[e].sort(t);return this.order()},za.each=function(t){return G(this,function(e,r,n){t.call(e,e.__data__,r,n)})},za.call=function(t){var e=fa(arguments);return t.apply(e[0]=this,e),this},za.empty=function(){return!this.node()},za.node=function(){for(var t=0,e=this.length;e>t;t++)for(var r=this[t],n=0,i=r.length;i>n;n++){var o=r[n];if(o)return o}return null},za.size=function(){var t=0;return G(this,function(){++t}),t};var Pa=[];ua.selection.enter=Y,ua.selection.enter.prototype=Pa,Pa.append=za.append,Pa.empty=za.empty,Pa.node=za.node,Pa.call=za.call,Pa.size=za.size,Pa.select=function(t){for(var e,r,n,i,o,a=[],s=-1,l=this.length;++s<l;){n=(i=this[s]).update,a.push(e=[]),e.parentNode=i.parentNode;for(var c=-1,u=i.length;++c<u;)(o=i[c])?(e.push(n[c]=r=t.call(i.parentNode,o.__data__,c,s)),r.__data__=o.__data__):e.push(null)}return S(a)},Pa.insert=function(t,e){return arguments.length<2&&(e=X(this)),za.insert.call(this,t,e)},ua.select=function(t){var r;return"string"==typeof t?(r=[La(t,da)],r.parentNode=da.documentElement):(r=[t],r.parentNode=e(t)),S([r])},ua.selectAll=function(t){var e;return"string"==typeof t?(e=fa(Sa(t,da)),e.parentNode=da.documentElement):(e=fa(t),e.parentNode=null),S([e])},za.on=function(t,e,r){var n=arguments.length;if(3>n){if("string"!=typeof t){2>n&&(e=!1);for(r in t)this.each(W(r,t[r],e));return this}if(2>n)return(n=this.node()["__on"+t])&&n._;r=!1}return this.each(W(t,e,r))};var Ia=ua.map({mouseenter:"mouseover",mouseleave:"mouseout"});da&&Ia.forEach(function(t){"on"+t in da&&Ia.remove(t)});var Ra,Oa=0;ua.mouse=function(t){return K(t,E())};var Na=this.navigator&&/WebKit/.test(this.navigator.userAgent)?-1:0;ua.touch=function(t,e,r){if(arguments.length<3&&(r=e,e=E().changedTouches),e)for(var n,i=0,o=e.length;o>i;++i)if((n=e[i]).identifier===r)return K(t,n)},ua.behavior.drag=function(){function t(){this.on("mousedown.drag",o).on("touchstart.drag",a)}function e(t,e,n,o,a){return function(){function s(){var t,r,n=e(f,g);n&&(t=n[0]-b[0],r=n[1]-b[1],p|=t|r,b=n,d({type:"drag",x:n[0]+c[0],y:n[1]+c[1],dx:t,dy:r}))}function l(){e(f,g)&&(m.on(o+v,null).on(a+v,null),y(p),d({type:"dragend"}))}var c,u=this,h=ua.event.target,f=u.parentNode,d=r.of(u,arguments),p=0,g=t(),v=".drag"+(null==g?"":"-"+g),m=ua.select(n(h)).on(o+v,s).on(a+v,l),y=$(h),b=e(f,g);i?(c=i.apply(u,arguments),c=[c.x-b[0],c.y-b[1]]):c=[0,0],d({type:"dragstart"})}}var r=L(t,"drag","dragstart","dragend"),i=null,o=e(k,ua.mouse,n,"mousemove","mouseup"),a=e(J,ua.touch,x,"touchmove","touchend");return t.origin=function(e){return arguments.length?(i=e,t):i},ua.rebind(t,r,"on")},ua.touches=function(t,e){return arguments.length<2&&(e=E().touches),e?fa(e).map(function(e){var r=K(t,e);return r.identifier=e.identifier,r}):[]};var Da=1e-6,Fa=Da*Da,Ba=Math.PI,Ua=2*Ba,Va=Ua-Da,qa=Ba/2,Ha=Ba/180,Ga=180/Ba,Ya=Math.SQRT2,Xa=2,Wa=4;ua.interpolateZoom=function(t,e){var r,n,i=t[0],o=t[1],a=t[2],s=e[0],l=e[1],c=e[2],u=s-i,h=l-o,f=u*u+h*h;if(Fa>f)n=Math.log(c/a)/Ya,r=function(t){return[i+t*u,o+t*h,a*Math.exp(Ya*t*n)]};else{var d=Math.sqrt(f),p=(c*c-a*a+Wa*f)/(2*a*Xa*d),g=(c*c-a*a-Wa*f)/(2*c*Xa*d),v=Math.log(Math.sqrt(p*p+1)-p),m=Math.log(Math.sqrt(g*g+1)-g);n=(m-v)/Ya,r=function(t){var e=t*n,r=ot(v),s=a/(Xa*d)*(r*at(Ya*e+v)-it(v));return[i+s*u,o+s*h,a*r/ot(Ya*e+v)]}}return r.duration=1e3*n,r},ua.behavior.zoom=function(){function t(t){t.on(z,h).on(Qa+".zoom",d).on("dblclick.zoom",p).on(I,f)}function e(t){return[(t[0]-A.x)/A.k,(t[1]-A.y)/A.k]}function r(t){return[t[0]*A.k+A.x,t[1]*A.k+A.y]}function i(t){A.k=Math.max(E[0],Math.min(E[1],t))}function o(t,e){e=r(e),A.x+=t[0]-e[0],A.y+=t[1]-e[1]}function a(e,r,n,a){e.__chart__={x:A.x,y:A.y,k:A.k},i(Math.pow(2,a)),o(v=r,n),e=ua.select(e),S>0&&(e=e.transition().duration(S)),e.call(t.event)}function s(){_&&_.domain(x.range().map(function(t){return(t-A.x)/A.k}).map(x.invert)),k&&k.domain(w.range().map(function(t){return(t-A.y)/A.k}).map(w.invert))}function l(t){C++||t({type:"zoomstart"})}function c(t){s(),t({type:"zoom",scale:A.k,translate:[A.x,A.y]})}function u(t){--C||(t({type:"zoomend"}),v=null)}function h(){function t(){s=1,o(ua.mouse(i),f),c(a)}function r(){h.on(j,null).on(P,null),d(s),u(a)}var i=this,a=R.of(i,arguments),s=0,h=ua.select(n(i)).on(j,t).on(P,r),f=e(ua.mouse(i)),d=$(i);ql.call(i),l(a)}function f(){function t(){var t=ua.touches(p);return d=A.k,t.forEach(function(t){t.identifier in v&&(v[t.identifier]=e(t))}),t}function r(){var e=ua.event.target;ua.select(e).on(x,n).on(_,s),w.push(e);for(var r=ua.event.changedTouches,i=0,o=r.length;o>i;++i)v[r[i].identifier]=null;var l=t(),c=Date.now();if(1===l.length){if(500>c-b){var u=l[0];a(p,u,v[u.identifier],Math.floor(Math.log(A.k)/Math.LN2)+1),T()}b=c}else if(l.length>1){var u=l[0],h=l[1],f=u[0]-h[0],d=u[1]-h[1];m=f*f+d*d}}function n(){var t,e,r,n,a=ua.touches(p);ql.call(p);for(var s=0,l=a.length;l>s;++s,n=null)if(r=a[s],n=v[r.identifier]){if(e)break;t=r,e=n}if(n){var u=(u=r[0]-t[0])*u+(u=r[1]-t[1])*u,h=m&&Math.sqrt(u/m);t=[(t[0]+r[0])/2,(t[1]+r[1])/2],e=[(e[0]+n[0])/2,(e[1]+n[1])/2],i(h*d)}b=null,o(t,e),c(g)}function s(){if(ua.event.touches.length){for(var e=ua.event.changedTouches,r=0,n=e.length;n>r;++r)delete v[e[r].identifier];for(var i in v)return void t()}ua.selectAll(w).on(y,null),k.on(z,h).on(I,f),M(),u(g)}var d,p=this,g=R.of(p,arguments),v={},m=0,y=".zoom-"+ua.event.changedTouches[0].identifier,x="touchmove"+y,_="touchend"+y,w=[],k=ua.select(p),M=$(p);r(),l(g),k.on(z,null).on(I,r)}function d(){var t=R.of(this,arguments);y?clearTimeout(y):(ql.call(this),g=e(v=m||ua.mouse(this)),l(t)),y=setTimeout(function(){y=null,u(t)},50),T(),i(Math.pow(2,.002*Za())*A.k),o(v,g),c(t)}function p(){var t=ua.mouse(this),r=Math.log(A.k)/Math.LN2;a(this,t,e(t),ua.event.shiftKey?Math.ceil(r)-1:Math.floor(r)+1)}var g,v,m,y,b,x,_,w,k,A={x:0,y:0,k:1},M=[960,500],E=$a,S=250,C=0,z="mousedown.zoom",j="mousemove.zoom",P="mouseup.zoom",I="touchstart.zoom",R=L(t,"zoomstart","zoom","zoomend");return Qa||(Qa="onwheel"in da?(Za=function(){return-ua.event.deltaY*(ua.event.deltaMode?120:1)},"wheel"):"onmousewheel"in da?(Za=function(){return ua.event.wheelDelta},"mousewheel"):(Za=function(){return-ua.event.detail},"MozMousePixelScroll")),t.event=function(t){t.each(function(){var t=R.of(this,arguments),e=A;Ul?ua.select(this).transition().each("start.zoom",function(){A=this.__chart__||{x:0,y:0,k:1},l(t)}).tween("zoom:zoom",function(){var r=M[0],n=M[1],i=v?v[0]:r/2,o=v?v[1]:n/2,a=ua.interpolateZoom([(i-A.x)/A.k,(o-A.y)/A.k,r/A.k],[(i-e.x)/e.k,(o-e.y)/e.k,r/e.k]);return function(e){var n=a(e),s=r/n[2];this.__chart__=A={x:i-n[0]*s,y:o-n[1]*s,k:s},c(t)}}).each("interrupt.zoom",function(){u(t)}).each("end.zoom",function(){u(t)}):(this.__chart__=A,l(t),c(t),u(t))})},t.translate=function(e){return arguments.length?(A={x:+e[0],y:+e[1],k:A.k},s(),t):[A.x,A.y]},t.scale=function(e){return arguments.length?(A={x:A.x,y:A.y,k:null},i(+e),s(),t):A.k},t.scaleExtent=function(e){return arguments.length?(E=null==e?$a:[+e[0],+e[1]],t):E},t.center=function(e){return arguments.length?(m=e&&[+e[0],+e[1]],t):m},t.size=function(e){return arguments.length?(M=e&&[+e[0],+e[1]],t):M},t.duration=function(e){return arguments.length?(S=+e,t):S},t.x=function(e){return arguments.length?(_=e,x=e.copy(),A={x:0,y:0,k:1},t):_},t.y=function(e){return arguments.length?(k=e,w=e.copy(),A={x:0,y:0,k:1},t):k},ua.rebind(t,R,"on")};var Za,Qa,$a=[0,1/0];ua.color=lt,lt.prototype.toString=function(){return this.rgb()+""},ua.hsl=ct;var Ka=ct.prototype=new lt;Ka.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new ct(this.h,this.s,this.l/t)},Ka.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new ct(this.h,this.s,t*this.l)},Ka.rgb=function(){return ut(this.h,this.s,this.l)},ua.hcl=ht;var Ja=ht.prototype=new lt;Ja.brighter=function(t){return new ht(this.h,this.c,Math.min(100,this.l+ts*(arguments.length?t:1)))},Ja.darker=function(t){return new ht(this.h,this.c,Math.max(0,this.l-ts*(arguments.length?t:1)))},Ja.rgb=function(){return ft(this.h,this.c,this.l).rgb()},ua.lab=dt;var ts=18,es=.95047,rs=1,ns=1.08883,is=dt.prototype=new lt;is.brighter=function(t){return new dt(Math.min(100,this.l+ts*(arguments.length?t:1)),this.a,this.b)},is.darker=function(t){return new dt(Math.max(0,this.l-ts*(arguments.length?t:1)),this.a,this.b)},is.rgb=function(){return pt(this.l,this.a,this.b)},ua.rgb=bt;var os=bt.prototype=new lt;os.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var e=this.r,r=this.g,n=this.b,i=30;return e||r||n?(e&&i>e&&(e=i),r&&i>r&&(r=i),n&&i>n&&(n=i),new bt(Math.min(255,e/t),Math.min(255,r/t),Math.min(255,n/t))):new bt(i,i,i)},os.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new bt(t*this.r,t*this.g,t*this.b)},os.hsl=function(){return At(this.r,this.g,this.b)},os.toString=function(){return"#"+wt(this.r)+wt(this.g)+wt(this.b)};var as=ua.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});as.forEach(function(t,e){as.set(t,xt(e))}),ua.functor=Lt,ua.xhr=St(x),ua.dsv=function(t,e){function r(t,r,o){arguments.length<3&&(o=r,r=null);var a=Ct(t,e,null==r?n:i(r),o);return a.row=function(t){return arguments.length?a.response(null==(r=t)?n:i(t)):r},a}function n(t){return r.parse(t.responseText)}function i(t){return function(e){return r.parse(e.responseText,t)}}function o(e){return e.map(a).join(t)}function a(t){return s.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}var s=new RegExp('["'+t+"\n]"),l=t.charCodeAt(0);return r.parse=function(t,e){var n;return r.parseRows(t,function(t,r){if(n)return n(t,r-1);var i=new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+"]"}).join(",")+"}");n=e?function(t,r){return e(i(t),r)}:i})},r.parseRows=function(t,e){function r(){if(u>=c)return a;if(i)return i=!1,o;var e=u;if(34===t.charCodeAt(e)){for(var r=e;r++<c;)if(34===t.charCodeAt(r)){if(34!==t.charCodeAt(r+1))break;++r}u=r+2;var n=t.charCodeAt(r+1);return 13===n?(i=!0,10===t.charCodeAt(r+2)&&++u):10===n&&(i=!0),t.slice(e+1,r).replace(/""/g,'"')}for(;c>u;){var n=t.charCodeAt(u++),s=1;if(10===n)i=!0;else if(13===n)i=!0,10===t.charCodeAt(u)&&(++u,++s);else if(n!==l)continue;return t.slice(e,u-s)}return t.slice(e)}for(var n,i,o={},a={},s=[],c=t.length,u=0,h=0;(n=r())!==a;){for(var f=[];n!==o&&n!==a;)f.push(n),n=r();e&&null==(f=e(f,h++))||s.push(f)}return s},r.format=function(e){if(Array.isArray(e[0]))return r.formatRows(e);var n=new b,i=[];return e.forEach(function(t){for(var e in t)n.has(e)||i.push(n.add(e))}),[i.map(a).join(t)].concat(e.map(function(e){return i.map(function(t){return a(e[t])}).join(t)})).join("\n")},r.formatRows=function(t){return t.map(o).join("\n")},r},ua.csv=ua.dsv(",","text/csv"),ua.tsv=ua.dsv(" ","text/tab-separated-values");var ss,ls,cs,us,hs=this[w(this,"requestAnimationFrame")]||function(t){setTimeout(t,17)};ua.timer=function(){Pt.apply(this,arguments)},ua.timer.flush=function(){Rt(),Ot()},ua.round=function(t,e){return e?Math.round(t*(e=Math.pow(10,e)))/e:Math.round(t)};var fs=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"].map(Dt);ua.formatPrefix=function(t,e){var r=0;return(t=+t)&&(0>t&&(t*=-1),e&&(t=ua.round(t,Nt(t,e))),r=1+Math.floor(1e-12+Math.log(t)/Math.LN10),r=Math.max(-24,Math.min(24,3*Math.floor((r-1)/3)))),fs[8+r/3]};var ds=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,ps=ua.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(t,e){return(t=ua.round(t,Nt(t,e))).toFixed(Math.max(0,Math.min(20,Nt(t*(1+1e-15),e))))}}),gs=ua.time={},vs=Date;Ut.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){ms.setUTCDate.apply(this._,arguments)},setDay:function(){ms.setUTCDay.apply(this._,arguments)},setFullYear:function(){ms.setUTCFullYear.apply(this._,arguments)},setHours:function(){ms.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ms.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ms.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ms.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ms.setUTCSeconds.apply(this._,arguments)},setTime:function(){ms.setTime.apply(this._,arguments)}};var ms=Date.prototype;gs.year=Vt(function(t){return t=gs.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),gs.years=gs.year.range,gs.years.utc=gs.year.utc.range,gs.day=Vt(function(t){var e=new vs(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e},function(t,e){t.setDate(t.getDate()+e)},function(t){return t.getDate()-1}),gs.days=gs.day.range,gs.days.utc=gs.day.utc.range,gs.dayOfYear=function(t){var e=gs.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(t,e){e=7-e;var r=gs[t]=Vt(function(t){return(t=gs.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t},function(t,e){t.setDate(t.getDate()+7*Math.floor(e))},function(t){var r=gs.year(t).getDay();return Math.floor((gs.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});gs[t+"s"]=r.range,gs[t+"s"].utc=r.utc.range,gs[t+"OfYear"]=function(t){var r=gs.year(t).getDay();return Math.floor((gs.dayOfYear(t)+(r+e)%7)/7)}}),gs.week=gs.sunday,gs.weeks=gs.sunday.range,gs.weeks.utc=gs.sunday.utc.range,gs.weekOfYear=gs.sundayOfYear;var ys={"-":"",_:" ",0:"0"},bs=/^\s*\d+/,xs=/^%/;ua.locale=function(t){return{numberFormat:Ft(t),timeFormat:Ht(t)}};var _s=ua.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});ua.format=_s.numberFormat,ua.geo={},he.prototype={s:0,t:0,add:function(t){fe(t,this.t,ws),fe(ws.s,this.s,this),this.s?this.t+=ws.t:this.s=ws.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var ws=new he;ua.geo.stream=function(t,e){t&&ks.hasOwnProperty(t.type)?ks[t.type](t,e):de(t,e)};var ks={Feature:function(t,e){de(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++n<i;)de(r[n].geometry,e)}},As={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)t=r[n],e.point(t[0],t[1],t[2])},LineString:function(t,e){pe(t.coordinates,e,0)},MultiLineString:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)pe(r[n],e,0)},Polygon:function(t,e){ge(t.coordinates,e)},MultiPolygon:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)ge(r[n],e)},GeometryCollection:function(t,e){for(var r=t.geometries,n=-1,i=r.length;++n<i;)de(r[n],e)}};ua.geo.area=function(t){return Ms=0,ua.geo.stream(t,Es),Ms};var Ms,Ts=new he,Es={sphere:function(){Ms+=4*Ba},point:k,lineStart:k,lineEnd:k,polygonStart:function(){Ts.reset(),Es.lineStart=ve},polygonEnd:function(){var t=2*Ts;Ms+=0>t?4*Ba+t:t,Es.lineStart=Es.lineEnd=Es.point=k}};ua.geo.bounds=function(){function t(t,e){b.push(x=[u=t,f=t]),h>e&&(h=e),e>d&&(d=e)}function e(e,r){var n=me([e*Ha,r*Ha]);if(m){var i=be(m,n),o=[i[1],-i[0],0],a=be(o,i);we(a),a=ke(a);var l=e-p,c=l>0?1:-1,g=a[0]*Ga*c,v=wa(l)>180;if(v^(g>c*p&&c*e>g)){var y=a[1]*Ga;y>d&&(d=y)}else if(g=(g+360)%360-180,v^(g>c*p&&c*e>g)){var y=-a[1]*Ga;h>y&&(h=y)}else h>r&&(h=r),r>d&&(d=r);v?p>e?s(u,e)>s(u,f)&&(f=e):s(e,f)>s(u,f)&&(u=e):f>=u?(u>e&&(u=e),e>f&&(f=e)):e>p?s(u,e)>s(u,f)&&(f=e):s(e,f)>s(u,f)&&(u=e)}else t(e,r);m=n,p=e}function r(){_.point=e}function n(){x[0]=u,x[1]=f,_.point=t,m=null}function i(t,r){if(m){var n=t-p;y+=wa(n)>180?n+(n>0?360:-360):n}else g=t,v=r;Es.point(t,r),e(t,r)}function o(){Es.lineStart()}function a(){i(g,v),Es.lineEnd(),wa(y)>Da&&(u=-(f=180)),x[0]=u,x[1]=f,m=null}function s(t,e){return(e-=t)<0?e+360:e}function l(t,e){return t[0]-e[0]}function c(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t<e[0]||e[1]<t}var u,h,f,d,p,g,v,m,y,b,x,_={point:t,lineStart:r,lineEnd:n,polygonStart:function(){_.point=i,_.lineStart=o,_.lineEnd=a,y=0,Es.polygonStart()},polygonEnd:function(){Es.polygonEnd(),_.point=t,_.lineStart=r,_.lineEnd=n,0>Ts?(u=-(f=180),h=-(d=90)):y>Da?d=90:-Da>y&&(h=-90),x[0]=u,x[1]=f}};return function(t){d=f=-(u=h=1/0),b=[],ua.geo.stream(t,_);var e=b.length;if(e){b.sort(l);for(var r,n=1,i=b[0],o=[i];e>n;++n)r=b[n],c(r[0],i)||c(r[1],i)?(s(i[0],r[1])>s(i[0],i[1])&&(i[1]=r[1]),s(r[0],i[1])>s(i[0],i[1])&&(i[0]=r[0])):o.push(i=r);for(var a,r,p=-(1/0),e=o.length-1,n=0,i=o[e];e>=n;i=r,++n)r=o[n],(a=s(i[1],r[0]))>p&&(p=a,u=r[0],f=i[1])}return b=x=null,u===1/0||h===1/0?[[NaN,NaN],[NaN,NaN]]:[[u,h],[f,d]]}}(),ua.geo.centroid=function(t){Ls=Ss=Cs=zs=js=Ps=Is=Rs=Os=Ns=Ds=0,ua.geo.stream(t,Fs);var e=Os,r=Ns,n=Ds,i=e*e+r*r+n*n;return Fa>i&&(e=Ps,r=Is,n=Rs,Da>Ss&&(e=Cs,r=zs,n=js),i=e*e+r*r+n*n,Fa>i)?[NaN,NaN]:[Math.atan2(r,e)*Ga,nt(n/Math.sqrt(i))*Ga]};var Ls,Ss,Cs,zs,js,Ps,Is,Rs,Os,Ns,Ds,Fs={sphere:k,point:Me,lineStart:Ee,lineEnd:Le,polygonStart:function(){Fs.lineStart=Se},polygonEnd:function(){Fs.lineStart=Ee}},Bs=Re(ze,Fe,Ue,[-Ba,-Ba/2]),Us=1e9;ua.geo.clipExtent=function(){var t,e,r,n,i,o,a={stream:function(t){return i&&(i.valid=!1),i=o(t),i.valid=!0,i},extent:function(s){return arguments.length?(o=Ge(t=+s[0][0],e=+s[0][1],r=+s[1][0],n=+s[1][1]),i&&(i.valid=!1,i=null),a):[[t,e],[r,n]]}};return a.extent([[0,0],[960,500]])},(ua.geo.conicEqualArea=function(){return Ye(Xe)}).raw=Xe,ua.geo.albers=function(){return ua.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},ua.geo.albersUsa=function(){function t(t){var o=t[0],a=t[1];return e=null,r(o,a),e||(n(o,a),e)||i(o,a),e}var e,r,n,i,o=ua.geo.albers(),a=ua.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=ua.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(t,r){e=[t,r]}};return t.invert=function(t){var e=o.scale(),r=o.translate(),n=(t[0]-r[0])/e,i=(t[1]-r[1])/e;return(i>=.12&&.234>i&&n>=-.425&&-.214>n?a:i>=.166&&.234>i&&n>=-.214&&-.115>n?s:o).invert(t)},t.stream=function(t){var e=o.stream(t),r=a.stream(t),n=s.stream(t);return{point:function(t,i){e.point(t,i),r.point(t,i),n.point(t,i)},sphere:function(){e.sphere(),r.sphere(),n.sphere()},lineStart:function(){e.lineStart(),r.lineStart(),n.lineStart()},lineEnd:function(){e.lineEnd(),r.lineEnd(),n.lineEnd()},polygonStart:function(){e.polygonStart(),r.polygonStart(),n.polygonStart()},polygonEnd:function(){e.polygonEnd(),r.polygonEnd(),n.polygonEnd()}}},t.precision=function(e){return arguments.length?(o.precision(e),a.precision(e),s.precision(e),t):o.precision()},t.scale=function(e){return arguments.length?(o.scale(e),a.scale(.35*e),s.scale(e),t.translate(o.translate())):o.scale()},t.translate=function(e){if(!arguments.length)return o.translate();var c=o.scale(),u=+e[0],h=+e[1];return r=o.translate(e).clipExtent([[u-.455*c,h-.238*c],[u+.455*c,h+.238*c]]).stream(l).point,n=a.translate([u-.307*c,h+.201*c]).clipExtent([[u-.425*c+Da,h+.12*c+Da],[u-.214*c-Da,h+.234*c-Da]]).stream(l).point,
i=s.translate([u-.205*c,h+.212*c]).clipExtent([[u-.214*c+Da,h+.166*c+Da],[u-.115*c-Da,h+.234*c-Da]]).stream(l).point,t},t.scale(1070)};var Vs,qs,Hs,Gs,Ys,Xs,Ws={point:k,lineStart:k,lineEnd:k,polygonStart:function(){qs=0,Ws.lineStart=We},polygonEnd:function(){Ws.lineStart=Ws.lineEnd=Ws.point=k,Vs+=wa(qs/2)}},Zs={point:Ze,lineStart:k,lineEnd:k,polygonStart:k,polygonEnd:k},Qs={point:Ke,lineStart:Je,lineEnd:tr,polygonStart:function(){Qs.lineStart=er},polygonEnd:function(){Qs.point=Ke,Qs.lineStart=Je,Qs.lineEnd=tr}};ua.geo.path=function(){function t(t){return t&&("function"==typeof s&&o.pointRadius(+s.apply(this,arguments)),a&&a.valid||(a=i(o)),ua.geo.stream(t,a)),o.result()}function e(){return a=null,t}var r,n,i,o,a,s=4.5;return t.area=function(t){return Vs=0,ua.geo.stream(t,i(Ws)),Vs},t.centroid=function(t){return Cs=zs=js=Ps=Is=Rs=Os=Ns=Ds=0,ua.geo.stream(t,i(Qs)),Ds?[Os/Ds,Ns/Ds]:Rs?[Ps/Rs,Is/Rs]:js?[Cs/js,zs/js]:[NaN,NaN]},t.bounds=function(t){return Ys=Xs=-(Hs=Gs=1/0),ua.geo.stream(t,i(Zs)),[[Hs,Gs],[Ys,Xs]]},t.projection=function(t){return arguments.length?(i=(r=t)?t.stream||ir(t):x,e()):r},t.context=function(t){return arguments.length?(o=null==(n=t)?new Qe:new rr(t),"function"!=typeof s&&o.pointRadius(s),e()):n},t.pointRadius=function(e){return arguments.length?(s="function"==typeof e?e:(o.pointRadius(+e),+e),t):s},t.projection(ua.geo.albersUsa()).context(null)},ua.geo.transform=function(t){return{stream:function(e){var r=new or(e);for(var n in t)r[n]=t[n];return r}}},or.prototype={point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},ua.geo.projection=sr,ua.geo.projectionMutator=lr,(ua.geo.equirectangular=function(){return sr(ur)}).raw=ur.invert=ur,ua.geo.rotation=function(t){function e(e){return e=t(e[0]*Ha,e[1]*Ha),e[0]*=Ga,e[1]*=Ga,e}return t=fr(t[0]%360*Ha,t[1]*Ha,t.length>2?t[2]*Ha:0),e.invert=function(e){return e=t.invert(e[0]*Ha,e[1]*Ha),e[0]*=Ga,e[1]*=Ga,e},e},hr.invert=ur,ua.geo.circle=function(){function t(){var t="function"==typeof n?n.apply(this,arguments):n,e=fr(-t[0]*Ha,-t[1]*Ha,0).invert,i=[];return r(null,null,1,{point:function(t,r){i.push(t=e(t,r)),t[0]*=Ga,t[1]*=Ga}}),{type:"Polygon",coordinates:[i]}}var e,r,n=[0,0],i=6;return t.origin=function(e){return arguments.length?(n=e,t):n},t.angle=function(n){return arguments.length?(r=vr((e=+n)*Ha,i*Ha),t):e},t.precision=function(n){return arguments.length?(r=vr(e*Ha,(i=+n)*Ha),t):i},t.angle(90)},ua.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Ha,i=t[1]*Ha,o=e[1]*Ha,a=Math.sin(n),s=Math.cos(n),l=Math.sin(i),c=Math.cos(i),u=Math.sin(o),h=Math.cos(o);return Math.atan2(Math.sqrt((r=h*a)*r+(r=c*u-l*h*s)*r),l*u+c*h*s)},ua.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return ua.range(Math.ceil(o/v)*v,i,v).map(f).concat(ua.range(Math.ceil(c/m)*m,l,m).map(d)).concat(ua.range(Math.ceil(n/p)*p,r,p).filter(function(t){return wa(t%v)>Da}).map(u)).concat(ua.range(Math.ceil(s/g)*g,a,g).filter(function(t){return wa(t%m)>Da}).map(h))}var r,n,i,o,a,s,l,c,u,h,f,d,p=10,g=p,v=90,m=360,y=2.5;return t.lines=function(){return e().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[f(o).concat(d(l).slice(1),f(i).reverse().slice(1),d(c).reverse().slice(1))]}},t.extent=function(e){return arguments.length?t.majorExtent(e).minorExtent(e):t.minorExtent()},t.majorExtent=function(e){return arguments.length?(o=+e[0][0],i=+e[1][0],c=+e[0][1],l=+e[1][1],o>i&&(e=o,o=i,i=e),c>l&&(e=c,c=l,l=e),t.precision(y)):[[o,c],[i,l]]},t.minorExtent=function(e){return arguments.length?(n=+e[0][0],r=+e[1][0],s=+e[0][1],a=+e[1][1],n>r&&(e=n,n=r,r=e),s>a&&(e=s,s=a,a=e),t.precision(y)):[[n,s],[r,a]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(v=+e[0],m=+e[1],t):[v,m]},t.minorStep=function(e){return arguments.length?(p=+e[0],g=+e[1],t):[p,g]},t.precision=function(e){return arguments.length?(y=+e,u=yr(s,a,90),h=br(n,r,y),f=yr(c,l,90),d=br(o,i,y),t):y},t.majorExtent([[-180,-90+Da],[180,90-Da]]).minorExtent([[-180,-80-Da],[180,80+Da]])},ua.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||n.apply(this,arguments),r||i.apply(this,arguments)]}}var e,r,n=xr,i=_r;return t.distance=function(){return ua.geo.distance(e||n.apply(this,arguments),r||i.apply(this,arguments))},t.source=function(r){return arguments.length?(n=r,e="function"==typeof r?null:r,t):n},t.target=function(e){return arguments.length?(i=e,r="function"==typeof e?null:e,t):i},t.precision=function(){return arguments.length?t:0},t},ua.geo.interpolate=function(t,e){return wr(t[0]*Ha,t[1]*Ha,e[0]*Ha,e[1]*Ha)},ua.geo.length=function(t){return $s=0,ua.geo.stream(t,Ks),$s};var $s,Ks={sphere:k,point:k,lineStart:kr,lineEnd:k,polygonStart:k,polygonEnd:k},Js=Ar(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(ua.geo.azimuthalEqualArea=function(){return sr(Js)}).raw=Js;var tl=Ar(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},x);(ua.geo.azimuthalEquidistant=function(){return sr(tl)}).raw=tl,(ua.geo.conicConformal=function(){return Ye(Mr)}).raw=Mr,(ua.geo.conicEquidistant=function(){return Ye(Tr)}).raw=Tr;var el=Ar(function(t){return 1/t},Math.atan);(ua.geo.gnomonic=function(){return sr(el)}).raw=el,Er.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-qa]},(ua.geo.mercator=function(){return Lr(Er)}).raw=Er;var rl=Ar(function(){return 1},Math.asin);(ua.geo.orthographic=function(){return sr(rl)}).raw=rl;var nl=Ar(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(ua.geo.stereographic=function(){return sr(nl)}).raw=nl,Sr.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-qa]},(ua.geo.transverseMercator=function(){var t=Lr(Sr),e=t.center,r=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):(t=e(),[t[1],-t[0]])},t.rotate=function(t){return t?r([t[0],t[1],t.length>2?t[2]+90:90]):(t=r(),[t[0],t[1],t[2]-90])},r([0,0,90])}).raw=Sr,ua.geom={},ua.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,i=Lt(r),o=Lt(n),a=t.length,s=[],l=[];for(e=0;a>e;e++)s.push([+i.call(this,t[e],e),+o.call(this,t[e],e),e]);for(s.sort(Pr),e=0;a>e;e++)l.push([s[e][0],-s[e][1]]);var c=jr(s),u=jr(l),h=u[0]===c[0],f=u[u.length-1]===c[c.length-1],d=[];for(e=c.length-1;e>=0;--e)d.push(t[s[c[e]][2]]);for(e=+h;e<u.length-f;++e)d.push(t[s[u[e]][2]]);return d}var r=Cr,n=zr;return arguments.length?e(t):(e.x=function(t){return arguments.length?(r=t,e):r},e.y=function(t){return arguments.length?(n=t,e):n},e)},ua.geom.polygon=function(t){return Ea(t,il),t};var il=ua.geom.polygon.prototype=[];il.area=function(){for(var t,e=-1,r=this.length,n=this[r-1],i=0;++e<r;)t=n,n=this[e],i+=t[1]*n[0]-t[0]*n[1];return.5*i},il.centroid=function(t){var e,r,n=-1,i=this.length,o=0,a=0,s=this[i-1];for(arguments.length||(t=-1/(6*this.area()));++n<i;)e=s,s=this[n],r=e[0]*s[1]-s[0]*e[1],o+=(e[0]+s[0])*r,a+=(e[1]+s[1])*r;return[o*t,a*t]},il.clip=function(t){for(var e,r,n,i,o,a,s=Or(t),l=-1,c=this.length-Or(this),u=this[c-1];++l<c;){for(e=t.slice(),t.length=0,i=this[l],o=e[(n=e.length-s)-1],r=-1;++r<n;)a=e[r],Ir(a,u,i)?(Ir(o,u,i)||t.push(Rr(o,a,u,i)),t.push(a)):Ir(o,u,i)&&t.push(Rr(o,a,u,i)),o=a;s&&t.push(t[0]),u=i}return t};var ol,al,sl,ll,cl,ul=[],hl=[];Hr.prototype.prepare=function(){for(var t,e=this.edges,r=e.length;r--;)t=e[r].edge,t.b&&t.a||e.splice(r,1);return e.sort(Yr),e.length},rn.prototype={start:function(){return this.edge.l===this.site?this.edge.a:this.edge.b},end:function(){return this.edge.l===this.site?this.edge.b:this.edge.a}},nn.prototype={insert:function(t,e){var r,n,i;if(t){if(e.P=t,e.N=t.N,t.N&&(t.N.P=e),t.N=e,t.R){for(t=t.R;t.L;)t=t.L;t.L=e}else t.R=e;r=t}else this._?(t=ln(this._),e.P=null,e.N=t,t.P=t.L=e,r=t):(e.P=e.N=null,this._=e,r=null);for(e.L=e.R=null,e.U=r,e.C=!0,t=e;r&&r.C;)n=r.U,r===n.L?(i=n.R,i&&i.C?(r.C=i.C=!1,n.C=!0,t=n):(t===r.R&&(an(this,r),t=r,r=t.U),r.C=!1,n.C=!0,sn(this,n))):(i=n.L,i&&i.C?(r.C=i.C=!1,n.C=!0,t=n):(t===r.L&&(sn(this,r),t=r,r=t.U),r.C=!1,n.C=!0,an(this,n))),r=t.U;this._.C=!1},remove:function(t){t.N&&(t.N.P=t.P),t.P&&(t.P.N=t.N),t.N=t.P=null;var e,r,n,i=t.U,o=t.L,a=t.R;if(r=o?a?ln(a):o:a,i?i.L===t?i.L=r:i.R=r:this._=r,o&&a?(n=r.C,r.C=t.C,r.L=o,o.U=r,r!==a?(i=r.U,r.U=t.U,t=r.R,i.L=t,r.R=a,a.U=r):(r.U=i,i=r,t=r.R)):(n=t.C,t=r),t&&(t.U=i),!n){if(t&&t.C)return void(t.C=!1);do{if(t===this._)break;if(t===i.L){if(e=i.R,e.C&&(e.C=!1,i.C=!0,an(this,i),e=i.R),e.L&&e.L.C||e.R&&e.R.C){e.R&&e.R.C||(e.L.C=!1,e.C=!0,sn(this,e),e=i.R),e.C=i.C,i.C=e.R.C=!1,an(this,i),t=this._;break}}else if(e=i.L,e.C&&(e.C=!1,i.C=!0,sn(this,i),e=i.L),e.L&&e.L.C||e.R&&e.R.C){e.L&&e.L.C||(e.R.C=!1,e.C=!0,an(this,e),e=i.L),e.C=i.C,i.C=e.L.C=!1,sn(this,i),t=this._;break}e.C=!0,t=i,i=i.U}while(!t.C);t&&(t.C=!1)}}},ua.geom.voronoi=function(t){function e(t){var e=new Array(t.length),n=s[0][0],i=s[0][1],o=s[1][0],a=s[1][1];return cn(r(t),s).cells.forEach(function(r,s){var l=r.edges,c=r.site,u=e[s]=l.length?l.map(function(t){var e=t.start();return[e.x,e.y]}):c.x>=n&&c.x<=o&&c.y>=i&&c.y<=a?[[n,a],[o,a],[o,i],[n,i]]:[];u.point=t[s]}),e}function r(t){return t.map(function(t,e){return{x:Math.round(o(t,e)/Da)*Da,y:Math.round(a(t,e)/Da)*Da,i:e}})}var n=Cr,i=zr,o=n,a=i,s=fl;return t?e(t):(e.links=function(t){return cn(r(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},e.triangles=function(t){var e=[];return cn(r(t)).cells.forEach(function(r,n){for(var i,o,a=r.site,s=r.edges.sort(Yr),l=-1,c=s.length,u=s[c-1].edge,h=u.l===a?u.r:u.l;++l<c;)i=u,o=h,u=s[l].edge,h=u.l===a?u.r:u.l,n<o.i&&n<h.i&&hn(a,o,h)<0&&e.push([t[n],t[o.i],t[h.i]])}),e},e.x=function(t){return arguments.length?(o=Lt(n=t),e):n},e.y=function(t){return arguments.length?(a=Lt(i=t),e):i},e.clipExtent=function(t){return arguments.length?(s=null==t?fl:t,e):s===fl?null:s},e.size=function(t){return arguments.length?e.clipExtent(t&&[[0,0],t]):s===fl?null:s&&s[1]},e)};var fl=[[-1e6,-1e6],[1e6,1e6]];ua.geom.delaunay=function(t){return ua.geom.voronoi().triangles(t)},ua.geom.quadtree=function(t,e,r,n,i){function o(t){function o(t,e,r,n,i,o,a,s){if(!isNaN(r)&&!isNaN(n))if(t.leaf){var l=t.x,u=t.y;if(null!=l)if(wa(l-r)+wa(u-n)<.01)c(t,e,r,n,i,o,a,s);else{var h=t.point;t.x=t.y=t.point=null,c(t,h,l,u,i,o,a,s),c(t,e,r,n,i,o,a,s)}else t.x=r,t.y=n,t.point=e}else c(t,e,r,n,i,o,a,s)}function c(t,e,r,n,i,a,s,l){var c=.5*(i+s),u=.5*(a+l),h=r>=c,f=n>=u,d=f<<1|h;t.leaf=!1,t=t.nodes[d]||(t.nodes[d]=pn()),h?i=c:s=c,f?a=u:l=u,o(t,e,r,n,i,a,s,l)}var u,h,f,d,p,g,v,m,y,b=Lt(s),x=Lt(l);if(null!=e)g=e,v=r,m=n,y=i;else if(m=y=-(g=v=1/0),h=[],f=[],p=t.length,a)for(d=0;p>d;++d)u=t[d],u.x<g&&(g=u.x),u.y<v&&(v=u.y),u.x>m&&(m=u.x),u.y>y&&(y=u.y),h.push(u.x),f.push(u.y);else for(d=0;p>d;++d){var _=+b(u=t[d],d),w=+x(u,d);g>_&&(g=_),v>w&&(v=w),_>m&&(m=_),w>y&&(y=w),h.push(_),f.push(w)}var k=m-g,A=y-v;k>A?y=v+k:m=g+A;var M=pn();if(M.add=function(t){o(M,t,+b(t,++d),+x(t,d),g,v,m,y)},M.visit=function(t){gn(t,M,g,v,m,y)},M.find=function(t){return vn(M,t[0],t[1],g,v,m,y)},d=-1,null==e){for(;++d<p;)o(M,t[d],h[d],f[d],g,v,m,y);--d}else t.forEach(M.add);return h=f=t=u=null,M}var a,s=Cr,l=zr;return(a=arguments.length)?(s=fn,l=dn,3===a&&(i=r,n=e,r=e=0),o(t)):(o.x=function(t){return arguments.length?(s=t,o):s},o.y=function(t){return arguments.length?(l=t,o):l},o.extent=function(t){return arguments.length?(null==t?e=r=n=i=null:(e=+t[0][0],r=+t[0][1],n=+t[1][0],i=+t[1][1]),o):null==e?null:[[e,r],[n,i]]},o.size=function(t){return arguments.length?(null==t?e=r=n=i=null:(e=r=0,n=+t[0],i=+t[1]),o):null==e?null:[n-e,i-r]},o)},ua.interpolateRgb=mn,ua.interpolateObject=yn,ua.interpolateNumber=bn,ua.interpolateString=xn;var dl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,pl=new RegExp(dl.source,"g");ua.interpolate=_n,ua.interpolators=[function(t,e){var r=typeof e;return("string"===r?as.has(e.toLowerCase())||/^(#|rgb\(|hsl\()/i.test(e)?mn:xn:e instanceof lt?mn:Array.isArray(e)?wn:"object"===r&&isNaN(e)?yn:bn)(t,e)}],ua.interpolateArray=wn;var gl=function(){return x},vl=ua.map({linear:gl,poly:Sn,quad:function(){return Tn},cubic:function(){return En},sin:function(){return Cn},exp:function(){return zn},circle:function(){return jn},elastic:Pn,back:In,bounce:function(){return Rn}}),ml=ua.map({"in":x,out:An,"in-out":Mn,"out-in":function(t){return Mn(An(t))}});ua.ease=function(t){var e=t.indexOf("-"),r=e>=0?t.slice(0,e):t,n=e>=0?t.slice(e+1):"in";return r=vl.get(r)||gl,n=ml.get(n)||x,kn(n(r.apply(null,ha.call(arguments,1))))},ua.interpolateHcl=On,ua.interpolateHsl=Nn,ua.interpolateLab=Dn,ua.interpolateRound=Fn,ua.transform=function(t){var e=da.createElementNS(ua.ns.prefix.svg,"g");return(ua.transform=function(t){if(null!=t){e.setAttribute("transform",t);var r=e.transform.baseVal.consolidate()}return new Bn(r?r.matrix:yl)})(t)},Bn.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var yl={a:1,b:0,c:0,d:1,e:0,f:0};ua.interpolateTransform=Zn,ua.layout={},ua.layout.bundle=function(){return function(t){for(var e=[],r=-1,n=t.length;++r<n;)e.push(Kn(t[r]));return e}},ua.layout.chord=function(){function t(){var t,c,h,f,d,p={},g=[],v=ua.range(o),m=[];for(r=[],n=[],t=0,f=-1;++f<o;){for(c=0,d=-1;++d<o;)c+=i[f][d];g.push(c),m.push(ua.range(o)),t+=c}for(a&&v.sort(function(t,e){return a(g[t],g[e])}),s&&m.forEach(function(t,e){t.sort(function(t,r){return s(i[e][t],i[e][r])})}),t=(Ua-u*o)/t,c=0,f=-1;++f<o;){for(h=c,d=-1;++d<o;){var y=v[f],b=m[y][d],x=i[y][b],_=c,w=c+=x*t;p[y+"-"+b]={index:y,subindex:b,startAngle:_,endAngle:w,value:x}}n[y]={index:y,startAngle:h,endAngle:c,value:g[y]},c+=u}for(f=-1;++f<o;)for(d=f-1;++d<o;){var k=p[f+"-"+d],A=p[d+"-"+f];(k.value||A.value)&&r.push(k.value<A.value?{source:A,target:k}:{source:k,target:A})}l&&e()}function e(){r.sort(function(t,e){return l((t.source.value+t.target.value)/2,(e.source.value+e.target.value)/2)})}var r,n,i,o,a,s,l,c={},u=0;return c.matrix=function(t){return arguments.length?(o=(i=t)&&i.length,r=n=null,c):i},c.padding=function(t){return arguments.length?(u=t,r=n=null,c):u},c.sortGroups=function(t){return arguments.length?(a=t,r=n=null,c):a},c.sortSubgroups=function(t){return arguments.length?(s=t,r=null,c):s},c.sortChords=function(t){return arguments.length?(l=t,r&&e(),c):l},c.chords=function(){return r||t(),r},c.groups=function(){return n||t(),n},c},ua.layout.force=function(){function t(t){return function(e,r,n,i){if(e.point!==t){var o=e.cx-t.x,a=e.cy-t.y,s=i-r,l=o*o+a*a;if(l>s*s/m){if(g>l){var c=e.charge/l;t.px-=o*c,t.py-=a*c}return!0}if(e.point&&l&&g>l){var c=e.pointCharge/l;t.px-=o*c,t.py-=a*c}}return!e.charge}}function e(t){t.px=ua.event.x,t.py=ua.event.y,l.resume()}var r,n,i,o,a,s,l={},c=ua.dispatch("start","tick","end"),u=[1,1],h=.9,f=bl,d=xl,p=-30,g=_l,v=.1,m=.64,y=[],b=[];return l.tick=function(){if((i*=.99)<.005)return r=null,c.end({type:"end",alpha:i=0}),!0;var e,n,l,f,d,g,m,x,_,w=y.length,k=b.length;for(n=0;k>n;++n)l=b[n],f=l.source,d=l.target,x=d.x-f.x,_=d.y-f.y,(g=x*x+_*_)&&(g=i*a[n]*((g=Math.sqrt(g))-o[n])/g,x*=g,_*=g,d.x-=x*(m=f.weight+d.weight?f.weight/(f.weight+d.weight):.5),d.y-=_*m,f.x+=x*(m=1-m),f.y+=_*m);if((m=i*v)&&(x=u[0]/2,_=u[1]/2,n=-1,m))for(;++n<w;)l=y[n],l.x+=(x-l.x)*m,l.y+=(_-l.y)*m;if(p)for(oi(e=ua.geom.quadtree(y),i,s),n=-1;++n<w;)(l=y[n]).fixed||e.visit(t(l));for(n=-1;++n<w;)l=y[n],l.fixed?(l.x=l.px,l.y=l.py):(l.x-=(l.px-(l.px=l.x))*h,l.y-=(l.py-(l.py=l.y))*h);c.tick({type:"tick",alpha:i})},l.nodes=function(t){return arguments.length?(y=t,l):y},l.links=function(t){return arguments.length?(b=t,l):b},l.size=function(t){return arguments.length?(u=t,l):u},l.linkDistance=function(t){return arguments.length?(f="function"==typeof t?t:+t,l):f},l.distance=l.linkDistance,l.linkStrength=function(t){return arguments.length?(d="function"==typeof t?t:+t,l):d},l.friction=function(t){return arguments.length?(h=+t,l):h},l.charge=function(t){return arguments.length?(p="function"==typeof t?t:+t,l):p},l.chargeDistance=function(t){return arguments.length?(g=t*t,l):Math.sqrt(g)},l.gravity=function(t){return arguments.length?(v=+t,l):v},l.theta=function(t){return arguments.length?(m=t*t,l):Math.sqrt(m)},l.alpha=function(t){return arguments.length?(t=+t,i?t>0?i=t:(r.c=null,r.t=NaN,r=null,c.end({type:"end",alpha:i=0})):t>0&&(c.start({type:"start",alpha:i=t}),r=Pt(l.tick)),l):i},l.start=function(){function t(t,n){if(!r){for(r=new Array(i),l=0;i>l;++l)r[l]=[];for(l=0;c>l;++l){var o=b[l];r[o.source.index].push(o.target),r[o.target.index].push(o.source)}}for(var a,s=r[e],l=-1,u=s.length;++l<u;)if(!isNaN(a=s[l][t]))return a;return Math.random()*n}var e,r,n,i=y.length,c=b.length,h=u[0],g=u[1];for(e=0;i>e;++e)(n=y[e]).index=e,n.weight=0;for(e=0;c>e;++e)n=b[e],"number"==typeof n.source&&(n.source=y[n.source]),"number"==typeof n.target&&(n.target=y[n.target]),++n.source.weight,++n.target.weight;for(e=0;i>e;++e)n=y[e],isNaN(n.x)&&(n.x=t("x",h)),isNaN(n.y)&&(n.y=t("y",g)),isNaN(n.px)&&(n.px=n.x),isNaN(n.py)&&(n.py=n.y);if(o=[],"function"==typeof f)for(e=0;c>e;++e)o[e]=+f.call(this,b[e],e);else for(e=0;c>e;++e)o[e]=f;if(a=[],"function"==typeof d)for(e=0;c>e;++e)a[e]=+d.call(this,b[e],e);else for(e=0;c>e;++e)a[e]=d;if(s=[],"function"==typeof p)for(e=0;i>e;++e)s[e]=+p.call(this,y[e],e);else for(e=0;i>e;++e)s[e]=p;return l.resume()},l.resume=function(){return l.alpha(.1)},l.stop=function(){return l.alpha(0)},l.drag=function(){return n||(n=ua.behavior.drag().origin(x).on("dragstart.force",ei).on("drag.force",e).on("dragend.force",ri)),arguments.length?void this.on("mouseover.force",ni).on("mouseout.force",ii).call(n):n},ua.rebind(l,c,"on")};var bl=20,xl=1,_l=1/0;ua.layout.hierarchy=function(){function t(i){var o,a=[i],s=[];for(i.depth=0;null!=(o=a.pop());)if(s.push(o),(c=r.call(t,o,o.depth))&&(l=c.length)){for(var l,c,u;--l>=0;)a.push(u=c[l]),u.parent=o,u.depth=o.depth+1;n&&(o.value=0),o.children=c}else n&&(o.value=+n.call(t,o,o.depth)||0),delete o.children;return li(i,function(t){var r,i;e&&(r=t.children)&&r.sort(e),n&&(i=t.parent)&&(i.value+=t.value)}),s}var e=hi,r=ci,n=ui;return t.sort=function(r){return arguments.length?(e=r,t):e},t.children=function(e){return arguments.length?(r=e,t):r},t.value=function(e){return arguments.length?(n=e,t):n},t.revalue=function(e){return n&&(si(e,function(t){t.children&&(t.value=0)}),li(e,function(e){var r;e.children||(e.value=+n.call(t,e,e.depth)||0),(r=e.parent)&&(r.value+=e.value)})),e},t},ua.layout.partition=function(){function t(e,r,n,i){var o=e.children;if(e.x=r,e.y=e.depth*i,e.dx=n,e.dy=i,o&&(a=o.length)){var a,s,l,c=-1;for(n=e.value?n/e.value:0;++c<a;)t(s=o[c],r,l=s.value*n,i),r+=l}}function e(t){var r=t.children,n=0;if(r&&(i=r.length))for(var i,o=-1;++o<i;)n=Math.max(n,e(r[o]));return 1+n}function r(r,o){var a=n.call(this,r,o);return t(a[0],0,i[0],i[1]/e(a[0])),a}var n=ua.layout.hierarchy(),i=[1,1];return r.size=function(t){return arguments.length?(i=t,r):i},ai(r,n)},ua.layout.pie=function(){function t(a){var s,l=a.length,c=a.map(function(r,n){return+e.call(t,r,n)}),u=+("function"==typeof n?n.apply(this,arguments):n),h=("function"==typeof i?i.apply(this,arguments):i)-u,f=Math.min(Math.abs(h)/l,+("function"==typeof o?o.apply(this,arguments):o)),d=f*(0>h?-1:1),p=ua.sum(c),g=p?(h-l*d)/p:0,v=ua.range(l),m=[];return null!=r&&v.sort(r===wl?function(t,e){return c[e]-c[t]}:function(t,e){return r(a[t],a[e])}),v.forEach(function(t){m[t]={data:a[t],value:s=c[t],startAngle:u,endAngle:u+=s*g+d,padAngle:f}}),m}var e=Number,r=wl,n=0,i=Ua,o=0;return t.value=function(r){return arguments.length?(e=r,t):e},t.sort=function(e){return arguments.length?(r=e,t):r},t.startAngle=function(e){return arguments.length?(n=e,t):n},t.endAngle=function(e){return arguments.length?(i=e,t):i},t.padAngle=function(e){return arguments.length?(o=e,t):o},t};var wl={};ua.layout.stack=function(){function t(s,l){if(!(f=s.length))return s;var c=s.map(function(r,n){return e.call(t,r,n)}),u=c.map(function(e){return e.map(function(e,r){return[o.call(t,e,r),a.call(t,e,r)]})}),h=r.call(t,u,l);c=ua.permute(c,h),u=ua.permute(u,h);var f,d,p,g,v=n.call(t,u,l),m=c[0].length;for(p=0;m>p;++p)for(i.call(t,c[0][p],g=v[p],u[0][p][1]),d=1;f>d;++d)i.call(t,c[d][p],g+=u[d-1][p][1],u[d][p][1]);return s}var e=x,r=vi,n=mi,i=gi,o=di,a=pi;return t.values=function(r){return arguments.length?(e=r,t):e},t.order=function(e){return arguments.length?(r="function"==typeof e?e:kl.get(e)||vi,t):r},t.offset=function(e){return arguments.length?(n="function"==typeof e?e:Al.get(e)||mi,t):n},t.x=function(e){return arguments.length?(o=e,t):o},t.y=function(e){return arguments.length?(a=e,t):a},t.out=function(e){return arguments.length?(i=e,t):i},t};var kl=ua.map({"inside-out":function(t){var e,r,n=t.length,i=t.map(yi),o=t.map(bi),a=ua.range(n).sort(function(t,e){return i[t]-i[e]}),s=0,l=0,c=[],u=[];for(e=0;n>e;++e)r=a[e],l>s?(s+=o[r],c.push(r)):(l+=o[r],u.push(r));return u.reverse().concat(c)},reverse:function(t){return ua.range(t.length).reverse()},"default":vi}),Al=ua.map({silhouette:function(t){var e,r,n,i=t.length,o=t[0].length,a=[],s=0,l=[];for(r=0;o>r;++r){for(e=0,n=0;i>e;e++)n+=t[e][r][1];n>s&&(s=n),a.push(n)}for(r=0;o>r;++r)l[r]=(s-a[r])/2;return l},wiggle:function(t){var e,r,n,i,o,a,s,l,c,u=t.length,h=t[0],f=h.length,d=[];for(d[0]=l=c=0,r=1;f>r;++r){for(e=0,i=0;u>e;++e)i+=t[e][r][1];for(e=0,o=0,s=h[r][0]-h[r-1][0];u>e;++e){for(n=0,a=(t[e][r][1]-t[e][r-1][1])/(2*s);e>n;++n)a+=(t[n][r][1]-t[n][r-1][1])/s;o+=a*t[e][r][1]}d[r]=l-=i?o/i*s:0,c>l&&(c=l)}for(r=0;f>r;++r)d[r]-=c;return d},expand:function(t){var e,r,n,i=t.length,o=t[0].length,a=1/i,s=[];for(r=0;o>r;++r){for(e=0,n=0;i>e;e++)n+=t[e][r][1];if(n)for(e=0;i>e;e++)t[e][r][1]/=n;else for(e=0;i>e;e++)t[e][r][1]=a}for(r=0;o>r;++r)s[r]=0;return s},zero:mi});ua.layout.histogram=function(){function t(t,o){for(var a,s,l=[],c=t.map(r,this),u=n.call(this,c,o),h=i.call(this,u,c,o),o=-1,f=c.length,d=h.length-1,p=e?1:1/f;++o<d;)a=l[o]=[],a.dx=h[o+1]-(a.x=h[o]),a.y=0;if(d>0)for(o=-1;++o<f;)s=c[o],s>=u[0]&&s<=u[1]&&(a=l[ua.bisect(h,s,1,d)-1],a.y+=p,a.push(t[o]));return l}var e=!0,r=Number,n=ki,i=_i;return t.value=function(e){return arguments.length?(r=e,t):r},t.range=function(e){return arguments.length?(n=Lt(e),t):n},t.bins=function(e){return arguments.length?(i="number"==typeof e?function(t){return wi(t,e)}:Lt(e),t):i},t.frequency=function(r){return arguments.length?(e=!!r,t):e},t},ua.layout.pack=function(){function t(t,o){var a=r.call(this,t,o),s=a[0],l=i[0],c=i[1],u=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,li(s,function(t){t.r=+u(t.value)}),li(s,Li),n){var h=n*(e?1:Math.max(2*s.r/l,2*s.r/c))/2;li(s,function(t){t.r+=h}),li(s,Li),li(s,function(t){t.r-=h})}return zi(s,l/2,c/2,e?1:1/Math.max(2*s.r/l,2*s.r/c)),a}var e,r=ua.layout.hierarchy().sort(Ai),n=0,i=[1,1];return t.size=function(e){return arguments.length?(i=e,t):i},t.radius=function(r){return arguments.length?(e=null==r||"function"==typeof r?r:+r,t):e},t.padding=function(e){return arguments.length?(n=+e,t):n},ai(t,r)},ua.layout.tree=function(){function t(t,i){var u=a.call(this,t,i),h=u[0],f=e(h);if(li(f,r),f.parent.m=-f.z,si(f,n),c)si(h,o);else{var d=h,p=h,g=h;si(h,function(t){t.x<d.x&&(d=t),t.x>p.x&&(p=t),t.depth>g.depth&&(g=t)});var v=s(d,p)/2-d.x,m=l[0]/(p.x+s(p,d)/2+v),y=l[1]/(g.depth||1);si(h,function(t){t.x=(t.x+v)*m,t.y=t.depth*y})}return u}function e(t){for(var e,r={A:null,children:[t]},n=[r];null!=(e=n.pop());)for(var i,o=e.children,a=0,s=o.length;s>a;++a)n.push((o[a]=i={_:o[a],parent:e,children:(i=o[a].children)&&i.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:a}).a=i);return r.children[0]}function r(t){var e=t.children,r=t.parent.children,n=t.i?r[t.i-1]:null;if(e.length){Ni(t);var o=(e[0].z+e[e.length-1].z)/2;n?(t.z=n.z+s(t._,n._),t.m=t.z-o):t.z=o}else n&&(t.z=n.z+s(t._,n._));t.parent.A=i(t,n,t.parent.A||r[0])}function n(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function i(t,e,r){if(e){for(var n,i=t,o=t,a=e,l=i.parent.children[0],c=i.m,u=o.m,h=a.m,f=l.m;a=Ri(a),i=Ii(i),a&&i;)l=Ii(l),o=Ri(o),o.a=t,n=a.z+h-i.z-c+s(a._,i._),n>0&&(Oi(Di(a,t,r),t,n),c+=n,u+=n),h+=a.m,c+=i.m,f+=l.m,u+=o.m;a&&!Ri(o)&&(o.t=a,o.m+=h-u),i&&!Ii(l)&&(l.t=i,l.m+=c-f,r=t)}return r}function o(t){t.x*=l[0],t.y=t.depth*l[1]}var a=ua.layout.hierarchy().sort(null).value(null),s=Pi,l=[1,1],c=null;return t.separation=function(e){return arguments.length?(s=e,t):s},t.size=function(e){return arguments.length?(c=null==(l=e)?o:null,t):c?null:l},t.nodeSize=function(e){return arguments.length?(c=null==(l=e)?null:o,t):c?l:null},ai(t,a)},ua.layout.cluster=function(){function t(t,o){var a,s=e.call(this,t,o),l=s[0],c=0;li(l,function(t){var e=t.children;e&&e.length?(t.x=Bi(e),t.y=Fi(e)):(t.x=a?c+=r(t,a):0,t.y=0,a=t)});var u=Ui(l),h=Vi(l),f=u.x-r(u,h)/2,d=h.x+r(h,u)/2;return li(l,i?function(t){t.x=(t.x-l.x)*n[0],t.y=(l.y-t.y)*n[1]}:function(t){t.x=(t.x-f)/(d-f)*n[0],t.y=(1-(l.y?t.y/l.y:1))*n[1]}),s}var e=ua.layout.hierarchy().sort(null).value(null),r=Pi,n=[1,1],i=!1;return t.separation=function(e){return arguments.length?(r=e,t):r},t.size=function(e){return arguments.length?(i=null==(n=e),t):i?null:n},t.nodeSize=function(e){return arguments.length?(i=null!=(n=e),t):i?n:null},ai(t,e)},ua.layout.treemap=function(){function t(t,e){for(var r,n,i=-1,o=t.length;++i<o;)n=(r=t[i]).value*(0>e?0:e),r.area=isNaN(n)||0>=n?0:n}function e(r){var o=r.children;if(o&&o.length){var a,s,l,c=h(r),u=[],f=o.slice(),p=1/0,g="slice"===d?c.dx:"dice"===d?c.dy:"slice-dice"===d?1&r.depth?c.dy:c.dx:Math.min(c.dx,c.dy);for(t(f,c.dx*c.dy/r.value),u.area=0;(l=f.length)>0;)u.push(a=f[l-1]),u.area+=a.area,"squarify"!==d||(s=n(u,g))<=p?(f.pop(),p=s):(u.area-=u.pop().area,i(u,g,c,!1),g=Math.min(c.dx,c.dy),u.length=u.area=0,p=1/0);u.length&&(i(u,g,c,!0),u.length=u.area=0),o.forEach(e)}}function r(e){var n=e.children;if(n&&n.length){var o,a=h(e),s=n.slice(),l=[];for(t(s,a.dx*a.dy/e.value),l.area=0;o=s.pop();)l.push(o),l.area+=o.area,null!=o.z&&(i(l,o.z?a.dx:a.dy,a,!s.length),l.length=l.area=0);n.forEach(r)}}function n(t,e){for(var r,n=t.area,i=0,o=1/0,a=-1,s=t.length;++a<s;)(r=t[a].area)&&(o>r&&(o=r),r>i&&(i=r));return n*=n,e*=e,n?Math.max(e*i*p/n,n/(e*o*p)):1/0}function i(t,e,r,n){var i,o=-1,a=t.length,s=r.x,c=r.y,u=e?l(t.area/e):0;if(e==r.dx){for((n||u>r.dy)&&(u=r.dy);++o<a;)i=t[o],i.x=s,i.y=c,i.dy=u,s+=i.dx=Math.min(r.x+r.dx-s,u?l(i.area/u):0);i.z=!0,i.dx+=r.x+r.dx-s,r.y+=u,r.dy-=u}else{for((n||u>r.dx)&&(u=r.dx);++o<a;)i=t[o],i.x=s,i.y=c,i.dx=u,c+=i.dy=Math.min(r.y+r.dy-c,u?l(i.area/u):0);i.z=!1,i.dy+=r.y+r.dy-c,r.x+=u,r.dx-=u}}function o(n){var i=a||s(n),o=i[0];return o.x=o.y=0,o.value?(o.dx=c[0],o.dy=c[1]):o.dx=o.dy=0,a&&s.revalue(o),t([o],o.dx*o.dy/o.value),(a?r:e)(o),f&&(a=i),i}var a,s=ua.layout.hierarchy(),l=Math.round,c=[1,1],u=null,h=qi,f=!1,d="squarify",p=.5*(1+Math.sqrt(5));return o.size=function(t){return arguments.length?(c=t,o):c},o.padding=function(t){function e(e){var r=t.call(o,e,e.depth);return null==r?qi(e):Hi(e,"number"==typeof r?[r,r,r,r]:r)}function r(e){return Hi(e,t)}if(!arguments.length)return u;var n;return h=null==(u=t)?qi:"function"==(n=typeof t)?e:"number"===n?(t=[t,t,t,t],r):r,o},o.round=function(t){return arguments.length?(l=t?Math.round:Number,o):l!=Number},o.sticky=function(t){return arguments.length?(f=t,a=null,o):f},o.ratio=function(t){return arguments.length?(p=t,o):p},o.mode=function(t){return arguments.length?(d=t+"",o):d},ai(o,s)},ua.random={normal:function(t,e){var r=arguments.length;return 2>r&&(e=1),1>r&&(t=0),function(){var r,n,i;do r=2*Math.random()-1,n=2*Math.random()-1,i=r*r+n*n;while(!i||i>1);return t+e*r*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=ua.random.normal.apply(ua,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=ua.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,r=0;t>r;r++)e+=Math.random();return e}}},ua.scale={};var Ml={floor:x,ceil:x};ua.scale.linear=function(){return $i([0,1],[0,1],_n,!1)};var Tl={s:1,g:1,p:1,r:1,e:1};ua.scale.log=function(){return oo(ua.scale.linear().domain([0,1]),10,!0,[1,10])};var El=ua.format(".0e"),Ll={floor:function(t){return-Math.ceil(-t)},ceil:function(t){return-Math.floor(-t)}};ua.scale.pow=function(){return ao(ua.scale.linear(),1,[0,1])},ua.scale.sqrt=function(){return ua.scale.pow().exponent(.5)},ua.scale.ordinal=function(){return lo([],{t:"range",a:[[]]})},ua.scale.category10=function(){return ua.scale.ordinal().range(Sl)},ua.scale.category20=function(){return ua.scale.ordinal().range(Cl)},ua.scale.category20b=function(){return ua.scale.ordinal().range(zl)},ua.scale.category20c=function(){return ua.scale.ordinal().range(jl)};var Sl=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(_t),Cl=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(_t),zl=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(_t),jl=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(_t);ua.scale.quantile=function(){return co([],[])},ua.scale.quantize=function(){return uo(0,1,[0,1])},ua.scale.threshold=function(){return ho([.5],[0,1])},ua.scale.identity=function(){return fo([0,1])},ua.svg={},ua.svg.arc=function(){function t(){var t=Math.max(0,+r.apply(this,arguments)),c=Math.max(0,+n.apply(this,arguments)),u=a.apply(this,arguments)-qa,h=s.apply(this,arguments)-qa,f=Math.abs(h-u),d=u>h?0:1;if(t>c&&(p=c,c=t,t=p),f>=Va)return e(c,d)+(t?e(t,1-d):"")+"Z";var p,g,v,m,y,b,x,_,w,k,A,M,T=0,E=0,L=[];if((m=(+l.apply(this,arguments)||0)/2)&&(v=o===Pl?Math.sqrt(t*t+c*c):+o.apply(this,arguments),d||(E*=-1),c&&(E=nt(v/c*Math.sin(m))),t&&(T=nt(v/t*Math.sin(m)))),c){y=c*Math.cos(u+E),b=c*Math.sin(u+E),x=c*Math.cos(h-E),_=c*Math.sin(h-E);var S=Math.abs(h-u-2*E)<=Ba?0:1;if(E&&xo(y,b,x,_)===d^S){var C=(u+h)/2;y=c*Math.cos(C),b=c*Math.sin(C),x=_=null}}else y=b=0;if(t){w=t*Math.cos(h-T),k=t*Math.sin(h-T),A=t*Math.cos(u+T),M=t*Math.sin(u+T);var z=Math.abs(u-h+2*T)<=Ba?0:1;if(T&&xo(w,k,A,M)===1-d^z){var j=(u+h)/2;w=t*Math.cos(j),k=t*Math.sin(j),A=M=null}}else w=k=0;if(f>Da&&(p=Math.min(Math.abs(c-t)/2,+i.apply(this,arguments)))>.001){g=c>t^d?0:1;var P=p,I=p;if(Ba>f){var R=null==A?[w,k]:null==x?[y,b]:Rr([y,b],[A,M],[x,_],[w,k]),O=y-R[0],N=b-R[1],D=x-R[0],F=_-R[1],B=1/Math.sin(Math.acos((O*D+N*F)/(Math.sqrt(O*O+N*N)*Math.sqrt(D*D+F*F)))/2),U=Math.sqrt(R[0]*R[0]+R[1]*R[1]);I=Math.min(p,(t-U)/(B-1)),P=Math.min(p,(c-U)/(B+1))}if(null!=x){var V=_o(null==A?[w,k]:[A,M],[y,b],c,P,d),q=_o([x,_],[w,k],c,P,d);p===P?L.push("M",V[0],"A",P,",",P," 0 0,",g," ",V[1],"A",c,",",c," 0 ",1-d^xo(V[1][0],V[1][1],q[1][0],q[1][1]),",",d," ",q[1],"A",P,",",P," 0 0,",g," ",q[0]):L.push("M",V[0],"A",P,",",P," 0 1,",g," ",q[0])}else L.push("M",y,",",b);if(null!=A){var H=_o([y,b],[A,M],t,-I,d),G=_o([w,k],null==x?[y,b]:[x,_],t,-I,d);p===I?L.push("L",G[0],"A",I,",",I," 0 0,",g," ",G[1],"A",t,",",t," 0 ",d^xo(G[1][0],G[1][1],H[1][0],H[1][1]),",",1-d," ",H[1],"A",I,",",I," 0 0,",g," ",H[0]):L.push("L",G[0],"A",I,",",I," 0 0,",g," ",H[0])}else L.push("L",w,",",k)}else L.push("M",y,",",b),null!=x&&L.push("A",c,",",c," 0 ",S,",",d," ",x,",",_),L.push("L",w,",",k),null!=A&&L.push("A",t,",",t," 0 ",z,",",1-d," ",A,",",M);return L.push("Z"),L.join("")}function e(t,e){return"M0,"+t+"A"+t+","+t+" 0 1,"+e+" 0,"+-t+"A"+t+","+t+" 0 1,"+e+" 0,"+t}var r=go,n=vo,i=po,o=Pl,a=mo,s=yo,l=bo;return t.innerRadius=function(e){return arguments.length?(r=Lt(e),t):r},t.outerRadius=function(e){return arguments.length?(n=Lt(e),
t):n},t.cornerRadius=function(e){return arguments.length?(i=Lt(e),t):i},t.padRadius=function(e){return arguments.length?(o=e==Pl?Pl:Lt(e),t):o},t.startAngle=function(e){return arguments.length?(a=Lt(e),t):a},t.endAngle=function(e){return arguments.length?(s=Lt(e),t):s},t.padAngle=function(e){return arguments.length?(l=Lt(e),t):l},t.centroid=function(){var t=(+r.apply(this,arguments)+ +n.apply(this,arguments))/2,e=(+a.apply(this,arguments)+ +s.apply(this,arguments))/2-qa;return[Math.cos(e)*t,Math.sin(e)*t]},t};var Pl="auto";ua.svg.line=function(){return wo(x)};var Il=ua.map({linear:ko,"linear-closed":Ao,step:Mo,"step-before":To,"step-after":Eo,basis:Po,"basis-open":Io,"basis-closed":Ro,bundle:Oo,cardinal:Co,"cardinal-open":Lo,"cardinal-closed":So,monotone:Vo});Il.forEach(function(t,e){e.key=t,e.closed=/-closed$/.test(t)});var Rl=[0,2/3,1/3,0],Ol=[0,1/3,2/3,0],Nl=[0,1/6,2/3,1/6];ua.svg.line.radial=function(){var t=wo(qo);return t.radius=t.x,delete t.x,t.angle=t.y,delete t.y,t},To.reverse=Eo,Eo.reverse=To,ua.svg.area=function(){return Ho(x)},ua.svg.area.radial=function(){var t=Ho(qo);return t.radius=t.x,delete t.x,t.innerRadius=t.x0,delete t.x0,t.outerRadius=t.x1,delete t.x1,t.angle=t.y,delete t.y,t.startAngle=t.y0,delete t.y0,t.endAngle=t.y1,delete t.y1,t},ua.svg.chord=function(){function t(t,s){var l=e(this,o,t,s),c=e(this,a,t,s);return"M"+l.p0+n(l.r,l.p1,l.a1-l.a0)+(r(l,c)?i(l.r,l.p1,l.r,l.p0):i(l.r,l.p1,c.r,c.p0)+n(c.r,c.p1,c.a1-c.a0)+i(c.r,c.p1,l.r,l.p0))+"Z"}function e(t,e,r,n){var i=e.call(t,r,n),o=s.call(t,i,n),a=l.call(t,i,n)-qa,u=c.call(t,i,n)-qa;return{r:o,a0:a,a1:u,p0:[o*Math.cos(a),o*Math.sin(a)],p1:[o*Math.cos(u),o*Math.sin(u)]}}function r(t,e){return t.a0==e.a0&&t.a1==e.a1}function n(t,e,r){return"A"+t+","+t+" 0 "+ +(r>Ba)+",1 "+e}function i(t,e,r,n){return"Q 0,0 "+n}var o=xr,a=_r,s=Go,l=mo,c=yo;return t.radius=function(e){return arguments.length?(s=Lt(e),t):s},t.source=function(e){return arguments.length?(o=Lt(e),t):o},t.target=function(e){return arguments.length?(a=Lt(e),t):a},t.startAngle=function(e){return arguments.length?(l=Lt(e),t):l},t.endAngle=function(e){return arguments.length?(c=Lt(e),t):c},t},ua.svg.diagonal=function(){function t(t,i){var o=e.call(this,t,i),a=r.call(this,t,i),s=(o.y+a.y)/2,l=[o,{x:o.x,y:s},{x:a.x,y:s},a];return l=l.map(n),"M"+l[0]+"C"+l[1]+" "+l[2]+" "+l[3]}var e=xr,r=_r,n=Yo;return t.source=function(r){return arguments.length?(e=Lt(r),t):e},t.target=function(e){return arguments.length?(r=Lt(e),t):r},t.projection=function(e){return arguments.length?(n=e,t):n},t},ua.svg.diagonal.radial=function(){var t=ua.svg.diagonal(),e=Yo,r=t.projection;return t.projection=function(t){return arguments.length?r(Xo(e=t)):e},t},ua.svg.symbol=function(){function t(t,n){return(Dl.get(e.call(this,t,n))||Qo)(r.call(this,t,n))}var e=Zo,r=Wo;return t.type=function(r){return arguments.length?(e=Lt(r),t):e},t.size=function(e){return arguments.length?(r=Lt(e),t):r},t};var Dl=ua.map({circle:Qo,cross:function(t){var e=Math.sqrt(t/5)/2;return"M"+-3*e+","+-e+"H"+-e+"V"+-3*e+"H"+e+"V"+-e+"H"+3*e+"V"+e+"H"+e+"V"+3*e+"H"+-e+"V"+e+"H"+-3*e+"Z"},diamond:function(t){var e=Math.sqrt(t/(2*Bl)),r=e*Bl;return"M0,"+-e+"L"+r+",0 0,"+e+" "+-r+",0Z"},square:function(t){var e=Math.sqrt(t)/2;return"M"+-e+","+-e+"L"+e+","+-e+" "+e+","+e+" "+-e+","+e+"Z"},"triangle-down":function(t){var e=Math.sqrt(t/Fl),r=e*Fl/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Fl),r=e*Fl/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});ua.svg.symbolTypes=Dl.keys();var Fl=Math.sqrt(3),Bl=Math.tan(30*Ha);za.transition=function(t){for(var e,r,n=Ul||++Gl,i=ea(t),o=[],a=Vl||{time:Date.now(),ease:Ln,delay:0,duration:250},s=-1,l=this.length;++s<l;){o.push(e=[]);for(var c=this[s],u=-1,h=c.length;++u<h;)(r=c[u])&&ra(r,u,i,n,a),e.push(r)}return Ko(o,i,n)},za.interrupt=function(t){return this.each(null==t?ql:$o(ea(t)))};var Ul,Vl,ql=$o(ea()),Hl=[],Gl=0;Hl.call=za.call,Hl.empty=za.empty,Hl.node=za.node,Hl.size=za.size,ua.transition=function(t,e){return t&&t.transition?Ul?t.transition(e):t:ua.selection().transition(t)},ua.transition.prototype=Hl,Hl.select=function(t){var e,r,n,i=this.id,o=this.namespace,a=[];t=C(t);for(var s=-1,l=this.length;++s<l;){a.push(e=[]);for(var c=this[s],u=-1,h=c.length;++u<h;)(n=c[u])&&(r=t.call(n,n.__data__,u,s))?("__data__"in n&&(r.__data__=n.__data__),ra(r,u,o,i,n[o][i]),e.push(r)):e.push(null)}return Ko(a,o,i)},Hl.selectAll=function(t){var e,r,n,i,o,a=this.id,s=this.namespace,l=[];t=z(t);for(var c=-1,u=this.length;++c<u;)for(var h=this[c],f=-1,d=h.length;++f<d;)if(n=h[f]){o=n[s][a],r=t.call(n,n.__data__,f,c),l.push(e=[]);for(var p=-1,g=r.length;++p<g;)(i=r[p])&&ra(i,p,s,a,o),e.push(i)}return Ko(l,s,a)},Hl.filter=function(t){var e,r,n,i=[];"function"!=typeof t&&(t=q(t));for(var o=0,a=this.length;a>o;o++){i.push(e=[]);for(var r=this[o],s=0,l=r.length;l>s;s++)(n=r[s])&&t.call(n,n.__data__,s,o)&&e.push(n)}return Ko(i,this.namespace,this.id)},Hl.tween=function(t,e){var r=this.id,n=this.namespace;return arguments.length<2?this.node()[n][r].tween.get(t):G(this,null==e?function(e){e[n][r].tween.remove(t)}:function(i){i[n][r].tween.set(t,e)})},Hl.attr=function(t,e){function r(){this.removeAttribute(s)}function n(){this.removeAttributeNS(s.space,s.local)}function i(t){return null==t?r:(t+="",function(){var e,r=this.getAttribute(s);return r!==t&&(e=a(r,t),function(t){this.setAttribute(s,e(t))})})}function o(t){return null==t?n:(t+="",function(){var e,r=this.getAttributeNS(s.space,s.local);return r!==t&&(e=a(r,t),function(t){this.setAttributeNS(s.space,s.local,e(t))})})}if(arguments.length<2){for(e in t)this.attr(e,t[e]);return this}var a="transform"==t?Zn:_n,s=ua.ns.qualify(t);return Jo(this,"attr."+t,e,s.local?o:i)},Hl.attrTween=function(t,e){function r(t,r){var n=e.call(this,t,r,this.getAttribute(i));return n&&function(t){this.setAttribute(i,n(t))}}function n(t,r){var n=e.call(this,t,r,this.getAttributeNS(i.space,i.local));return n&&function(t){this.setAttributeNS(i.space,i.local,n(t))}}var i=ua.ns.qualify(t);return this.tween("attr."+t,i.local?n:r)},Hl.style=function(t,e,r){function i(){this.style.removeProperty(t)}function o(e){return null==e?i:(e+="",function(){var i,o=n(this).getComputedStyle(this,null).getPropertyValue(t);return o!==e&&(i=_n(o,e),function(e){this.style.setProperty(t,i(e),r)})})}var a=arguments.length;if(3>a){if("string"!=typeof t){2>a&&(e="");for(r in t)this.style(r,t[r],e);return this}r=""}return Jo(this,"style."+t,e,o)},Hl.styleTween=function(t,e,r){function i(i,o){var a=e.call(this,i,o,n(this).getComputedStyle(this,null).getPropertyValue(t));return a&&function(e){this.style.setProperty(t,a(e),r)}}return arguments.length<3&&(r=""),this.tween("style."+t,i)},Hl.text=function(t){return Jo(this,"text",t,ta)},Hl.remove=function(){var t=this.namespace;return this.each("end.transition",function(){var e;this[t].count<2&&(e=this.parentNode)&&e.removeChild(this)})},Hl.ease=function(t){var e=this.id,r=this.namespace;return arguments.length<1?this.node()[r][e].ease:("function"!=typeof t&&(t=ua.ease.apply(ua,arguments)),G(this,function(n){n[r][e].ease=t}))},Hl.delay=function(t){var e=this.id,r=this.namespace;return arguments.length<1?this.node()[r][e].delay:G(this,"function"==typeof t?function(n,i,o){n[r][e].delay=+t.call(n,n.__data__,i,o)}:(t=+t,function(n){n[r][e].delay=t}))},Hl.duration=function(t){var e=this.id,r=this.namespace;return arguments.length<1?this.node()[r][e].duration:G(this,"function"==typeof t?function(n,i,o){n[r][e].duration=Math.max(1,t.call(n,n.__data__,i,o))}:(t=Math.max(1,t),function(n){n[r][e].duration=t}))},Hl.each=function(t,e){var r=this.id,n=this.namespace;if(arguments.length<2){var i=Vl,o=Ul;try{Ul=r,G(this,function(e,i,o){Vl=e[n][r],t.call(e,e.__data__,i,o)})}finally{Vl=i,Ul=o}}else G(this,function(i){var o=i[n][r];(o.event||(o.event=ua.dispatch("start","end","interrupt"))).on(t,e)});return this},Hl.transition=function(){for(var t,e,r,n,i=this.id,o=++Gl,a=this.namespace,s=[],l=0,c=this.length;c>l;l++){s.push(t=[]);for(var e=this[l],u=0,h=e.length;h>u;u++)(r=e[u])&&(n=r[a][i],ra(r,u,a,o,{time:n.time,ease:n.ease,delay:n.delay+n.duration,duration:n.duration})),t.push(r)}return Ko(s,a,o)},ua.svg.axis=function(){function t(t){t.each(function(){var t,c=ua.select(this),u=this.__chart__||r,h=this.__chart__=r.copy(),f=null==l?h.ticks?h.ticks.apply(h,s):h.domain():l,d=null==e?h.tickFormat?h.tickFormat.apply(h,s):x:e,p=c.selectAll(".tick").data(f,h),g=p.enter().insert("g",".domain").attr("class","tick").style("opacity",Da),v=ua.transition(p.exit()).style("opacity",Da).remove(),m=ua.transition(p.order()).style("opacity",1),y=Math.max(i,0)+a,b=Yi(h),_=c.selectAll(".domain").data([0]),w=(_.enter().append("path").attr("class","domain"),ua.transition(_));g.append("line"),g.append("text");var k,A,M,T,E=g.select("line"),L=m.select("line"),S=p.select("text").text(d),C=g.select("text"),z=m.select("text"),j="top"===n||"left"===n?-1:1;if("bottom"===n||"top"===n?(t=na,k="x",M="y",A="x2",T="y2",S.attr("dy",0>j?"0em":".71em").style("text-anchor","middle"),w.attr("d","M"+b[0]+","+j*o+"V0H"+b[1]+"V"+j*o)):(t=ia,k="y",M="x",A="y2",T="x2",S.attr("dy",".32em").style("text-anchor",0>j?"end":"start"),w.attr("d","M"+j*o+","+b[0]+"H0V"+b[1]+"H"+j*o)),E.attr(T,j*i),C.attr(M,j*y),L.attr(A,0).attr(T,j*i),z.attr(k,0).attr(M,j*y),h.rangeBand){var P=h,I=P.rangeBand()/2;u=h=function(t){return P(t)+I}}else u.rangeBand?u=h:v.call(t,h,u);g.call(t,u,h),m.call(t,h,h)})}var e,r=ua.scale.linear(),n=Yl,i=6,o=6,a=3,s=[10],l=null;return t.scale=function(e){return arguments.length?(r=e,t):r},t.orient=function(e){return arguments.length?(n=e in Xl?e+"":Yl,t):n},t.ticks=function(){return arguments.length?(s=fa(arguments),t):s},t.tickValues=function(e){return arguments.length?(l=e,t):l},t.tickFormat=function(r){return arguments.length?(e=r,t):e},t.tickSize=function(e){var r=arguments.length;return r?(i=+e,o=+arguments[r-1],t):i},t.innerTickSize=function(e){return arguments.length?(i=+e,t):i},t.outerTickSize=function(e){return arguments.length?(o=+e,t):o},t.tickPadding=function(e){return arguments.length?(a=+e,t):a},t.tickSubdivide=function(){return arguments.length&&t},t};var Yl="bottom",Xl={top:1,right:1,bottom:1,left:1};ua.svg.brush=function(){function t(n){n.each(function(){var n=ua.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",o).on("touchstart.brush",o),a=n.selectAll(".background").data([0]);a.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),n.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var s=n.selectAll(".resize").data(g,x);s.exit().remove(),s.enter().append("g").attr("class",function(t){return"resize "+t}).style("cursor",function(t){return Wl[t]}).append("rect").attr("x",function(t){return/[ew]$/.test(t)?-3:null}).attr("y",function(t){return/^[ns]/.test(t)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),s.style("display",t.empty()?"none":null);var l,h=ua.transition(n),f=ua.transition(a);c&&(l=Yi(c),f.attr("x",l[0]).attr("width",l[1]-l[0]),r(h)),u&&(l=Yi(u),f.attr("y",l[0]).attr("height",l[1]-l[0]),i(h)),e(h)})}function e(t){t.selectAll(".resize").attr("transform",function(t){return"translate("+h[+/e$/.test(t)]+","+f[+/^s/.test(t)]+")"})}function r(t){t.select(".extent").attr("x",h[0]),t.selectAll(".extent,.n>rect,.s>rect").attr("width",h[1]-h[0])}function i(t){t.select(".extent").attr("y",f[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",f[1]-f[0])}function o(){function o(){32==ua.event.keyCode&&(S||(b=null,z[0]-=h[1],z[1]-=f[1],S=2),T())}function g(){32==ua.event.keyCode&&2==S&&(z[0]+=h[1],z[1]+=f[1],S=0,T())}function v(){var t=ua.mouse(_),n=!1;x&&(t[0]+=x[0],t[1]+=x[1]),S||(ua.event.altKey?(b||(b=[(h[0]+h[1])/2,(f[0]+f[1])/2]),z[0]=h[+(t[0]<b[0])],z[1]=f[+(t[1]<b[1])]):b=null),E&&m(t,c,0)&&(r(A),n=!0),L&&m(t,u,1)&&(i(A),n=!0),n&&(e(A),k({type:"brush",mode:S?"move":"resize"}))}function m(t,e,r){var n,i,o=Yi(e),l=o[0],c=o[1],u=z[r],g=r?f:h,v=g[1]-g[0];return S&&(l-=u,c-=v+u),n=(r?p:d)?Math.max(l,Math.min(c,t[r])):t[r],S?i=(n+=u)+v:(b&&(u=Math.max(l,Math.min(c,2*b[r]-n))),n>u?(i=n,n=u):i=u),g[0]!=n||g[1]!=i?(r?s=null:a=null,g[0]=n,g[1]=i,!0):void 0}function y(){v(),A.style("pointer-events","all").selectAll(".resize").style("display",t.empty()?"none":null),ua.select("body").style("cursor",null),j.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),C(),k({type:"brushend"})}var b,x,_=this,w=ua.select(ua.event.target),k=l.of(_,arguments),A=ua.select(_),M=w.datum(),E=!/^(n|s)$/.test(M)&&c,L=!/^(e|w)$/.test(M)&&u,S=w.classed("extent"),C=$(_),z=ua.mouse(_),j=ua.select(n(_)).on("keydown.brush",o).on("keyup.brush",g);if(ua.event.changedTouches?j.on("touchmove.brush",v).on("touchend.brush",y):j.on("mousemove.brush",v).on("mouseup.brush",y),A.interrupt().selectAll("*").interrupt(),S)z[0]=h[0]-z[0],z[1]=f[0]-z[1];else if(M){var P=+/w$/.test(M),I=+/^n/.test(M);x=[h[1-P]-z[0],f[1-I]-z[1]],z[0]=h[P],z[1]=f[I]}else ua.event.altKey&&(b=z.slice());A.style("pointer-events","none").selectAll(".resize").style("display",null),ua.select("body").style("cursor",w.style("cursor")),k({type:"brushstart"}),v()}var a,s,l=L(t,"brushstart","brush","brushend"),c=null,u=null,h=[0,0],f=[0,0],d=!0,p=!0,g=Zl[0];return t.event=function(t){t.each(function(){var t=l.of(this,arguments),e={x:h,y:f,i:a,j:s},r=this.__chart__||e;this.__chart__=e,Ul?ua.select(this).transition().each("start.brush",function(){a=r.i,s=r.j,h=r.x,f=r.y,t({type:"brushstart"})}).tween("brush:brush",function(){var r=wn(h,e.x),n=wn(f,e.y);return a=s=null,function(i){h=e.x=r(i),f=e.y=n(i),t({type:"brush",mode:"resize"})}}).each("end.brush",function(){a=e.i,s=e.j,t({type:"brush",mode:"resize"}),t({type:"brushend"})}):(t({type:"brushstart"}),t({type:"brush",mode:"resize"}),t({type:"brushend"}))})},t.x=function(e){return arguments.length?(c=e,g=Zl[!c<<1|!u],t):c},t.y=function(e){return arguments.length?(u=e,g=Zl[!c<<1|!u],t):u},t.clamp=function(e){return arguments.length?(c&&u?(d=!!e[0],p=!!e[1]):c?d=!!e:u&&(p=!!e),t):c&&u?[d,p]:c?d:u?p:null},t.extent=function(e){var r,n,i,o,l;return arguments.length?(c&&(r=e[0],n=e[1],u&&(r=r[0],n=n[0]),a=[r,n],c.invert&&(r=c(r),n=c(n)),r>n&&(l=r,r=n,n=l),(r!=h[0]||n!=h[1])&&(h=[r,n])),u&&(i=e[0],o=e[1],c&&(i=i[1],o=o[1]),s=[i,o],u.invert&&(i=u(i),o=u(o)),i>o&&(l=i,i=o,o=l),(i!=f[0]||o!=f[1])&&(f=[i,o])),t):(c&&(a?(r=a[0],n=a[1]):(r=h[0],n=h[1],c.invert&&(r=c.invert(r),n=c.invert(n)),r>n&&(l=r,r=n,n=l))),u&&(s?(i=s[0],o=s[1]):(i=f[0],o=f[1],u.invert&&(i=u.invert(i),o=u.invert(o)),i>o&&(l=i,i=o,o=l))),c&&u?[[r,i],[n,o]]:c?[r,n]:u&&[i,o])},t.clear=function(){return t.empty()||(h=[0,0],f=[0,0],a=s=null),t},t.empty=function(){return!!c&&h[0]==h[1]||!!u&&f[0]==f[1]},ua.rebind(t,l,"on")};var Wl={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Zl=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],Ql=gs.format=_s.timeFormat,$l=Ql.utc,Kl=$l("%Y-%m-%dT%H:%M:%S.%LZ");Ql.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?oa:Kl,oa.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},oa.toString=Kl.toString,gs.second=Vt(function(t){return new vs(1e3*Math.floor(t/1e3))},function(t,e){t.setTime(t.getTime()+1e3*Math.floor(e))},function(t){return t.getSeconds()}),gs.seconds=gs.second.range,gs.seconds.utc=gs.second.utc.range,gs.minute=Vt(function(t){return new vs(6e4*Math.floor(t/6e4))},function(t,e){t.setTime(t.getTime()+6e4*Math.floor(e))},function(t){return t.getMinutes()}),gs.minutes=gs.minute.range,gs.minutes.utc=gs.minute.utc.range,gs.hour=Vt(function(t){var e=t.getTimezoneOffset()/60;return new vs(36e5*(Math.floor(t/36e5-e)+e))},function(t,e){t.setTime(t.getTime()+36e5*Math.floor(e))},function(t){return t.getHours()}),gs.hours=gs.hour.range,gs.hours.utc=gs.hour.utc.range,gs.month=Vt(function(t){return t=gs.day(t),t.setDate(1),t},function(t,e){t.setMonth(t.getMonth()+e)},function(t){return t.getMonth()}),gs.months=gs.month.range,gs.months.utc=gs.month.utc.range;var Jl=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],tc=[[gs.second,1],[gs.second,5],[gs.second,15],[gs.second,30],[gs.minute,1],[gs.minute,5],[gs.minute,15],[gs.minute,30],[gs.hour,1],[gs.hour,3],[gs.hour,6],[gs.hour,12],[gs.day,1],[gs.day,2],[gs.week,1],[gs.month,1],[gs.month,3],[gs.year,1]],ec=Ql.multi([[".%L",function(t){return t.getMilliseconds()}],[":%S",function(t){return t.getSeconds()}],["%I:%M",function(t){return t.getMinutes()}],["%I %p",function(t){return t.getHours()}],["%a %d",function(t){return t.getDay()&&1!=t.getDate()}],["%b %d",function(t){return 1!=t.getDate()}],["%B",function(t){return t.getMonth()}],["%Y",ze]]),rc={range:function(t,e,r){return ua.range(Math.ceil(t/r)*r,+e,r).map(sa)},floor:x,ceil:x};tc.year=gs.year,gs.scale=function(){return aa(ua.scale.linear(),tc,ec)};var nc=tc.map(function(t){return[t[0].utc,t[1]]}),ic=$l.multi([[".%L",function(t){return t.getUTCMilliseconds()}],[":%S",function(t){return t.getUTCSeconds()}],["%I:%M",function(t){return t.getUTCMinutes()}],["%I %p",function(t){return t.getUTCHours()}],["%a %d",function(t){return t.getUTCDay()&&1!=t.getUTCDate()}],["%b %d",function(t){return 1!=t.getUTCDate()}],["%B",function(t){return t.getUTCMonth()}],["%Y",ze]]);nc.year=gs.year.utc,gs.scale.utc=function(){return aa(ua.scale.linear(),nc,ic)},ua.text=St(function(t){return t.responseText}),ua.json=function(t,e){return Ct(t,"application/json",la,e)},ua.html=function(t,e){return Ct(t,"text/html",ca,e)},ua.xml=St(function(t){return t.responseXML}),"function"==typeof t&&t.amd?(this.d3=ua,t(ua)):"object"==typeof r&&r.exports?r.exports=ua:this.d3=ua}()},{}],71:[function(t,e,r){"use strict";function n(t,e){this.point=t,this.index=e}function i(t,e){for(var r=t.point,n=e.point,i=r.length,o=0;i>o;++o){var a=n[o]-r[o];if(a)return a}return 0}function o(t,e,r){if(1===t)return r?[[-1,0]]:[];var n=e.map(function(t,e){return[t[0],e]});n.sort(function(t,e){return t[0]-e[0]});for(var i=new Array(t-1),o=1;t>o;++o){var a=n[o-1],s=n[o];i[o-1]=[a[1],s[1]]}return r&&i.push([-1,i[0][1]],[i[t-1][1],-1]),i}function a(t,e){var r=t.length;if(0===r)return[];var a=t[0].length;if(1>a)return[];if(1===a)return o(r,t,e);for(var c=new Array(r),u=1,h=0;r>h;++h){for(var f=t[h],d=new Array(a+1),p=0,g=0;a>g;++g){var v=f[g];d[g]=v,p+=v*v}d[a]=p,c[h]=new n(d,h),u=Math.max(p,u)}l(c,i),r=c.length;for(var m=new Array(r+a+1),y=new Array(r+a+1),b=(a+1)*(a+1)*u,x=new Array(a+1),h=0;a>=h;++h)x[h]=0;x[a]=b,m[0]=x.slice(),y[0]=-1;for(var h=0;a>=h;++h){var d=x.slice();d[h]=1,m[h+1]=d,y[h+1]=-1}for(var h=0;r>h;++h){var _=c[h];m[h+a+1]=_.point,y[h+a+1]=_.index}var w=s(m,!1);if(w=e?w.filter(function(t){for(var e=0,r=0;a>=r;++r){var n=y[t[r]];if(0>n&&++e>=2)return!1;t[r]=n}return!0}):w.filter(function(t){for(var e=0;a>=e;++e){var r=y[t[e]];if(0>r)return!1;t[e]=r}return!0}),1&a)for(var h=0;h<w.length;++h){var _=w[h],d=_[0];_[0]=_[1],_[1]=d}return w}var s=t("incremental-convex-hull"),l=t("uniq");e.exports=a},{"incremental-convex-hull":191,uniq:234}],72:[function(t,e,r){"use strict";function n(t,e,r){var i=0|t[r];if(0>=i)return[];var o,a=new Array(i);if(r===t.length-1)for(o=0;i>o;++o)a[o]=e;else for(o=0;i>o;++o)a[o]=n(t,e,r+1);return a}function i(t,e){var r,n;for(r=new Array(t),n=0;t>n;++n)r[n]=e;return r}function o(t,e){switch("undefined"==typeof e&&(e=0),typeof t){case"number":if(t>0)return i(0|t,e);break;case"object":if("number"==typeof t.length)return n(t,e,0)}return[]}e.exports=o},{}],73:[function(e,r,n){(function(n,i){(function(){"use strict";function o(t){return"function"==typeof t||"object"==typeof t&&null!==t}function a(t){return"function"==typeof t}function s(t){return"object"==typeof t&&null!==t}function l(t){Y=t}function c(t){Q=t}function u(){return function(){n.nextTick(g)}}function h(){return function(){G(g)}}function f(){var t=0,e=new J(g),r=document.createTextNode("");return e.observe(r,{characterData:!0}),function(){r.data=t=++t%2}}function d(){var t=new MessageChannel;return t.port1.onmessage=g,function(){t.port2.postMessage(0)}}function p(){return function(){setTimeout(g,1)}}function g(){for(var t=0;Z>t;t+=2){var e=rt[t],r=rt[t+1];e(r),rt[t]=void 0,rt[t+1]=void 0}Z=0}function v(){try{var t=e,r=t("vertx");return G=r.runOnLoop||r.runOnContext,h()}catch(n){return p()}}function m(){}function y(){return new TypeError("You cannot resolve a promise with itself")}function b(){return new TypeError("A promises callback cannot return that same promise.")}function x(t){try{return t.then}catch(e){return at.error=e,at}}function _(t,e,r,n){try{t.call(e,r,n)}catch(i){return i}}function w(t,e,r){Q(function(t){var n=!1,i=_(r,e,function(r){n||(n=!0,e!==r?M(t,r):E(t,r))},function(e){n||(n=!0,L(t,e))},"Settle: "+(t._label||" unknown promise"));!n&&i&&(n=!0,L(t,i))},t)}function k(t,e){e._state===it?E(t,e._result):e._state===ot?L(t,e._result):S(e,void 0,function(e){M(t,e)},function(e){L(t,e)})}function A(t,e){if(e.constructor===t.constructor)k(t,e);else{var r=x(e);r===at?L(t,at.error):void 0===r?E(t,e):a(r)?w(t,e,r):E(t,e)}}function M(t,e){t===e?L(t,y()):o(e)?A(t,e):E(t,e)}function T(t){t._onerror&&t._onerror(t._result),C(t)}function E(t,e){t._state===nt&&(t._result=e,t._state=it,0!==t._subscribers.length&&Q(C,t))}function L(t,e){t._state===nt&&(t._state=ot,t._result=e,Q(T,t))}function S(t,e,r,n){var i=t._subscribers,o=i.length;t._onerror=null,i[o]=e,i[o+it]=r,i[o+ot]=n,0===o&&t._state&&Q(C,t)}function C(t){var e=t._subscribers,r=t._state;if(0!==e.length){for(var n,i,o=t._result,a=0;a<e.length;a+=3)n=e[a],i=e[a+r],n?P(r,n,i,o):i(o);t._subscribers.length=0}}function z(){this.error=null}function j(t,e){try{return t(e)}catch(r){return st.error=r,st}}function P(t,e,r,n){var i,o,s,l,c=a(r);if(c){if(i=j(r,n),i===st?(l=!0,o=i.error,i=null):s=!0,e===i)return void L(e,b())}else i=n,s=!0;e._state!==nt||(c&&s?M(e,i):l?L(e,o):t===it?E(e,i):t===ot&&L(e,i))}function I(t,e){try{e(function(e){M(t,e)},function(e){L(t,e)})}catch(r){L(t,r)}}function R(t,e){var r=this;r._instanceConstructor=t,r.promise=new t(m),r._validateInput(e)?(r._input=e,r.length=e.length,r._remaining=e.length,r._init(),0===r.length?E(r.promise,r._result):(r.length=r.length||0,r._enumerate(),0===r._remaining&&E(r.promise,r._result))):L(r.promise,r._validationError())}function O(t){return new lt(this,t).promise}function N(t){function e(t){M(i,t)}function r(t){L(i,t)}var n=this,i=new n(m);if(!W(t))return L(i,new TypeError("You must pass an array to race.")),i;for(var o=t.length,a=0;i._state===nt&&o>a;a++)S(n.resolve(t[a]),void 0,e,r);return i}function D(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var r=new e(m);return M(r,t),r}function F(t){var e=this,r=new e(m);return L(r,t),r}function B(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function U(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function V(t){this._id=dt++,this._state=void 0,this._result=void 0,this._subscribers=[],m!==t&&(a(t)||B(),this instanceof V||U(),I(this,t))}function q(){var t;if("undefined"!=typeof i)t=i;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var r=t.Promise;(!r||"[object Promise]"!==Object.prototype.toString.call(r.resolve())||r.cast)&&(t.Promise=pt)}var H;H=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var G,Y,X,W=H,Z=0,Q=({}.toString,function(t,e){rt[Z]=t,rt[Z+1]=e,Z+=2,2===Z&&(Y?Y(g):X())}),$="undefined"!=typeof window?window:void 0,K=$||{},J=K.MutationObserver||K.WebKitMutationObserver,tt="undefined"!=typeof n&&"[object process]"==={}.toString.call(n),et="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,rt=new Array(1e3);X=tt?u():J?f():et?d():void 0===$&&"function"==typeof e?v():p();var nt=void 0,it=1,ot=2,at=new z,st=new z;R.prototype._validateInput=function(t){return W(t)},R.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},R.prototype._init=function(){this._result=new Array(this.length)};var lt=R;R.prototype._enumerate=function(){for(var t=this,e=t.length,r=t.promise,n=t._input,i=0;r._state===nt&&e>i;i++)t._eachEntry(n[i],i)},R.prototype._eachEntry=function(t,e){var r=this,n=r._instanceConstructor;s(t)?t.constructor===n&&t._state!==nt?(t._onerror=null,r._settledAt(t._state,e,t._result)):r._willSettleAt(n.resolve(t),e):(r._remaining--,r._result[e]=t)},R.prototype._settledAt=function(t,e,r){var n=this,i=n.promise;i._state===nt&&(n._remaining--,t===ot?L(i,r):n._result[e]=r),0===n._remaining&&E(i,n._result)},R.prototype._willSettleAt=function(t,e){var r=this;S(t,void 0,function(t){r._settledAt(it,e,t)},function(t){r._settledAt(ot,e,t)})};var ct=O,ut=N,ht=D,ft=F,dt=0,pt=V;V.all=ct,V.race=ut,V.resolve=ht,V.reject=ft,V._setScheduler=l,V._setAsap=c,V._asap=Q,V.prototype={constructor:V,then:function(t,e){var r=this,n=r._state;if(n===it&&!t||n===ot&&!e)return this;var i=new this.constructor(m),o=r._result;if(n){var a=arguments[n-1];Q(function(){P(n,i,a,o)})}else S(r,i,t,e);return i},"catch":function(t){return this.then(null,t)}};var gt=q,vt={Promise:pt,polyfill:gt};"function"==typeof t&&t.amd?t(function(){return vt}):"undefined"!=typeof r&&r.exports?r.exports=vt:"undefined"!=typeof this&&(this.ES6Promise=vt),gt()}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:55}],74:[function(t,e,r){"use strict";function n(t){for(var e,r=t.length,n=0;r>n;n++)if(e=t.charCodeAt(n),(9>e||e>13)&&32!==e&&133!==e&&160!==e&&5760!==e&&6158!==e&&(8192>e||e>8205)&&8232!==e&&8233!==e&&8239!==e&&8287!==e&&8288!==e&&12288!==e&&65279!==e)return!1;return!0}e.exports=function(t){var e=typeof t;if("string"===e){var r=t;if(t=+t,0===t&&n(r))return!1}else if("number"!==e)return!1;return 1>t-t}},{}],75:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.gl=t,this.type=e,this.handle=r,this.length=n,this.usage=i}function i(t,e,r,n,i,o){var a=i.length*i.BYTES_PER_ELEMENT;if(0>o)return t.bufferData(e,i,n),a;if(a+o>r)throw new Error("gl-buffer: If resizing buffer, must not specify offset");return t.bufferSubData(e,o,i),r}function o(t,e){for(var r=l.malloc(t.length,e),n=t.length,i=0;n>i;++i)r[i]=t[i];return r}function a(t,e){for(var r=1,n=e.length-1;n>=0;--n){if(e[n]!==r)return!1;r*=t[n]}return!0}function s(t,e,r,i){if(r=r||t.ARRAY_BUFFER,i=i||t.DYNAMIC_DRAW,r!==t.ARRAY_BUFFER&&r!==t.ELEMENT_ARRAY_BUFFER)throw new Error("gl-buffer: Invalid type for webgl buffer, must be either gl.ARRAY_BUFFER or gl.ELEMENT_ARRAY_BUFFER");if(i!==t.DYNAMIC_DRAW&&i!==t.STATIC_DRAW&&i!==t.STREAM_DRAW)throw new Error("gl-buffer: Invalid usage for buffer, must be either gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW");var o=t.createBuffer(),a=new n(t,r,o,0,i);return a.update(e),a}var l=t("typedarray-pool"),c=t("ndarray-ops"),u=t("ndarray"),h=["uint8","uint8_clamped","uint16","uint32","int8","int16","int32","float32"],f=n.prototype;f.bind=function(){this.gl.bindBuffer(this.type,this.handle)},f.unbind=function(){this.gl.bindBuffer(this.type,null)},f.dispose=function(){this.gl.deleteBuffer(this.handle)},f.update=function(t,e){if("number"!=typeof e&&(e=-1),this.bind(),"object"==typeof t&&"undefined"!=typeof t.shape){var r=t.dtype;if(h.indexOf(r)<0&&(r="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER){var n=gl.getExtension("OES_element_index_uint");r=n&&"uint16"!==r?"uint32":"uint16"}if(r===t.dtype&&a(t.shape,t.stride))0===t.offset&&t.data.length===t.shape[0]?this.length=i(this.gl,this.type,this.length,this.usage,t.data,e):this.length=i(this.gl,this.type,this.length,this.usage,t.data.subarray(t.offset,t.shape[0]),e);else{var s=l.malloc(t.size,r),f=u(s,t.shape);c.assign(f,t),0>e?this.length=i(this.gl,this.type,this.length,this.usage,s,e):this.length=i(this.gl,this.type,this.length,this.usage,s.subarray(0,t.size),e),l.free(s)}}else if(Array.isArray(t)){var d;d=this.type===this.gl.ELEMENT_ARRAY_BUFFER?o(t,"uint16"):o(t,"float32"),0>e?this.length=i(this.gl,this.type,this.length,this.usage,d,e):this.length=i(this.gl,this.type,this.length,this.usage,d.subarray(0,t.length),e),l.free(d)}else if("object"==typeof t&&"number"==typeof t.length)this.length=i(this.gl,this.type,this.length,this.usage,t,e);else{if("number"!=typeof t&&void 0!==t)throw new Error("gl-buffer: Invalid data type");if(e>=0)throw new Error("gl-buffer: Cannot specify offset when resizing buffer");t=0|t,0>=t&&(t=1),this.gl.bufferData(this.type,0|t,this.usage),this.length=t}},e.exports=s},{ndarray:208,"ndarray-ops":207,"typedarray-pool":233}],76:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.shader=e,this.buffer=r,this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.numPoints=0,this.color=[0,0,0,1]}function i(t,e){var r=o(t.gl,l.vertex,l.fragment),i=a(t.gl),s=new n(t,r,i);return s.update(e),t.addObject(s),s}var o=t("gl-shader"),a=t("gl-buffer"),s=t("typedarray-pool"),l=t("./lib/shaders");e.exports=i;var c=[[1,0,0,1,0,0],[1,0,0,-1,0,0],[-1,0,0,-1,0,0],[-1,0,0,-1,0,0],[-1,0,0,1,0,0],[1,0,0,1,0,0],[1,0,-1,0,0,1],[1,0,-1,0,0,-1],[1,0,1,0,0,-1],[1,0,1,0,0,-1],[1,0,1,0,0,1],[1,0,-1,0,0,1],[-1,0,-1,0,0,1],[-1,0,-1,0,0,-1],[-1,0,1,0,0,-1],[-1,0,1,0,0,-1],[-1,0,1,0,0,1],[-1,0,-1,0,0,1],[0,1,1,0,0,0],[0,1,-1,0,0,0],[0,-1,-1,0,0,0],[0,-1,-1,0,0,0],[0,1,1,0,0,0],[0,-1,1,0,0,0],[0,1,0,-1,1,0],[0,1,0,-1,-1,0],[0,1,0,1,-1,0],[0,1,0,1,1,0],[0,1,0,-1,1,0],[0,1,0,1,-1,0],[0,-1,0,-1,1,0],[0,-1,0,-1,-1,0],[0,-1,0,1,-1,0],[0,-1,0,1,1,0],[0,-1,0,-1,1,0],[0,-1,0,1,-1,0]],u=n.prototype;u.draw=function(){var t=[1,0,0,0,1,0,0,0,1],e=[1,1];return function(){var r=this.plot,n=this.shader,i=this.buffer,o=this.bounds,a=this.numPoints,s=(this.color,r.gl),l=r.dataBox,u=r.viewBox,h=r.pixelRatio,f=o[2]-o[0],d=o[3]-o[1],p=l[2]-l[0],g=l[3]-l[1];t[0]=2*f/p,t[4]=2*d/g,t[6]=2*(o[0]-l[0])/p-1,t[7]=2*(o[1]-l[1])/g-1;var v=u[2]-u[0],m=u[3]-u[1];e[0]=2*h/v,e[1]=2*h/m,i.bind(),n.bind(),n.uniforms.viewTransform=t,n.uniforms.pixelScale=e,n.uniforms.color=this.color,n.attributes.position.pointer(s.FLOAT,!1,16,0),n.attributes.pixelOffset.pointer(s.FLOAT,!1,16,8),s.drawArrays(s.TRIANGLES,0,a*c.length)}}(),u.drawPick=function(t){return t},u.pick=function(t,e){return null},u.update=function(t){t=t||{};var e=t.positions||[],r=t.errors||[],n=1;"lineWidth"in t&&(n=+t.lineWidth);var i=5;"capSize"in t&&(i=+t.capSize),this.color=(t.color||[0,0,0,1]).slice();for(var o=this.bounds=[1/0,1/0,-(1/0),-(1/0)],a=this.numPoints=e.length>>1,l=0;a>l;++l){var u=e[2*l],h=e[2*l+1];o[0]=Math.min(u,o[0]),o[1]=Math.min(h,o[1]),o[2]=Math.max(u,o[2]),o[3]=Math.max(h,o[3])}o[2]===o[0]&&(o[2]+=1),o[3]===o[1]&&(o[3]+=1);for(var f=1/(o[2]-o[0]),d=1/(o[3]-o[1]),p=o[0],g=o[1],v=s.mallocFloat32(a*c.length*4),m=0,l=0;a>l;++l)for(var u=e[2*l],h=e[2*l+1],y=r[4*l],b=r[4*l+1],x=r[4*l+2],_=r[4*l+3],w=0;w<c.length;++w){var k=c[w],A=k[0],M=k[1];0>A?A*=y:A>0&&(A*=b),0>M?M*=x:M>0&&(M*=_),v[m++]=f*(u-p+A),v[m++]=d*(h-g+M),v[m++]=n*k[2]+(i+n)*k[4],v[m++]=n*k[3]+(i+n)*k[5]}this.buffer.update(v),s.free(v)},u.dispose=function(){this.plot.removeObject(this),this.shader.dispose(),this.buffer.dispose()}},{"./lib/shaders":77,"gl-buffer":75,"gl-shader":154,"typedarray-pool":233}],77:[function(t,e,r){e.exports={vertex:"#define GLSLIFY 1\nprecision mediump float;\n\nattribute vec2 position;\nattribute vec2 pixelOffset;\n\nuniform mat3 viewTransform;\nuniform vec2 pixelScale;\n\nvoid main() {\n vec3 scrPosition = viewTransform * vec3(position, 1);\n gl_Position = vec4(\n scrPosition.xy + scrPosition.z * pixelScale * pixelOffset,\n 0,\n scrPosition.z);\n}\n",
fragment:"#define GLSLIFY 1\nprecision mediump float;\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = vec4(color.rgb * color.a, color.a);\n}\n"}},{}],78:[function(t,e,r){"use strict";function n(t,e,r,n){this.gl=t,this.shader=n,this.buffer=e,this.vao=r,this.pixelRatio=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.lineWidth=[1,1,1],this.capSize=[10,10,10],this.lineCount=[0,0,0],this.lineOffset=[0,0,0],this.opacity=1}function i(t,e){for(var r=0;3>r;++r)t[0][r]=Math.min(t[0][r],e[r]),t[1][r]=Math.max(t[1][r],e[r])}function o(t,e,r,n){for(var i=f[n],o=0;o<i.length;++o){var a=i[o];t.push(e[0],e[1],e[2],r[0],r[1],r[2],r[3],a[0],a[1],a[2])}return i.length}function a(t){var e=t.gl,r=s(e),i=l(e,[{buffer:r,type:e.FLOAT,size:3,offset:0,stride:40},{buffer:r,type:e.FLOAT,size:4,offset:12,stride:40},{buffer:r,type:e.FLOAT,size:3,offset:28,stride:40}]),o=c(e);o.attributes.position.location=0,o.attributes.color.location=1,o.attributes.offset.location=2;var a=new n(e,r,i,o);return a.update(t),a}e.exports=a;var s=t("gl-buffer"),l=t("gl-vao"),c=t("./shaders/index"),u=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],h=n.prototype;h.isOpaque=function(){return this.opacity>=1},h.isTransparent=function(){return this.opacity<1},h.drawTransparent=h.draw=function(t){var e=this.gl,r=this.shader.uniforms;this.shader.bind();var n=r.view=t.view||u,i=r.projection=t.projection||u;r.model=t.model||u,r.clipBounds=this.clipBounds,r.opacity=this.opacity;var o=n[12],a=n[13],s=n[14],l=n[15],c=this.pixelRatio*(i[3]*o+i[7]*a+i[11]*s+i[15]*l)/e.drawingBufferHeight;this.vao.bind();for(var h=0;3>h;++h)e.lineWidth(this.lineWidth[h]),r.capSize=this.capSize[h]*c,e.drawArrays(e.LINES,this.lineOffset[h],this.lineCount[h]);this.vao.unbind()};var f=function(){for(var t=new Array(3),e=0;3>e;++e){for(var r=[],n=1;2>=n;++n)for(var i=-1;1>=i;i+=2){var o=(n+e)%3,a=[0,0,0];a[o]=i,r.push(a)}t[e]=r}return t}();h.update=function(t){t=t||{},"lineWidth"in t&&(this.lineWidth=t.lineWidth,Array.isArray(this.lineWidth)||(this.lineWidth=[this.lineWidth,this.lineWidth,this.lineWidth])),"capSize"in t&&(this.capSize=t.capSize,Array.isArray(this.capSize)||(this.capSize=[this.capSize,this.capSize,this.capSize])),"opacity"in t&&(this.opacity=t.opacity);var e=t.color||[[0,0,0],[0,0,0],[0,0,0]],r=t.position,n=t.error;if(Array.isArray(e[0])||(e=[e,e,e]),r&&n){var a=[],s=r.length,l=0;this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],this.lineCount=[0,0,0];for(var c=0;3>c;++c){this.lineOffset[c]=l;t:for(var u=0;s>u;++u){for(var h=r[u],f=0;3>f;++f)if(isNaN(h[f])||!isFinite(h[f]))continue t;var d=n[u],p=e[c];if(Array.isArray(p[0])&&(p=e[u]),3===p.length&&(p=[p[0],p[1],p[2],1]),!isNaN(d[0][c])&&!isNaN(d[1][c])){if(d[0][c]<0){var g=h.slice();g[c]+=d[0][c],a.push(h[0],h[1],h[2],p[0],p[1],p[2],p[3],0,0,0,g[0],g[1],g[2],p[0],p[1],p[2],p[3],0,0,0),i(this.bounds,g),l+=2+o(a,g,p,c)}if(d[1][c]>0){var g=h.slice();g[c]+=d[1][c],a.push(h[0],h[1],h[2],p[0],p[1],p[2],p[3],0,0,0,g[0],g[1],g[2],p[0],p[1],p[2],p[3],0,0,0),i(this.bounds,g),l+=2+o(a,g,p,c)}}}this.lineCount[c]=l-this.lineOffset[c]}this.buffer.update(a)}},h.dispose=function(){this.shader.dispose(),this.buffer.dispose(),this.vao.dispose()}},{"./shaders/index":79,"gl-buffer":75,"gl-vao":189}],79:[function(t,e,r){"use strict";var n=t("gl-shader"),i="#define GLSLIFY 1\nprecision mediump float;\n\nattribute vec3 position, offset;\nattribute vec4 color;\nuniform mat4 model, view, projection;\nuniform float capSize;\nvarying vec4 fragColor;\nvarying vec3 fragPosition;\n\nvoid main() {\n vec4 worldPosition = model * vec4(position, 1.0);\n worldPosition = (worldPosition / worldPosition.w) + vec4(capSize * offset, 0.0);\n gl_Position = projection * view * worldPosition;\n fragColor = color;\n fragPosition = position;\n}",o="#define GLSLIFY 1\nprecision mediump float;\nuniform vec3 clipBounds[2];\nuniform float opacity;\nvarying vec3 fragPosition;\nvarying vec4 fragColor;\n\nvoid main() {\n if(any(lessThan(fragPosition, clipBounds[0])) || any(greaterThan(fragPosition, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = opacity * fragColor;\n}";e.exports=function(t){return n(t,i,o,null,[{name:"position",type:"vec3"},{name:"offset",type:"vec3"},{name:"color",type:"vec4"}])}},{"gl-shader":154}],80:[function(t,e,r){"use strict";function n(t){var e=t.getParameter(t.FRAMEBUFFER_BINDING),r=t.getParameter(t.RENDERBUFFER_BINDING),n=t.getParameter(t.TEXTURE_BINDING_2D);return[e,r,n]}function i(t,e){t.bindFramebuffer(t.FRAMEBUFFER,e[0]),t.bindRenderbuffer(t.RENDERBUFFER,e[1]),t.bindTexture(t.TEXTURE_2D,e[2])}function o(t,e){var r=t.getParameter(e.MAX_COLOR_ATTACHMENTS_WEBGL);y=new Array(r+1);for(var n=0;r>=n;++n){for(var i=new Array(r),o=0;n>o;++o)i[o]=t.COLOR_ATTACHMENT0+o;for(var o=n;r>o;++o)i[o]=t.NONE;y[n]=i}}function a(t){switch(t){case p:throw new Error("gl-fbo: Framebuffer unsupported");case g:throw new Error("gl-fbo: Framebuffer incomplete attachment");case v:throw new Error("gl-fbo: Framebuffer incomplete dimensions");case m:throw new Error("gl-fbo: Framebuffer incomplete missing attachment");default:throw new Error("gl-fbo: Framebuffer failed for unspecified reason")}}function s(t,e,r,n,i,o){if(!n)return null;var a=d(t,e,r,i,n);return a.magFilter=t.NEAREST,a.minFilter=t.NEAREST,a.mipSamples=1,a.bind(),t.framebufferTexture2D(t.FRAMEBUFFER,o,t.TEXTURE_2D,a.handle,0),a}function l(t,e,r,n,i){var o=t.createRenderbuffer();return t.bindRenderbuffer(t.RENDERBUFFER,o),t.renderbufferStorage(t.RENDERBUFFER,n,e,r),t.framebufferRenderbuffer(t.FRAMEBUFFER,i,t.RENDERBUFFER,o),o}function c(t){var e=n(t.gl),r=t.gl,o=t.handle=r.createFramebuffer(),c=t._shape[0],u=t._shape[1],h=t.color.length,f=t._ext,d=t._useStencil,p=t._useDepth,g=t._colorType;r.bindFramebuffer(r.FRAMEBUFFER,o);for(var v=0;h>v;++v)t.color[v]=s(r,c,u,g,r.RGBA,r.COLOR_ATTACHMENT0+v);0===h?(t._color_rb=l(r,c,u,r.RGBA4,r.COLOR_ATTACHMENT0),f&&f.drawBuffersWEBGL(y[0])):h>1&&f.drawBuffersWEBGL(y[h]);var m=r.getExtension("WEBGL_depth_texture");m?d?t.depth=s(r,c,u,m.UNSIGNED_INT_24_8_WEBGL,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):p&&(t.depth=s(r,c,u,r.UNSIGNED_SHORT,r.DEPTH_COMPONENT,r.DEPTH_ATTACHMENT)):p&&d?t._depth_rb=l(r,c,u,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):p?t._depth_rb=l(r,c,u,r.DEPTH_COMPONENT16,r.DEPTH_ATTACHMENT):d&&(t._depth_rb=l(r,c,u,r.STENCIL_INDEX,r.STENCIL_ATTACHMENT));var b=r.checkFramebufferStatus(r.FRAMEBUFFER);if(b!==r.FRAMEBUFFER_COMPLETE){t._destroyed=!0,r.bindFramebuffer(r.FRAMEBUFFER,null),r.deleteFramebuffer(t.handle),t.handle=null,t.depth&&(t.depth.dispose(),t.depth=null),t._depth_rb&&(r.deleteRenderbuffer(t._depth_rb),t._depth_rb=null);for(var v=0;v<t.color.length;++v)t.color[v].dispose(),t.color[v]=null;t._color_rb&&(r.deleteRenderbuffer(t._color_rb),t._color_rb=null),i(r,e),a(b)}i(r,e)}function u(t,e,r,n,i,o,a,s){this.gl=t,this._shape=[0|e,0|r],this._destroyed=!1,this._ext=s,this.color=new Array(i);for(var l=0;i>l;++l)this.color[l]=null;this._color_rb=null,this.depth=null,this._depth_rb=null,this._colorType=n,this._useDepth=o,this._useStencil=a;var u=this,h=[0|e,0|r];Object.defineProperties(h,{0:{get:function(){return u._shape[0]},set:function(t){return u.width=t}},1:{get:function(){return u._shape[1]},set:function(t){return u.height=t}}}),this._shapeVector=h,c(this)}function h(t,e,r){if(t._destroyed)throw new Error("gl-fbo: Can't resize destroyed FBO");if(t._shape[0]!==e||t._shape[1]!==r){var o=t.gl,s=o.getParameter(o.MAX_RENDERBUFFER_SIZE);if(0>e||e>s||0>r||r>s)throw new Error("gl-fbo: Can't resize FBO, invalid dimensions");t._shape[0]=e,t._shape[1]=r;for(var l=n(o),c=0;c<t.color.length;++c)t.color[c].shape=t._shape;t._color_rb&&(o.bindRenderbuffer(o.RENDERBUFFER,t._color_rb),o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,t._shape[0],t._shape[1])),t.depth&&(t.depth.shape=t._shape),t._depth_rb&&(o.bindRenderbuffer(o.RENDERBUFFER,t._depth_rb),t._useDepth&&t._useStencil?o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,t._shape[0],t._shape[1]):t._useDepth?o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_COMPONENT16,t._shape[0],t._shape[1]):t._useStencil&&o.renderbufferStorage(o.RENDERBUFFER,o.STENCIL_INDEX,t._shape[0],t._shape[1])),o.bindFramebuffer(o.FRAMEBUFFER,t.handle);var u=o.checkFramebufferStatus(o.FRAMEBUFFER);u!==o.FRAMEBUFFER_COMPLETE&&(t.dispose(),i(o,l),a(u)),i(o,l)}}function f(t,e,r,n){p||(p=t.FRAMEBUFFER_UNSUPPORTED,g=t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT,v=t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS,m=t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT);var i=t.getExtension("WEBGL_draw_buffers");if(!y&&i&&o(t,i),Array.isArray(e)&&(n=r,r=0|e[1],e=0|e[0]),"number"!=typeof e)throw new Error("gl-fbo: Missing shape parameter");var a=t.getParameter(t.MAX_RENDERBUFFER_SIZE);if(0>e||e>a||0>r||r>a)throw new Error("gl-fbo: Parameters are too large for FBO");n=n||{};var s=1;if("color"in n){if(s=Math.max(0|n.color,0),0>s)throw new Error("gl-fbo: Must specify a nonnegative number of colors");if(s>1){if(!i)throw new Error("gl-fbo: Multiple draw buffer extension not supported");if(s>t.getParameter(i.MAX_COLOR_ATTACHMENTS_WEBGL))throw new Error("gl-fbo: Context does not support "+s+" draw buffers")}}var l=t.UNSIGNED_BYTE,c=t.getExtension("OES_texture_float");if(n.float&&s>0){if(!c)throw new Error("gl-fbo: Context does not support floating point textures");l=t.FLOAT}else n.preferFloat&&s>0&&c&&(l=t.FLOAT);var h=!0;"depth"in n&&(h=!!n.depth);var f=!1;return"stencil"in n&&(f=!!n.stencil),new u(t,e,r,l,s,h,f,i)}var d=t("gl-texture2d");e.exports=f;var p,g,v,m,y=null,b=u.prototype;Object.defineProperties(b,{shape:{get:function(){return this._destroyed?[0,0]:this._shapeVector},set:function(t){if(Array.isArray(t)||(t=[0|t,0|t]),2!==t.length)throw new Error("gl-fbo: Shape vector must be length 2");var e=0|t[0],r=0|t[1];return h(this,e,r),[e,r]},enumerable:!1},width:{get:function(){return this._destroyed?0:this._shape[0]},set:function(t){return t=0|t,h(this,t,this._shape[1]),t},enumerable:!1},height:{get:function(){return this._destroyed?0:this._shape[1]},set:function(t){return t=0|t,h(this,this._shape[0],t),t},enumerable:!1}}),b.bind=function(){if(!this._destroyed){var t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,this.handle),t.viewport(0,0,this._shape[0],this._shape[1])}},b.dispose=function(){if(!this._destroyed){this._destroyed=!0;var t=this.gl;t.deleteFramebuffer(this.handle),this.handle=null,this.depth&&(this.depth.dispose(),this.depth=null),this._depth_rb&&(t.deleteRenderbuffer(this._depth_rb),this._depth_rb=null);for(var e=0;e<this.color.length;++e)this.color[e].dispose(),this.color[e]=null;this._color_rb&&(t.deleteRenderbuffer(this._color_rb),this._color_rb=null)}}},{"gl-texture2d":185}],81:[function(t,e,r){r.lineVertex="#define GLSLIFY 1\nprecision mediump float;\n\nfloat inverse_1_0(float m) {\n return 1.0 / m;\n}\n\nmat2 inverse_1_0(mat2 m) {\n return mat2(m[1][1],-m[0][1],\n -m[1][0], m[0][0]) / (m[0][0]*m[1][1] - m[0][1]*m[1][0]);\n}\n\nmat3 inverse_1_0(mat3 m) {\n float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];\n float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];\n float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n}\n\nmat4 inverse_1_0(mat4 m) {\n float\n a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],\n a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],\n a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],\n a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n return mat4(\n a11 * b11 - a12 * b10 + a13 * b09,\n a02 * b10 - a01 * b11 - a03 * b09,\n a31 * b05 - a32 * b04 + a33 * b03,\n a22 * b04 - a21 * b05 - a23 * b03,\n a12 * b08 - a10 * b11 - a13 * b07,\n a00 * b11 - a02 * b08 + a03 * b07,\n a32 * b02 - a30 * b05 - a33 * b01,\n a20 * b05 - a22 * b02 + a23 * b01,\n a10 * b10 - a11 * b08 + a13 * b06,\n a01 * b08 - a00 * b10 - a03 * b06,\n a30 * b04 - a31 * b02 + a33 * b00,\n a21 * b02 - a20 * b04 - a23 * b00,\n a11 * b07 - a10 * b09 - a12 * b06,\n a00 * b09 - a01 * b07 + a02 * b06,\n a31 * b01 - a30 * b03 - a32 * b00,\n a20 * b03 - a21 * b01 + a22 * b00) / det;\n}\n\n\n\nattribute vec2 a, d;\n\nuniform mat3 matrix;\nuniform vec2 screenShape;\nuniform float width;\n\nvarying vec2 direction;\n\nvoid main() {\n vec2 dir = (matrix * vec3(d, 0)).xy;\n vec3 base = matrix * vec3(a, 1);\n vec2 n = 0.5 * width *\n normalize(screenShape.yx * vec2(dir.y, -dir.x)) / screenShape.xy;\n vec2 tangent = normalize(screenShape.xy * dir);\n if(dir.x < 0.0 || (dir.x == 0.0 && dir.y < 0.0)) {\n direction = -tangent;\n } else {\n direction = tangent;\n }\n gl_Position = vec4(base.xy/base.z + n, 0, 1);\n}\n",r.lineFragment="#define GLSLIFY 1\nprecision mediump float;\n\nuniform vec4 color;\nuniform vec2 screenShape;\nuniform sampler2D dashPattern;\nuniform float dashLength;\n\nvarying vec2 direction;\n\nvoid main() {\n float t = fract(dot(direction, gl_FragCoord.xy) / dashLength);\n vec4 pcolor = color * texture2D(dashPattern, vec2(t, 0.0)).r;\n gl_FragColor = vec4(pcolor.rgb * pcolor.a, pcolor.a);\n}\n",r.mitreVertex="#define GLSLIFY 1\nprecision mediump float;\n\nattribute vec2 p;\n\nuniform mat3 matrix;\nuniform vec2 screenShape;\nuniform float radius;\n\nvoid main() {\n vec3 pp = matrix * vec3(p, 1);\n gl_Position = vec4(pp.xy, 0, pp.z);\n gl_PointSize = radius;\n}\n",r.mitreFragment="#define GLSLIFY 1\nprecision mediump float;\n\nuniform vec4 color;\n\nvoid main() {\n if(length(gl_PointCoord.xy - 0.5) > 0.25) {\n discard;\n }\n gl_FragColor = vec4(color.rgb, color.a);\n}\n",r.pickVertex="#define GLSLIFY 1\nprecision mediump float;\n\nattribute vec2 a, d;\nattribute vec4 pick0, pick1;\n\nuniform mat3 matrix;\nuniform vec2 screenShape;\nuniform float width;\n\nvarying vec4 pickA, pickB;\n\nfloat inverse_1_0(float m) {\n return 1.0 / m;\n}\n\nmat2 inverse_1_0(mat2 m) {\n return mat2(m[1][1],-m[0][1],\n -m[1][0], m[0][0]) / (m[0][0]*m[1][1] - m[0][1]*m[1][0]);\n}\n\nmat3 inverse_1_0(mat3 m) {\n float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];\n float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];\n float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n}\n\nmat4 inverse_1_0(mat4 m) {\n float\n a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],\n a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],\n a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],\n a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n return mat4(\n a11 * b11 - a12 * b10 + a13 * b09,\n a02 * b10 - a01 * b11 - a03 * b09,\n a31 * b05 - a32 * b04 + a33 * b03,\n a22 * b04 - a21 * b05 - a23 * b03,\n a12 * b08 - a10 * b11 - a13 * b07,\n a00 * b11 - a02 * b08 + a03 * b07,\n a32 * b02 - a30 * b05 - a33 * b01,\n a20 * b05 - a22 * b02 + a23 * b01,\n a10 * b10 - a11 * b08 + a13 * b06,\n a01 * b08 - a00 * b10 - a03 * b06,\n a30 * b04 - a31 * b02 + a33 * b00,\n a21 * b02 - a20 * b04 - a23 * b00,\n a11 * b07 - a10 * b09 - a12 * b06,\n a00 * b09 - a01 * b07 + a02 * b06,\n a31 * b01 - a30 * b03 - a32 * b00,\n a20 * b03 - a21 * b01 + a22 * b00) / det;\n}\n\n\n\nvoid main() {\n vec3 base = matrix * vec3(a, 1);\n vec2 n = width *\n normalize(screenShape.yx * vec2(d.y, -d.x)) / screenShape.xy;\n gl_Position = vec4(base.xy/base.z + n, 0, 1);\n pickA = pick0;\n pickB = pick1;\n}\n",r.pickFragment="#define GLSLIFY 1\nprecision mediump float;\n\nuniform vec4 pickOffset;\n\nvarying vec4 pickA, pickB;\n\nvoid main() {\n vec4 fragId = vec4(pickA.xyz, 0.0);\n if(pickB.w > pickA.w) {\n fragId.xyz = pickB.xyz;\n }\n\n fragId += 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 gl_FragColor = fragId / 255.0;\n}\n",r.fillVertex="#define GLSLIFY 1\nprecision mediump float;\n\nattribute vec2 a, d;\n\nuniform mat3 matrix;\nuniform vec2 projectAxis;\nuniform float projectValue;\nuniform float depth;\n\nvoid main() {\n vec3 base = matrix * vec3(a, 1);\n vec2 p = base.xy / base.z;\n if(d.y < 0.0 || (d.y == 0.0 && d.x < 0.0)) {\n if(dot(p, projectAxis) < projectValue) {\n p = p * (1.0 - abs(projectAxis)) + projectAxis * projectValue;\n }\n }\n gl_Position = vec4(p, depth, 1);\n}\n",r.fillFragment="#define GLSLIFY 1\nprecision mediump float;\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = vec4(color.rgb * color.a, color.a);\n}\n"},{}],82:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a,s){this.plot=t,this.dashPattern=e,this.lineBuffer=r,this.pickBuffer=n,this.lineShader=i,this.mitreShader=o,this.fillShader=a,this.pickShader=s,this.usingDashes=!1,this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.width=1,this.color=[0,0,1,1],this.fill=[!1,!1,!1,!1],this.fillColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.data=null,this.numPoints=0,this.vertCount=0,this.pickOffset=0,this.lodBuffer=[]}function i(t){return t.map(function(t){return t.slice()})}function o(t,e){var r=t.gl,i=s(r),o=s(r),c=l(r,[1,1]),u=a(r,h.lineVertex,h.lineFragment),f=a(r,h.mitreVertex,h.mitreFragment),d=a(r,h.fillVertex,h.fillFragment),p=a(r,h.pickVertex,h.pickFragment),g=new n(t,c,i,o,u,f,d,p);return t.addObject(g),g.update(e),g}e.exports=o;var a=t("gl-shader"),s=t("gl-buffer"),l=t("gl-texture2d"),c=t("ndarray"),u=t("typedarray-pool"),h=t("./lib/shaders"),f=n.prototype;f.draw=function(){var t=[1,0,0,0,1,0,0,0,1],e=[0,0],r=[1,0],n=[-1,0],i=[0,1],o=[0,-1];return function(){var a=this.plot,s=this.color,l=this.width,c=(this.numPoints,this.bounds),u=this.vertCount,h=a.gl,f=a.viewBox,d=a.dataBox,p=a.pixelRatio,g=c[2]-c[0],v=c[3]-c[1],m=d[2]-d[0],y=d[3]-d[1],b=f[2]-f[0],x=f[3]-f[1];t[0]=2*g/m,t[4]=2*v/y,t[6]=2*(c[0]-d[0])/m-1,t[7]=2*(c[1]-d[1])/y-1,e[0]=b,e[1]=x;var _=this.lineBuffer;_.bind();var w=this.fill;if(w[0]||w[1]||w[2]||w[3]){var k=this.fillShader;k.bind();var A=k.uniforms;A.matrix=t,A.depth=a.nextDepthValue();var M=k.attributes;M.a.pointer(h.FLOAT,!1,16,0),M.d.pointer(h.FLOAT,!1,16,8),h.depthMask(!0),h.enable(h.DEPTH_TEST);var T=this.fillColor;w[0]&&(A.color=T[0],A.projectAxis=n,A.projectValue=1,h.drawArrays(h.TRIANGLES,0,u)),w[1]&&(A.color=T[1],A.projectAxis=o,A.projectValue=1,h.drawArrays(h.TRIANGLES,0,u)),w[2]&&(A.color=T[2],A.projectAxis=r,A.projectValue=1,h.drawArrays(h.TRIANGLES,0,u)),w[3]&&(A.color=T[3],A.projectAxis=i,A.projectValue=1,h.drawArrays(h.TRIANGLES,0,u)),h.depthMask(!1),h.disable(h.DEPTH_TEST)}var E=this.lineShader;E.bind();var L=E.uniforms;L.matrix=t,L.color=s,L.width=l*p,L.screenShape=e,L.dashPattern=this.dashPattern.bind(),L.dashLength=this.dashLength*p;var S=E.attributes;if(S.a.pointer(h.FLOAT,!1,16,0),S.d.pointer(h.FLOAT,!1,16,8),h.drawArrays(h.TRIANGLES,0,u),l>2&&!this.usingDashes){var C=this.mitreShader;C.bind();var z=C.uniforms;z.matrix=t,z.color=s,z.screenShape=e,z.radius=l*p,C.attributes.p.pointer(h.FLOAT,!1,48,0),h.drawArrays(h.POINTS,0,u/3|0)}}}(),f.drawPick=function(){var t=[1,0,0,0,1,0,0,0,1],e=[0,0],r=[0,0,0,0];return function(n){var i=this.plot,o=this.pickShader,a=this.lineBuffer,s=this.pickBuffer,l=this.width,c=this.numPoints,u=this.bounds,h=this.vertCount,f=i.gl,d=i.viewBox,p=i.dataBox,g=i.pickPixelRatio,v=u[2]-u[0],m=u[3]-u[1],y=p[2]-p[0],b=p[3]-p[1],x=d[2]-d[0],_=d[3]-d[1];this.pickOffset=n,t[0]=2*v/y,t[4]=2*m/b,t[6]=2*(u[0]-p[0])/y-1,t[7]=2*(u[1]-p[1])/b-1,e[0]=x,e[1]=_,r[0]=255&n,r[1]=n>>>8&255,r[2]=n>>>16&255,r[3]=n>>>24,o.bind();var w=o.uniforms;w.matrix=t,w.width=l*g,w.pickOffset=r,w.screenShape=e;var k=o.attributes;return a.bind(),k.a.pointer(f.FLOAT,!1,16,0),k.d.pointer(f.FLOAT,!1,16,8),s.bind(),k.pick0.pointer(f.UNSIGNED_BYTE,!1,8,0),k.pick1.pointer(f.UNSIGNED_BYTE,!1,8,4),f.drawArrays(f.TRIANGLES,0,h),n+c}}(),f.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.data;return{object:this,pointId:o,dataCoord:[a[2*o],a[2*o+1]]}},f.update=function(t){t=t||{};var e=this.plot.gl;this.color=(t.color||[0,0,1,1]).slice(),this.width=+(t.width||1),this.fill=(t.fill||[!1,!1,!1,!1]).slice(),this.fillColor=i(t.fillColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]);for(var r=t.dashes||[1],n=0,o=0;o<r.length;++o)n+=r[o];for(var a=u.mallocUint8(n),s=0,h=255,o=0;o<r.length;++o){for(var f=0;f<r[o];++f)a[s++]=h;h^=255}this.dashPattern.dispose(),this.usingDashes=r.length>1,this.dashPattern=l(e,c(a,[n,1,4],[1,0,0])),this.dashPattern.minFilter=e.NEAREST,this.dashPattern.magFilter=e.NEAREST,this.dashLength=n,u.free(a);var d=t.positions;this.data=d;var p=this.bounds;p[0]=p[1]=1/0,p[2]=p[3]=-(1/0);var g=this.numPoints=d.length>>>1;if(0!==g){for(var o=0;g>o;++o){var v=d[2*o],m=d[2*o+1];p[0]=Math.min(p[0],v),p[1]=Math.min(p[1],m),p[2]=Math.max(p[2],v),p[3]=Math.max(p[3],m)}p[0]===p[2]&&(p[2]+=1),p[3]===p[1]&&(p[3]+=1);var y=u.mallocFloat32(24*(g-1)),b=u.mallocUint32(12*(g-1)),x=y.length,_=b.length,s=g;for(this.vertCount=6*(g-1);s>1;){var w=--s,v=d[2*s],m=d[2*s+1];v=(v-p[0])/(p[2]-p[0]),m=(m-p[1])/(p[3]-p[1]);var k=w-1,A=d[2*k],M=d[2*k+1];A=(A-p[0])/(p[2]-p[0]),M=(M-p[1])/(p[3]-p[1]);var T=A-v,E=M-m,L=w|1<<24,S=w-1,C=w,z=w-1|1<<24;y[--x]=-E,y[--x]=-T,y[--x]=m,y[--x]=v,b[--_]=L,b[--_]=S,y[--x]=E,y[--x]=T,y[--x]=M,y[--x]=A,b[--_]=C,b[--_]=z,y[--x]=-E,y[--x]=-T,y[--x]=M,y[--x]=A,b[--_]=C,b[--_]=z,y[--x]=E,y[--x]=T,y[--x]=M,y[--x]=A,b[--_]=C,b[--_]=z,y[--x]=-E,y[--x]=-T,y[--x]=m,y[--x]=v,b[--_]=L,b[--_]=S,y[--x]=E,y[--x]=T,y[--x]=m,y[--x]=v,b[--_]=L,b[--_]=S}this.lineBuffer.update(y),this.pickBuffer.update(b),u.free(y),u.free(b)}},f.dispose=function(){this.plot.removeObject(this),this.lineBuffer.dispose(),this.pickBuffer.dispose(),this.lineShader.dispose(),this.mitreShader.dispose(),this.fillShader.dispose(),this.pickShader.dispose(),this.dashPattern.dispose()}},{"./lib/shaders":81,"gl-buffer":75,"gl-shader":154,"gl-texture2d":185,ndarray:208,"typedarray-pool":233}],83:[function(t,e,r){var n=t("gl-shader"),i="#define GLSLIFY 1\nprecision mediump float;\n\nattribute vec3 position, nextPosition;\nattribute float arcLength, lineWidth;\nattribute vec4 color;\n\nuniform vec2 screenShape;\nuniform float pixelRatio;\nuniform mat4 model, view, projection;\n\nvarying vec4 fragColor;\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\n\nvoid main() {\n vec4 projected = projection * view * model * vec4(position, 1.0);\n vec4 tangentClip = projection * view * model * vec4(nextPosition - position, 0.0);\n vec2 tangent = normalize(screenShape * tangentClip.xy);\n vec2 offset = 0.5 * pixelRatio * lineWidth * vec2(tangent.y, -tangent.x) / screenShape;\n\n gl_Position = vec4(projected.xy + projected.w * offset, projected.zw);\n\n worldPosition = position;\n pixelArcLength = arcLength;\n fragColor = color;\n}\n",o="#define GLSLIFY 1\nprecision mediump float;\n\nuniform vec3 clipBounds[2];\nuniform sampler2D dashTexture;\nuniform float dashScale;\nuniform float opacity;\n\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\nvarying vec4 fragColor;\n\nvoid main() {\n if(any(lessThan(worldPosition, clipBounds[0])) || any(greaterThan(worldPosition, clipBounds[1]))) {\n discard;\n }\n float dashWeight = texture2D(dashTexture, vec2(dashScale * pixelArcLength, 0)).r;\n if(dashWeight < 0.5) {\n discard;\n }\n gl_FragColor = fragColor * opacity;\n}\n",a="#define GLSLIFY 1\nprecision mediump float;\n\n#define FLOAT_MAX 1.70141184e38\n#define FLOAT_MIN 1.17549435e-38\n\nlowp vec4 encode_float_1_0(highp float v) {\n highp float av = abs(v);\n\n //Handle special cases\n if(av < FLOAT_MIN) {\n return vec4(0.0, 0.0, 0.0, 0.0);\n } else if(v > FLOAT_MAX) {\n return vec4(127.0, 128.0, 0.0, 0.0) / 255.0;\n } else if(v < -FLOAT_MAX) {\n return vec4(255.0, 128.0, 0.0, 0.0) / 255.0;\n }\n\n highp vec4 c = vec4(0,0,0,0);\n\n //Compute exponent and mantissa\n highp float e = floor(log2(av));\n highp float m = av * pow(2.0, -e) - 1.0;\n \n //Unpack mantissa\n c[1] = floor(128.0 * m);\n m -= c[1] / 128.0;\n c[2] = floor(32768.0 * m);\n m -= c[2] / 32768.0;\n c[3] = floor(8388608.0 * m);\n \n //Unpack exponent\n highp float ebias = e + 127.0;\n c[0] = floor(ebias / 2.0);\n ebias -= c[0] * 2.0;\n c[1] += floor(ebias) * 128.0; \n\n //Unpack sign bit\n c[0] += 128.0 * step(0.0, -v);\n\n //Scale back to range\n return c / 255.0;\n}\n\n\n\nuniform float pickId;\nuniform vec3 clipBounds[2];\n\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\nvarying vec4 fragColor;\n\nvoid main() {\n if(any(lessThan(worldPosition, clipBounds[0])) || any(greaterThan(worldPosition, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId/255.0, encode_float_1_0(pixelArcLength).xyz);\n}",s=[{name:"position",type:"vec3"},{name:"nextPosition",type:"vec3"},{name:"arcLength",type:"float"},{name:"lineWidth",type:"float"},{name:"color",type:"vec4"}];r.createShader=function(t){return n(t,i,o,null,s)},r.createPickShader=function(t){return n(t,i,a,null,s)}},{"gl-shader":154}],84:[function(t,e,r){"use strict";function n(t,e){for(var r=0,n=0;3>n;++n){var i=t[n]-e[n];r+=i*i}return Math.sqrt(r)}function i(t){for(var e=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],r=0;3>r;++r)e[0][r]=Math.max(t[0][r],e[0][r]),e[1][r]=Math.min(t[1][r],e[1][r]);return e}function o(t,e,r,n){this.arcLength=t,this.position=e,this.index=r,this.dataCoordinate=n}function a(t,e,r,n,i,o){this.gl=t,this.shader=e,this.pickShader=r,this.buffer=n,this.vao=i,this.clipBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.points=[],this.arcLength=[],this.vertexCount=0,this.bounds=[[0,0,0],[0,0,0]],this.pickId=0,this.lineWidth=1,this.texture=o,this.dashScale=1,this.opacity=1,this.dirty=!0,this.pixelRatio=1}function s(t){var e=t.gl||t.scene&&t.scene.gl,r=g(e);r.attributes.position.location=0,r.attributes.nextPosition.location=1,r.attributes.arcLength.location=2,r.attributes.lineWidth.location=3,r.attributes.color.location=4;var n=v(e);n.attributes.position.location=0,n.attributes.nextPosition.location=1,n.attributes.arcLength.location=2,n.attributes.lineWidth.location=3,n.attributes.color.location=4;for(var i=l(e),o=c(e,[{buffer:i,size:3,offset:0,stride:48},{buffer:i,size:3,offset:12,stride:48},{buffer:i,size:1,offset:24,stride:48},{buffer:i,size:1,offset:28,stride:48},{buffer:i,size:4,offset:32,stride:48}]),s=d(new Array(1024),[256,1,4]),h=0;1024>h;++h)s.data[h]=255;var f=u(e,s);f.wrap=e.REPEAT;var p=new a(e,r,n,i,o,f);return p.update(t),p}e.exports=s;var l=t("gl-buffer"),c=t("gl-vao"),u=t("gl-texture2d"),h=t("glsl-read-float"),f=t("binary-search-bounds"),d=t("ndarray"),p=t("./lib/shaders"),g=p.createShader,v=p.createPickShader,m=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],y=a.prototype;y.isTransparent=function(){return this.opacity<1},y.isOpaque=function(){return this.opacity>=1},y.pickSlots=1,y.setPickBase=function(t){this.pickId=t},y.drawTransparent=y.draw=function(t){var e=this.gl,r=this.shader,n=this.vao;r.bind(),r.uniforms={model:t.model||m,view:t.view||m,projection:t.projection||m,clipBounds:i(this.clipBounds),dashTexture:this.texture.bind(),dashScale:this.dashScale/this.arcLength[this.arcLength.length-1],opacity:this.opacity,screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount)},y.drawPick=function(t){var e=this.gl,r=this.pickShader,n=this.vao;r.bind(),r.uniforms={model:t.model||m,view:t.view||m,projection:t.projection||m,pickId:this.pickId,clipBounds:i(this.clipBounds),screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount)},y.update=function(t){this.dirty=!0,"dashScale"in t&&(this.dashScale=t.dashScale),"opacity"in t&&(this.opacity=+t.opacity);var e=t.position||t.positions;if(e){var r=t.color||t.colors||[0,0,0,1],i=t.lineWidth||1,o=[],a=[],s=[],l=0,c=0,u=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]];t:for(var h=1;h<e.length;++h){var p=e[h-1],g=e[h];a.push(l),s.push(p.slice());for(var v=0;3>v;++v){if(isNaN(p[v])||isNaN(g[v])||!isFinite(p[v])||!isFinite(g[v]))continue t;u[0][v]=Math.min(u[0][v],p[v],g[v]),u[1][v]=Math.max(u[1][v],p[v],g[v])}var m,y;Array.isArray(r[0])?(m=r[h-1],y=r[h]):m=y=r,3===m.length&&(m=[m[0],m[1],m[2],1]),3===y.length&&(y=[y[0],y[1],y[2],1]);var b,x;Array.isArray(i)?(b=i[h-1],x=lineWidht[h]):b=x=i;var _=l;l+=n(p,g),o.push(p[0],p[1],p[2],g[0],g[1],g[2],_,b,m[0],m[1],m[2],m[3],p[0],p[1],p[2],g[0],g[1],g[2],_,-b,m[0],m[1],m[2],m[3],g[0],g[1],g[2],p[0],p[1],p[2],l,-b,y[0],y[1],y[2],y[3],g[0],g[1],g[2],p[0],p[1],p[2],l,b,y[0],y[1],y[2],y[3]),c+=4}if(this.buffer.update(o),a.push(l),s.push(e[e.length-1].slice()),this.bounds=u,this.vertexCount=c,this.points=s,this.arcLength=a,"dashes"in t){var w=t.dashes,k=w.slice();k.unshift(0);for(var h=1;h<k.length;++h)k[h]=k[h-1]+k[h];for(var A=d(new Array(1024),[256,1,4]),h=0;256>h;++h){for(var v=0;4>v;++v)A.set(h,0,v,0);1&f.le(k,k[k.length-1]*h/255)?A.set(h,0,0,0):A.set(h,0,0,255)}this.texture.setPixels(A)}}},y.dispose=function(){this.shader.dispose(),this.vao.dispose(),this.buffer.dispose()},y.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=h(t.value[0],t.value[1],t.value[2],0),r=f.le(this.arcLength,e);if(0>r)return null;if(r===this.arcLength.length-1)return new o(this.arcLength[this.arcLength.length-1],this.points[this.points.length-1].slice(),r);for(var n=this.points[r],i=this.points[Math.min(r+1,this.points.length-1)],a=(e-this.arcLength[r])/(this.arcLength[r+1]-this.arcLength[r]),s=1-a,l=[0,0,0],c=0;3>c;++c)l[c]=s*n[c]+a*i[c];var u=Math.min(.5>a?r:r+1,this.points.length-1);return new o(e,l,u,this.points[u])}},{"./lib/shaders":83,"binary-search-bounds":85,"gl-buffer":75,"gl-texture2d":185,"gl-vao":189,"glsl-read-float":86,ndarray:208}],85:[function(t,e,r){arguments[4][20][0].apply(r,arguments)},{dup:20}],86:[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)},{}],87:[function(t,e,r){function n(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],c=e[7],u=e[8],h=u*a-s*c,f=-u*o+s*l,d=c*o-a*l,p=r*h+n*f+i*d;
return p?(p=1/p,t[0]=h*p,t[1]=(-u*n+i*c)*p,t[2]=(s*n-i*a)*p,t[3]=f*p,t[4]=(u*r-i*l)*p,t[5]=(-s*r+i*o)*p,t[6]=d*p,t[7]=(-c*r+n*l)*p,t[8]=(a*r-n*o)*p,t):null}e.exports=n},{}],88:[function(t,e,r){function n(t){var e=new Float32Array(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}e.exports=n},{}],89:[function(t,e,r){function n(){var t=new Float32Array(16);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=n},{}],90:[function(t,e,r){function n(t){var e=t[0],r=t[1],n=t[2],i=t[3],o=t[4],a=t[5],s=t[6],l=t[7],c=t[8],u=t[9],h=t[10],f=t[11],d=t[12],p=t[13],g=t[14],v=t[15],m=e*a-r*o,y=e*s-n*o,b=e*l-i*o,x=r*s-n*a,_=r*l-i*a,w=n*l-i*s,k=c*p-u*d,A=c*g-h*d,M=c*v-f*d,T=u*g-h*p,E=u*v-f*p,L=h*v-f*g;return m*L-y*E+b*T+x*M-_*A+w*k}e.exports=n},{}],91:[function(t,e,r){function n(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r+r,s=n+n,l=i+i,c=r*a,u=n*a,h=n*s,f=i*a,d=i*s,p=i*l,g=o*a,v=o*s,m=o*l;return t[0]=1-h-p,t[1]=u+m,t[2]=f-v,t[3]=0,t[4]=u-m,t[5]=1-c-p,t[6]=d+g,t[7]=0,t[8]=f+v,t[9]=d-g,t[10]=1-c-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=n},{}],92:[function(t,e,r){function n(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=n+n,l=i+i,c=o+o,u=n*s,h=n*l,f=n*c,d=i*l,p=i*c,g=o*c,v=a*s,m=a*l,y=a*c;return t[0]=1-(d+g),t[1]=h+y,t[2]=f-m,t[3]=0,t[4]=h-y,t[5]=1-(u+g),t[6]=p+v,t[7]=0,t[8]=f+m,t[9]=p-v,t[10]=1-(u+d),t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}e.exports=n},{}],93:[function(t,e,r){function n(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}e.exports=n},{}],94:[function(t,e,r){function n(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],c=e[7],u=e[8],h=e[9],f=e[10],d=e[11],p=e[12],g=e[13],v=e[14],m=e[15],y=r*s-n*a,b=r*l-i*a,x=r*c-o*a,_=n*l-i*s,w=n*c-o*s,k=i*c-o*l,A=u*g-h*p,M=u*v-f*p,T=u*m-d*p,E=h*v-f*g,L=h*m-d*g,S=f*m-d*v,C=y*S-b*L+x*E+_*T-w*M+k*A;return C?(C=1/C,t[0]=(s*S-l*L+c*E)*C,t[1]=(i*L-n*S-o*E)*C,t[2]=(g*k-v*w+m*_)*C,t[3]=(f*w-h*k-d*_)*C,t[4]=(l*T-a*S-c*M)*C,t[5]=(r*S-i*T+o*M)*C,t[6]=(v*x-p*k-m*b)*C,t[7]=(u*k-f*x+d*b)*C,t[8]=(a*L-s*T+c*A)*C,t[9]=(n*T-r*L-o*A)*C,t[10]=(p*w-g*x+m*y)*C,t[11]=(h*x-u*w-d*y)*C,t[12]=(s*M-a*E-l*A)*C,t[13]=(r*E-n*M+i*A)*C,t[14]=(g*b-p*_-v*y)*C,t[15]=(u*_-h*b+f*y)*C,t):null}e.exports=n},{}],95:[function(t,e,r){function n(t,e,r,n){var o,a,s,l,c,u,h,f,d,p,g=e[0],v=e[1],m=e[2],y=n[0],b=n[1],x=n[2],_=r[0],w=r[1],k=r[2];return Math.abs(g-_)<1e-6&&Math.abs(v-w)<1e-6&&Math.abs(m-k)<1e-6?i(t):(h=g-_,f=v-w,d=m-k,p=1/Math.sqrt(h*h+f*f+d*d),h*=p,f*=p,d*=p,o=b*d-x*f,a=x*h-y*d,s=y*f-b*h,p=Math.sqrt(o*o+a*a+s*s),p?(p=1/p,o*=p,a*=p,s*=p):(o=0,a=0,s=0),l=f*s-d*a,c=d*o-h*s,u=h*a-f*o,p=Math.sqrt(l*l+c*c+u*u),p?(p=1/p,l*=p,c*=p,u*=p):(l=0,c=0,u=0),t[0]=o,t[1]=l,t[2]=h,t[3]=0,t[4]=a,t[5]=c,t[6]=f,t[7]=0,t[8]=s,t[9]=u,t[10]=d,t[11]=0,t[12]=-(o*g+a*v+s*m),t[13]=-(l*g+c*v+u*m),t[14]=-(h*g+f*v+d*m),t[15]=1,t)}var i=t("./identity");e.exports=n},{"./identity":93}],96:[function(t,e,r){function n(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],c=e[6],u=e[7],h=e[8],f=e[9],d=e[10],p=e[11],g=e[12],v=e[13],m=e[14],y=e[15],b=r[0],x=r[1],_=r[2],w=r[3];return t[0]=b*n+x*s+_*h+w*g,t[1]=b*i+x*l+_*f+w*v,t[2]=b*o+x*c+_*d+w*m,t[3]=b*a+x*u+_*p+w*y,b=r[4],x=r[5],_=r[6],w=r[7],t[4]=b*n+x*s+_*h+w*g,t[5]=b*i+x*l+_*f+w*v,t[6]=b*o+x*c+_*d+w*m,t[7]=b*a+x*u+_*p+w*y,b=r[8],x=r[9],_=r[10],w=r[11],t[8]=b*n+x*s+_*h+w*g,t[9]=b*i+x*l+_*f+w*v,t[10]=b*o+x*c+_*d+w*m,t[11]=b*a+x*u+_*p+w*y,b=r[12],x=r[13],_=r[14],w=r[15],t[12]=b*n+x*s+_*h+w*g,t[13]=b*i+x*l+_*f+w*v,t[14]=b*o+x*c+_*d+w*m,t[15]=b*a+x*u+_*p+w*y,t}e.exports=n},{}],97:[function(t,e,r){function n(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}e.exports=n},{}],98:[function(t,e,r){function n(t,e,r,n){var i,o,a,s,l,c,u,h,f,d,p,g,v,m,y,b,x,_,w,k,A,M,T,E,L=n[0],S=n[1],C=n[2],z=Math.sqrt(L*L+S*S+C*C);return Math.abs(z)<1e-6?null:(z=1/z,L*=z,S*=z,C*=z,i=Math.sin(r),o=Math.cos(r),a=1-o,s=e[0],l=e[1],c=e[2],u=e[3],h=e[4],f=e[5],d=e[6],p=e[7],g=e[8],v=e[9],m=e[10],y=e[11],b=L*L*a+o,x=S*L*a+C*i,_=C*L*a-S*i,w=L*S*a-C*i,k=S*S*a+o,A=C*S*a+L*i,M=L*C*a+S*i,T=S*C*a-L*i,E=C*C*a+o,t[0]=s*b+h*x+g*_,t[1]=l*b+f*x+v*_,t[2]=c*b+d*x+m*_,t[3]=u*b+p*x+y*_,t[4]=s*w+h*k+g*A,t[5]=l*w+f*k+v*A,t[6]=c*w+d*k+m*A,t[7]=u*w+p*k+y*A,t[8]=s*M+h*T+g*E,t[9]=l*M+f*T+v*E,t[10]=c*M+d*T+m*E,t[11]=u*M+p*T+y*E,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}e.exports=n},{}],99:[function(t,e,r){function n(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[4],a=e[5],s=e[6],l=e[7],c=e[8],u=e[9],h=e[10],f=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*i+c*n,t[5]=a*i+u*n,t[6]=s*i+h*n,t[7]=l*i+f*n,t[8]=c*i-o*n,t[9]=u*i-a*n,t[10]=h*i-s*n,t[11]=f*i-l*n,t}e.exports=n},{}],100:[function(t,e,r){function n(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],a=e[1],s=e[2],l=e[3],c=e[8],u=e[9],h=e[10],f=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i-c*n,t[1]=a*i-u*n,t[2]=s*i-h*n,t[3]=l*i-f*n,t[8]=o*n+c*i,t[9]=a*n+u*i,t[10]=s*n+h*i,t[11]=l*n+f*i,t}e.exports=n},{}],101:[function(t,e,r){function n(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],a=e[1],s=e[2],l=e[3],c=e[4],u=e[5],h=e[6],f=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i+c*n,t[1]=a*i+u*n,t[2]=s*i+h*n,t[3]=l*i+f*n,t[4]=c*i-o*n,t[5]=u*i-a*n,t[6]=h*i-s*n,t[7]=f*i-l*n,t}e.exports=n},{}],102:[function(t,e,r){function n(t,e,r){var n=r[0],i=r[1],o=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}e.exports=n},{}],103:[function(t,e,r){function n(t,e,r){var n,i,o,a,s,l,c,u,h,f,d,p,g=r[0],v=r[1],m=r[2];return e===t?(t[12]=e[0]*g+e[4]*v+e[8]*m+e[12],t[13]=e[1]*g+e[5]*v+e[9]*m+e[13],t[14]=e[2]*g+e[6]*v+e[10]*m+e[14],t[15]=e[3]*g+e[7]*v+e[11]*m+e[15]):(n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],c=e[6],u=e[7],h=e[8],f=e[9],d=e[10],p=e[11],t[0]=n,t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t[6]=c,t[7]=u,t[8]=h,t[9]=f,t[10]=d,t[11]=p,t[12]=n*g+s*v+h*m+e[12],t[13]=i*g+l*v+f*m+e[13],t[14]=o*g+c*v+d*m+e[14],t[15]=a*g+u*v+p*m+e[15]),t}e.exports=n},{}],104:[function(t,e,r){function n(t,e){if(t===e){var r=e[1],n=e[2],i=e[3],o=e[6],a=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=o,t[11]=e[14],t[12]=i,t[13]=a,t[14]=s}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}e.exports=n},{}],105:[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 c(t[0],t[1],t[2],e,o),l(t,o)}return[]}function a(t,e){for(var r=[0,0,0],n=0;n<t.length;++n)for(var i=t[n],o=e[n],a=0;3>a;++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 c=new Array(t.length),u=0;u<t.length;++u)c[u]=i(t[u],r,n,s,l);for(var h=0,f=1/0,u=0;u<c.length;++u){for(var d=0,p=0;2>p;++p)d+=Math.pow(c[u][p]-e[p],2);f>d&&(f=d,h=u)}for(var g=o(c,e),v=0,u=0;3>u;++u){if(g[u]<-.001||g[u]>1.0001)return null;v+=g[u]}return Math.abs(v-1)>.001?null:[h,a(t,g),g]}var l=t("barycentric"),c=t("polytope-closest-point/lib/closest_point_2d.js");e.exports=s},{barycentric:108,"polytope-closest-point/lib/closest_point_2d.js":110}],106:[function(t,e,r){var n="#define GLSLIFY 1\nprecision mediump float;\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="#define GLSLIFY 1\nprecision mediump float;\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="#define GLSLIFY 1\nprecision mediump float;\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="#define GLSLIFY 1\nprecision mediump float;\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="#define GLSLIFY 1\nprecision mediump float;\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="#define GLSLIFY 1\nprecision mediump float;\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}",c="#define GLSLIFY 1\nprecision mediump float;\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}",u="#define GLSLIFY 1\nprecision mediump float;\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="#define GLSLIFY 1\nprecision mediump float;\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="#define GLSLIFY 1\nprecision mediump float;\n\nattribute vec3 position;\n\nuniform mat4 model, view, projection;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n}",d="#define GLSLIFY 1\nprecision mediump float;\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:c,fragment:u,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]},r.pointPickShader={vertex:h,fragment:u,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]},r.contourShader={vertex:f,fragment:d,attributes:[{name:"position",type:"vec3"}]}},{}],107:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a,s,l,c,u,h,f,d,p,g,v,m,y,b,x,_,w,k,A,M,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=u,this.triangleNormals=f,this.triangleUVs=h,this.triangleIds=c,this.triangleVAO=d,this.triangleCount=0,this.lineWidth=1,this.edgePositions=p,this.edgeColors=v,this.edgeUVs=m,this.edgeIds=g,this.edgeVAO=y,this.edgeCount=0,this.pointPositions=b,this.pointColors=_,this.pointUVs=w,this.pointSizes=k,this.pointIds=x,this.pointVAO=A,this.pointCount=0,this.contourLineWidth=1,this.contourPositions=M,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=P,this._view=P,this._projection=P,this._resolution=[1,1]}function i(t){for(var e=w({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 _(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;s<a.length;++s)n[a[s]]=r[i];return n}function a(t){for(var e=t.length,r=new Array(e),n=0;e>n;++n)r[n]=t[n][2];return r}function s(t){var e=p(t,E);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=p(t,L);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e}function c(t){var e=p(t,S);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e.attributes.pointSize.location=4,e}function u(t){var e=p(t,C);return e.attributes.position.location=0,e.attributes.id.location=1,e}function h(t){var e=p(t,z);return e.attributes.position.location=0,e.attributes.id.location=1,e.attributes.pointSize.location=4,e}function f(t){var e=p(t,j);return e.attributes.position.location=0,e}function d(t){var e=t.gl,r=s(e),i=l(e),o=c(e),a=u(e),d=h(e),p=f(e),y=m(e,_(new Uint8Array([255,255,255,255]),[1,1,4]));y.generateMipmap(),y.minFilter=e.LINEAR_MIPMAP_LINEAR,y.magFilter=e.LINEAR;var b=g(e),x=g(e),w=g(e),k=g(e),A=g(e),M=v(e,[{buffer:b,type:e.FLOAT,size:3},{buffer:A,type:e.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:x,type:e.FLOAT,size:4},{buffer:w,type:e.FLOAT,size:2},{buffer:k,type:e.FLOAT,size:3}]),T=g(e),E=g(e),L=g(e),S=g(e),C=v(e,[{buffer:T,type:e.FLOAT,size:3},{buffer:S,type:e.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:E,type:e.FLOAT,size:4},{buffer:L,type:e.FLOAT,size:2}]),z=g(e),j=g(e),P=g(e),I=g(e),R=g(e),O=v(e,[{buffer:z,type:e.FLOAT,size:3},{buffer:R,type:e.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:j,type:e.FLOAT,size:4},{buffer:P,type:e.FLOAT,size:2},{buffer:I,type:e.FLOAT,size:1}]),N=g(e),D=v(e,[{buffer:N,type:e.FLOAT,size:3}]),F=new n(e,y,r,i,o,a,d,p,b,A,x,w,k,M,T,S,E,L,C,z,R,j,P,I,O,N,D);return F.update(t),F}var p=t("gl-shader"),g=t("gl-buffer"),v=t("gl-vao"),m=t("gl-texture2d"),y=t("normals"),b=t("gl-mat4/multiply"),x=t("gl-mat4/invert"),_=t("ndarray"),w=t("colormap"),k=t("simplicial-complex-contour"),A=t("typedarray-pool"),M=t("./lib/shaders"),T=t("./lib/closest-point"),E=M.meshShader,L=M.wireShader,S=M.pointShader,C=M.pickShader,z=M.pointPickShader,j=M.contourShader,P=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],I=n.prototype;I.isOpaque=function(){return this.opacity>=1},I.isTransparent=function(){return this.opacity<1},I.pickSlots=1,I.setPickBase=function(t){this.pickId=t},I.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=A.mallocFloat32(6*o),s=0,l=0;o>l;++l)for(var c=r[l],u=0;2>u;++u){var h=c[0];2===c.length&&(h=c[u]);for(var f=n[h][0],d=n[h][1],p=i[h],g=1-p,v=this.positions[f],m=this.positions[d],y=0;3>y;++y)a[s++]=p*v[y]+g*m[y]}this.contourCount=s/3|0,this.contourPositions.update(a.subarray(0,s)),A.free(a)},I.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),"opacity"in t&&(this.opacity=t.opacity),t.texture?(this.texture.dispose(),this.texture=m(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=[],c=[],u=[],h=[],f=[],d=[],p=[],g=[],v=[],b=[],x=[],_=[],w=[];this.cells=r,this.positions=n;var k=t.vertexNormals,A=t.cellNormals;t.useFacetNormals&&!A&&(A=y.faceNormals(r,n)),A||k||(k=y.vertexNormals(r,n));var M=t.vertexColors,T=t.cellColors,E=t.meshColor||[1,1,1,1],L=t.vertexUVs,S=t.vertexIntensity,C=t.cellUVs,z=t.cellIntensity,j=1/0,P=-(1/0);if(!L&&!C)if(S)for(var I=0;I<S.length;++I){var R=S[I];j=Math.min(j,R),P=Math.max(P,R)}else if(z)for(var I=0;I<z.length;++I){var R=z[I];j=Math.min(j,R),P=Math.max(P,R)}else for(var I=0;I<n.length;++I){var R=n[I][2];j=Math.min(j,R),P=Math.max(P,R)}S?this.intensity=S:z?this.intensity=o(r,n.length,z):this.intensity=a(n);var O=t.pointSizes,N=t.pointSize||1;this.bounds=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]];for(var I=0;I<n.length;++I)for(var D=n[I],F=0;3>F;++F)!isNaN(D[F])&&isFinite(D[F])&&(this.bounds[0][F]=Math.min(this.bounds[0][F],D[F]),this.bounds[1][F]=Math.max(this.bounds[1][F],D[F]));var B=0,U=0,V=0;t:for(var I=0;I<r.length;++I){var q=r[I];switch(q.length){case 1:for(var H=q[0],D=n[H],F=0;3>F;++F)if(isNaN(D[F])||!isFinite(D[F]))continue t;v.push(D[0],D[1],D[2]);var G;G=M?M[H]:T?T[I]:E,3===G.length?b.push(G[0],G[1],G[2],1):b.push(G[0],G[1],G[2],G[3]);var Y;Y=L?L[H]:S?[(S[H]-j)/(P-j),0]:C?C[I]:z?[(z[I]-j)/(P-j),0]:[(D[2]-j)/(P-j),0],x.push(Y[0],Y[1]),O?_.push(O[H]):_.push(N),w.push(I),V+=1;break;case 2:for(var F=0;2>F;++F)for(var H=q[F],D=n[H],X=0;3>X;++X)if(isNaN(D[X])||!isFinite(D[X]))continue t;for(var F=0;2>F;++F){var H=q[F],D=n[H];f.push(D[0],D[1],D[2]);var G;G=M?M[H]:T?T[I]:E,3===G.length?d.push(G[0],G[1],G[2],1):d.push(G[0],G[1],G[2],G[3]);var Y;Y=L?L[H]:S?[(S[H]-j)/(P-j),0]:C?C[I]:z?[(z[I]-j)/(P-j),0]:[(D[2]-j)/(P-j),0],p.push(Y[0],Y[1]),g.push(I)}U+=1;break;case 3:for(var F=0;3>F;++F)for(var H=q[F],D=n[H],X=0;3>X;++X)if(isNaN(D[X])||!isFinite(D[X]))continue t;for(var F=0;3>F;++F){var H=q[F],D=n[H];s.push(D[0],D[1],D[2]);var G;G=M?M[H]:T?T[I]:E,3===G.length?l.push(G[0],G[1],G[2],1):l.push(G[0],G[1],G[2],G[3]);var Y;Y=L?L[H]:S?[(S[H]-j)/(P-j),0]:C?C[I]:z?[(z[I]-j)/(P-j),0]:[(D[2]-j)/(P-j),0],u.push(Y[0],Y[1]);var W;W=k?k[H]:A[I],c.push(W[0],W[1],W[2]),h.push(I)}B+=1}}this.pointCount=V,this.edgeCount=U,this.triangleCount=B,this.pointPositions.update(v),this.pointColors.update(b),this.pointUVs.update(x),this.pointSizes.update(_),this.pointIds.update(new Uint32Array(w)),this.edgePositions.update(f),this.edgeColors.update(d),this.edgeUVs.update(p),this.edgeIds.update(new Uint32Array(g)),this.trianglePositions.update(s),this.triangleColors.update(l),this.triangleUVs.update(u),this.triangleNormals.update(c),this.triangleIds.update(new Uint32Array(h))}},I.drawTransparent=I.draw=function(t){t=t||{};for(var e=this.gl,r=t.model||P,n=t.view||P,i=t.projection||P,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);b(l,s.view,s.model),b(l,s.projection,l),x(l,l);for(var a=0;3>a;++a)s.eyePosition[a]=l[12+a]/l[15];for(var c=l[15],a=0;3>a;++a)c+=this.lightPosition[a]*l[4*a+3];for(var a=0;3>a;++a){for(var u=l[12+a],h=0;3>h;++h)u+=l[4*h+a]*this.lightPosition[h];s.lightPosition[a]=u/c}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()}},I.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||P,n=t.view||P,i=t.projection||P,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()}},I.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;o<r.length;++o)i[o]=n[r[o]];var a=T(i,[t.coord[0],this._resolution[1]-t.coord[1]],this._model,this._view,this._projection,this._resolution);if(!a)return null;for(var s=a[2],l=0,o=0;o<r.length;++o)l+=s[o]*this.intensity[r[o]];return{position:a[1],index:r[a[0]],cell:r,cellId:e,intensity:l,dataCoordinate:this.positions[r[a[0]]]}},I.dispose=function(){this.texture.dispose(),this.triShader.dispose(),this.lineShader.dispose(),this.pointShader.dispose(),this.pickShader.dispose(),this.pointPickShader.dispose(),this.triangleVAO.dispose(),this.trianglePositions.dispose(),this.triangleColors.dispose(),this.triangleUVs.dispose(),this.triangleNormals.dispose(),this.triangleIds.dispose(),this.edgeVAO.dispose(),this.edgePositions.dispose(),this.edgeColors.dispose(),this.edgeUVs.dispose(),this.edgeIds.dispose(),this.pointVAO.dispose(),this.pointPositions.dispose(),this.pointColors.dispose(),this.pointUVs.dispose(),this.pointSizes.dispose(),this.pointIds.dispose(),this.contourVAO.dispose(),this.contourPositions.dispose(),this.contourShader.dispose()},e.exports=d},{"./lib/closest-point":105,"./lib/shaders":106,colormap:57,"gl-buffer":75,"gl-mat4/invert":94,"gl-mat4/multiply":96,"gl-shader":154,"gl-texture2d":185,"gl-vao":189,ndarray:208,normals:109,"simplicial-complex-contour":111,"typedarray-pool":233}],108:[function(t,e,r){"use strict";function n(t){for(var e=0,r=0;r<t.length;++r)e+=t[r];return e}function i(t,e){for(var r=e.length,i=new Array(r+1),a=0;r>a;++a){for(var s=new Array(r+1),l=0;r>=l;++l)s[l]=t[l][a];i[a]=s}i[r]=new Array(r+1);for(var a=0;r>=a;++a)i[r][a]=1;for(var c=new Array(r+1),a=0;r>a;++a)c[a]=e[a];c[r]=1;var u=o(i,c),h=n(u[r+1]);0===h&&(h=1);for(var f=new Array(r+1),a=0;r>=a;++a)f[a]=n(u[a])/h;return f}e.exports=i;var o=t("robust-linear-solve")},{"robust-linear-solve":211}],109:[function(t,e,r){var n=1e-6;r.vertexNormals=function(t,e){for(var r=e.length,i=new Array(r),o=0;r>o;++o)i[o]=[0,0,0];for(var o=0;o<t.length;++o)for(var a=t[o],s=0,l=a[a.length-1],c=a[0],u=0;u<a.length;++u){s=l,l=c,c=a[(u+1)%a.length];for(var h=e[s],f=e[l],d=e[c],p=new Array(3),g=0,v=new Array(3),m=0,y=0;3>y;++y)p[y]=h[y]-f[y],g+=p[y]*p[y],v[y]=d[y]-f[y],m+=v[y]*v[y];if(g*m>n)for(var b=i[l],x=1/Math.sqrt(g*m),y=0;3>y;++y){var _=(y+1)%3,w=(y+2)%3;b[y]+=x*(v[_]*p[w]-v[w]*p[_])}}for(var o=0;r>o;++o){for(var b=i[o],k=0,y=0;3>y;++y)k+=b[y]*b[y];if(k>n)for(var x=1/Math.sqrt(k),y=0;3>y;++y)b[y]*=x;else for(var y=0;3>y;++y)b[y]=0}return i},r.faceNormals=function(t,e){for(var r=t.length,i=new Array(r),o=0;r>o;++o){for(var a=t[o],s=new Array(3),l=0;3>l;++l)s[l]=e[a[l]];for(var c=new Array(3),u=new Array(3),l=0;3>l;++l)c[l]=s[1][l]-s[0][l],u[l]=s[2][l]-s[0][l];for(var h=new Array(3),f=0,l=0;3>l;++l){var d=(l+1)%3,p=(l+2)%3;h[l]=c[d]*u[p]-c[p]*u[d],f+=h[l]*h[l]}f=f>n?1/Math.sqrt(f):0;for(var l=0;3>l;++l)h[l]*=f;i[o]=h}return i}},{}],110:[function(t,e,r){"use strict";function n(t,e,r,n,s){i.length<n.length&&(i=new Float64Array(n.length),o=new Float64Array(n.length),a=new Float64Array(n.length));for(var l=0;l<n.length;++l)i[l]=t[l]-n[l],o[l]=e[l]-t[l],a[l]=r[l]-t[l];for(var c=0,u=0,h=0,f=0,d=0,p=0,l=0;l<n.length;++l){var g=o[l],v=a[l],m=i[l];c+=g*g,u+=g*v,h+=v*v,f+=m*g,d+=m*v,p+=m*m}var y,b=Math.abs(c*h-u*u),x=u*d-h*f,_=u*f-c*d;if(b>=x+_)if(0>x)0>_&&0>f?(_=0,-f>=c?(x=1,y=c+2*f+p):(x=-f/c,y=f*x+p)):(x=0,d>=0?(_=0,y=p):-d>=h?(_=1,y=h+2*d+p):(_=-d/h,y=d*_+p));else if(0>_)_=0,f>=0?(x=0,y=p):-f>=c?(x=1,y=c+2*f+p):(x=-f/c,y=f*x+p);else{var w=1/b;x*=w,_*=w,y=x*(c*x+u*_+2*f)+_*(u*x+h*_+2*d)+p}else{var k,A,M,T;0>x?(k=u+f,A=h+d,A>k?(M=A-k,T=c-2*u+h,M>=T?(x=1,_=0,y=c+2*f+p):(x=M/T,_=1-x,y=x*(c*x+u*_+2*f)+_*(u*x+h*_+2*d)+p)):(x=0,0>=A?(_=1,y=h+2*d+p):d>=0?(_=0,y=p):(_=-d/h,y=d*_+p))):0>_?(k=u+d,A=c+f,A>k?(M=A-k,T=c-2*u+h,M>=T?(_=1,x=0,y=h+2*d+p):(_=M/T,x=1-_,y=x*(c*x+u*_+2*f)+_*(u*x+h*_+2*d)+p)):(_=0,0>=A?(x=1,y=c+2*f+p):f>=0?(x=0,y=p):(x=-f/c,y=f*x+p))):(M=h+d-u-f,0>=M?(x=0,_=1,y=h+2*d+p):(T=c-2*u+h,M>=T?(x=1,_=0,y=c+2*f+p):(x=M/T,_=1-x,y=x*(c*x+u*_+2*f)+_*(u*x+h*_+2*d)+p)))}for(var E=1-x-_,l=0;l<n.length;++l)s[l]=E*t[l]+x*e[l]+_*r[l];return 0>y?0:y}var i=new Float64Array(4),o=new Float64Array(4),a=new Float64Array(4);e.exports=n},{}],111:[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]<e|0;return n}function o(t,e){for(var r=t.length,n=e*(e+1)/2*r|0,i=h.mallocUint32(2*n),o=0,a=0;r>a;++a)for(var s=t[a],e=s.length,l=0;e>l;++l)for(var c=0;l>c;++c){var d=s[c],p=s[l];i[o++]=0|Math.min(d,p),i[o++]=0|Math.max(d,p)}var g=o/2|0;f(u(i,[g,2]));for(var v=2,a=2;o>a;a+=2)(i[a-2]!==i[a]||i[a-1]!==i[a+1])&&(i[v++]=i[a],i[v++]=i[a+1]);return u(i,[v/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 c=i[2*l],f=i[2*l+1];if(r[c]!==r[f]){var d=e[c],p=e[f];i[2*s]=c,i[2*s+1]=f,a[s++]=(p-n)/(p-d)}}return t.shape[0]=s,u(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;++o<s;)r[2*o]=a,r[2*o+1]=a;r[2*o]=a}}for(r[2*o+1]=n;++o<e;)r[2*o]=r[2*o+1]=n;return r}function l(t){for(var e=0|t.shape[0],r=t.data,n=new Array(e),i=0;e>i;++i)n[i]=[r[2*i],r[2*i+1]];return n}function c(t,e,r,c){r=r||0,"undefined"==typeof c&&(c=n(t));var u=t.length;if(0===u||1>c)return{cells:[],vertexIds:[],vertexWeights:[]};var f=i(e,+r),p=o(t,c),g=a(p,e,f,+r),v=s(p,0|e.length),m=d(c)(t,p.data,v,f),y=l(p),b=[].slice.call(g.data,0,g.shape[0]);return h.free(f),h.free(p.data),h.free(g.data),h.free(v),{cells:m,vertexIds:y,vertexWeights:b}}e.exports=c;var u=t("ndarray"),h=t("typedarray-pool"),f=t("ndarray-sort"),d=t("./lib/codegen")},{"./lib/codegen":112,ndarray:208,"ndarray-sort":115,"typedarray-pool":233}],112:[function(t,e,r){"use strict";function n(t){function e(t){if(!(t.length<=0)){c.push("R.push(");for(var e=0;e<t.length;++e){var r=t[e];e>0&&c.push(","),c.push("[");for(var n=0;n<r.length;++n){var i=r[n];n>0&&c.push(","),c.push("B(C,E,c[",i[0],"],c[",i[1],"])")}c.push("]")}c.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<s.length;++l)r=Math.max(r,s[i].length);for(var c=["function B(C,E,i,j){","var a=Math.min(i,j)|0,b=Math.max(i,j)|0,l=C[2*a],h=C[2*a+1];","while(l<h){","var m=(l+h)>>1,v=E[2*m+1];","if(v===b){return m}","if(b<v){h=m}else{l=m+1}","}","return l;","};","function getContour",t,"d(F,E,C,S){","var n=F.length,R=[];","for(var i=0;i<n;++i){var c=F[i],l=c.length;"],i=t+1;i>1;--i){t+1>i&&c.push("else "),c.push("if(l===",i,"){");
for(var u=[],l=0;i>l;++l)u.push("(S[c["+l+"]]<<"+l+")");c.push("var M=",u.join("+"),";if(M===0||M===",(1<<i)-1,"){continue}switch(M){");for(var s=n[i-1],l=0;l<s.length;++l)c.push("case ",l,":"),e(s[l]),c.push("break;");c.push("}}")}c.push("}return R;};return getContour",t,"d");var h=new Function("pool",c.join(""));return h(o)}function i(t){var e=s[t];return e||(e=s[t]=n(t)),e}e.exports=i;var o=t("typedarray-pool"),a=t("marching-simplex-table"),s={}},{"marching-simplex-table":113,"typedarray-pool":233}],113:[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<<t+1)-1)return[];for(var r=[],i=[],o=0;t>=o;++o)if(e&1<<o){r.push(n(t,o-1,o-1)),i.push(null);for(var s=0;t>=s;++s)~e&1<<s&&(r.push(n(t,o-1,s-1)),i.push([o,s]))}var l=a(r),c=[];t:for(var o=0;o<l.length;++o){for(var u=l[o],h=[],s=0;s<u.length;++s){if(!i[u[s]])continue t;h.push(i[u[s]].slice())}c.push(h)}return c}function o(t){for(var e=1<<t+1,r=new Array(e),n=0;e>n;++n)r[n]=i(t,n);return r}e.exports=o;var a=t("convex-hull")},{"convex-hull":60}],114:[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)),c=n(e),u=["i,j,cptr,ptr=left*s0+offset"];if(t.length>1){for(var h=[],f=1;f<t.length;++f)u.push("i"+f),h.push("n"+f);c?u.push("scratch=malloc("+h.join("*")+")"):u.push("scratch=new Array("+h.join("*")+")"),u.push("dptr","sptr","a","b")}else u.push("scratch");if(a.push(["function ",s,"(",l.join(","),"){var ",u.join(",")].join(""),"for(i=left+1;i<=right;++i){","j=i;ptr+=s0","cptr=ptr"),t.length>1){a.push("dptr=0;sptr=ptr");for(var f=t.length-1;f>=0;--f){var d=t[f];0!==d&&a.push(["for(i",d,"=0;i",d,"<n",d,";++i",d,"){"].join(""))}a.push("scratch[dptr++]=",r("sptr"));for(var f=0;f<t.length;++f){var d=t[f];0!==d&&a.push("sptr+=d"+d,"}")}a.push("__g:while(j-->left){","dptr=0","sptr=cptr-s0");for(var f=1;f<t.length;++f)1===f&&a.push("__l:"),a.push(["for(i",f,"=0;i",f,"<n",f,";++i",f,"){"].join(""));a.push(["a=",r("sptr"),"\nb=scratch[dptr]\nif(a<b){break __g}\nif(a>b){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 d=t[f];0!==d&&a.push(["for(i",d,"=0;i",d,"<n",d,";++i",d,"){"].join(""))}a.push(o("dptr",r("sptr")));for(var f=0;f<t.length;++f){var d=t[f];0!==d&&a.push(["dptr+=d",d,";sptr+=d",d].join(""),"}")}a.push("cptr-=s0\n}"),a.push("dptr=cptr;sptr=0");for(var f=t.length-1;f>=0;--f){var d=t[f];0!==d&&a.push(["for(i",d,"=0;i",d,"<n",d,";++i",d,"){"].join(""))}a.push(o("dptr","scratch[sptr++]"));for(var f=0;f<t.length;++f){var d=t[f];0!==d&&a.push("dptr+=d"+d,"}")}}else a.push("scratch="+r("ptr"),"while((j-->left)&&("+r("cptr-s0")+">scratch)){",o("cptr",r("cptr-s0")),"cptr-=s0","}",o("cptr","scratch"));if(a.push("}"),t.length>1&&c&&a.push("free(scratch)"),a.push("} return "+s),c){var p=new Function("malloc","free",a.join("\n"));return p(c[0],c[1])}var p=new Function(a.join("\n"));return p()}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<e.length;++i)_.push(["b_ptr",i,"=s0*",e[i]].join(""));r&&_.push("pivot_ptr=0"),_.push("ptr_shift=offset");for(var i=t.length-1;i>=0;--i){var a=t[i];0!==a&&_.push(["for(i",a,"=0;i",a,"<n",a,";++i",a,"){"].join(""))}if(e.length>1)for(var i=0;i<e.length;++i)_.push(["ptr",i,"=b_ptr",i,"+ptr_shift"].join(""));_.push(n),r&&_.push("++pivot_ptr");for(var i=0;i<t.length;++i){var a=t[i];0!==a&&(e.length>1?_.push("ptr_shift+=d"+a):_.push("ptr0+=d"+a),_.push("}"))}}function u(e,r,n,i){if(1===r.length)_.push("ptr0="+o(r[0]));else{for(var a=0;a<r.length;++a)_.push(["b_ptr",a,"=s0*",r[a]].join(""));_.push("ptr_shift=offset")}n&&_.push("pivot_ptr=0"),e&&_.push(e+":");for(var a=1;a<t.length;++a)_.push(["for(i",a,"=0;i",a,"<n",a,";++i",a,"){"].join(""));if(r.length>1)for(var a=0;a<r.length;++a)_.push(["ptr",a,"=b_ptr",a,"+ptr_shift"].join(""));_.push(i);for(var a=t.length-1;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"+ ++M;u(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 d(e,r){t.length>1?l([e,r],!1,s("ptr0",a("ptr1"))):_.push(s(o(e),a(o(r))))}function p(e,r,n){if(t.length>1){var i="__l"+ ++M;u(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 g(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 v(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 m(t,e){g(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 b(e,r){_.push(["if((",r,"-",e,")<=",c,"){\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 x(e,r,n){t.length>1?(_.push(["__l",++M,":while(true){"].join("")),l([e],!0,["if(",a("ptr0"),"!==pivot",r,"[pivot_ptr]){break __l",M,"}"].join("")),_.push(n,"}")):_.push(["while(",a(o(e)),"===pivot",r,"){",n,"}"].join(""))}var _=["'use strict'"],w=["ndarrayQuickSort",t.join("d"),e].join(""),k=["left","right","data","offset"].concat(i(t.length)),A=n(e),M=0;_.push(["function ",w,"(",k.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=[],L=1;L<t.length;++L)E.push("n"+L),T.push("i"+L);for(var L=0;8>L;++L)T.push("b_ptr"+L);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("")),d("index2","left"),d("index4","right"),_.push("if(pivots_are_equal){"),_.push("for(k=less;k<=great;++k){"),p("comp","k",1),_.push("if(comp===0){continue}"),_.push("if(comp<0){"),_.push("if(k!==less){"),g("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),_.push("while(true){"),p("comp","great",1),_.push("if(comp>0){"),_.push("great--"),_.push("}else if(comp<0){"),v("k","less","great"),_.push("break"),_.push("}else{"),m("k","great"),_.push("break"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}else{"),_.push("for(k=less;k<=great;++k){"),p("comp_pivot1","k",1),_.push("if(comp_pivot1<0){"),_.push("if(k!==less){"),g("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),p("comp_pivot2","k",2),_.push("if(comp_pivot2>0){"),_.push("while(true){"),p("comp","great",2),_.push("if(comp>0){"),_.push("if(--great<k){break}"),_.push("continue"),_.push("}else{"),p("comp","great",1),_.push("if(comp<0){"),v("k","less","great"),_.push("}else{"),m("k","great"),_.push("}"),_.push("break"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),y("left","(less-1)",1),y("right","(great+1)",2),b("left","(less-2)"),b("(great+2)","right"),_.push("if(pivots_are_equal){"),h(),_.push("return"),_.push("}"),_.push("if(less<index1&&great>index5){"),x("less",1,"++less"),x("great",2,"--great"),_.push("for(k=less;k<=great;++k){"),p("comp_pivot1","k",1),_.push("if(comp_pivot1===0){"),_.push("if(k!==less){"),g("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),p("comp_pivot2","k",2),_.push("if(comp_pivot2===0){"),_.push("while(true){"),p("comp","great",2),_.push("if(comp===0){"),_.push("if(--great<k){break}"),_.push("continue"),_.push("}else{"),p("comp","great",1),_.push("if(comp<0){"),v("k","less","great"),_.push("}else{"),m("k","great"),_.push("}"),_.push("break"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),h(),b("less","great"),_.push("}return "+w),t.length>1&&A){var S=new Function("insertionSort","malloc","free",_.join("\n"));return S(r,A[0],A[1])}var S=new Function("insertionSort",_.join("\n"));return S(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"],u=0;u<t.length;++u)l.push(["s",u,"=stride[",u,"]|0,n",u,"=shape[",u,"]|0"].join(""));for(var h=new Array(t.length),f=[],u=0;u<t.length;++u){var d=t[u];0!==d&&(0===f.length?h[d]="1":h[d]=f.join("*"),f.push("n"+d))}for(var p=-1,g=-1,u=0;u<t.length;++u){var v=t[u];0!==v&&(p>0?l.push(["d",v,"=s",v,"-d",p,"*n",p].join("")):l.push(["d",v,"=s",v].join("")),p=v);var d=t.length-1-u;0!==d&&(g>0?l.push(["e",d,"=s",d,"-e",g,"*n",g,",f",d,"=",h[d],"-f",g,"*n",g].join("")):l.push(["e",d,"=s",d,",f",d,"=",h[d]].join("")),g=d)}r.push("var "+l.join(","));var m=["0","n0-1","data","offset"].concat(i(t.length));r.push(["if(n0<=",c,"){","insertionSort(",m.join(","),")}else{","quickSort(",m.join(","),")}"].join("")),r.push("}return "+n);var y=new Function("insertionSort","quickSort",r.join("\n")),b=o(t,e),x=a(t,e,b);return y(b,x)}var l=t("typedarray-pool"),c=32;e.exports=s},{"typedarray-pool":233}],115:[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":114}],116:[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,[0,0,0,1,1,0,1,1]),i=a(e,s.boxVert,s.lineFrag);return new n(t,r,i)}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.drawBox=function(){var t=[0,0],e=[0,0];return function(r,n,i,o,a){var s=this.plot,l=this.shader,c=s.gl;t[0]=r,t[1]=n,e[0]=i,e[1]=o,l.uniforms.lo=t,l.uniforms.hi=e,l.uniforms.color=a,c.drawArrays(c.TRIANGLE_STRIP,0,4)}}(),l.dispose=function(){this.vbo.dispose(),this.shader.dispose()}},{"./shaders":119,"gl-buffer":75,"gl-shader":154}],117:[function(t,e,r){"use strict";function n(t,e,r,n){this.plot=t,this.vbo=e,this.shader=r,this.tickShader=n,this.ticks=[[],[]]}function i(t,e){return t-e}function o(t){var e=t.gl,r=a(e),i=s(e,c.gridVert,c.gridFrag),o=s(e,c.tickVert,c.gridFrag),l=new n(t,r,i,o);return l}e.exports=o;var a=t("gl-buffer"),s=t("gl-shader"),l=t("binary-search-bounds"),c=t("./shaders"),u=n.prototype;u.draw=function(){var t=[0,0],e=[0,0],r=[0,0];return function(){for(var n=this.plot,i=this.vbo,o=this.shader,a=this.ticks,s=n.gl,l=n._tickBounds,c=n.dataBox,u=n.viewBox,h=n.gridLineWidth,f=n.gridLineColor,d=n.gridLineEnable,p=n.pixelRatio,g=0;2>g;++g){var v=l[g],m=l[g+2],y=m-v,b=.5*(c[g+2]+c[g]),x=c[g+2]-c[g];e[g]=2*y/x,t[g]=2*(v-b)/x}o.bind(),i.bind(),o.attributes.dataCoord.pointer(),o.uniforms.dataShift=t,o.uniforms.dataScale=e;for(var _=0,g=0;2>g;++g){r[0]=r[1]=0,r[g]=1,o.uniforms.dataAxis=r,o.uniforms.lineWidth=h[g]/(u[g+2]-u[g])*p,o.uniforms.color=f[g];var w=6*a[g].length;d[g]&&s.drawArrays(s.TRIANGLES,_,w),_+=w}}}(),u.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,c=this.vbo,u=this.tickShader,h=this.ticks,f=s.gl,d=s._tickBounds,p=s.dataBox,g=s.viewBox,v=s.pixelRatio,m=s.screenBox,y=m[2]-m[0],b=m[3]-m[1],x=g[2]-g[0],_=g[3]-g[1],w=0;2>w;++w){var k=d[w],A=d[w+2],M=A-k,T=.5*(p[w+2]+p[w]),E=p[w+2]-p[w];e[w]=2*M/E,t[w]=2*(k-T)/E}e[0]*=x/y,t[0]*=x/y,e[1]*=_/b,t[1]*=_/b,u.bind(),c.bind(),u.attributes.dataCoord.pointer();var L=u.uniforms;L.dataShift=t,L.dataScale=e;var S=s.tickMarkLength,C=s.tickMarkWidth,z=s.tickMarkColor,j=0,P=6*h[0].length,I=Math.min(l.ge(h[0],(p[0]-d[0])/(d[2]-d[0]),i),h[0].length),R=Math.min(l.gt(h[0],(p[2]-d[0])/(d[2]-d[0]),i),h[0].length),O=j+6*I,N=6*Math.max(0,R-I),D=Math.min(l.ge(h[1],(p[1]-d[1])/(d[3]-d[1]),i),h[1].length),F=Math.min(l.gt(h[1],(p[3]-d[1])/(d[3]-d[1]),i),h[1].length),B=P+6*D,U=6*Math.max(0,F-D);o[0]=2*(g[0]-S[1])/y-1,o[1]=(g[3]+g[1])/b-1,a[0]=S[1]*v/y,a[1]=C[1]*v/b,L.color=z[1],L.tickScale=a,L.dataAxis=n,L.screenOffset=o,f.drawArrays(f.TRIANGLES,B,U),o[0]=(g[2]+g[0])/y-1,o[1]=2*(g[1]-S[0])/b-1,a[0]=C[0]*v/y,a[1]=S[0]*v/b,L.color=z[0],L.tickScale=a,L.dataAxis=r,L.screenOffset=o,f.drawArrays(f.TRIANGLES,O,N),o[0]=2*(g[2]+S[3])/y-1,o[1]=(g[3]+g[1])/b-1,a[0]=S[3]*v/y,a[1]=C[3]*v/b,L.color=z[3],L.tickScale=a,L.dataAxis=n,L.screenOffset=o,f.drawArrays(f.TRIANGLES,B,U),o[0]=(g[2]+g[0])/y-1,o[1]=2*(g[3]+S[2])/b-1,a[0]=C[2]*v/y,a[1]=S[2]*v/b,L.color=z[2],L.tickScale=a,L.dataAxis=r,L.screenOffset=o,f.drawArrays(f.TRIANGLES,O,N)}}(),u.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 c=s[l],u=n[l],h=i[l],f=i[l+2],d=0;d<u.length;++d){var p=(u[d].x-h)/(f-h);c.push(p);for(var g=0;6>g;++g)o[a++]=p,o[a++]=t[g],o[a++]=e[g]}this.ticks=s,this.vbo.update(o)}}(),u.dispose=function(){this.vbo.dispose(),this.shader.dispose(),this.tickShader.dispose()}},{"./shaders":119,"binary-search-bounds":121,"gl-buffer":75,"gl-shader":154}],118:[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,c=this.shader,u=l.gl;t[0]=r,t[1]=n,e[0]=i,e[1]=o,c.uniforms.start=t,c.uniforms.end=e,c.uniforms.width=a*l.pixelRatio,c.uniforms.color=s,u.drawArrays(u.TRIANGLE_STRIP,0,4)}}(),l.dispose=function(){this.vbo.dispose(),this.shader.dispose()}},{"./shaders":119,"gl-buffer":75,"gl-shader":154}],119:[function(t,e,r){"use strict";var n="#define GLSLIFY 1\nprecision lowp float;\nuniform vec4 color;\nvoid main() {\n gl_FragColor = vec4(color.xyz * color.w, color.w);\n}\n";e.exports={lineVert:"#define GLSLIFY 1\nprecision mediump float;\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:"#define GLSLIFY 1\nprecision mediump float;\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:"#define GLSLIFY 1\nprecision mediump float;\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:"#define GLSLIFY 1\nprecision mediump float;\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"}},{}],120:[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,c.textVert,c.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"),c=t("./shaders"),u=n.prototype;u.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],c=i.gl,u=i.viewBox,h=i.dataBox,f=i.screenBox,d=i.pixelRatio,p=i.tickEnable,g=i.tickPad,v=i.tickColor,m=i.tickAngle,y=(i.tickMarkLength,i.labelEnable),b=i.labelPad,x=i.labelColor,_=i.labelAngle,w=this.labelOffset[n],k=this.labelCount[n],A=l.lt(a,h[n]),M=l.le(a,h[n+2]);t[0]=t[1]=0,t[n]=1,e[n]=(u[2+n]+u[n])/(f[2+n]-f[n])-1;var T=2/f[2+(1^n)]-f[1^n];e[1^n]=T*u[1^n]-1,p[n]&&(e[1^n]-=T*d*g[n],M>A&&(o.uniforms.dataAxis=t,o.uniforms.screenOffset=e,o.uniforms.color=v[n],o.uniforms.angle=m[n],c.drawArrays(c.TRIANGLES,s[A],s[M]-s[A]))),y[n]&&(e[1^n]-=T*d*b[n],o.uniforms.dataAxis=r,o.uniforms.screenOffset=e,o.uniforms.color=x[n],o.uniforms.angle=_[n],c.drawArrays(c.TRIANGLES,w,k)),e[1^n]=T*u[2+(1^n)]-1,p[n+2]&&(e[1^n]+=T*d*g[n+2],M>A&&(o.uniforms.dataAxis=t,o.uniforms.screenOffset=e,o.uniforms.color=v[n+2],o.uniforms.angle=m[n+2],c.drawArrays(c.TRIANGLES,s[A],s[M]-s[A]))),y[n+2]&&(e[1^n]+=T*d*b[n+2],o.uniforms.dataAxis=r,o.uniforms.screenOffset=e,o.uniforms.color=x[n+2],o.uniforms.angle=_[n+2],c.drawArrays(c.TRIANGLES,w,k))}}(),u.drawTitle=function(){var t=[0,0],e=[0,0];return function(){for(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,c=r.pixelRatio,u=0;2>u;++u)e[u]=2*(a[u]*c-o[u])/(o[2+u]-o[u])-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)}}(),u.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 c=0;2>c;++c){var u=o[c],h=o[c+2],f=h-u,d=.5*(a[c+2]+a[c]),p=a[c+2]-a[c],g=l[c],v=l[c+2],m=v-g,y=s[c],b=s[c+2],x=b-y;e[c]=2*f/p*m/x,t[c]=2*(u-d)/p*m/x}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()}}(),u.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],c=0;c<l.length;++c){for(var u=l[c],h=u.x,f=u.text,d=u.font||"sans-serif",p=u.fontSize||12,g=s(d,f).data,v=1/(n[i+2]-n[i]),m=n[i],y=0;y<g.length;y+=2)e.push(g[y]*p,-g[y+1]*p,(h-m)*v);o.push(Math.floor(e.length/3)),a.push(h)}this.tickOffset[i]=o,this.tickX[i]=a}for(var i=0;2>i;++i){this.labelOffset[i]=Math.floor(e.length/3);for(var g=s(t.labelFont[i],t.labels[i]).data,p=t.labelSize[i],c=0;c<g.length;c+=2)e.push(g[c]*p,-g[c+1]*p,0);this.labelCount[i]=Math.floor(e.length/3)-this.labelOffset[i]}this.titleOffset=Math.floor(e.length/3);for(var g=s(t.titleFont,t.title).data,p=t.titleSize,c=0;c<g.length;c+=2)e.push(g[c]*p,-g[c+1]*p,0);this.titleCount=Math.floor(e.length/3)-this.titleOffset,this.vbo.update(e)},u.dispose=function(){this.vbo.dispose(),this.shader.dispose()}},{"./shaders":119,"binary-search-bounds":121,"gl-buffer":75,"gl-shader":154,"text-cache":228}],121:[function(t,e,r){"use strict";function n(t,e,r,n,i){var o=["function ",t,"(a,l,h,",n.join(","),"){",i?"":"var i=",r?"l-1":"h+1",";while(l<=h){var m=(l+h)>>>1,x=a[m]"];return i?e.indexOf("c")<0?o.push(";if(x===y){return m}else if(x<=y){"):o.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"):o.push(";if(",e,"){i=m;"),r?o.push("l=m+1}else{h=m-1}"):o.push("h=m-1}else{l=m+1}"),o.push("}"),i?o.push("return -1};"):o.push("return i};"),o.join("")}function i(t,e,r,i){var o=new Function([n("A","x"+t+"y",e,["y"],i),n("P","c(x,y)"+t+"0",e,["y","c"],i),"function dispatchBsearch",r,"(a,y,c,l,h){if(typeof(c)==='function'){return P(a,(l===void 0)?0:l|0,(h===void 0)?a.length-1:h|0,y,c)}else{return A(a,(c===void 0)?0:c|0,(l===void 0)?a.length-1:l|0,y)}}return dispatchBsearch",r].join(""));return o()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],122:[function(t,e,r){"use strict";function n(t,e){this.gl=t,this.pickBuffer=e,this.screenBox=[0,0,t.drawingBufferWidth,t.drawingBufferHeight],this.viewBox=[0,0,0,0],this.dataBox=[-10,-10,10,10],this.gridLineEnable=[!0,!0],this.gridLineWidth=[1,1],this.gridLineColor=[[0,0,0,1],[0,0,0,1]],this.pixelRatio=1,this.tickMarkLength=[0,0,0,0],this.tickMarkWidth=[0,0,0,0],this.tickMarkColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.tickPad=[15,15,15,15],this.tickAngle=[0,0,0,0],this.tickEnable=[!0,!0,!0,!0],this.tickColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.labelPad=[15,15,15,15],this.labelAngle=[0,Math.PI/2,0,3*Math.PI/2],this.labelEnable=[!0,!0,!0,!0],this.labelColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.titleCenter=[0,0],this.titleEnable=!0,this.titleAngle=0,this.titleColor=[0,0,0,1],this.borderColor=[0,0,0,0],this.backgroundColor=[0,0,0,0],this.zeroLineEnable=[!0,!0],this.zeroLineWidth=[4,4],this.zeroLineColor=[[0,0,0,1],[0,0,0,1]],this.borderLineEnable=[!0,!0,!0,!0],this.borderLineWidth=[2,2,2,2],this.borderLineColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.grid=null,this.text=null,this.line=null,this.box=null,this.objects=[],this.overlays=[],this._tickBounds=[1/0,1/0,-(1/0),-(1/0)],this.dirty=!1,this.pickDirty=!1,this.pickDelay=120,this.pickRadius=10,this._pickTimeout=null,this._drawPick=this.drawPick.bind(this),this._depthCounter=0}function i(t){for(var e=t.slice(),r=0;r<e.length;++r)e[r]=e[r].slice();return e}function o(t,e){return t.x-e.x}function a(t){var e=t.gl,r=s(e,[e.drawingBufferWidth,e.drawingBufferHeight]),i=new n(e,r);return i.grid=l(i),i.text=c(i),i.line=u(i),i.box=h(i),i.update(t),i}e.exports=a;var s=t("gl-select-static"),l=t("./lib/grid"),c=t("./lib/text"),u=t("./lib/line"),h=t("./lib/box"),f=n.prototype;f.setDirty=function(){this.dirty=this.pickDirty=!0},f.setOverlayDirty=function(){this.dirty=!0},f.nextDepthValue=function(){return this._depthCounter++/65536},f.draw=function(){return function(){var t=this.gl,e=this.screenBox,r=this.viewBox,n=this.dataBox,i=this.pixelRatio,o=this.grid,a=this.line,s=this.text,l=this.objects;if(this._depthCounter=0,this.pickDirty&&(this._pickTimeout&&clearTimeout(this._pickTimeout),this.pickDirty=!1,this._pickTimeout=setTimeout(this._drawPick,this.pickDelay)),this.dirty){this.dirty=!1,t.bindFramebuffer(t.FRAMEBUFFER,null),t.enable(t.SCISSOR_TEST),t.disable(t.DEPTH_TEST),t.depthFunc(t.LESS),t.depthMask(!1),t.enable(t.BLEND),t.blendEquation(t.FUNC_ADD,t.FUNC_ADD),t.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA),t.scissor(e[0],e[1],e[2]-e[0],e[3]-e[1]);var c=this.borderColor;t.clearColor(c[0]*c[3],c[1]*c[3],c[2]*c[3],c[3]),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),t.scissor(r[0],r[1],r[2]-r[0],r[3]-r[1]),t.viewport(r[0],r[1],r[2]-r[0],r[3]-r[1]);var u=this.backgroundColor;t.clearColor(u[0]*u[3],u[1]*u[3],u[2]*u[3],u[3]),t.clear(t.COLOR_BUFFER_BIT),o.draw();var h=this.zeroLineEnable,f=this.zeroLineColor,d=this.zeroLineWidth;if(h[0]||h[1]){a.bind();for(var p=0;2>p;++p)if(h[p]&&n[p]<=0&&n[p+2]>=0){var g=e[p]-n[p]*(e[p+2]-e[p])/(n[p+2]-n[p]);0===p?a.drawLine(g,e[1],g,e[3],d[p],f[p]):a.drawLine(e[0],g,e[2],g,d[p],f[p])}}for(var p=0;p<l.length;++p)l[p].draw();t.viewport(e[0],e[1],e[2]-e[0],e[3]-e[1]),t.scissor(e[0],e[1],e[2]-e[0],e[3]-e[1]),this.grid.drawTickMarks(),a.bind();var v=this.borderLineEnable,m=this.borderLineWidth,y=this.borderLineColor;v[1]&&a.drawLine(r[0],r[1]-.5*m[1]*i,r[0],r[3]+.5*m[3]*i,m[1],y[1]),v[0]&&a.drawLine(r[0]-.5*m[0]*i,r[1],r[2]+.5*m[2]*i,r[1],m[0],y[0]),v[3]&&a.drawLine(r[2],r[1]-.5*m[1]*i,r[2],r[3]+.5*m[3]*i,m[3],y[3]),v[2]&&a.drawLine(r[0]-.5*m[0]*i,r[3],r[2]+.5*m[2]*i,r[3],m[2],y[2]),s.bind();for(var p=0;2>p;++p)s.drawTicks(p);this.titleEnable&&s.drawTitle();for(var b=this.overlays,p=0;p<b.length;++p)b[p].draw();t.disable(t.SCISSOR_TEST),t.disable(t.BLEND),t.depthMask(!0)}}}(),f.drawPick=function(){return function(){var t=this.pickBuffer;this.gl;this._pickTimeout=null,t.begin();for(var e=1,r=this.objects,n=0;n<r.length;++n)e=r[n].drawPick(e);t.end()}}(),f.pick=function(){return function(t,e){var r=this.pixelRatio,n=this.pickPixelRatio,i=this.viewBox,o=0|Math.round((t-i[0]/r)*n),a=0|Math.round((e-i[1]/r)*n),s=this.pickBuffer.query(o,a,this.pickRadius);if(!s)return null;for(var l=s.id+(s.value[0]<<8)+(s.value[1]<<16)+(s.value[2]<<24),c=this.objects,u=0;u<c.length;++u){var h=c[u].pick(o,a,l);if(h)return h}return null}}(),f.setScreenBox=function(t){var e=this.screenBox,r=this.pixelRatio;e[0]=0|Math.round(t[0]*r),e[1]=0|Math.round(t[1]*r),e[2]=0|Math.round(t[2]*r),e[3]=0|Math.round(t[3]*r),this.setDirty()},f.setDataBox=function(t){var e=this.dataBox,r=e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3];r&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],this.setDirty())},f.setViewBox=function(t){var e=this.pixelRatio,r=this.viewBox;r[0]=0|Math.round(t[0]*e),r[1]=0|Math.round(t[1]*e),r[2]=0|Math.round(t[2]*e),r[3]=0|Math.round(t[3]*e);var n=this.pickPixelRatio;this.pickBuffer.shape=[0|Math.round((t[2]-t[0])*n),0|Math.round((t[3]-t[1])*n)],this.setDirty()},f.update=function(t){t=t||{};var e=this.gl;this.pixelRatio=t.pixelRatio||1;var r=this.pixelRatio;this.pickPixelRatio=Math.max(r,1),this.setScreenBox(t.screenBox||[0,0,e.drawingBufferWidth/r,e.drawingBufferHeight/r]);this.screenBox;this.setViewBox(t.viewBox||[.125*(this.screenBox[2]-this.screenBox[0])/r,.125*(this.screenBox[3]-this.screenBox[1])/r,.875*(this.screenBox[2]-this.screenBox[0])/r,.875*(this.screenBox[3]-this.screenBox[1])/r]);var n=this.viewBox,a=(n[2]-n[0])/(n[3]-n[1]);this.setDataBox(t.dataBox||[-10,-10/a,10,10/a]),this.borderColor=(t.borderColor||[0,0,0,0]).slice(),this.backgroundColor=(t.backgroundColor||[0,0,0,0]).slice(),this.gridLineEnable=(t.gridLineEnable||[!0,!0]).slice(),this.gridLineWidth=(t.gridLineWidth||[1,1]).slice(),this.gridLineColor=i(t.gridLineColor||[[.5,.5,.5,1],[.5,.5,.5,1]]),this.zeroLineEnable=(t.zeroLineEnable||[!0,!0]).slice(),this.zeroLineWidth=(t.zeroLineWidth||[4,4]).slice(),this.zeroLineColor=i(t.zeroLineColor||[[0,0,0,1],[0,0,0,1]]),this.tickMarkLength=(t.tickMarkLength||[0,0,0,0]).slice(),this.tickMarkWidth=(t.tickMarkWidth||[0,0,0,0]).slice(),this.tickMarkColor=i(t.tickMarkColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]),this.titleCenter=(t.titleCenter||[.5*(n[0]+n[2])/r,(n[3]+120)/r]).slice(),this.titleEnable=!("titleEnable"in t&&!t.titleEnable),this.titleAngle=t.titleAngle||0,this.titleColor=(t.titleColor||[0,0,0,1]).slice(),this.labelPad=(t.labelPad||[15,15,15,15]).slice(),this.labelAngle=(t.labelAngle||[0,Math.PI/2,0,3*Math.PI/2]).slice(),this.labelEnable=(t.labelEnable||[!0,!0,!0,!0]).slice(),this.labelColor=i(t.labelColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]),this.tickPad=(t.tickPad||[15,15,15,15]).slice(),this.tickAngle=(t.tickAngle||[0,0,0,0]).slice(),this.tickEnable=(t.tickEnable||[!0,!0,!0,!0]).slice(),this.tickColor=i(t.tickColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]),this.borderLineEnable=(t.borderLineEnable||[!0,!0,!0,!0]).slice(),this.borderLineWidth=(t.borderLineWidth||[2,2,2,2]).slice(),this.borderLineColor=i(t.borderLineColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]);var s=t.ticks||[[],[]],l=this._tickBounds;l[0]=l[1]=1/0,l[2]=l[3]=-(1/0);for(var c=0;2>c;++c){var u=s[c].slice(0);0!==u.length&&(u.sort(o),l[c]=Math.min(l[c],u[0].x),l[c+2]=Math.max(l[c+2],u[u.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;r<e.length;++r)if(e[r]===t){e.splice(r,1),this.setDirty();break}},f.addOverlay=function(t){this.overlays.indexOf(t)<0&&(this.overlays.push(t),this.setOverlayDirty())},f.removeOverlay=function(t){for(var e=this.overlays,r=0;r<e.length;++r)if(e[r]===t){e.splice(r,1),this.setOverlayDirty();break}}},{"./lib/box":116,"./lib/grid":117,"./lib/line":118,"./lib/text":120,"gl-select-static":153}],123:[function(t,e,r){var n=t("gl-shader"),i="#define GLSLIFY 1\nprecision mediump float;\nattribute vec2 position;\nvarying vec2 uv;\nvoid main() {\n uv = position;\n gl_Position = vec4(position, 0, 1);\n}",o="#define GLSLIFY 1\nprecision mediump float;\n\nuniform sampler2D accumBuffer;\nvarying vec2 uv;\n\nvoid main() {\n vec4 accum = texture2D(accumBuffer, 0.5 * (uv + 1.0));\n gl_FragColor = min(vec4(1,1,1,1), accum);\n}";
e.exports=function(t){return n(t,i,o,null,[{name:"position",type:"vec2"}])}},{"gl-shader":154}],124:[function(t,e,r){"use strict";function n(t,e){t=t||document.body,e=e||{};var r=[.01,1/0];"distanceLimits"in e&&(r[0]=e.distanceLimits[0],r[1]=e.distanceLimits[1]),"zoomMin"in e&&(r[0]=e.zoomMin),"zoomMax"in e&&(r[1]=e.zoomMax);var n=o({center:e.center||[0,0,0],up:e.up||[0,1,0],eye:e.eye||[0,0,10],mode:e.mode||"orbit",distanceLimits:r}),l=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],c=0,u=t.clientWidth,h=t.clientHeight,f={view:n,element:t,delay:e.delay||16,rotateSpeed:e.rotateSpeed||1,zoomSpeed:e.zoomSpeed||1,translateSpeed:e.translateSpeed||1,flipX:!!e.flipX,flipY:!!e.flipY,modes:n.modes,tick:function(){var e=i(),r=this.delay;n.idle(e-r),n.flush(e-(100+2*r));var o=e-2*r;n.recalcMatrix(o);for(var a=!0,s=n.computedMatrix,f=0;16>f;++f)a=a&&l[f]===s[f],l[f]=s[f];var d=t.clientWidth===u&&t.clientHeight===h;return u=t.clientWidth,h=t.clientHeight,a?!d:(c=Math.exp(n.computedRadius[0]),!0)},lookAt:function(t,e,r){n.lookAt(n.lastT(),t,e,r)},rotate:function(t,e,r){n.rotate(n.lastT(),t,e,r)},pan:function(t,e,r){n.pan(n.lastT(),t,e,r)},translate:function(t,e,r){n.translate(n.lastT(),t,e,r)}};Object.defineProperties(f,{matrix:{get:function(){return n.computedMatrix},set:function(t){return n.setMatrix(n.lastT(),t),n.computedMatrix},enumerable:!0},mode:{get:function(){return n.getMode()},set:function(t){return n.setMode(t),n.getMode()},enumerable:!0},center:{get:function(){return n.computedCenter},set:function(t){return n.lookAt(n.lastT(),t),n.computedCenter},enumerable:!0},eye:{get:function(){return n.computedEye},set:function(t){return n.lookAt(n.lastT(),null,t),n.computedEye},enumerable:!0},up:{get:function(){return n.computedUp},set:function(t){return n.lookAt(n.lastT(),null,null,t),n.computedUp},enumerable:!0},distance:{get:function(){return c},set:function(t){return n.setDistance(n.lastT(),t),t},enumerable:!0},distanceLimits:{get:function(){return n.getDistanceLimits(r)},set:function(t){return n.setDistanceLimits(t),t},enumerable:!0}}),t.addEventListener("contextmenu",function(t){return t.preventDefault(),!1});var d=0,p=0;return a(t,function(e,r,o,a){var s=1/t.clientHeight,l=s*(r-d),u=s*(o-p),h=f.flipX?1:-1,g=f.flipY?1:-1,v=Math.PI*f.rotateSpeed,m=i();if(1&e)a.shift?n.rotate(m,0,0,-l*v):n.rotate(m,h*v*l,-g*v*u,0);else if(2&e)n.pan(m,-f.translateSpeed*l*c,f.translateSpeed*u*c,0);else if(4&e){var y=f.zoomSpeed*u/window.innerHeight*(m-n.lastT())*50;n.pan(m,0,0,c*(Math.exp(y)-1))}d=r,p=o}),s(t,function(t,e,r){var o=f.flipX?1:-1,a=f.flipY?1:-1,s=i();if(Math.abs(t)>Math.abs(e))n.rotate(s,0,0,-t*o*Math.PI*f.rotateSpeed/window.innerWidth);else{var l=f.zoomSpeed*a*e/window.innerHeight*(s-n.lastT())/100;n.pan(s,0,0,c*(Math.exp(l)-1))}},!0),f}e.exports=n;var i=t("right-now"),o=t("3d-view"),a=t("mouse-change"),s=t("mouse-wheel")},{"3d-view":38,"mouse-change":196,"mouse-wheel":200,"right-now":210}],125:[function(t,e,r){!function(){"use strict";function t(e){e.permitHostObjects___&&e.permitHostObjects___(t)}function r(t){return!(t.substr(0,d.length)==d&&"___"===t.substr(t.length-3))}function n(t){if(t!==Object(t))throw new TypeError("Not an object: "+t);var e=t[p];if(e&&e.key===t)return e;if(f(t)){e={key:t};try{return h(t,p,{value:e,writable:!1,enumerable:!1,configurable:!1}),e}catch(r){return}}}function i(t){return t.prototype=null,Object.freeze(t)}function o(){y||"undefined"==typeof console||(y=!0,console.warn("WeakMap should be invoked as new WeakMap(), not WeakMap(). This will be an error in the future."))}if("undefined"==typeof ses||!ses.ok||ses.ok()){"undefined"!=typeof ses&&(ses.weakMapPermitHostObjects=t);var a=!1;if("function"==typeof WeakMap){var s=WeakMap;if("undefined"!=typeof navigator&&/Firefox/.test(navigator.userAgent));else{var l=new s,c=Object.freeze({});if(l.set(c,1),1===l.get(c))return void(e.exports=WeakMap);a=!0}}var u=(Object.prototype.hasOwnProperty,Object.getOwnPropertyNames),h=Object.defineProperty,f=Object.isExtensible,d="weakmap:",p=d+"ident:"+Math.random()+"___";if("undefined"!=typeof crypto&&"function"==typeof crypto.getRandomValues&&"function"==typeof ArrayBuffer&&"function"==typeof Uint8Array){var g=new ArrayBuffer(25),v=new Uint8Array(g);crypto.getRandomValues(v),p=d+"rand:"+Array.prototype.map.call(v,function(t){return(t%36).toString(36)}).join("")+"___"}if(h(Object,"getOwnPropertyNames",{value:function(t){return u(t).filter(r)}}),"getPropertyNames"in Object){var m=Object.getPropertyNames;h(Object,"getPropertyNames",{value:function(t){return m(t).filter(r)}})}!function(){var t=Object.freeze;h(Object,"freeze",{value:function(e){return n(e),t(e)}});var e=Object.seal;h(Object,"seal",{value:function(t){return n(t),e(t)}});var r=Object.preventExtensions;h(Object,"preventExtensions",{value:function(t){return n(t),r(t)}})}();var y=!1,b=0,x=function(){function t(t,e){var r,i=n(t);return i?c in i?i[c]:e:(r=s.indexOf(t),r>=0?l[r]:e)}function e(t){var e=n(t);return e?c in e:s.indexOf(t)>=0}function r(t,e){var r,i=n(t);return i?i[c]=e:(r=s.indexOf(t),r>=0?l[r]=e:(r=s.length,l[r]=e,s[r]=t)),this}function a(t){var e,r,i=n(t);return i?c in i&&delete i[c]:(e=s.indexOf(t),0>e?!1:(r=s.length-1,s[e]=void 0,l[e]=l[r],s[e]=s[r],s.length=r,l.length=r,!0))}this instanceof x||o();var s=[],l=[],c=b++;return Object.create(x.prototype,{get___:{value:i(t)},has___:{value:i(e)},set___:{value:i(r)},delete___:{value:i(a)}})};x.prototype=Object.create(Object.prototype,{get:{value:function(t,e){return this.get___(t,e)},writable:!0,configurable:!0},has:{value:function(t){return this.has___(t)},writable:!0,configurable:!0},set:{value:function(t,e){return this.set___(t,e)},writable:!0,configurable:!0},"delete":{value:function(t){return this.delete___(t)},writable:!0,configurable:!0}}),"function"==typeof s?!function(){function r(){function e(t,e){return u?c.has(t)?c.get(t):u.get___(t,e):c.get(t,e)}function r(t){return c.has(t)||(u?u.has___(t):!1)}function n(t){var e=!!c.delete(t);return u?u.delete___(t)||e:e}this instanceof x||o();var l,c=new s,u=void 0,h=!1;return l=a?function(t,e){return c.set(t,e),c.has(t)||(u||(u=new x),u.set(t,e)),this}:function(t,e){if(h)try{c.set(t,e)}catch(r){u||(u=new x),u.set___(t,e)}else c.set(t,e);return this},Object.create(x.prototype,{get___:{value:i(e)},has___:{value:i(r)},set___:{value:i(l)},delete___:{value:i(n)},permitHostObjects___:{value:i(function(e){if(e!==t)throw new Error("bogus call to permitHostObjects___");h=!0})}})}a&&"undefined"!=typeof Proxy&&(Proxy=void 0),r.prototype=x.prototype,e.exports=r,Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:!1,configurable:!0,writable:!0})}():("undefined"!=typeof Proxy&&(Proxy=void 0),e.exports=x)}}()},{}],126:[function(t,e,r){"use strict";function n(t){var e=s.get(t);if(!e||!t.isBuffer(e._triangleBuffer.buffer)){var r=o(t,new Float32Array([-1,-1,-1,4,4,-1]));e=a(t,[{buffer:r,type:t.FLOAT,size:2}]),e._triangleBuffer=r,s.set(t,e)}e.bind(),t.drawArrays(t.TRIANGLES,0,3),e.unbind()}var i="undefined"==typeof WeakMap?t("weak-map"):WeakMap,o=t("gl-buffer"),a=t("gl-vao"),s=new i;e.exports=n},{"gl-buffer":75,"gl-vao":189,"weak-map":125}],127:[function(t,e,r){"use strict";function n(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function i(t){this.gl=t,this.pixelRatio=1,this.bounds=[[-10,-10,-10],[10,10,10]],this.ticks=[[],[],[]],this.autoTicks=!0,this.tickSpacing=[1,1,1],this.tickEnable=[!0,!0,!0],this.tickFont=["sans-serif","sans-serif","sans-serif"],this.tickSize=[12,12,12],this.tickAngle=[0,0,0],this.tickColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.tickPad=[10,10,10],this.lastCubeProps={cubeEdges:[0,0,0],axis:[0,0,0]},this.labels=["x","y","z"],this.labelEnable=[!0,!0,!0],this.labelFont="sans-serif",this.labelSize=[20,20,20],this.labelAngle=[0,0,0],this.labelColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.labelPad=[10,10,10],this.lineEnable=[!0,!0,!0],this.lineMirror=[!1,!1,!1],this.lineWidth=[1,1,1],this.lineColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.lineTickEnable=[!0,!0,!0],this.lineTickMirror=[!1,!1,!1],this.lineTickLength=[0,0,0],this.lineTickWidth=[1,1,1],this.lineTickColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.gridEnable=[!0,!0,!0],this.gridWidth=[1,1,1],this.gridColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.zeroEnable=[!0,!0,!0],this.zeroLineColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.zeroLineWidth=[2,2,2],this.backgroundEnable=[!1,!1,!1],this.backgroundColor=[[.8,.8,.8,.5],[.8,.8,.8,.5],[.8,.8,.8,.5]],this._firstInit=!0,this._text=null,this._lines=null,this._background=u(t)}function o(){this.primalOffset=[0,0,0],this.primalMinor=[0,0,0],this.mirrorOffset=[0,0,0],this.mirrorMinor=[0,0,0]}function a(t,e,r,n,i){for(var o=t.primalOffset,a=t.primalMinor,s=t.mirrorOffset,l=t.mirrorMinor,c=n[e],u=0;3>u;++u)if(e!==u){var h=o,f=s,d=a,p=l;c&1<<u&&(h=s,f=o,d=l,p=a),h[u]=r[0][u],f[u]=r[1][u],i[u]>0?(d[u]=-1,p[u]=0):(d[u]=0,p[u]=1)}}function s(t,e){var r=new i(t);return r.update(e),r}e.exports=s;var l=t("./lib/text.js"),c=t("./lib/lines.js"),u=t("./lib/background.js"),h=t("./lib/cube.js"),f=t("./lib/ticks.js"),d=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),p=i.prototype;p.update=function(t){function e(e,r,n){if(n in t){var i,o=t[n],a=this[n];(e?Array.isArray(o)&&Array.isArray(o[0]):Array.isArray(o))?this[n]=i=[r(o[0]),r(o[1]),r(o[2])]:this[n]=i=[r(o),r(o),r(o)];for(var s=0;3>s;++s)if(i[s]!==a[s])return!0}return!1}t=t||{};var r,n=e.bind(this,!1,Number),i=e.bind(this,!1,Boolean),o=e.bind(this,!1,String),a=e.bind(this,!0,function(t){if(Array.isArray(t)){if(3===t.length)return[+t[0],+t[1],+t[2],1];if(4===t.length)return[+t[0],+t[1],+t[2],+t[3]]}return[0,0,0,1]}),s=!1,u=!1;if("bounds"in t)for(var h=t.bounds,d=0;2>d;++d)for(var p=0;3>p;++p)h[d][p]!==this.bounds[d][p]&&(u=!0),this.bounds[d][p]=h[d][p];if("ticks"in t){r=t.ticks,s=!0,this.autoTicks=!1;for(var d=0;3>d;++d)this.tickSpacing[d]=0}else n("tickSpacing")&&(this.autoTicks=!0,u=!0);if(this._firstInit&&("ticks"in t||"tickSpacing"in t||(this.autoTicks=!0),u=!0,s=!0,this._firstInit=!1),u&&this.autoTicks&&(r=f.create(this.bounds,this.tickSpacing),s=!0),s){for(var d=0;3>d;++d)r[d].sort(function(t,e){return t.x-e.x});f.equal(r,this.ticks)?s=!1:this.ticks=r}i("tickEnable"),o("tickFont")&&(s=!0),n("tickSize"),n("tickAngle"),n("tickPad"),a("tickColor");var g=o("labels");o("labelFont")&&(g=!0),i("labelEnable"),n("labelSize"),n("labelPad"),a("labelColor"),i("lineEnable"),i("lineMirror"),n("lineWidth"),a("lineColor"),i("lineTickEnable"),i("lineTickMirror"),n("lineTickLength"),n("lineTickWidth"),a("lineTickColor"),i("gridEnable"),n("gridWidth"),a("gridColor"),i("zeroEnable"),a("zeroLineColor"),n("zeroLineWidth"),i("backgroundEnable"),a("backgroundColor"),this._text?this._text&&(g||s)&&this._text.update(this.bounds,this.labels,this.labelFont,this.ticks,this.tickFont):this._text=l(this.gl,this.bounds,this.labels,this.labelFont,this.ticks,this.tickFont),this._lines&&s&&(this._lines.dispose(),this._lines=null),this._lines||(this._lines=c(this.gl,this.bounds,this.ticks))};var g=[new o,new o,new o],v=[0,0,0],m={model:d,view:d,projection:d};p.isOpaque=function(){return!0},p.isTransparent=function(){return!1},p.drawTransparent=function(t){};var y=[0,0,0],b=[0,0,0],x=[0,0,0];p.draw=function(t){t=t||m;for(var e=this.gl,r=t.model||d,i=t.view||d,o=t.projection||d,s=this.bounds,l=h(r,i,o,s),c=l.cubeEdges,u=l.axis,f=i[12],p=i[13],_=i[14],w=i[15],k=this.pixelRatio*(o[3]*f+o[7]*p+o[11]*_+o[15]*w)/e.drawingBufferHeight,A=0;3>A;++A)this.lastCubeProps.cubeEdges[A]=c[A],this.lastCubeProps.axis[A]=u[A];for(var M=g,A=0;3>A;++A)a(g[A],A,this.bounds,c,u);for(var e=this.gl,T=v,A=0;3>A;++A)this.backgroundEnable[A]?T[A]=u[A]:T[A]=0;this._background.draw(r,i,o,s,T,this.backgroundColor),this._lines.bind(r,i,o,this);for(var A=0;3>A;++A){var E=[0,0,0];u[A]>0?E[A]=s[1][A]:E[A]=s[0][A];for(var L=0;2>L;++L){var S=(A+1+L)%3,C=(A+1+(1^L))%3;this.gridEnable[S]&&this._lines.drawGrid(S,C,this.bounds,E,this.gridColor[S],this.gridWidth[S]*this.pixelRatio)}for(var L=0;2>L;++L){var S=(A+1+L)%3,C=(A+1+(1^L))%3;this.zeroEnable[C]&&s[0][C]<=0&&s[1][C]>=0&&this._lines.drawZero(S,C,this.bounds,E,this.zeroLineColor[C],this.zeroLineWidth[C]*this.pixelRatio)}}for(var A=0;3>A;++A){this.lineEnable[A]&&this._lines.drawAxisLine(A,this.bounds,M[A].primalOffset,this.lineColor[A],this.lineWidth[A]*this.pixelRatio),this.lineMirror[A]&&this._lines.drawAxisLine(A,this.bounds,M[A].mirrorOffset,this.lineColor[A],this.lineWidth[A]*this.pixelRatio);for(var z=n(y,M[A].primalMinor),j=n(b,M[A].mirrorMinor),P=this.lineTickLength,L=0;3>L;++L){var I=k/r[5*L];z[L]*=P[L]*I,j[L]*=P[L]*I}this.lineTickEnable[A]&&this._lines.drawAxisTicks(A,M[A].primalOffset,z,this.lineTickColor[A],this.lineTickWidth[A]*this.pixelRatio),this.lineTickMirror[A]&&this._lines.drawAxisTicks(A,M[A].mirrorOffset,j,this.lineTickColor[A],this.lineTickWidth[A]*this.pixelRatio)}this._text.bind(r,i,o,this.pixelRatio);for(var A=0;3>A;++A){for(var R=M[A].primalMinor,O=n(x,M[A].primalOffset),L=0;3>L;++L)this.lineTickEnable[A]&&(O[L]+=k*R[L]*Math.max(this.lineTickLength[L],0)/r[5*L]);if(this.tickEnable[A]){for(var L=0;3>L;++L)O[L]+=k*R[L]*this.tickPad[L]/r[5*L];this._text.drawTicks(A,this.tickSize[A],this.tickAngle[A],O,this.tickColor[A])}if(this.labelEnable[A]){for(var L=0;3>L;++L)O[L]+=k*R[L]*this.labelPad[L]/r[5*L];O[A]+=.5*(s[0][A]+s[1][A]),this._text.drawLabel(A,this.labelSize[A],this.labelAngle[A],O,this.labelColor[A])}}},p.dispose=function(){this._text.dispose(),this._lines.dispose(),this._background.dispose(),this._lines=null,this._text=null,this._background=null,this.gl=null}},{"./lib/background.js":128,"./lib/cube.js":129,"./lib/lines.js":130,"./lib/text.js":132,"./lib/ticks.js":133}],128:[function(t,e,r){"use strict";function n(t,e,r,n){this.gl=t,this.buffer=e,this.vao=r,this.shader=n}function i(t){for(var e=[],r=[],i=0,l=0;3>l;++l)for(var c=(l+1)%3,u=(l+2)%3,h=[0,0,0],f=[0,0,0],d=-1;1>=d;d+=2){r.push(i,i+2,i+1,i+1,i+2,i+3),h[l]=d,f[l]=d;for(var p=-1;1>=p;p+=2){h[c]=p;for(var g=-1;1>=g;g+=2)h[u]=g,e.push(h[0],h[1],h[2],f[0],f[1],f[2]),i+=1}var v=c;c=u,u=v}var m=o(t,new Float32Array(e)),y=o(t,new Uint16Array(r),t.ELEMENT_ARRAY_BUFFER),b=a(t,[{buffer:m,type:t.FLOAT,size:3,offset:0,stride:24},{buffer:m,type:t.FLOAT,size:3,offset:12,stride:24}],y),x=s(t);return x.attributes.position.location=0,x.attributes.normal.location=1,new n(t,m,b,x)}e.exports=i;var o=t("gl-buffer"),a=t("gl-vao"),s=t("./shaders").bg,l=n.prototype;l.draw=function(t,e,r,n,i,o){for(var a=!1,s=0;3>s;++s)a=a||i[s];if(a){var l=this.gl;l.enable(l.POLYGON_OFFSET_FILL),l.polygonOffset(1,2),this.shader.bind(),this.shader.uniforms={model:t,view:e,projection:r,bounds:n,enable:i,colors:o},this.vao.bind(),this.vao.draw(this.gl.TRIANGLES,36),l.disable(l.POLYGON_OFFSET_FILL)}},l.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders":131,"gl-buffer":75,"gl-vao":189}],129:[function(t,e,r){"use strict";function n(t,e,r){for(var n=0;4>n;++n){t[n]=r[12+n];for(var i=0;3>i;++i)t[n]+=e[i]*r[4*i+n]}}function i(t){for(var e=0;e<g.length;++e)if(t=l.positive(t,g[e]),t.length<3)return 0;for(var r=t[0],n=r[0]/r[3],i=r[1]/r[3],o=0,e=1;e+1<t.length;++e){var a=t[e],s=t[e+1],c=a[0]/a[3],u=a[1]/a[3],h=s[0]/s[3],f=s[1]/s[3],d=c-n,p=u-i,v=h-n,m=f-i;o+=Math.abs(d*m-p*v)}return o}function o(t,e,r,o){s(u,e,t),s(u,r,u);for(var l=0,g=0;2>g;++g){d[2]=o[g][2];for(var b=0;2>b;++b){d[1]=o[b][1];for(var x=0;2>x;++x)d[0]=o[x][0],n(h[l],d,u),l+=1}}for(var _=-1,g=0;8>g;++g){for(var w=h[g][3],k=0;3>k;++k)f[g][k]=h[g][k]/w;0>w&&(0>_?_=g:f[g][2]<f[_][2]&&(_=g))}if(0>_){_=0;for(var A=0;3>A;++A){for(var M=(A+2)%3,T=(A+1)%3,E=-1,L=-1,S=0;2>S;++S){var C=S<<A,z=C+(S<<M)+(1-S<<T),j=C+(1-S<<M)+(S<<T);c(f[C],f[z],f[j],p)<0||(S?E=1:L=1)}if(0>E||0>L)L>E&&(_|=1<<A);else{for(var S=0;2>S;++S){var C=S<<A,z=C+(S<<M)+(1-S<<T),j=C+(1-S<<M)+(S<<T),P=i([h[C],h[z],h[j],h[C+(1<<M)+(1<<T)]]);S?E=P:L=P}L>E&&(_|=1<<A)}}}for(var I=7^_,R=-1,g=0;8>g;++g)g!==_&&g!==I&&(0>R?R=g:f[R][1]>f[g][1]&&(R=g));for(var O=-1,g=0;3>g;++g){var N=R^1<<g;if(N!==_&&N!==I){0>O&&(O=N);var T=f[N];T[0]<f[O][0]&&(O=N)}}for(var D=-1,g=0;3>g;++g){var N=R^1<<g;if(N!==_&&N!==I&&N!==O){0>D&&(D=N);var T=f[N];T[0]>f[D][0]&&(D=N)}}var F=v;F[0]=F[1]=F[2]=0,F[a.log2(O^R)]=R&O,F[a.log2(R^D)]=R&D;var B=7^D;B===_||B===I?(B=7^O,F[a.log2(D^B)]=B&D):F[a.log2(O^B)]=B&O;for(var U=m,V=_,A=0;3>A;++A)V&1<<A?U[A]=-1:U[A]=1;return y}e.exports=o;var a=t("bit-twiddle"),s=t("gl-mat4/multiply"),l=(t("gl-mat4/invert"),t("split-polygon")),c=t("robust-orientation"),u=new Array(16),h=(new Array(16),new Array(8)),f=new Array(8),d=new Array(3),p=[0,0,0];!function(){for(var t=0;8>t;++t)h[t]=[1,1,1,1],f[t]=[1,1,1]}();var g=[[0,0,1,0,0],[0,0,-1,1,0],[0,-1,0,1,0],[0,1,0,1,0],[-1,0,0,1,0],[1,0,0,1,0]],v=[1,1,1],m=[0,0,0],y={cubeEdges:v,axis:m}},{"bit-twiddle":49,"gl-mat4/invert":94,"gl-mat4/multiply":96,"robust-orientation":214,"split-polygon":135}],130:[function(t,e,r){"use strict";function n(t){return t[0]=t[1]=t[2]=0,t}function i(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function o(t,e,r,n,i,o,a,s){this.gl=t,this.vertBuffer=e,this.vao=r,this.shader=n,this.tickCount=i,this.tickOffset=o,this.gridCount=a,this.gridOffset=s}function a(t,e,r){var n=[],i=[0,0,0],a=[0,0,0],u=[0,0,0],h=[0,0,0];n.push(0,0,1,0,1,1,0,0,-1,0,0,-1,0,1,1,0,1,-1);for(var f=0;3>f;++f){for(var d=n.length/3|0,p=0;p<r[f].length;++p){var g=+r[f][p].x;n.push(g,0,1,g,1,1,g,0,-1,g,0,-1,g,1,1,g,1,-1)}var v=n.length/3|0;i[f]=d,a[f]=v-d;for(var d=n.length/3|0,m=0;m<r[f].length;++m){var g=+r[f][m].x;n.push(g,0,1,g,1,1,g,0,-1,g,0,-1,g,1,1,g,1,-1)}var v=n.length/3|0;u[f]=d,h[f]=v-d}var y=s(t,new Float32Array(n)),b=l(t,[{buffer:y,type:t.FLOAT,size:3,stride:0,offset:0}]),x=c(t);return x.attributes.position.location=0,new o(t,y,b,x,a,i,h,u)}e.exports=a;var s=t("gl-buffer"),l=t("gl-vao"),c=t("./shaders").line,u=[0,0,0],h=[0,0,0],f=[0,0,0],d=[0,0,0],p=[1,1],g=o.prototype;g.bind=function(t,e,r){this.shader.bind(),this.shader.uniforms.model=t,this.shader.uniforms.view=e,this.shader.uniforms.projection=r,p[0]=this.gl.drawingBufferWidth,p[1]=this.gl.drawingBufferHeight,this.shader.uniforms.screenShape=p,this.vao.bind()},g.drawAxisLine=function(t,e,r,o,a){var s=n(h);this.shader.uniforms.majorAxis=h,s[t]=e[1][t]-e[0][t],this.shader.uniforms.minorAxis=s;var l=i(d,r);l[t]+=e[0][t],this.shader.uniforms.offset=l,this.shader.uniforms.lineWidth=a,this.shader.uniforms.color=o;var c=n(f);c[(t+2)%3]=1,this.shader.uniforms.screenAxis=c,this.vao.draw(this.gl.TRIANGLES,6);var c=n(f);c[(t+1)%3]=1,this.shader.uniforms.screenAxis=c,this.vao.draw(this.gl.TRIANGLES,6)},g.drawAxisTicks=function(t,e,r,i,o){var a=n(u);a[t]=1,this.shader.uniforms.majorAxis=a,this.shader.uniforms.offset=e,this.shader.uniforms.minorAxis=r,this.shader.uniforms.color=i,this.shader.uniforms.lineWidth=o;var s=n(f);s[t]=1,this.shader.uniforms.screenAxis=s,this.vao.draw(this.gl.TRIANGLES,this.tickCount[t],this.tickOffset[t])},g.drawGrid=function(t,e,r,o,a,s){var l=n(h);l[e]=r[1][e]-r[0][e],this.shader.uniforms.minorAxis=l;var c=i(d,o);c[e]+=r[0][e],this.shader.uniforms.offset=c;var p=n(u);p[t]=1,this.shader.uniforms.majorAxis=p;var g=n(f);g[t]=1,this.shader.uniforms.screenAxis=g,this.shader.uniforms.lineWidth=s,this.shader.uniforms.color=a,this.vao.draw(this.gl.TRIANGLES,this.gridCount[t],this.gridOffset[t])},g.drawZero=function(t,e,r,o,a,s){var l=n(h);this.shader.uniforms.majorAxis=l,l[t]=r[1][t]-r[0][t],this.shader.uniforms.minorAxis=l;var c=i(d,o);c[t]+=r[0][t],this.shader.uniforms.offset=c;var u=n(f);u[e]=1,this.shader.uniforms.screenAxis=u,this.shader.uniforms.lineWidth=s,this.shader.uniforms.color=a,this.vao.draw(this.gl.TRIANGLES,6)},g.dispose=function(){this.vao.dispose(),this.vertBuffer.dispose(),this.shader.dispose()}},{"./shaders":131,"gl-buffer":75,"gl-vao":189}],131:[function(t,e,r){"use strict";var n=t("gl-shader"),i="#define GLSLIFY 1\nattribute vec3 position;\n\nuniform mat4 model, view, projection;\nuniform vec3 offset, majorAxis, minorAxis, screenAxis;\nuniform float lineWidth;\nuniform vec2 screenShape;\n\nvec3 project(vec3 p) {\n vec4 pp = projection * view * model * vec4(p, 1.0);\n return pp.xyz / max(pp.w, 0.0001);\n}\n\nvoid main() {\n vec3 major = position.x * majorAxis;\n vec3 minor = position.y * minorAxis;\n\n vec3 vPosition = major + minor + offset;\n vec3 pPosition = project(vPosition);\n vec3 offset = project(vPosition + screenAxis * position.z);\n\n vec2 screen = normalize((offset - pPosition).xy * screenShape) / screenShape;\n\n gl_Position = vec4(pPosition + vec3(0.5 * screen * lineWidth, 0), 1.0);\n}\n",o="#define GLSLIFY 1\nprecision mediump float;\nuniform vec4 color;\nvoid main() {\n gl_FragColor = color;\n}";r.line=function(t){return n(t,i,o,null,[{name:"position",type:"vec3"}])};var a="#define GLSLIFY 1\nattribute vec3 position;\n\nuniform mat4 model, view, projection;\nuniform vec3 offset, axis;\nuniform float scale, angle, pixelScale;\nuniform vec2 resolution;\n\nvoid main() { \n //Compute plane offset\n vec2 planeCoord = position.xy * pixelScale;\n mat2 planeXform = scale * mat2(cos(angle), sin(angle),\n -sin(angle), cos(angle));\n vec2 viewOffset = 2.0 * planeXform * planeCoord / resolution;\n\n //Compute world offset\n float axisDistance = position.z;\n vec3 dataPosition = axisDistance * axis + offset;\n vec4 worldPosition = model * vec4(dataPosition, 1);\n \n //Compute clip position\n vec4 viewPosition = view * worldPosition;\n vec4 clipPosition = projection * viewPosition;\n clipPosition /= clipPosition.w;\n\n //Apply text offset in clip coordinates\n clipPosition += vec4(viewOffset, 0, 0);\n\n //Done\n gl_Position = clipPosition;\n}",s="#define GLSLIFY 1\nprecision mediump float;\nuniform vec4 color;\nvoid main() {\n gl_FragColor = color;\n}";r.text=function(t){return n(t,a,s,null,[{name:"position",type:"vec3"}])};var l="#define GLSLIFY 1\nattribute vec3 position;\nattribute vec3 normal;\n\nuniform mat4 model, view, projection;\nuniform vec3 enable;\nuniform vec3 bounds[2];\n\nvarying vec3 colorChannel;\n\nvoid main() {\n if(dot(normal, enable) > 0.0) {\n vec3 nPosition = mix(bounds[0], bounds[1], 0.5 * (position + 1.0));\n gl_Position = projection * view * model * vec4(nPosition, 1.0);\n } else {\n gl_Position = vec4(0,0,0,0);\n }\n colorChannel = abs(normal);\n}",c="#define GLSLIFY 1\nprecision mediump float;\n\nuniform vec4 colors[3];\n\nvarying vec3 colorChannel;\n\nvoid main() {\n gl_FragColor = colorChannel.x * colors[0] + \n colorChannel.y * colors[1] +\n colorChannel.z * colors[2];\n}";r.bg=function(t){return n(t,l,c,null,[{name:"position",type:"vec3"},{name:"normal",type:"vec3"}])}},{"gl-shader":154}],132:[function(t,e,r){(function(r){"use strict";function n(t,e,r,n){this.gl=t,this.shader=e,this.buffer=r,this.vao=n,this.tickOffset=this.tickCount=this.labelOffset=this.labelCount=null}function i(t,e){try{return l(t,e)}catch(r){return console.warn("error vectorizing text:",r),{cells:[],positions:[]}}}function o(t,e,r,i,o,l){var u=a(t),h=s(t,[{buffer:u,size:3}]),f=c(t);f.attributes.position.location=0;var d=new n(t,f,u,h);return d.update(e,r,i,o,l),d}e.exports=o;var a=t("gl-buffer"),s=t("gl-vao"),l=t("vectorize-text"),c=t("./shaders").text,u=window||r.global||{},h=u.__TEXT_CACHE||{};u.__TEXT_CACHE={};var f=3,d=n.prototype,p=[0,0];d.bind=function(t,e,r,n){this.vao.bind(),this.shader.bind();var i=this.shader.uniforms;i.model=t,i.view=e,i.projection=r,i.pixelScale=n,p[0]=this.gl.drawingBufferWidth,p[1]=this.gl.drawingBufferHeight,this.shader.uniforms.resolution=p},d.update=function(t,e,r,n,o){function a(t,e,r,n){var o=h[r];o||(o=h[r]={});var a=o[e];a||(a=o[e]=i(e,{triangles:!0,font:r,textAlign:"center",textBaseline:"middle"}));for(var l=(n||12)/12,c=a.positions,u=a.cells,f=0,d=u.length;d>f;++f)for(var p=u[f],g=2;g>=0;--g){var v=c[p[g]];s.push(l*v[0],-l*v[1],t)}}for(var s=(this.gl,[]),l=[0,0,0],c=[0,0,0],u=[0,0,0],d=[0,0,0],p=0;3>p;++p){u[p]=s.length/f|0,a(.5*(t[0][p]+t[1][p]),e[p],r),d[p]=(s.length/f|0)-u[p],l[p]=s.length/f|0;for(var g=0;g<n[p].length;++g)n[p][g].text&&a(n[p][g].x,n[p][g].text,n[p][g].font||o,n[p][g].fontSize||12);c[p]=(s.length/f|0)-l[p]}this.buffer.update(s),this.tickOffset=l,this.tickCount=c,this.labelOffset=u,this.labelCount=d};var g=[0,0,0];d.drawTicks=function(t,e,r,n,i){var o=g;o[0]=o[1]=o[2]=0,o[t]=1,this.shader.uniforms.axis=o,this.shader.uniforms.color=i,this.shader.uniforms.angle=r,this.shader.uniforms.scale=e,this.shader.uniforms.offset=n,this.vao.draw(this.gl.TRIANGLES,this.tickCount[t],this.tickOffset[t])};var v=[0,0,0];d.drawLabel=function(t,e,r,n,i){this.shader.uniforms.axis=v,this.shader.uniforms.color=i,this.shader.uniforms.angle=r,this.shader.uniforms.scale=e,this.shader.uniforms.offset=n,this.vao.draw(this.gl.TRIANGLES,this.labelCount[t],this.labelOffset[t])},d.dispose=function(){this.shader.dispose(),this.vao.dispose(),this.buffer.dispose()}}).call(this,t("_process"))},{"./shaders":131,_process:55,"gl-buffer":75,"gl-vao":189,"vectorize-text":235}],133:[function(t,e,r){"use strict";function n(t,e){var r=t+"",n=r.indexOf("."),i=0;n>=0&&(i=r.length-n-1);var o=Math.pow(10,i),a=Math.round(t*e*o),s=a+"";if(s.indexOf("e")>=0)return s;var l=a/o,c=a%o;0>a?(l=0|-Math.ceil(l),c=0|-c):(l=0|Math.floor(l),c=0|c);var u=""+l;if(0>a&&(u="-"+u),i){for(var h=""+c;h.length<i;)h="0"+h;return u+"."+h}return u}function i(t,e){for(var r=[],i=0;3>i;++i){for(var o=[],a=(.5*(t[0][i]+t[1][i]),0);a*e[i]<=t[1][i];++a)o.push({x:a*e[i],text:n(e[i],a)});for(var a=-1;a*e[i]>=t[0][i];--a)o.push({x:a*e[i],text:n(e[i],a)});r.push(o)}return r}function o(t,e){for(var r=0;3>r;++r){if(t[r].length!==e[r].length)return!1;for(var n=0;n<t[r].length;++n){var i=t[r][n],o=e[r][n];if(i.x!==o.x||i.text!==o.text)return!1}}return!0}r.create=i,r.equal=o},{}],134:[function(t,e,r){"use strict";function n(t,e,r){var n=e||0,i=r||1;return[[t[12]+t[0],t[13]+t[1],t[14]+t[2],t[15]+t[3]],[t[12]-t[0],t[13]-t[1],t[14]-t[2],t[15]-t[3]],[t[12]+t[4],t[13]+t[5],t[14]+t[6],t[15]+t[7]],[t[12]-t[4],t[13]-t[5],t[14]-t[6],t[15]-t[7]],[n*t[12]+t[8],n*t[13]+t[9],n*t[14]+t[10],n*t[15]+t[11]],[i*t[12]-t[8],i*t[13]-t[9],i*t[14]-t[10],i*t[15]-t[11]]]}e.exports=n},{}],135:[function(t,e,r){"use strict";function n(t,e){var r=c(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),c=0;s>c;++c)l[c]=o*t[c]+a*r[c];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],c=0;c<t.length;++c,s=l){l=t[c];var u=n(l,e);if(0>a&&u>0||a>0&&0>u){var h=i(s,u,l,a);r.push(h),o.push(h.slice())}0>u?o.push(l.slice()):u>0?r.push(l.slice()):(r.push(l.slice()),o.push(l.slice())),a=u}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;l<t.length;++l,a=s){s=t[l];var c=n(s,e);(0>o&&c>0||o>0&&0>c)&&r.push(i(a,c,s,o)),c>=0&&r.push(s.slice()),o=c}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;l<t.length;++l,a=s){s=t[l];var c=n(s,e);(0>o&&c>0||o>0&&0>c)&&r.push(i(a,c,s,o)),0>=c&&r.push(s.slice()),o=c}return r}var l=t("robust-dot-product"),c=t("robust-sum");e.exports=o,e.exports.positive=a,e.exports.negative=s},{"robust-dot-product":136,"robust-sum":217}],136:[function(t,e,r){"use strict";function n(t,e){for(var r=i(t[0],e[0]),n=1;n<t.length;++n)r=o(r,i(t[n],e[n]));return r}var i=t("two-product"),o=t("robust-sum");e.exports=n},{"robust-sum":217,"two-product":231}],137:[function(t,e,r){"use strict";function n(t,e,r){this.lo=t,this.hi=e,this.pixelsPerDataUnit=r}function i(t,e,r,n,i){for(var o=0;3>o;++o){for(var a=p,s=g,l=0;3>l;++l)s[l]=a[l]=r[l];s[3]=a[3]=1,s[o]+=1,h(s,s,e),s[3]<0&&(t[o]=1/0),a[o]-=1,h(a,a,e),a[3]<0&&(t[o]=1/0);var c=(a[0]/a[3]-s[0]/s[3])*n,u=(a[1]/a[3]-s[1]/s[3])*i;t[o]=.25*Math.sqrt(c*c+u*u)}return t}function o(t,e,r,n,o){var h=e.model||f,p=e.view||f,g=e.projection||f,y=t.bounds,o=o||l(h,p,g,y),b=o.axis;o.edges;c(d,p,h),c(d,g,d);for(var x=v,_=0;3>_;++_)x[_].lo=1/0,x[_].hi=-(1/0),x[_].pixelsPerDataUnit=1/0;var w=a(u(d,d));u(d,d);for(var k=0;3>k;++k){var A=(k+1)%3,M=(k+2)%3,T=m;t:for(var _=0;2>_;++_){var E=[];if(b[k]<0!=!!_){T[k]=y[_][k];for(var L=0;2>L;++L){T[A]=y[L^_][A];for(var S=0;2>S;++S)T[M]=y[S^L^_][M],E.push(T.slice())}for(var L=0;L<w.length;++L){if(0===E.length)continue t;E=s.positive(E,w[L])}for(var L=0;L<E.length;++L)for(var M=E[L],C=i(m,d,M,r,n),S=0;3>S;++S)x[S].lo=Math.min(x[S].lo,M[S]),x[S].hi=Math.max(x[S].hi,M[S]),S!==k&&(x[S].pixelsPerDataUnit=Math.min(x[S].pixelsPerDataUnit,Math.abs(C[S])))}}}return x}e.exports=o;var a=t("extract-frustum-planes"),s=t("split-polygon"),l=t("./lib/cube.js"),c=t("gl-mat4/multiply"),u=t("gl-mat4/transpose"),h=t("gl-vec4/transformMat4"),f=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),d=new Float32Array(16),p=[0,0,0,1],g=[0,0,0,1],v=[new n(1/0,-(1/0),1/0),new n(1/0,-(1/0),1/0),new n(1/0,-(1/0),1/0)],m=[0,0,0]},{"./lib/cube.js":129,"extract-frustum-planes":134,"gl-mat4/multiply":96,"gl-mat4/transpose":104,"gl-vec4/transformMat4":190,"split-polygon":135}],138:[function(t,e,r){"use strict";var n=t("gl-shader"),i="#define GLSLIFY 1\nprecision mediump float;\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="#define GLSLIFY 1\nprecision mediump float;\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":154}],139:[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),c=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}]),u=s(t);u.attributes.position.location=0,u.attributes.color.location=1,u.attributes.weight.location=2;var h=new n(t,l,c,u);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],c=n.prototype,u=[0,0,0],h=[0,0,0],f=[0,0];c.isTransparent=function(){return!1},c.drawTransparent=function(t){},c.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 c=u,d=h,p=0;3>p;++p)i&&i[p]<0?(c[p]=this.bounds[0][p],d[p]=this.bounds[1][p]):(c[p]=this.bounds[1][p],d[p]=this.bounds[0][p]);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,c,d],n.uniforms.colors=this.colors,n.uniforms.screenShape=f;for(var p=0;3>p;++p)n.uniforms.lineWidth=this.lineWidth[p]*this.pixelRatio,
this.enabled[p]&&(r.draw(e.TRIANGLES,6,6*p),this.drawSides[p]&&r.draw(e.TRIANGLES,12,18+12*p));r.unbind()},c.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))},c.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders/index":138,"gl-buffer":75,"gl-vao":189}],140:[function(t,e,r){"use strict";function n(){this.mouse=[-1,-1],this.screen=null,this.distance=1/0,this.index=null,this.dataCoordinate=null,this.dataPosition=null,this.object=null,this.data=null}function i(t,e){var r=null;try{r=t.getContext("webgl",e),r||(r=t.getContext("experimental-webgl",e))}catch(n){return null}return r}function o(t){var e=Math.round(Math.log(Math.abs(t))/Math.log(10));if(0>e){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(!_&&H.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*H.pixelRatio),i=0|Math.ceil(r*H.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",D=!0}}}function r(){for(var t=I.length,e=N.length,r=0;e>r;++r)O[r]=0;t:for(var r=0;t>r;++r){var n=I[r],i=n.pickSlots;if(i){for(var o=0;e>o;++o)if(O[o]+i<255){R[r]=o,n.setPickBase(O[o]+1),O[o]+=i;continue t}var a=f(A,q);R[r]=e,N.push(a),O.push(i),n.setPickBase(1),e+=1}else R[r]=-1}for(;e>0&&0===O[e-1];)O.pop(),N.pop().dispose()}function s(){return H.contextLost?!0:void(A.isContextLost()&&(H.contextLost=!0,H.mouseListener.enabled=!1,H.selection.object=null,H.oncontextloss&&H.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=I.length,e=N.length,r=0;e>r;++r){var n=N[r];n.shape=G,n.begin();for(var i=0;t>i;++i)if(R[i]===r){var o=I[i];o.drawPick&&(o.pixelRatio=1,o.drawPick(V))}n.end()}}}function b(){if(!s()){e();var t=H.camera.tick();V.view=H.camera.matrix,D=D||t,F=F||t,z.pixelRatio=H.pixelRatio,P.pixelRatio=H.pixelRatio;var r=I.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=I[a];l.pixelRatio=H.pixelRatio,l.axes=H.axes,D=D||!!l.dirty,F=F||!!l.dirty;var c=l.bounds;if(c)for(var h=c[0],f=c[1],d=0;3>d;++d)n[d]=Math.min(n[d],h[d]),i[d]=Math.max(i[d],f[d])}var g=H.bounds;if(H.autoBounds)for(var d=0;3>d;++d){if(i[d]<n[d])n[d]=-1,i[d]=1;else{n[d]===i[d]&&(n[d]-=1,i[d]+=1);var m=.05*(i[d]-n[d]);n[d]=n[d]-m,i[d]=i[d]+m}g[0][d]=n[d],g[1][d]=i[d]}for(var b=!1,d=0;3>d;++d)b=b||Z[0][d]!==g[0][d]||Z[1][d]!==g[1][d],Z[0][d]=g[0][d],Z[1][d]=g[1][d];if(b){for(var x=[0,0,0],a=0;3>a;++a)x[a]=o((g[1][a]-g[0][a])/10);z.autoTicks?z.update({bounds:g,tickSpacing:x}):z.update({bounds:g})}F=F||b,D=D||b;var _=A.drawingBufferWidth,w=A.drawingBufferHeight;q[0]=_,q[1]=w,G[0]=0|Math.max(_/H.pixelRatio,1),G[1]=0|Math.max(w/H.pixelRatio,1),v(B,H.fovy,_/w,H.zNear,H.zFar);for(var a=0;16>a;++a)U[a]=0;U[15]=1;for(var k=0,a=0;3>a;++a)k=Math.max(k,g[1][a]-g[0][a]);for(var a=0;3>a;++a)H.autoScale?U[5*a]=H.aspect[a]/(g[1][a]-g[0][a]):U[5*a]=1/k,H.autoCenter&&(U[12+a]=.5*-U[5*a]*(g[0][a]+g[1][a]));for(var a=0;r>a;++a){var l=I[a];l.axesBounds=g,H.clipToBounds&&(l.clipBounds=g)}if(T.object&&(H.snapToData?P.position=T.dataCoordinate:P.position=T.dataPosition,P.bounds=g),F&&(F=!1,y()),D){H.axesPixels=u(H.axes,V,_,w),H.onrender&&H.onrender(),A.bindFramebuffer(A.FRAMEBUFFER,null),A.viewport(0,0,_,w);var M=H.clearColor;A.clearColor(M[0],M[1],M[2],M[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 S=!1;z.enable&&(S=S||z.isTransparent(),z.draw(V)),P.axes=z,T.object&&P.draw(V),A.disable(A.CULL_FACE);for(var a=0;r>a;++a){var l=I[a];l.axes=z,l.pixelRatio=H.pixelRatio,l.isOpaque&&l.isOpaque()&&l.draw(V),l.isTransparent&&l.isTransparent()&&(S=!0)}if(S){E.shape=q,E.bind(),A.clear(A.DEPTH_BUFFER_BIT),A.colorMask(!1,!1,!1,!1),A.depthMask(!0),A.depthFunc(A.LESS),z.enable&&z.isTransparent()&&z.drawTransparent(V);for(var a=0;r>a;++a){var l=I[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),z.isTransparent()&&z.drawTransparent(V);for(var a=0;r>a;++a){var l=I[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),L.bind(),E.color[0].bind(0),L.uniforms.accumBuffer=0,p(A),A.disable(A.BLEND)}D=!1;for(var a=0;r>a;++a)I[a].dirty=!1}}}function x(){_||H.contextLost||(requestAnimationFrame(x),b())}t=t||{};var _=!1,w=(t.pixelRatio||parseFloat(window.devicePixelRatio),t.canvas);if(!w)if(w=document.createElement("canvas"),t.container){var k=t.container;k.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 M=t.bounds||[[-10,-10,-10],[10,10,10]],T=new n,E=d(A,[A.drawingBufferWidth,A.drawingBufferHeight],{preferFloat:!0}),L=m(A),S=t.camera||{eye:[2,0,0],center:[0,0,0],up:[0,1,0],zoomMin:.1,zoomMax:100,mode:"turntable"},C=t.axes||{},z=c(A,C);z.enable=!C.disable;var j=t.spikes||{},P=h(A,j),I=[],R=[],O=[],N=[],D=!0,F=!0,B=new Array(16),U=new Array(16),V={view:null,projection:B,model:U},F=!0,q=[A.drawingBufferWidth,A.drawingBufferHeight],H={gl:A,contextLost:!1,pixelRatio:t.pixelRatio||parseFloat(window.devicePixelRatio),canvas:w,selection:T,camera:l(w,S),axes:z,axesPixels:null,spikes:P,bounds:M,objects:I,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},G=[A.drawingBufferWidth/H.pixelRatio|0,A.drawingBufferHeight/H.pixelRatio|0];H.autoResize&&e(),window.addEventListener("resize",e),H.update=function(t){_||(t=t||{},D=!0,F=!0)},H.add=function(t){_||(t.axes=z,I.push(t),R.push(-1),D=!0,F=!0,r())},H.remove=function(t){if(!_){var e=I.indexOf(t);0>e||(I.splice(e,1),R.pop(),D=!0,F=!0,r())}},H.dispose=function(){if(!_&&(_=!0,window.removeEventListener("resize",e),w.removeEventListener("webglcontextlost",s),H.mouseListener.enabled=!1,!H.contextLost)){z.dispose(),P.dispose();for(var t=0;t<I.length;++t)I[t].dispose();E.dispose();for(var t=0;t<N.length;++t)N[t].dispose();L.dispose(),A=null,z=null,P=null,I=[]}};var Y=!1,X=0;H.mouseListener=g(w,function(t,e,r){if(!_){var n=N.length,i=I.length,o=T.object;T.distance=1/0,T.mouse[0]=e,T.mouse[1]=r,T.object=null,T.screen=null,T.dataCoordinate=T.dataPosition=null;var a=!1;if(t)Y=!0;else{Y&&(F=!0),Y=!1;for(var s=0;n>s;++s){var l=N[s].query(e,G[1]-r-1,H.pickRadius);if(l){if(l.distance>T.distance)continue;for(var c=0;i>c;++c){var u=I[c];if(R[c]===s){var h=u.pick(l);h&&(T.screen=l.coord,T.distance=l.distance,T.object=u,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),D=!0),T.object&&(T.object.highlight&&T.object.highlight(T.data),D=!0),a=a||T.object!==o,a&&H.onselect&&H.onselect(T),1&t&&!(1&X)&&H.onclick&&H.onclick(T),X=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 x(),H.redraw=function(){_||(D=!0,b())},H}e.exports=s;var l=t("3d-view-controls"),c=t("gl-axes3d"),u=t("gl-axes3d/properties"),h=t("gl-spikes3d"),f=t("gl-select-static"),d=t("gl-fbo"),p=t("a-big-triangle"),g=t("mouse-change"),v=t("gl-mat4/perspective"),m=t("./lib/shader")},{"./lib/shader":123,"3d-view-controls":124,"a-big-triangle":126,"gl-axes3d":127,"gl-axes3d/properties":137,"gl-fbo":80,"gl-mat4/perspective":97,"gl-select-static":153,"gl-spikes3d":139,"mouse-change":196}],141:[function(t,e,r){"use strict";e.exports={vertex:"#define GLSLIFY 1\nprecision mediump float;\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:"#define GLSLIFY 1\nprecision lowp float;\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = vec4(fragColor.rgb * fragColor.a, fragColor.a);\n}\n",pickVertex:"#define GLSLIFY 1\nprecision mediump float;\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:"#define GLSLIFY 1\nprecision lowp float;\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = fragColor;\n}\n"}},{}],142:[function(t,e,r){"use strict";function n(t){if(t in f)return f[t];var e=u(t,{polygons:!0,font:"sans-serif",textAlign:"left",textBaseline:"alphabetic"}),r=[],n=[];e.forEach(function(t){t.forEach(function(t){for(var e=0;e<t.length;++e){var i=t[(e+t.length-1)%t.length],o=t[e],a=t[(e+1)%t.length],s=t[(e+2)%t.length],l=o[0]-i[0],c=o[1]-i[1],u=Math.sqrt(l*l+c*c);l/=u,c/=u,r.push(i[0],i[1]+1.4),n.push(c,-l),r.push(i[0],i[1]+1.4),n.push(-c,l),r.push(o[0],o[1]+1.4),n.push(-c,l),r.push(o[0],o[1]+1.4),n.push(-c,l),r.push(i[0],i[1]+1.4),n.push(c,-l),r.push(o[0],o[1]+1.4),n.push(c,-l);var h=s[0]-a[0],f=s[1]-a[1],d=Math.sqrt(h*h+f*f);h/=d,f/=d,r.push(o[0],o[1]+1.4),n.push(c,-l),r.push(o[0],o[1]+1.4),n.push(-c,l),r.push(a[0],a[1]+1.4),n.push(-f,h),r.push(a[0],a[1]+1.4),n.push(-f,h),r.push(o[0],o[1]+1.4),n.push(f,-h),r.push(a[0],a[1]+1.4),n.push(f,-h)}})});for(var i=[1/0,1/0,-(1/0),-(1/0)],o=0;o<r.length;o+=2)for(var a=0;2>a;++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),c=s(r),u=s(r),f=s(r),d=new i(t,n,o,l,c,u,f);return d.update(e),t.addObject(d),d}e.exports=o;var a=t("gl-shader"),s=t("gl-buffer"),l=t("text-cache"),c=t("typedarray-pool"),u=t("vectorize-text"),h=t("./lib/shaders"),f={},d=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],c=o[2]-o[0],u=o[3]-o[1];e[0]=2*s/c,e[4]=2*l/u,e[6]=2*(n[0]-o[0])/c-1,e[7]=2*(n[1]-o[1])/u-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];d.draw=function(){var n=this.plot,i=this.shader,o=this.numVertices,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];d.drawPick=function(i){var o=this.plot,a=this.pickShader,s=this.numVertices,l=o.gl;this.pickOffset=i;for(var c=0;4>c;++c)n[c]=i>>8*c&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}}(),d.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]]}},d.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 u=this.bounds=[1/0,1/0,-(1/0),-(1/0)],h=0,f=0;f<i.length;++f){h+=l("sans-serif",i[f]).data.length+n(i[f]).coords.length>>1;for(var d=0;2>d;++d)u[d]=Math.min(u[d],e[2*f+d]),u[2+d]=Math.max(u[2+d],e[2*f+d])}u[0]===u[2]&&(u[2]+=1),u[3]===u[1]&&(u[3]+=1);for(var p=1/(u[2]-u[0]),g=1/(u[3]-u[1]),v=u[0],m=u[1],y=c.mallocFloat32(2*h),b=c.mallocFloat32(2*h),x=c.mallocUint8(4*h),_=c.mallocUint32(h),w=0,f=0;f<i.length;++f){for(var k=l("sans-serif",i[f]),A=n(i[f]),M=p*(e[2*f]-v),T=g*(e[2*f+1]-m),E=o[f],L=255*r[4*f],S=255*r[4*f+1],C=255*r[4*f+2],z=255*r[4*f+3],j=.5*(A.bounds[0]+A.bounds[2]),P=.5*(A.bounds[1]+A.bounds[3]),d=0;d<k.data.length;d+=2)y[2*w]=M,y[2*w+1]=T,b[2*w]=-E*(k.data[d]-j),b[2*w+1]=-E*(k.data[d+1]-P),x[4*w]=L,x[4*w+1]=S,x[4*w+2]=C,x[4*w+3]=z,_[w]=f,w+=1;var I=a[f];L=255*s[4*f],S=255*s[4*f+1],C=255*s[4*f+2],z=255*s[4*f+3];for(var d=0;d<A.coords.length;d+=2)y[2*w]=M,y[2*w+1]=T,b[2*w]=-(E*(A.coords[d]-j)+I*A.normals[d]),b[2*w+1]=-(E*(A.coords[d+1]-P)+I*A.normals[d+1]),x[4*w]=L,x[4*w+1]=S,x[4*w+2]=C,x[4*w+3]=z,_[w]=f,w+=1}this.numPoints=i.length,this.numVertices=h,this.positionBuffer.update(y),this.offsetBuffer.update(b),this.colorBuffer.update(x),this.idBuffer.update(_),c.free(y),c.free(b),c.free(x),c.free(_)},d.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.positionBuffer.dispose(),this.offsetBuffer.dispose(),this.colorBuffer.dispose(),this.idBuffer.dispose(),this.plot.removeObject(this)}},{"./lib/shaders":141,"gl-buffer":75,"gl-shader":154,"text-cache":228,"typedarray-pool":233,"vectorize-text":235}],143:[function(t,e,r){r.pointVertex="#define GLSLIFY 1\nprecision mediump float;\n\nattribute vec2 position;\nattribute float weight;\n\nuniform mat3 matrix;\nuniform float pointSize, useWeight;\n\nvarying float fragWeight;\n\nvoid main() {\n vec3 hgPosition = matrix * vec3(position, 1);\n gl_Position = vec4(hgPosition.xy, 0, hgPosition.z);\n gl_PointSize = pointSize;\n fragWeight = mix(1.0, weight, useWeight);\n}\n",r.pointFragment="#define GLSLIFY 1\nprecision mediump float;\n\nuniform vec4 color, borderColor;\nuniform float centerFraction;\n\nvarying float fragWeight;\n\nfloat smoothStep(float x, float y) {\n return 1.0 / (1.0 + exp(50.0*(x - y)));\n}\n\nvoid main() {\n float radius = length(2.0*gl_PointCoord.xy-1.0);\n if(radius > 1.0) {\n discard;\n }\n vec4 baseColor = mix(borderColor, color, smoothStep(radius, centerFraction));\n float alpha = 1.0 - pow(1.0 - baseColor.a, fragWeight);\n gl_FragColor = vec4(baseColor.rgb * alpha, alpha);\n}\n",r.pickVertex="#define GLSLIFY 1\nprecision mediump float;\n\nattribute vec2 position;\nattribute vec4 pickId;\n\nuniform mat3 matrix;\nuniform float pointSize;\nuniform vec4 pickOffset;\n\nvarying vec4 fragId;\n\nvoid main() {\n vec3 hgPosition = matrix * vec3(position, 1);\n gl_Position = vec4(hgPosition.xy, 0, hgPosition.z);\n gl_PointSize = pointSize;\n\n vec4 id = pickId + pickOffset;\n id.y += floor(id.x / 256.0);\n id.x -= floor(id.x / 256.0) * 256.0;\n\n id.z += floor(id.y / 256.0);\n id.y -= floor(id.y / 256.0) * 256.0;\n\n id.w += floor(id.z / 256.0);\n id.z -= floor(id.z / 256.0) * 256.0;\n\n fragId = id;\n}\n",r.pickFragment="#define GLSLIFY 1\nprecision mediump float;\n\nvarying vec4 fragId;\n\nvoid main() {\n float radius = length(2.0*gl_PointCoord.xy-1.0);\n if(radius > 1.0) {\n discard;\n }\n gl_FragColor = fragId / 255.0;\n}\n"},{}],144:[function(t,e,r){arguments[4][121][0].apply(r,arguments)},{dup:121}],145:[function(t,e,r){"use strict";function n(t,e,r,n,o){4*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],c=n[2*a+1],u=i[a],h=o[a],f=a;f>t;){var d=r[f-1],p=n[2*(f-1)];if((d-s||l-p)>=0)break;r[f]=d,n[2*f]=p,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]=c,i[f]=u,o[f]=h}}function o(t,e,r,n,i,o){var a=r[t],s=n[2*t],l=n[2*t+1],c=i[t],u=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]=c,o[e]=u}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],c=i[2*t+1],u=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]=c,o[r]=u,a[r]=h}function l(t,e,r,n,i,o,a,s,l,c,u){s[t]=s[e],l[2*t]=l[2*e],l[2*t+1]=l[2*e+1],c[t]=c[e],u[t]=u[e],s[e]=r,l[2*e]=n,l[2*e+1]=i,c[e]=o,u[e]=a}function c(t,e,r,n,i){return(r[t]-r[e]||n[2*e]-n[2*t]||i[t]-i[e])<0}function u(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,d,p){var g=(e-t+1)/6|0,v=t+g,m=e-g,y=t+e>>1,b=y-g,x=y+g,_=v,w=b,k=y,A=x,M=m,T=t+1,E=e-1,L=0;c(_,w,r,n,d,p)&&(L=_,_=w,w=L),c(A,M,r,n,d,p)&&(L=A,A=M,M=L),c(_,k,r,n,d,p)&&(L=_,_=k,k=L),c(w,k,r,n,d,p)&&(L=w,w=k,k=L),c(_,A,r,n,d,p)&&(L=_,_=A,A=L),c(k,A,r,n,d,p)&&(L=k,k=A,A=L),c(w,M,r,n,d,p)&&(L=w,w=M,M=L),c(w,k,r,n,d,p)&&(L=w,w=k,k=L),c(A,M,r,n,d,p)&&(L=A,A=M,M=L);var S=r[w],C=n[2*w],z=n[2*w+1],j=d[w],P=p[w],I=r[A],R=n[2*A],O=n[2*A+1],N=d[A],D=p[A],F=_,B=k,U=M,V=v,q=y,H=m,G=r[F],Y=r[B],X=r[U];r[V]=G,r[q]=Y,r[H]=X;for(var W=0;2>W;++W){var Z=n[2*F+W],Q=n[2*B+W],$=n[2*U+W];n[2*V+W]=Z,n[2*q+W]=Q,n[2*H+W]=$}var K=d[F],J=d[B],tt=d[U];d[V]=K,d[q]=J,d[H]=tt;var et=p[F],rt=p[B],nt=p[U];p[V]=et,p[q]=rt,p[H]=nt,a(b,t,r,n,d,p),a(x,e,r,n,d,p);for(var it=T;E>=it;++it)if(u(it,S,C,z,j,r,n,d))it!==T&&o(it,T,r,n,d,p),++T;else if(!u(it,I,R,O,N,r,n,d))for(;;){if(u(E,I,R,O,N,r,n,d)){u(E,S,C,z,j,r,n,d)?(s(it,T,E,r,n,d,p),++T,--E):(o(it,E,r,n,d,p),--E);break}if(--E<it)break}l(t,T-1,S,C,z,j,P,r,n,d,p),l(e,E+1,I,R,O,N,D,r,n,d,p),f>=T-2-t?i(t,T-2,r,n,d,p):h(t,T-2,r,n,d,p),f>=e-(E+2)?i(E+2,e,r,n,d,p):h(E+2,e,r,n,d,p),f>=E-T?i(T,E,r,n,d,p):h(T,E,r,n,d,p)}e.exports=n;var f=32},{}],146:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a,s){for(var l=r,c=r;n>c;++c){var u=t[2*c],h=t[2*c+1],f=e[c];u>=i&&a>=u&&h>=o&&s>=h&&(c===l?l+=1:(t[2*c]=t[2*l],t[2*c+1]=t[2*l+1],e[c]=e[l],t[2*l]=u,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,c,u){var h=.5*a,f=s+1,d=c-s;r[_]=d,x[_++]=u;for(var p=0;2>p;++p)for(var g=0;2>g;++g){var v=i+p*h,m=o+g*h,y=n(t,e,f,c,v,m,v+h,m+h);if(y!==f){if(y-f>=Math.max(.9*d,32)){var b=c+s>>>1;l(v,m,h,f,b,u+1),f=b}l(v,m,h,f,y,u+1),f=y}}}var c=t.length>>>1;if(1>c)return[];for(var u=1/0,h=1/0,f=-(1/0),d=-(1/0),p=0;c>p;++p){var g=t[2*p],v=t[2*p+1];u=Math.min(u,g),f=Math.max(f,g),h=Math.min(h,v),d=Math.max(d,v),e[p]=p}u===f&&(f+=1+Math.abs(f)),h===d&&(d+=1+Math.abs(f));var m=1/(f-u),y=1/(d-h),b=Math.max(f-u,d-h);o=o||[0,0,0,0],o[0]=u,o[1]=h,o[2]=f,o[3]=d;var x=a.mallocInt32(c),_=0;l(u,h,b,0,c,0),s(x,t,e,r,c);for(var w=[],k=0,A=c,_=c-1;_>=0;--_){t[2*_]=(t[2*_]-u)*m,t[2*_+1]=(t[2*_+1]-h)*y;var M=x[_];M!==k&&(w.push(new i(b*Math.pow(.5,M),_+1,A-(_+1))),A=_+1,k=M)}return w.push(new i(b*Math.pow(.5,M+1),0,A)),a.free(x),w}var a=t("typedarray-pool"),s=t("./lib/sort");e.exports=o},{"./lib/sort":145,"typedarray-pool":233}],147:[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),c=o(r,u.pointVertex,u.pointFragment),h=o(r,u.pickVertex,u.pickFragment),f=new n(t,i,s,l,c,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"),c=t("typedarray-pool"),u=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&&c.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&&c.free(this.xCoords);var r=t.positions,n=c.mallocFloat32(r.length),i=c.mallocInt32(r.length>>>1);n.set(r);var o=c.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=c.mallocFloat32(r.length>>>1),s=0,u=0;s<r.length;s+=2,++u)a[u]=n[s];c.free(i),c.free(n),c.free(o),this.xCoords=a,this.pointCount=r.length>>>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,c=this.bounds,u=this.size,h=this.borderSize,f=n.gl,d=n.pickPixelRatio,p=n.viewBox,g=n.dataBox;if(0===this.pointCount)return r;var v=c[2]-c[0],m=c[3]-c[1],y=g[2]-g[0],b=g[3]-g[1],x=(p[2]-p[0])*d/n.pixelRatio,_=(p[3]-p[1])*d/n.pixelRatio,w=Math.min(y/x,b/_);t[0]=2*v/y,t[4]=2*m/b,t[6]=2*(c[0]-g[0])/y-1,t[7]=2*(c[1]-g[1])/b-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=d*(u+h),i.uniforms.pickOffset=e,0===this.borderSize?i.uniforms.centerFraction=2:i.uniforms.centerFraction=u/(u+h+1.25),a.bind(),i.attributes.position.pointer(),l.bind(),i.attributes.pickId.pointer(f.UNSIGNED_BYTE);for(var k=this.xCoords,A=(g[0]-c[0]-w*u*d)/v,M=(g[2]-c[0]+w*u*d)/v,T=o.length-1;T>=0;--T){var E=o[T];if(!(E.pixelSize<w&&T>1)){var L=E.offset,S=E.count+L,C=s.ge(k,A,L,S-1),z=s.lt(k,M,C,S-1)+1;f.drawArrays(f.POINTS,C,z-C)}}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,c=e.gl,u=e.pixelRatio,h=e.viewBox,f=e.dataBox;if(0!==this.pointCount){var d=o[2]-o[0],p=o[3]-o[1],g=f[2]-f[0],v=f[3]-f[1],m=h[2]-h[0],y=h[3]-h[1],b=Math.min(g/m,v/y);t[0]=2*d/g,t[4]=2*p/v,t[6]=2*(o[0]-f[0])/g-1,t[7]=2*(o[1]-f[1])/v-1,r.bind(),r.uniforms.matrix=t,r.uniforms.color=this.color,r.uniforms.borderColor=this.borderColor,r.uniforms.pointSize=u*(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 x=this.xCoords,_=(f[0]-o[0]-b*a*u)/d,w=(f[2]-o[0]+b*a*u)/d,k=!0,A=n.length-1;A>=0;--A){var M=n[A];if(!(M.pixelSize<b&&A>1)){var T=M.offset,E=M.count+T,L=s.ge(x,_,T,E-1),S=s.lt(x,w,L,E-1)+1;c.drawArrays(c.POINTS,L,S-L),k&&(k=!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":143,"binary-search-bounds":144,"gl-buffer":75,"gl-shader":154,"snap-points-2d":146,"typedarray-pool":233}],148:[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;l<n.positions.length;++l)for(var c=n.positions[l],u=0;2>u;++u)s[0][u]=Math.min(s[0][u],c[u]),s[1][u]=Math.max(s[1][u],c[u]);return r[t]=[a,n,s]}var i=t("vectorize-text");e.exports=n;var o={}},{"vectorize-text":235}],149:[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="#define GLSLIFY 1\nprecision mediump float;\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="#define GLSLIFY 1\nprecision mediump float;\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="#define GLSLIFY 1\nprecision mediump float;\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="#define GLSLIFY 1\nprecision mediump float;\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",c="#define GLSLIFY 1\nprecision mediump float;\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}",u=[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"glyph",type:"vec2"},{name:"id",type:"vec4"}],h={vertex:o,fragment:l,attributes:u},f={vertex:a,fragment:l,attributes:u},d={vertex:s,fragment:l,attributes:u},p={vertex:o,fragment:c,attributes:u},g={vertex:a,fragment:c,attributes:u},v={vertex:s,fragment:c,attributes:u};r.createPerspective=function(t){return n(t,h)},r.createOrtho=function(t){return n(t,f)},r.createProject=function(t){return n(t,d)},r.createPickPerspective=function(t){return n(t,p)},r.createPickOrtho=function(t){return n(t,g)},r.createPickProject=function(t){return n(t,v)}},{"gl-shader":154}],150:[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,c,u,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=c,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=u,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 c(t,e,r,n){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[r]=n,t}function u(t){for(var e=S,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,d=t.uniforms,p=r.model||x,g=r.view||x,v=r.projection||x,y=e.axesBounds,b=u(e.clipBounds);a=e.axes?e.axes.lastCubeProps.axis:[1,1,1],w[0]=2/f.drawingBufferWidth,w[1]=2/f.drawingBufferHeight,t.bind(),d.view=g,d.projection=v,d.screenSize=w,d.highlightId=e.highlightId,d.highlightScale=e.highlightScale,d.clipBounds=b,d.pickGroup=e.pickId/255,d.pixelRatio=e.pixelRatio;for(var _=0;3>_;++_)if(h[_]&&e.projectOpacity[_]<1===n){d.scale=e.projectScale[_],d.opacity=e.projectOpacity[_];for(var S=E,C=0;16>C;++C)S[C]=0;for(var C=0;4>C;++C)S[5*C]=1;S[5*_]=0,a[_]<0?S[12+_]=y[0][_]:S[12+_]=y[1][_],m(S,p,S),d.model=S;var z=(_+1)%3,j=(_+2)%3,P=s(k),I=s(A);P[z]=1,I[j]=1;var R=i(v,g,p,l(M,P)),O=i(v,g,p,l(T,I));if(Math.abs(R[1])>Math.abs(O[1])){var N=R;R=O,O=N,N=P,P=I,I=N;var D=z;z=j,j=D}R[0]<0&&(P[z]=-1),
O[1]>0&&(I[j]=-1);for(var F=0,B=0,C=0;4>C;++C)F+=Math.pow(p[4*z+C],2),B+=Math.pow(p[4*j+C],2);P[z]/=Math.sqrt(F),I[j]/=Math.sqrt(B),d.axes[0]=P,d.axes[1]=I,d.fragClipBounds[0]=c(L,b[0],_,-1e8),d.fragClipBounds[1]=c(L,b[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||x,s.view=n.view||x,s.projection=n.projection||x,w[0]=2/a.drawingBufferWidth,w[1]=2/a.drawingBufferHeight,s.screenSize=w,s.highlightId=r.highlightId,s.highlightScale=r.highlightScale,s.fragClipBounds=j,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 d(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),c=p(e),u=p(e),h=p(e),f=p(e),d=g(e,[{buffer:c,size:3,type:e.FLOAT},{buffer:u,size:4,type:e.FLOAT},{buffer:h,size:2,type:e.FLOAT},{buffer:f,size:4,type:e.UNSIGNED_BYTE,normalized:!0}]),v=new a(e,r,n,i,c,u,h,f,d,o,s,l);return v.update(t),v}var p=t("gl-buffer"),g=t("gl-vao"),v=t("typedarray-pool"),m=t("gl-mat4/multiply"),y=t("./lib/shaders"),b=t("./lib/glyphs"),x=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];e.exports=d;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],k=[0,0,0],A=[0,0,0],M=[0,0,0,1],T=[0,0,0,1],E=x.slice(),L=[0,0,0],S=[[0,0,0],[0,0,0]],C=[-1e8,-1e8,-1e8],z=[1e8,1e8,1e8],j=[C,z];_.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,c=t.color,u=t.size,h=t.angle,f=t.lineColor,d=0,p=0,g=0,m=n.length;t:for(var y=0;m>y;++y){for(var x=n[y],_=0;3>_;++_)if(isNaN(x[_])||!isFinite(x[_]))continue t;var w;w=Array.isArray(l)?b(l[y],i):l?b(l,i):b("\u25cf",i);var k=w[0],A=w[1],M=w[2];p+=3*k.cells.length,g+=2*A.edges.length}var T=p+g,E=v.mallocFloat(3*T),L=v.mallocFloat(4*T),S=v.mallocFloat(2*T),C=v.mallocUint32(T),z=[0,o[1]],j=0,P=p,I=[0,0,0,1],R=[0,0,0,1],O=Array.isArray(c)&&Array.isArray(c[0]),N=Array.isArray(f)&&Array.isArray(f[0]);t:for(var y=0;m>y;++y){for(var x=n[y],_=0;3>_;++_){if(isNaN(x[_])||!isFinite(x[_])){d+=1;continue t}s[_]=Math.max(s[_],x[_]),a[_]=Math.min(a[_],x[_])}var w;w=Array.isArray(l)?b(l[y],i):l?b(l,i):b("\u25cf",i);var k=w[0],A=w[1],M=w[2];if(Array.isArray(c)){var D;if(D=O?c[y]:c,3===D.length){for(var _=0;3>_;++_)I[_]=D[_];I[3]=1}else if(4===D.length)for(var _=0;4>_;++_)I[_]=D[_]}else I[0]=I[1]=I[2]=0,I[3]=1;if(Array.isArray(f)){var D;if(D=N?f[y]:f,3===D.length){for(var _=0;3>_;++_)R[_]=D[_];R[_]=1}else if(4===D.length)for(var _=0;4>_;++_)R[_]=D[_]}else R[0]=R[1]=R[2]=0,R[3]=1;var F=.5;Array.isArray(u)?F=+u[y]:u?F=+u:this.useOrtho&&(F=12);var B=0;Array.isArray(h)?B=+h[y]:h&&(B=+h);for(var U=Math.cos(B),V=Math.sin(B),x=n[y],_=0;3>_;++_)s[_]=Math.max(s[_],x[_]),a[_]=Math.min(a[_],x[_]);o[0]<0?z[0]=o[0]*(1+M[1][0]):o[0]>0&&(z[0]=-o[0]*(1+M[0][0]));for(var q=k.cells,H=k.positions,_=0;_<q.length;++_)for(var G=q[_],Y=0;3>Y;++Y){for(var X=0;3>X;++X)E[3*j+X]=x[X];for(var X=0;4>X;++X)L[4*j+X]=I[X];C[j]=d;var W=H[G[Y]];S[2*j]=F*(U*W[0]-V*W[1]+z[0]),S[2*j+1]=F*(V*W[0]+U*W[1]+z[1]),j+=1}for(var q=A.edges,H=A.positions,_=0;_<q.length;++_)for(var G=q[_],Y=0;2>Y;++Y){for(var X=0;3>X;++X)E[3*P+X]=x[X];for(var X=0;4>X;++X)L[4*P+X]=R[X];C[P]=d;var W=H[G[Y]];S[2*P]=F*(U*W[0]-V*W[1]+z[0]),S[2*P+1]=F*(V*W[0]+U*W[1]+z[1]),P+=1}d+=1}this.vertexCount=p,this.lineVertexCount=g,this.pointBuffer.update(E),this.colorBuffer.update(L),this.glyphBuffer.update(S),this.idBuffer.update(new Uint32Array(C)),v.free(E),v.free(L),v.free(S),v.free(C),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":148,"./lib/shaders":149,"gl-buffer":75,"gl-mat4/multiply":96,"gl-vao":189,"typedarray-pool":233}],151:[function(t,e,r){"use strict";r.boxVertex="#define GLSLIFY 1\nprecision mediump float;\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="#define GLSLIFY 1\nprecision mediump float;\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = color;\n}\n"},{}],152:[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),c=new n(t,i,l);return c.update(e),t.addOverlay(c),c}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,c=t.viewBox,u=t.pixelRatio,h=(e[0]-l[0])*(c[2]-c[0])/(l[2]-l[0])+c[0],f=(e[1]-l[1])*(c[3]-c[1])/(l[3]-l[1])+c[1],d=(e[2]-l[0])*(c[2]-c[0])/(l[2]-l[0])+c[0],p=(e[3]-l[1])*(c[3]-c[1])/(l[3]-l[1])+c[1];if(h=Math.max(h,c[0]),f=Math.max(f,c[1]),d=Math.min(d,c[2]),p=Math.min(p,c[3]),!(h>d||f>p)){a.bind();var g=s[2]-s[0],v=s[3]-s[1];if(this.outerFill&&(a.drawBox(0,0,g,f,i),a.drawBox(0,f,h,p,i),a.drawBox(0,p,g,v,i),a.drawBox(d,f,g,p,i)),this.innerFill&&a.drawBox(h,f,d,p,n),r>0){var m=r*u;a.drawBox(h-m,f-m,d+m,f+m,o),a.drawBox(h-m,p-m,d+m,p+m,o),a.drawBox(h-m,f-m,h+m,p+m,o),a.drawBox(d-m,f-m,d+m,p+m,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":151,"gl-buffer":75,"gl-shader":154}],153:[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"),c=t("bit-twiddle").nextPow2,u=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_f<this_closestD2&&(this_closestD2=_inline_31_f,this_closestX=_inline_31_arg6_[0],this_closestY=_inline_31_arg6_[1])}}",args:[{name:"_inline_31_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_31_arg1_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_31_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_31_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_31_arg4_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_31_arg5_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_31_arg6_",lvalue:!1,rvalue:!0,count:4}],thisVars:["this_closestD2","this_closestX","this_closestY"],localVars:["_inline_31_a","_inline_31_f","_inline_31_l"]},post:{body:"{return[this_closestX,this_closestY,this_closestD2]}",args:[],thisVars:["this_closestD2","this_closestX","this_closestY"],localVars:[]},debug:!1,funcName:"cwise",blockSize:64}),h=i.prototype;Object.defineProperty(h,"shape",{get:function(){return this.gl?this.fbo.shape.slice():[0,0]},set:function(t){if(this.gl){this.fbo.shape=t;var e=this.fbo.shape[0],r=this.fbo.shape[1];if(r*e*4>this.buffer.length){s.free(this.buffer);for(var n=this.buffer=s.mallocUint8(c(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]),c=0|Math.min(Math.max(e+r,0),i[1]);if(o>=a||s>=c)return null;var h=[a-o,c-s],f=l(this.buffer,[h[0],h[1],4],[4,4*i[0],1],4*(o+i[0]*s)),d=u(f.hi(h[0],h[1],1),r,r),p=d[0],g=d[1];if(0>p||Math.pow(this.radius,2)<d[2])return null;var v=f.get(p,g,0),m=f.get(p,g,1),y=f.get(p,g,2),b=f.get(p,g,3);return new n(p+o|0,g+s|0,v,[m,y,b],Math.sqrt(d[2]))},h.dispose=function(){this.gl&&(this.fbo.dispose(),s.free(this.buffer),this.gl=null,this._readTimeout&&clearTimeout(this._readTimeout))}},{"bit-twiddle":49,"cwise/lib/wrapper":69,"gl-fbo":80,ndarray:208,"typedarray-pool":233}],154:[function(t,e,r){"use strict";function n(t){this.gl=t,this._vref=this._fref=this._relink=this.vertShader=this.fragShader=this.program=this.attributes=this.uniforms=this.types=null}function i(t,e){return t.name<e.name?-1:1}function o(t,e,r,i,o){var a=new n(t);return a.update(e,r,i,o),a}var a=t("./lib/create-uniforms"),s=t("./lib/create-attributes"),l=t("./lib/reflect"),c=t("./lib/shader-cache"),u=t("./lib/runtime-reflect"),h=t("./lib/GLError"),f=n.prototype;f.bind=function(){this.program||this._relink(),this.gl.useProgram(this.program)},f.dispose=function(){this._fref&&this._fref.dispose(),this._vref&&this._vref.dispose(),this.attributes=this.types=this.vertShader=this.fragShader=this.program=this._relink=this._fref=this._vref=null},f.update=function(t,e,r,n){function o(){d.program=c.program(p,d._vref,d._fref,x,_);for(var t=0;t<r.length;++t)L[t]=p.getUniformLocation(d.program,r[t].name)}if(!e||1===arguments.length){var f=t;t=f.vertex,e=f.fragment,r=f.uniforms,n=f.attributes}var d=this,p=d.gl,g=d._vref;d._vref=c.shader(p,p.VERTEX_SHADER,t),g&&g.dispose(),d.vertShader=d._vref.shader;var v=this._fref;if(d._fref=c.shader(p,p.FRAGMENT_SHADER,e),v&&v.dispose(),d.fragShader=d._fref.shader,!r||!n){var m=p.createProgram();if(p.attachShader(m,d.fragShader),p.attachShader(m,d.vertShader),p.linkProgram(m),!p.getProgramParameter(m,p.LINK_STATUS)){var y=p.getProgramInfoLog(m);throw new h(y,"Error linking program:"+y)}r=r||u.uniforms(p,m),n=n||u.attributes(p,m),p.deleteProgram(m)}n=n.slice(),n.sort(i);for(var b=[],x=[],_=[],w=0;w<n.length;++w){var k=n[w];if(k.type.indexOf("mat")>=0){for(var A=0|k.type.charAt(k.type.length-1),M=new Array(A),T=0;A>T;++T)M[T]=_.length,x.push(k.name+"["+T+"]"),"number"==typeof k.location?_.push(k.location+T):Array.isArray(k.location)&&k.location.length===A&&"number"==typeof k.location[T]?_.push(0|k.location[T]):_.push(-1);b.push({name:k.name,type:k.type,locations:M})}else b.push({name:k.name,type:k.type,locations:[_.length]}),x.push(k.name),"number"==typeof k.location?_.push(0|k.location):_.push(-1)}for(var E=0,w=0;w<_.length;++w)if(_[w]<0){for(;_.indexOf(E)>=0;)E+=1;_[w]=E}var L=new Array(r.length);o(),d._relink=o,d.types={uniforms:l(r),attributes:l(n)},d.attributes=s(p,d,b,_),Object.defineProperty(d,"uniforms",a(p,d,r,L))},e.exports=o},{"./lib/GLError":155,"./lib/create-attributes":156,"./lib/create-uniforms":157,"./lib/reflect":158,"./lib/runtime-reflect":159,"./lib/shader-cache":160}],155:[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},{}],156:[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"],c=[],u=0;o>u;++u)l.push("x"+u),c.push("x"+u);l.push("if(x0.length===void 0){return gl.vertexAttrib"+o+"f(v,"+c.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),c=new Array(o),u=0;o>u;++u)i(t,e,r[u],n,o,l,u),c[u]=l[u];Object.defineProperty(l,"location",{set:function(t){if(Array.isArray(t))for(var e=0;o>e;++e)c[e].location=t[e];else for(var e=0;o>e;++e)c[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 c=n[r[l]];t.vertexAttribPointer(c,o,e,i,a,s+l*o),t.enableVertexAttribArray(c)}};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,c=r.length;c>l;++l){var u=r[l],h=u.name,f=u.type,d=u.locations;switch(f){case"bool":case"int":case"float":i(t,e,d[0],n,1,a,h);break;default:if(f.indexOf("vec")>=0){var p=f.charCodeAt(f.length-1)-48;if(2>p||p>4)throw new s("","Invalid data type for attribute "+h+": "+f);i(t,e,d[0],n,p,a,h)}else{if(!(f.indexOf("mat")>=0))throw new s("","Unknown data type for attribute "+h+": "+f);var p=f.charCodeAt(f.length-1)-48;if(2>p||p>4)throw new s("","Invalid data type for attribute "+h+": "+f);o(t,e,d,n,p,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":155}],157:[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 c(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 u(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,u(o,i)):r.push([o,i])}return r}function h(e){for(var n=["return function updateProperty(obj){"],i=u("",e),a=0;a<i.length;++a){var s=i[a],l=s[0],h=s[1];o[h]&&n.push(c(l,h,r[h].type))}n.push("return obj}");var f=new Function("gl","locations",n.join("\n"));return f(t,o)}function f(t){switch(t){case"bool":return!1;case"int":case"sampler2D":case"samplerCube":return 0;case"float":return 0;default:var e=t.indexOf("vec");if(e>=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 d(t,e,i){if("object"==typeof i){var a=p(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 p(t){var e;if(Array.isArray(t)){e=new Array(t.length);for(var r=0;r<t.length;++r)d(e,r,t[r])}else{e={};for(var n in t)d(e,n,t[n])}return e}var g=a(r,!0);return{get:n(p(g)),set:h(g),enumerable:!0,configurable:!0}}var a=t("./reflect"),s=t("./GLError");e.exports=o},{"./GLError":155,"./reflect":158}],158:[function(t,e,r){"use strict";function n(t,e){for(var r={},n=0;n<t.length;++n)for(var i=t[n].name,o=i.split("."),a=r,s=0;s<o.length;++s){var l=o[s].split("[");if(l.length>1){l[0]in a||(a[l[0]]=[]),a=a[l[0]];for(var c=1;c<l.length;++c){var u=parseInt(l[c]);c<l.length-1||s<o.length-1?(u in a||(c<l.length-1?a[u]=[]:a[u]={}),a=a[u]):e?a[u]=n:a[u]=t[n].type}}else s<o.length-1?(l[0]in a||(a[l[0]]={}),a=a[l[0]]):e?a[l[0]]=n:a[l[0]]=t[n].type}return r}e.exports=n},{}],159:[function(t,e,r){"use strict";function n(t,e){if(!s){var r=Object.keys(a);s={};for(var n=0;n<r.length;++n){var i=r[n];s[t[i]]=a[i]}}return s[e]}function i(t,e){for(var r=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),i=[],o=0;r>o;++o){var a=t.getActiveUniform(e,o);if(a){var s=n(t,a.type);if(a.size>1)for(var l=0;l<a.size;++l)i.push({name:a.name.replace("[0]","["+l+"]"),type:s});else i.push({name:a.name,type:s})}}return i}function o(t,e){for(var r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),i=[],o=0;r>o;++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},{}],160:[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 u(i,"Error compiling shader:\n"+i)}throw new u(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;a<n.length;++a)t.bindAttribLocation(o,i[a],n[a]);if(t.linkProgram(o),!t.getProgramParameter(o,t.LINK_STATUS)){var s=t.getProgramInfoLog(o);throw new u(s,"Error linking program: "+s)}return o}function s(t){var e=d.get(t);return e||(e=new i(t),d.set(t,e)),e}function l(t,e,r){return s(t).getShaderReference(e,r)}function c(t,e,r,n,i){return s(t).getProgram(e,r,n,i)}r.shader=l,r.program=c;var u=t("./GLError"),h=t("gl-format-compiler-error"),f="undefined"==typeof WeakMap?t("weakmap-shim"):WeakMap,d=new f,p=0;n.prototype.dispose=function(){if(0===--this.count){for(var t=this.cache,e=t.gl,r=this.programs,n=0,i=r.length;i>n;++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 g=i.prototype;g.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(p++,e,t,s,[],1,this)}return a},g.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":155,"gl-format-compiler-error":161,"weakmap-shim":177}],161:[function(t,e,r){function n(t,e,r){"use strict";var n=a(e)||"of unknown name (see npm glsl-shader-name)",l="unknown type";void 0!==r&&(l=r===o.FRAGMENT_SHADER?"fragment":"vertex");for(var c=i("Error compiling %s shader %s:\n",l,n),u=i("%s%s",c,t),h=t.split("\n"),f={},d=0;d<h.length;d++){var p=h[d];if(""!==p){var g=parseInt(p.split(":")[2]);if(isNaN(g))throw new Error(i("Could not parse error: %s",p));f[g]=p}}for(var v=s(e).split("\n"),d=0;d<v.length;d++)if(f[d+3]||f[d+2]||f[d+1]){var m=v[d];if(c+=m+"\n",f[d+1]){var y=f[d+1];y=y.substr(y.split(":",3).join(":").length+1).trim(),c+=i("^^^ %s\n\n",y)}}return{"long":c.trim(),"short":u.trim()}}var i=t("sprintf-js").sprintf,o=t("gl-constants/lookup"),a=t("glsl-shader-name"),s=t("add-line-numbers");e.exports=n},{"add-line-numbers":162,"gl-constants/lookup":166,"glsl-shader-name":167,"sprintf-js":174}],162:[function(t,e,r){function n(t,e,r){e="number"==typeof e?e:1,r=r||": ";var n=t.split(/\r?\n/),o=String(n.length+e-1).length;return n.map(function(t,n){var a=n+e,s=String(a).length,l=i(a,o-s);return l+r+t}).join("\n")}var i=t("pad-left");e.exports=n},{"pad-left":163}],163:[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":164}],164:[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)}e.exports=n;var i,o=""},{}],165:[function(t,e,r){e.exports={0:"NONE",1:"ONE",2:"LINE_LOOP",3:"LINE_STRIP",4:"TRIANGLES",5:"TRIANGLE_STRIP",6:"TRIANGLE_FAN",256:"DEPTH_BUFFER_BIT",512:"NEVER",513:"LESS",514:"EQUAL",515:"LEQUAL",516:"GREATER",517:"NOTEQUAL",518:"GEQUAL",519:"ALWAYS",768:"SRC_COLOR",769:"ONE_MINUS_SRC_COLOR",770:"SRC_ALPHA",771:"ONE_MINUS_SRC_ALPHA",772:"DST_ALPHA",773:"ONE_MINUS_DST_ALPHA",774:"DST_COLOR",775:"ONE_MINUS_DST_COLOR",776:"SRC_ALPHA_SATURATE",1024:"STENCIL_BUFFER_BIT",1028:"FRONT",1029:"BACK",1032:"FRONT_AND_BACK",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",2304:"CW",2305:"CCW",2849:"LINE_WIDTH",2884:"CULL_FACE",2885:"CULL_FACE_MODE",2886:"FRONT_FACE",2928:"DEPTH_RANGE",2929:"DEPTH_TEST",2930:"DEPTH_WRITEMASK",2931:"DEPTH_CLEAR_VALUE",2932:"DEPTH_FUNC",2960:"STENCIL_TEST",2961:"STENCIL_CLEAR_VALUE",2962:"STENCIL_FUNC",2963:"STENCIL_VALUE_MASK",2964:"STENCIL_FAIL",2965:"STENCIL_PASS_DEPTH_FAIL",2966:"STENCIL_PASS_DEPTH_PASS",2967:"STENCIL_REF",2968:"STENCIL_WRITEMASK",2978:"VIEWPORT",3024:"DITHER",3042:"BLEND",3088:"SCISSOR_BOX",3089:"SCISSOR_TEST",3106:"COLOR_CLEAR_VALUE",3107:"COLOR_WRITEMASK",3317:"UNPACK_ALIGNMENT",3333:"PACK_ALIGNMENT",3379:"MAX_TEXTURE_SIZE",3386:"MAX_VIEWPORT_DIMS",3408:"SUBPIXEL_BITS",3410:"RED_BITS",3411:"GREEN_BITS",3412:"BLUE_BITS",3413:"ALPHA_BITS",3414:"DEPTH_BITS",3415:"STENCIL_BITS",3553:"TEXTURE_2D",4352:"DONT_CARE",4353:"FASTEST",4354:"NICEST",5120:"BYTE",5121:"UNSIGNED_BYTE",5122:"SHORT",5123:"UNSIGNED_SHORT",5124:"INT",5125:"UNSIGNED_INT",5126:"FLOAT",5386:"INVERT",5890:"TEXTURE",6401:"STENCIL_INDEX",6402:"DEPTH_COMPONENT",6406:"ALPHA",6407:"RGB",6408:"RGBA",6409:"LUMINANCE",6410:"LUMINANCE_ALPHA",7680:"KEEP",7681:"REPLACE",7682:"INCR",7683:"DECR",7936:"VENDOR",7937:"RENDERER",7938:"VERSION",9728:"NEAREST",9729:"LINEAR",9984:"NEAREST_MIPMAP_NEAREST",9985:"LINEAR_MIPMAP_NEAREST",9986:"NEAREST_MIPMAP_LINEAR",9987:"LINEAR_MIPMAP_LINEAR",10240:"TEXTURE_MAG_FILTER",10241:"TEXTURE_MIN_FILTER",10242:"TEXTURE_WRAP_S",10243:"TEXTURE_WRAP_T",10497:"REPEAT",10752:"POLYGON_OFFSET_UNITS",16384:"COLOR_BUFFER_BIT",32769:"CONSTANT_COLOR",32770:"ONE_MINUS_CONSTANT_COLOR",32771:"CONSTANT_ALPHA",32772:"ONE_MINUS_CONSTANT_ALPHA",32773:"BLEND_COLOR",32774:"FUNC_ADD",32777:"BLEND_EQUATION_RGB",32778:"FUNC_SUBTRACT",32779:"FUNC_REVERSE_SUBTRACT",32819:"UNSIGNED_SHORT_4_4_4_4",32820:"UNSIGNED_SHORT_5_5_5_1",32823:"POLYGON_OFFSET_FILL",32824:"POLYGON_OFFSET_FACTOR",32854:"RGBA4",32855:"RGB5_A1",32873:"TEXTURE_BINDING_2D",32926:"SAMPLE_ALPHA_TO_COVERAGE",32928:"SAMPLE_COVERAGE",32936:"SAMPLE_BUFFERS",32937:"SAMPLES",32938:"SAMPLE_COVERAGE_VALUE",32939:"SAMPLE_COVERAGE_INVERT",32968:"BLEND_DST_RGB",32969:"BLEND_SRC_RGB",32970:"BLEND_DST_ALPHA",32971:"BLEND_SRC_ALPHA",33071:"CLAMP_TO_EDGE",33170:"GENERATE_MIPMAP_HINT",33189:"DEPTH_COMPONENT16",33306:"DEPTH_STENCIL_ATTACHMENT",33635:"UNSIGNED_SHORT_5_6_5",33648:"MIRRORED_REPEAT",33901:"ALIASED_POINT_SIZE_RANGE",33902:"ALIASED_LINE_WIDTH_RANGE",33984:"TEXTURE0",33985:"TEXTURE1",33986:"TEXTURE2",33987:"TEXTURE3",33988:"TEXTURE4",33989:"TEXTURE5",33990:"TEXTURE6",33991:"TEXTURE7",33992:"TEXTURE8",33993:"TEXTURE9",33994:"TEXTURE10",33995:"TEXTURE11",33996:"TEXTURE12",33997:"TEXTURE13",33998:"TEXTURE14",33999:"TEXTURE15",34e3:"TEXTURE16",34001:"TEXTURE17",34002:"TEXTURE18",34003:"TEXTURE19",34004:"TEXTURE20",34005:"TEXTURE21",34006:"TEXTURE22",34007:"TEXTURE23",34008:"TEXTURE24",34009:"TEXTURE25",34010:"TEXTURE26",34011:"TEXTURE27",34012:"TEXTURE28",34013:"TEXTURE29",34014:"TEXTURE30",34015:"TEXTURE31",34016:"ACTIVE_TEXTURE",34024:"MAX_RENDERBUFFER_SIZE",34041:"DEPTH_STENCIL",34055:"INCR_WRAP",34056:"DECR_WRAP",34067:"TEXTURE_CUBE_MAP",34068:"TEXTURE_BINDING_CUBE_MAP",34069:"TEXTURE_CUBE_MAP_POSITIVE_X",34070:"TEXTURE_CUBE_MAP_NEGATIVE_X",34071:"TEXTURE_CUBE_MAP_POSITIVE_Y",34072:"TEXTURE_CUBE_MAP_NEGATIVE_Y",34073:"TEXTURE_CUBE_MAP_POSITIVE_Z",34074:"TEXTURE_CUBE_MAP_NEGATIVE_Z",34076:"MAX_CUBE_MAP_TEXTURE_SIZE",34338:"VERTEX_ATTRIB_ARRAY_ENABLED",34339:"VERTEX_ATTRIB_ARRAY_SIZE",34340:"VERTEX_ATTRIB_ARRAY_STRIDE",34341:"VERTEX_ATTRIB_ARRAY_TYPE",34342:"CURRENT_VERTEX_ATTRIB",34373:"VERTEX_ATTRIB_ARRAY_POINTER",34466:"NUM_COMPRESSED_TEXTURE_FORMATS",34467:"COMPRESSED_TEXTURE_FORMATS",34660:"BUFFER_SIZE",34661:"BUFFER_USAGE",34816:"STENCIL_BACK_FUNC",34817:"STENCIL_BACK_FAIL",34818:"STENCIL_BACK_PASS_DEPTH_FAIL",34819:"STENCIL_BACK_PASS_DEPTH_PASS",34877:"BLEND_EQUATION_ALPHA",34921:"MAX_VERTEX_ATTRIBS",34922:"VERTEX_ATTRIB_ARRAY_NORMALIZED",34930:"MAX_TEXTURE_IMAGE_UNITS",34962:"ARRAY_BUFFER",34963:"ELEMENT_ARRAY_BUFFER",34964:"ARRAY_BUFFER_BINDING",34965:"ELEMENT_ARRAY_BUFFER_BINDING",34975:"VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",35040:"STREAM_DRAW",35044:"STATIC_DRAW",35048:"DYNAMIC_DRAW",35632:"FRAGMENT_SHADER",35633:"VERTEX_SHADER",35660:"MAX_VERTEX_TEXTURE_IMAGE_UNITS",35661:"MAX_COMBINED_TEXTURE_IMAGE_UNITS",35663:"SHADER_TYPE",35664:"FLOAT_VEC2",35665:"FLOAT_VEC3",35666:"FLOAT_VEC4",35667:"INT_VEC2",35668:"INT_VEC3",35669:"INT_VEC4",35670:"BOOL",35671:"BOOL_VEC2",35672:"BOOL_VEC3",35673:"BOOL_VEC4",35674:"FLOAT_MAT2",35675:"FLOAT_MAT3",35676:"FLOAT_MAT4",35678:"SAMPLER_2D",35680:"SAMPLER_CUBE",35712:"DELETE_STATUS",35713:"COMPILE_STATUS",35714:"LINK_STATUS",35715:"VALIDATE_STATUS",35716:"INFO_LOG_LENGTH",35717:"ATTACHED_SHADERS",35718:"ACTIVE_UNIFORMS",35719:"ACTIVE_UNIFORM_MAX_LENGTH",35720:"SHADER_SOURCE_LENGTH",35721:"ACTIVE_ATTRIBUTES",35722:"ACTIVE_ATTRIBUTE_MAX_LENGTH",35724:"SHADING_LANGUAGE_VERSION",35725:"CURRENT_PROGRAM",36003:"STENCIL_BACK_REF",36004:"STENCIL_BACK_VALUE_MASK",36005:"STENCIL_BACK_WRITEMASK",36006:"FRAMEBUFFER_BINDING",36007:"RENDERBUFFER_BINDING",36048:"FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",36049:"FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",36050:"FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",36051:"FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",36053:"FRAMEBUFFER_COMPLETE",36054:"FRAMEBUFFER_INCOMPLETE_ATTACHMENT",36055:"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",36057:"FRAMEBUFFER_INCOMPLETE_DIMENSIONS",36061:"FRAMEBUFFER_UNSUPPORTED",36064:"COLOR_ATTACHMENT0",36096:"DEPTH_ATTACHMENT",36128:"STENCIL_ATTACHMENT",36160:"FRAMEBUFFER",36161:"RENDERBUFFER",36162:"RENDERBUFFER_WIDTH",36163:"RENDERBUFFER_HEIGHT",36164:"RENDERBUFFER_INTERNAL_FORMAT",36168:"STENCIL_INDEX8",36176:"RENDERBUFFER_RED_SIZE",36177:"RENDERBUFFER_GREEN_SIZE",36178:"RENDERBUFFER_BLUE_SIZE",36179:"RENDERBUFFER_ALPHA_SIZE",36180:"RENDERBUFFER_DEPTH_SIZE",36181:"RENDERBUFFER_STENCIL_SIZE",36194:"RGB565",36336:"LOW_FLOAT",36337:"MEDIUM_FLOAT",36338:"HIGH_FLOAT",36339:"LOW_INT",36340:"MEDIUM_INT",36341:"HIGH_INT",36346:"SHADER_COMPILER",36347:"MAX_VERTEX_UNIFORM_VECTORS",36348:"MAX_VARYING_VECTORS",36349:"MAX_FRAGMENT_UNIFORM_VECTORS",37440:"UNPACK_FLIP_Y_WEBGL",37441:"UNPACK_PREMULTIPLY_ALPHA_WEBGL",37442:"CONTEXT_LOST_WEBGL",37443:"UNPACK_COLORSPACE_CONVERSION_WEBGL",37444:"BROWSER_DEFAULT_WEBGL"}},{}],166:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":165}],167:[function(t,e,r){function n(t){for(var e=Array.isArray(t)?t:i(t),r=0;r<e.length;r++){var n=e[r];if("preprocessor"===n.type){var a=n.data.match(/\#define\s+SHADER_NAME(_B64)?\s+(.+)$/);if(a&&a[2]){var s=a[1],l=a[2];return(s?o(l):l).trim()}}}}var i=t("glsl-tokenizer"),o=t("atob-lite");e.exports=n},{"atob-lite":168,"glsl-tokenizer":173}],168:[function(t,e,r){e.exports=function(t){return atob(t)}},{}],169:[function(t,e,r){function n(){function t(t){t.length&&F.push({type:_[N],data:t,position:V,line:B,column:U})}function e(t){R=0,G+=t,I=G.length;
for(var e;j=G[R],I>R;){switch(e=R,N){case c:R=M();break;case u:R=A();break;case h:R=k();break;case f:R=T();break;case d:R=S();break;case x:R=L();break;case p:R=C();break;case l:R=z();break;case y:R=w();break;case s:R=n()}if(e!==R)switch(G[e]){case"\n":U=0,++B;break;default:++U}}return O+=R,G=G.slice(R),F}function r(e){return D.length&&t(D.join("")),N=b,t("(eof)"),F}function n(){return D=D.length?[]:D,"/"===P&&"*"===j?(V=O+R-1,N=c,P=j,R+1):"/"===P&&"/"===j?(V=O+R-1,N=u,P=j,R+1):"#"===j?(N=h,V=O+R,R):/\s/.test(j)?(N=y,V=O+R,R):(q=/\d/.test(j),H=/[^\w_]/.test(j),V=O+R,N=q?d:H?f:l,R)}function w(){return/[^\s]/g.test(j)?(t(D.join("")),N=s,R):(D.push(j),P=j,R+1)}function k(){return"\n"===j&&"\\"!==P?(t(D.join("")),N=s,R):(D.push(j),P=j,R+1)}function A(){return k()}function M(){return"/"===j&&"*"===P?(D.push(j),t(D.join("")),N=s,R+1):(D.push(j),P=j,R+1)}function T(){if("."===P&&/\d/.test(j))return N=p,R;if("/"===P&&"*"===j)return N=c,R;if("/"===P&&"/"===j)return N=u,R;if("."===j&&D.length){for(;E(D););return N=p,R}if(";"===j||")"===j||"("===j){if(D.length)for(;E(D););return t(j),N=s,R+1}var e=2===D.length&&"="!==j;if(/[\w_\d\s]/.test(j)||e){for(;E(D););return N=s,R}return D.push(j),P=j,R+1}function E(e){for(var r,n,i=0;;){if(r=o.indexOf(e.slice(0,e.length+i).join("")),n=o[r],-1===r){if(i--+e.length>0)continue;n=e.slice(0,1).join("")}return t(n),V+=n.length,D=D.slice(n.length),D.length}}function L(){return/[^a-fA-F0-9]/.test(j)?(t(D.join("")),N=s,R):(D.push(j),P=j,R+1)}function S(){return"."===j?(D.push(j),N=p,P=j,R+1):/[eE]/.test(j)?(D.push(j),N=p,P=j,R+1):"x"===j&&1===D.length&&"0"===D[0]?(N=x,D.push(j),P=j,R+1):/[^\d]/.test(j)?(t(D.join("")),N=s,R):(D.push(j),P=j,R+1)}function C(){return"f"===j&&(D.push(j),P=j,R+=1),/[eE]/.test(j)?(D.push(j),P=j,R+1):/[^\d]/.test(j)?(t(D.join("")),N=s,R):(D.push(j),P=j,R+1)}function z(){if(/[^\d\w_]/.test(j)){var e=D.join("");return N=i.indexOf(e)>-1?m:a.indexOf(e)>-1?v:g,t(D.join("")),N=s,R}return D.push(j),P=j,R+1}var j,P,I,R=0,O=0,N=s,D=[],F=[],B=1,U=0,V=0,q=!1,H=!1,G="";return function(t){return F=[],null!==t?e(t):r()}}e.exports=n;var i=t("./lib/literals"),o=t("./lib/operators"),a=t("./lib/builtins"),s=999,l=9999,c=0,u=1,h=2,f=3,d=4,p=5,g=6,v=7,m=8,y=9,b=10,x=11,_=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":170,"./lib/literals":171,"./lib/operators":172}],170:[function(t,e,r){e.exports=["gl_Position","gl_PointSize","gl_ClipVertex","gl_FragCoord","gl_FrontFacing","gl_FragColor","gl_FragData","gl_FragDepth","gl_Color","gl_SecondaryColor","gl_Normal","gl_Vertex","gl_MultiTexCoord0","gl_MultiTexCoord1","gl_MultiTexCoord2","gl_MultiTexCoord3","gl_MultiTexCoord4","gl_MultiTexCoord5","gl_MultiTexCoord6","gl_MultiTexCoord7","gl_FogCoord","gl_MaxLights","gl_MaxClipPlanes","gl_MaxTextureUnits","gl_MaxTextureCoords","gl_MaxVertexAttribs","gl_MaxVertexUniformComponents","gl_MaxVaryingFloats","gl_MaxVertexTextureImageUnits","gl_MaxCombinedTextureImageUnits","gl_MaxTextureImageUnits","gl_MaxFragmentUniformComponents","gl_MaxDrawBuffers","gl_ModelViewMatrix","gl_ProjectionMatrix","gl_ModelViewProjectionMatrix","gl_TextureMatrix","gl_NormalMatrix","gl_ModelViewMatrixInverse","gl_ProjectionMatrixInverse","gl_ModelViewProjectionMatrixInverse","gl_TextureMatrixInverse","gl_ModelViewMatrixTranspose","gl_ProjectionMatrixTranspose","gl_ModelViewProjectionMatrixTranspose","gl_TextureMatrixTranspose","gl_ModelViewMatrixInverseTranspose","gl_ProjectionMatrixInverseTranspose","gl_ModelViewProjectionMatrixInverseTranspose","gl_TextureMatrixInverseTranspose","gl_NormalScale","gl_DepthRangeParameters","gl_DepthRange","gl_ClipPlane","gl_PointParameters","gl_Point","gl_MaterialParameters","gl_FrontMaterial","gl_BackMaterial","gl_LightSourceParameters","gl_LightSource","gl_LightModelParameters","gl_LightModel","gl_LightModelProducts","gl_FrontLightModelProduct","gl_BackLightModelProduct","gl_LightProducts","gl_FrontLightProduct","gl_BackLightProduct","gl_FogParameters","gl_Fog","gl_TextureEnvColor","gl_EyePlaneS","gl_EyePlaneT","gl_EyePlaneR","gl_EyePlaneQ","gl_ObjectPlaneS","gl_ObjectPlaneT","gl_ObjectPlaneR","gl_ObjectPlaneQ","gl_FrontColor","gl_BackColor","gl_FrontSecondaryColor","gl_BackSecondaryColor","gl_TexCoord","gl_FogFragCoord","gl_Color","gl_SecondaryColor","gl_TexCoord","gl_FogFragCoord","gl_PointCoord","radians","degrees","sin","cos","tan","asin","acos","atan","pow","exp","log","exp2","log2","sqrt","inversesqrt","abs","sign","floor","ceil","fract","mod","min","max","clamp","mix","step","smoothstep","length","distance","dot","cross","normalize","faceforward","reflect","refract","matrixCompMult","lessThan","lessThanEqual","greaterThan","greaterThanEqual","equal","notEqual","any","all","not","texture2D","texture2DProj","texture2DLod","texture2DProjLod","textureCube","textureCubeLod","dFdx","dFdy"]},{}],171:[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"]},{}],172:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],173:[function(t,e,r){function n(t){var e=i(),r=[];return r=r.concat(e(t)),r=r.concat(e(null))}var i=t("./index");e.exports=n},{"./index":169}],174:[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,c,u,h,f,d=1,p=t.length,g="",v=[],m=!0,y="";for(s=0;p>s;s++)if(g=i(t[s]),"string"===g)v[v.length]=t[s];else if("array"===g){if(c=t[s],c[2])for(n=e[d],l=0;l<c[2].length;l++){if(!n.hasOwnProperty(c[2][l]))throw new Error(r("[sprintf] property '%s' does not exist",c[2][l]));n=n[c[2][l]]}else n=c[1]?e[c[1]]:e[d++];if("function"==i(n)&&(n=n()),a.not_string.test(c[8])&&a.not_json.test(c[8])&&"number"!=i(n)&&isNaN(n))throw new TypeError(r("[sprintf] expecting number but found %s",i(n)));switch(a.number.test(c[8])&&(m=n>=0),c[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,c[6]?parseInt(c[6]):0);break;case"e":n=c[7]?n.toExponential(c[7]):n.toExponential();break;case"f":n=c[7]?parseFloat(n).toFixed(c[7]):parseFloat(n);break;case"g":n=c[7]?parseFloat(n).toPrecision(c[7]):parseFloat(n);break;case"o":n=n.toString(8);break;case"s":n=(n=String(n))&&c[7]?n.substring(0,c[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(c[8])?v[v.length]=n:(!a.number.test(c[8])||m&&!c[3]?y="":(y=m?"+":"-",n=n.toString().replace(a.sign,"")),h=c[4]?"0"===c[4]?"0":c[4].charAt(1):" ",f=c[6]-(y+n).length,u=c[6]&&f>0?o(h,f):"",v[v.length]=c[5]?y+n+u:"0"===h?y+u+n:u+y+n)}return v.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)},{}],175:[function(t,e,r){function n(){var t={};return function(e){if(("object"!=typeof e||null===e)&&"function"!=typeof e)throw new Error("Weakmap-shim: Key must be object");var r=e.valueOf(t);return r&&r.identity===t?r:i(e,t)}}var i=t("./hidden-store.js");e.exports=n},{"./hidden-store.js":176}],176:[function(t,e,r){function n(t,e){var r={identity:e},n=t.valueOf;return Object.defineProperty(t,"valueOf",{value:function(t){return t!==e?n.apply(this,arguments):r},writable:!0}),r}e.exports=n},{}],177:[function(t,e,r){function n(){var t=i();return{get:function(e,r){var n=t(e);return n.hasOwnProperty("value")?n.value:r},set:function(e,r){t(e).value=r},has:function(e){return"value"in t(e)},"delete":function(e){return delete t(e).value}}}var i=t("./create-store.js");e.exports=n},{"./create-store.js":175}],178:[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]),c=s[1]+(n[1]-a[1])/(a[3]-a[1])*(s[3]-s[1]);t[0]&&o.drawLine(l,c,s[0],c,e[0],r[0]),t[1]&&o.drawLine(l,c,l,s[1],e[1],r[1]),t[2]&&o.drawLine(l,c,s[2],c,e[2],r[2]),t[3]&&o.drawLine(l,c,l,s[3],e[3],r[3])}},o.dispose=function(){this.plot.removeOverlay(this)}},{}],179:[function(t,e,r){var n=t("gl-shader"),i="#define GLSLIFY 1\nprecision mediump float;\n\nattribute vec4 uv;\nattribute vec2 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 value = f.x;\n kill = f.y;\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}",o="#define GLSLIFY 1\nprecision mediump float;\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 float interpValue = (value - lowerBound.z) / (upperBound.z - lowerBound.z);\n vec4 surfaceColor = texture2D(colormap, vec2(interpValue, interpValue));\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="#define GLSLIFY 1\nprecision mediump float;\n\nattribute vec4 uv;\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 = dataCoordinate.z;\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="#define GLSLIFY 1\nprecision mediump float;\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}";r.createShader=function(t){var e=n(t,i,o,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec2"},{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:"vec2"},{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"}]);return e.attributes.uv.location=0,e},r.createPickContourShader=function(t){var e=n(t,a,s,null,[{name:"uv",type:"vec4"}]);return e.attributes.uv.location=0,e}},{"gl-shader":154}],180:[function(t,e,r){arguments[4][20][0].apply(r,arguments)},{dup:20}],181:[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:u,post:u,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 c=".lo("+n.join()+").hi("+i.join()+")";if(0===n.length&&(c=""),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(),")",c);for(var l=0;o>l;++l)e.indexOf(l+1)>=0||e.indexOf(-(l+1))>=0||a.push(",dst.pick(",s.join(),",",l,")",c);a.push(");")}for(var l=0;l<e.length;++l){var u=Math.abs(e[l])-1,h="dst.pick("+s.join()+","+u+")"+c;switch(t[u]){case"clamp":var f=s.slice(),d=s.slice();e[l]<0?f[u]="s["+u+"]-2":d[u]="1",0===r?a.push("if(s[",u,"]>1){dst.set(",s.join(),",",u,",0.5*(src.get(",f.join(),")-src.get(",d.join(),")))}else{dst.set(",s.join(),",",u,",0)};"):a.push("if(s[",u,"]>1){diff(",h,",src.pick(",f.join(),")",c,",src.pick(",d.join(),")",c,");}else{zero(",h,");};");break;case"mirror":0===r?a.push("dst.set(",s.join(),",",u,",0);"):a.push("zero(",h,");");break;case"wrap":var p=s.slice(),g=s.slice();e[l]<0?(p[u]="s["+u+"]-2",g[u]="0"):(p[u]="s["+u+"]-1",g[u]="1"),0===r?a.push("if(s[",u,"]>2){dst.set(",s.join(),",",u,",0.5*(src.get(",p.join(),")-src.get(",g.join(),")))}else{dst.set(",s.join(),",",u,",0)};"):a.push("if(s[",u,"]>2){diff(",h,",src.pick(",p.join(),")",c,",src.pick(",g.join(),")",c,");}else{zero(",h,");};");break;default:throw new Error("ndarray-gradient: Invalid boundary condition")}}r>0&&a.push("};")}var r=t.join(),i=c[r];if(i)return i;for(var o=t.length,a=["function gradient(dst,src){var s=src.shape.slice();"],s=0;1<<o>s;++s){for(var u=[],d=0;o>d;++d)s&1<<d&&u.push(d+1);for(var p=0;p<1<<u.length;++p){for(var g=u.slice(),d=0;d<u.length;++d)p&1<<d&&(g[d]=-g[d]);e(g)}}a.push("return dst;};return gradient");for(var v=["diff","zero"],m=[h,f],s=1;o>=s;++s)v.push("grad"+s),m.push(n(s));v.push(a.join(""));var y=Function.apply(void 0,v),i=y.apply(void 0,m);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;n<e.dimension;++n)if(t.shape[n]!==e.shape[n])throw new Error("ndarray-gradient: shape mismatch");if(0===e.size)return t;if(e.dimension<=0)return t.set(0),t;var o=i(r);return o(t,e)}e.exports=o;var a=t("dup"),s=t("cwise-compiler"),l={},c={},u={body:"",args:[],thisVars:[],localVars:[]},h=s({args:["array","array","array"],pre:u,post:u,body:{args:[{name:"out",lvalue:!0,rvalue:!1,count:1},{name:"left",lvalue:!1,rvalue:!0,count:1},{name:"right",lvalue:!1,rvalue:!0,count:1}],body:"out=0.5*(left-right)",thisVars:[],localVars:[]},funcName:"cdiff"}),f=s({args:["array"],pre:u,post:u,body:{args:[{name:"out",lvalue:!0,rvalue:!1,count:1}],body:"out=0",thisVars:[],localVars:[]},funcName:"zero"})},{"cwise-compiler":66,dup:72}],182:[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":183,ndarray:208}],183:[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":66}],184:[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=x([y({colormap:t,nshades:O,format:"rgba"}).map(function(t){return[t[0],t[1],t[2],255*t[3]]})]);return b.divseq(e,255),e}function o(t,e,r,i,o,a,s,l,c,u,h,f,d,p){this.gl=t,this.shape=e,this.bounds=r,this._shader=i,this._pickShader=o,this._coordinateBuffer=a,this._vao=s,this._colorMap=l,this._contourShader=c,this._contourPickShader=u,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=d,this._dynamicVAO=p,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=[_(m.mallocFloat(1024),[0,0]),_(m.mallocFloat(1024),[0,0]),_(m.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){for(var r=e.axes&&e.axes.lastCubeProps.axis||D,n=e.showSurface,i=e.showContour,o=0;3>o;++o){n=n||e.surfaceProject[o];for(var a=0;3>a;++a)i=i||e.contourProject[o][a]}for(var o=0;3>o;++o){for(var s=F.projections[o],a=0;16>a;++a)s[a]=0;for(var a=0;4>a;++a)s[5*a]=1;s[5*o]=0,s[12+o]=e.axesBounds[+(r[o]>0)][o],k(s,t.model,s);for(var l=F.clipBounds[o],c=0;2>c;++c)for(var a=0;3>a;++a)l[c][a]=t.clipBounds[c][a];l[0][o]=-1e8,l[1][o]=1e8}return F.showSurface=n,F.showContour=i,F}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||P,n.view=t.view||P,n.projection=t.projection||P,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.shape=n.roughness=this.roughness,n.fresnel=this.fresnel,n.opacity=this.opacity,n.height=0,n.permutation=V;var l=U;k(l,n.view,n.model),k(l,n.projection,l),A(l,l);for(var i=0;3>i;++i)n.eyePosition[i]=l[12+i]/l[15];for(var c=l[15],i=0;3>i;++i)c+=this.lightPosition[i]*l[4*i+3];for(var i=0;3>i;++i){for(var u=l[12+i],s=0;3>s;++s)u+=l[4*s+i]*this.lightPosition[s];n.lightPosition[i]=u/c}var h=a(n,this);if(h.showSurface&&e===this.opacity<1){this._shader.bind(),this._shader.uniforms=n,this._vao.bind(),this.showSurface&&this._vao.draw(r.TRIANGLES,this._vertexCount);for(var i=0;3>i;++i)this.surfaceProject[i]&&(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 d=this._contourVAO;d.bind();for(var i=0;3>i;++i){f.uniforms.permutation=R[i],r.lineWidth(this.contourWidth[i]);for(var s=0;s<this.contourLevels[i].length;++s)s===this.highlightLevel[i]?(f.uniforms.contourColor=this.highlightColor[i],f.uniforms.contourTint=this.highlightTint[i]):(0===s||s-1===this.highlightLevel[i])&&(f.uniforms.contourColor=this.contourColor[i],f.uniforms.contourTint=this.contourTint[i]),f.uniforms.height=this.contourLevels[i][s],d.draw(r.LINES,this._contourCounts[i][s],this._contourOffsets[i][s])}for(var i=0;3>i;++i){f.uniforms.model=h.projections[i],f.uniforms.clipBounds=h.clipBounds[i];for(var s=0;3>s;++s)if(this.contourProject[i][s]){f.uniforms.permutation=R[s],r.lineWidth(this.contourWidth[s]);for(var p=0;p<this.contourLevels[s].length;++p)p===this.highlightLevel[s]?(f.uniforms.contourColor=this.highlightColor[s],f.uniforms.contourTint=this.highlightTint[s]):(0===p||p-1===this.highlightLevel[s])&&(f.uniforms.contourColor=this.contourColor[s],f.uniforms.contourTint=this.contourTint[s]),f.uniforms.height=this.contourLevels[s][p],d.draw(r.LINES,this._contourCounts[s][p],this._contourOffsets[s][p])}}d=this._dynamicVAO,d.bind();for(var i=0;3>i;++i)if(0!==this._dynamicCounts[i]){f.uniforms.model=n.model,f.uniforms.clipBounds=n.clipBounds,f.uniforms.permutation=R[i],r.lineWidth(this.dynamicWidth[i]),f.uniforms.contourColor=this.dynamicColor[i],f.uniforms.contourTint=this.dynamicTint[i],f.uniforms.height=this.dynamicLevel[i],d.draw(r.LINES,this._dynamicCounts[i],this._dynamicOffsets[i]);for(var s=0;3>s;++s)this.contourProject[s][i]&&(f.uniforms.model=h.projections[s],f.uniforms.clipBounds=h.clipBounds[s],d.draw(r.LINES,this._dynamicCounts[i],this._dynamicOffsets[i]))}d.unbind()}}function l(t,e){var r=e.shape.slice(),n=t.shape.slice();b.assign(t.lo(1,1).hi(r[0],r[1]),e),b.assign(t.lo(1).hi(r[0],1),e.hi(r[0],1)),b.assign(t.lo(1,n[1]-1).hi(r[0],1),e.lo(0,r[1]-1).hi(r[0],1)),b.assign(t.lo(0,1).hi(1,r[1]),e.hi(1)),b.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 c(t,e){return Array.isArray(t)?[e(t[0]),e(t[1]),e(t[2])]:[e(t),e(t),e(t)]}function u(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[u(t[0]),u(t[1]),u(t[2])];var e=u(t);return[e.slice(),e.slice(),e.slice()]}}function f(t){var e=t.gl,r=(t.field||t.coords&&t.coords[2]||_([],[0,0]),L(e)),n=C(e),i=S(e),a=z(e),s=p(e),l=g(e,[{buffer:s,size:4,stride:j,offset:0},{buffer:s,size:2,stride:j,offset:16},{buffer:s,size:3,stride:j,offset:24}]),c=p(e),u=g(e,[{buffer:c,size:4}]),h=p(e),f=g(e,[{buffer:h,size:2,type:e.FLOAT}]),d=v(e,1,O,e.RGBA,e.UNSIGNED_BYTE);d.minFilter=e.LINEAR,d.magFilter=e.LINEAR;var m=new o(e,[0,0],[[0,0,0],[0,0,0]],r,n,s,l,d,i,a,c,u,h,f),y={levels:[[],[],[]]};for(var b in t)y[b]=t[b];return y.colormap=y.colormap||"jet",m.update(y),m}e.exports=f;var d=t("bit-twiddle"),p=t("gl-buffer"),g=t("gl-vao"),v=t("gl-texture2d"),m=t("typedarray-pool"),y=t("colormap"),b=t("ndarray-ops"),x=t("ndarray-pack"),_=t("ndarray"),w=t("surface-nets"),k=t("gl-mat4/multiply"),A=t("gl-mat4/invert"),M=t("binary-search-bounds"),T=t("ndarray-gradient"),_=t("ndarray"),E=t("./lib/shaders"),L=E.createShader,S=E.createContourShader,C=E.createPickShader,z=E.createPickContourShader,j=36,P=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],I=[[0,0],[0,1],[1,0],[1,1],[1,0],[0,1]],R=[[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=R[t],r=(t+1)%3,n=(t+2)%3;e[r+0]=1,e[n+3]=1,e[t+6]=1}}();var O=265,N=o.prototype;N.isTransparent=function(){return this.opacity<1},N.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},N.pickSlots=1,N.setPickBase=function(t){this.pickId=t};var D=[0,0,0],F={showSurface:!1,showContour:!1,projections:[P.slice(),P.slice(),P.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]},B={model:P,view:P,projection:P,inverseModel:P.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=P.slice(),V=[1,0,0,0,1,0,0,0,1];N.draw=function(t){return s.call(this,t,!1)},N.drawTransparent=function(t){return s.call(this,t,!0)};var q={model:P,view:P,projection:P,inverseModel:P,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]};N.drawPick=function(t){t=t||{};var e=this.gl;e.disable(e.CULL_FACE);var r=q;r.model=t.model||P,r.view=t.view||P,r.projection=t.projection||P,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){this._pickShader.bind(),this._pickShader.uniforms=r,this._vao.bind(),this._vao.draw(e.TRIANGLES,this._vertexCount);for(var 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 c=this._contourVAO;c.bind();for(var o=0;3>o;++o){e.lineWidth(this.contourWidth[o]),l.uniforms.permutation=R[o];for(var n=0;n<this.contourLevels[o].length;++n)l.uniforms.height=this.contourLevels[o][n],c.draw(e.LINES,this._contourCounts[o][n],this._contourOffsets[o][n])}for(var n=0;3>n;++n){l.uniforms.model=s.projections[n],l.uniforms.clipBounds=s.clipBounds[n];for(var o=0;3>o;++o)if(this.contourProject[n][o]){l.uniforms.permutation=R[o],e.lineWidth(this.contourWidth[o]);for(var u=0;u<this.contourLevels[o].length;++u)l.uniforms.height=this.contourLevels[o][u],c.draw(e.LINES,this._contourCounts[o][u],this._contourOffsets[o][u])}}c.unbind()}},N.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=this._field[2].shape,r=this._pickResult,n=e[0]*(t.value[0]+(t.value[2]>>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 c=r.position;c[0]=c[1]=c[2]=0;for(var u=0;2>u;++u)for(var h=u?o:1-o,f=0;2>f;++f)for(var d=f?l:1-l,p=i+u,g=s+f,v=h*d,m=0;3>m;++m)c[m]+=this._field[m].get(p,g)*v;for(var y=this._pickResult.level,b=0;3>b;++b)if(y[b]=M.le(this.contourLevels[b],c[b]),y[b]<0)this.contourLevels[b].length>0&&(y[b]=0);else if(y[b]<this.contourLevels[b].length-1){var x=this.contourLevels[b][y[b]],_=this.contourLevels[b][y[b]+1];Math.abs(x-c[b])>Math.abs(_-c[b])&&(y[b]+=1)}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];for(var m=0;3>m;++m)r.dataCoordinate[m]=this._field[m].get(r.index[0],r.index[1]);return r},N.update=function(t){t=t||{},this.dirty=!0,"contourWidth"in t&&(this.contourWidth=c(t.contourWidth,Number)),"showContour"in t&&(this.showContour=c(t.showContour,Boolean)),"showSurface"in t&&(this.showSurface=!!t.showSurface),
"contourTint"in t&&(this.contourTint=c(t.contourTint,Boolean)),"contourColor"in t&&(this.contourColor=h(t.contourColor)),"contourProject"in t&&(this.contourProject=c(t.contourProject,function(t){return c(t,Boolean)})),"surfaceProject"in t&&(this.surfaceProject=t.surfaceProject),"dynamicColor"in t&&(this.dynamicColor=h(t.dynamicColor)),"dynamicTint"in t&&(this.dynamicTint=c(t.dynamicTint,Number)),"dynamicWidth"in t&&(this.dynamicWidth=c(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;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 r=(e.shape[0]+2)*(e.shape[1]+2);r>this._field[2].data.length&&(m.freeFloat(this._field[2].data),this._field[2].data=m.mallocFloat(d.nextPow2(r))),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 n=this.shape,o=0;2>o;++o)this._field[2].size>this._field[o].data.length&&(m.freeFloat(this._field[o].data),this._field[o].data=m.mallocFloat(this._field[2].size)),this._field[o]=_(this._field[o].data,[n[0]+2,n[1]+2]);if(t.coords){var a=t.coords;if(!Array.isArray(a)||3!==a.length)throw new Error("gl-surface: invalid coordinates for x/y");for(var o=0;2>o;++o){for(var s=a[o],u=0;2>u;++u)if(s.shape[u]!==n[u])throw new Error("gl-surface: coords have incorrect shape");l(this._field[o],s)}}else if(t.ticks){var f=t.ticks;if(!Array.isArray(f)||2!==f.length)throw new Error("gl-surface: invalid ticks");for(var o=0;2>o;++o){var p=f[o];if((Array.isArray(p)||p.length)&&(p=_(p)),p.shape[0]!==n[o])throw new Error("gl-surface: invalid tick length");var g=_(p.data,n);g.stride[o]=p.stride[0],g.stride[1^o]=0,l(this._field[o],g)}}else{for(var o=0;2>o;++o){var v=[0,0];v[o]=1,this._field[o]=_(this._field[o].data,[n[0]+2,n[1]+2],v,0)}this._field[0].set(0,0,0);for(var u=0;u<n[0];++u)this._field[0].set(u+1,0,u);this._field[0].set(n[0]+1,0,n[0]-1),this._field[1].set(0,0,0);for(var u=0;u<n[1];++u)this._field[1].set(0,u+1,u);this._field[1].set(0,n[1]+1,n[1]-1)}for(var y=this._field,b=(y[2].size,_(m.mallocFloat(3*y[2].size*2),[3,n[0]+2,n[1]+2,2])),o=0;3>o;++o)T(b.pick(o),y[o],"mirror");for(var x=_(m.mallocFloat(3*y[2].size),[n[0]+2,n[1]+2,3]),o=0;o<n[0]+2;++o)for(var u=0;u<n[1]+2;++u){var k=b.get(0,o,u,0),A=b.get(0,o,u,1),M=b.get(1,o,u,0),E=b.get(1,o,u,1),L=b.get(2,o,u,0),S=b.get(2,o,u,1),C=M*S-E*L,z=L*A-S*k,j=k*E-A*M,P=Math.sqrt(C*C+z*z+j*j);1e-8>P?(P=Math.max(Math.abs(C),Math.abs(z),Math.abs(j)),1e-8>P?(j=1,z=C=0,P=1):P=1/P):P=1/Math.sqrt(P),x.set(o,u,0,C*P),x.set(o,u,1,z*P),x.set(o,u,2,j*P)}m.free(b.data);for(var R=[1/0,1/0,1/0],O=[-(1/0),-(1/0),-(1/0)],N=(n[0]-1)*(n[1]-1)*6,D=m.mallocFloat(d.nextPow2(9*N)),F=0,B=0,o=0;o<n[0]-1;++o)t:for(var u=0;u<n[1]-1;++u){for(var U=0;2>U;++U)for(var V=0;2>V;++V)for(var q=0;3>q;++q){var H=this._field[q].get(1+o+U,1+u+V);if(isNaN(H)||!isFinite(H))continue t}for(var q=0;6>q;++q){var G=o+I[q][0],Y=u+I[q][1],X=this._field[0].get(G+1,Y+1),W=this._field[1].get(G+1,Y+1),H=this._field[2].get(G+1,Y+1),C=x.get(G+1,Y+1,0),z=x.get(G+1,Y+1,1),j=x.get(G+1,Y+1,2);D[F++]=G,D[F++]=Y,D[F++]=X,D[F++]=W,D[F++]=H,D[F++]=0,D[F++]=C,D[F++]=z,D[F++]=j,R[0]=Math.min(R[0],X),R[1]=Math.min(R[1],W),R[2]=Math.min(R[2],H),O[0]=Math.max(O[0],X),O[1]=Math.max(O[1],W),O[2]=Math.max(O[2],H),B+=1}}this._vertexCount=B,this._coordinateBuffer.update(D.subarray(0,F)),m.freeFloat(D),m.free(x.data),this.bounds=[R,O]}var Z=!1;if("levels"in t){var Q=t.levels;Q=Array.isArray(Q[0])?Q.slice():[[],[],Q];for(var o=0;3>o;++o)Q[o]=Q[o].slice(),Q.sort(function(t,e){return t-e});t:for(var o=0;3>o;++o){if(Q[o].length!==this.contourLevels[o].length){Z=!0;break}for(var u=0;u<Q[o].length;++u)if(Q[o][u]!==this.contourLevels[o][u]){Z=!0;break t}}this.contourLevels=Q}if(Z){for(var y=this._field,n=this.shape,$=[],K=0;3>K;++K){for(var Q=this.contourLevels[K],J=[],tt=[],et=[0,0],o=0;o<Q.length;++o){var rt=w(this._field[K],Q[o]);J.push($.length/4|0);var B=0;t:for(var u=0;u<rt.cells.length;++u)for(var nt=rt.cells[u],q=0;2>q;++q){var it=rt.positions[nt[q]],ot=it[0],at=0|Math.floor(ot),st=ot-at,lt=it[1],ct=0|Math.floor(lt),ut=lt-ct,ht=!1;e:for(var ft=0;2>ft;++ft){et[ft]=0;for(var dt=(K+ft+1)%3,U=0;2>U;++U)for(var pt=U?st:1-st,G=0|Math.min(Math.max(at+U,0),n[0]),V=0;2>V;++V){var gt=V?ut:1-ut,Y=0|Math.min(Math.max(ct+V,0),n[1]),H=this._field[dt].get(G,Y);if(!isFinite(H)||isNaN(H)){ht=!0;break e}var vt=pt*gt;et[ft]+=vt*H}}if(ht){if(q>0){for(var mt=0;4>mt;++mt)$.pop();B-=1}continue t}$.push(et[0],et[1],it[0],it[1]),B+=1}tt.push(B)}this._contourOffsets[K]=J,this._contourCounts[K]=tt}for(var yt=m.mallocFloat($.length),o=0;o<$.length;++o)yt[o]=$[o];this._contourBuffer.update(yt),m.freeFloat(yt)}t.colormap&&this._colorMap.setPixels(i(t.colormap))},N.dispose=function(){this._shader.dispose(),this._vao.dispose(),this._coordinateBuffer.dispose(),this._colorMap.dispose(),this._contourBuffer.dispose(),this._contourVAO.dispose(),this._contourShader.dispose(),this._contourPickShader.dispose(),this._dynamicBuffer.dispose(),this._dynamicVAO.dispose();for(var t=0;3>t;++t)m.freeFloat(this._field[t].data)},N.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=m.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,c=this._field[a],u=this._field[s],h=this._field[l],f=w(c,r[a]),d=f.cells,p=f.positions;this._dynamicOffsets[a]=n;for(var e=0;e<d.length;++e)for(var g=d[e],v=0;2>v;++v){var y=p[g[v]],b=+y[0],x=0|b,_=0|Math.min(x+1,i[0]),k=b-x,A=1-k,M=+y[1],T=0|M,E=0|Math.min(T+1,i[1]),L=M-T,S=1-L,C=A*S,z=A*L,j=k*S,P=k*L,I=C*u.get(x,T)+z*u.get(x,E)+j*u.get(_,T)+P*u.get(_,E),R=C*h.get(x,T)+z*h.get(x,E)+j*h.get(_,T)+P*h.get(_,E);if(isNaN(I)||isNaN(R)){v&&(n-=1);break}o[2*n+0]=I,o[2*n+1]=R,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)),m.freeFloat(o)}}},{"./lib/shaders":179,"binary-search-bounds":180,"bit-twiddle":49,colormap:57,"gl-buffer":75,"gl-mat4/invert":94,"gl-mat4/multiply":96,"gl-texture2d":185,"gl-vao":189,ndarray:208,"ndarray-gradient":181,"ndarray-ops":207,"ndarray-pack":182,"surface-nets":227,"typedarray-pool":233}],185:[function(t,e,r){"use strict";function n(t){v=[t.LINEAR,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_NEAREST],m=[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 c=l.dtype,u=l.shape.slice();if(u.length<2||u.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var h=0,f=0,v=a(u,l.stride.slice());"float32"===c?h=t.FLOAT:"float64"===c?(h=t.FLOAT,v=!1,c="float32"):"uint8"===c?h=t.UNSIGNED_BYTE:(h=t.UNSIGNED_BYTE,v=!1,c="uint8");var m=1;if(2===u.length)f=t.LUMINANCE,u=[u[0],u[1],1],l=d(l.data,u,[l.stride[0],l.stride[1],1],l.offset);else{if(3!==u.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===u[2])f=t.ALPHA;else if(2===u[2])f=t.LUMINANCE_ALPHA;else if(3===u[2])f=t.RGB;else{if(4!==u[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");f=t.RGBA}m=u[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,x=s.indexOf(n)<0;if(x&&s.push(n),h===o&&v)0===l.offset&&l.data.length===y?x?t.texImage2D(t.TEXTURE_2D,n,i,u[0],u[1],0,i,o,l.data):t.texSubImage2D(t.TEXTURE_2D,n,e,r,u[0],u[1],i,o,l.data):x?t.texImage2D(t.TEXTURE_2D,n,i,u[0],u[1],0,i,o,l.data.subarray(l.offset,l.offset+y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,u[0],u[1],i,o,l.data.subarray(l.offset,l.offset+y));else{var _;_=o===t.FLOAT?g.mallocFloat32(y):g.mallocUint8(y);var w=d(_,u,[u[2],u[2]*u[0],1]);h===t.FLOAT&&o===t.UNSIGNED_BYTE?b(w,l):p.assign(w,l),x?t.texImage2D(t.TEXTURE_2D,n,i,u[0],u[1],0,i,o,_.subarray(0,y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,u[0],u[1],i,o,_.subarray(0,y)),o===t.FLOAT?g.freeFloat32(_):g.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 c(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 u(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()),c=0;"float32"===r?c=t.FLOAT:"float64"===r?(c=t.FLOAT,s=!1,r="float32"):"uint8"===r?c=t.UNSIGNED_BYTE:(c=t.UNSIGNED_BYTE,s=!1,r="uint8");var u=0;if(2===n.length)u=t.LUMINANCE,n=[n[0],n[1],1],e=d(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])u=t.ALPHA;else if(2===n[2])u=t.LUMINANCE_ALPHA;else if(3===n[2])u=t.RGB;else{if(4!==n[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");u=t.RGBA}}c!==t.FLOAT||t.getExtension("OES_texture_float")||(c=t.UNSIGNED_BYTE,s=!1);var h,f,v=e.size;if(s)h=0===e.offset&&e.data.length===v?e.data:e.data.subarray(e.offset,e.offset+v);else{var m=[n[2],n[2]*n[0],1];f=g.malloc(v,r);var y=d(f,n,m,0);"float32"!==r&&"float64"!==r||c!==t.UNSIGNED_BYTE?p.assign(y,e):b(y,e),h=f.subarray(0,v)}var x=l(t);return t.texImage2D(t.TEXTURE_2D,0,u,n[0],n[1],0,u,c,h),s||g.free(f),new o(t,x,n[0],n[1],u,c)}function f(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(v||n(t),"number"==typeof arguments[1])return c(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return c(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 u(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 d=t("ndarray"),p=t("ndarray-ops"),g=t("typedarray-pool");e.exports=f;var v=null,m=null,y=null,b=function(t,e){p.muls(t,e,255)},x=o.prototype;Object.defineProperties(x,{minFilter:{get:function(){return this._minFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&v.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),m.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&&v.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),m.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}}}),x.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},x.dispose=function(){this.gl.deleteTexture(this.handle)},x.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)},x.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:208,"ndarray-ops":207,"typedarray-pool":233}],186:[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;i<r.length;++i){var o=r[i];if(o.buffer){var a=o.buffer,s=o.size||4,l=o.type||t.FLOAT,c=!!o.normalized,u=o.stride||0,h=o.offset||0;a.bind(),t.enableVertexAttribArray(i),t.vertexAttribPointer(i,s,l,c,u,h)}else{if("number"==typeof o)t.vertexAttrib1f(i,o);else if(1===o.length)t.vertexAttrib1f(i,o[0]);else if(2===o.length)t.vertexAttrib2f(i,o[0],o[1]);else if(3===o.length)t.vertexAttrib3f(i,o[0],o[1],o[2]);else{if(4!==o.length)throw new Error("gl-vao: Invalid vertex attribute");t.vertexAttrib4f(i,o[0],o[1],o[2],o[3])}t.disableVertexAttribArray(i)}}for(;n>i;++i)t.disableVertexAttribArray(i)}else{t.bindBuffer(t.ARRAY_BUFFER,null);for(var i=0;n>i;++i)t.disableVertexAttribArray(i)}}e.exports=n},{}],187:[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":186}],188:[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;t<this._attribs.length;++t)this._attribs[t].bind(this.gl)},i.prototype.unbind=function(){this._ext.bindVertexArrayOES(null)},i.prototype.dispose=function(){this._ext.deleteVertexArrayOES(this.handle)},i.prototype.update=function(t,e,r){if(this.bind(),a(this.gl,e,t),this.unbind(),this._attribs.length=0,t)for(var i=0;i<t.length;++i){var o=t[i];"number"==typeof o?this._attribs.push(new n(i,1,o)):Array.isArray(o)&&this._attribs.push(new n(i,o.length,o[0],o[1],o[2],o[3]))}this._useElements=!!e,this._elementsType=r||this.gl.UNSIGNED_SHORT},i.prototype.draw=function(t,e,r){r=r||0;var n=this.gl;this._useElements?n.drawElements(t,e,this._elementsType,r):n.drawArrays(t,r,e)},e.exports=o},{"./do-bind.js":186}],189:[function(t,e,r){"use strict";function n(t,e,r,n){var a,s=t.getExtension("OES_vertex_array_object");return a=s?i(t,s):o(t),a.update(e,r,n),a}var i=t("./lib/vao-native.js"),o=t("./lib/vao-emulated.js");e.exports=n},{"./lib/vao-emulated.js":187,"./lib/vao-native.js":188}],190:[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},{}],191:[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 u(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=c[t+1];return i||(i=c),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=c.apply(void 0,o);if(0===a)throw new Error("Input not in general position");for(var l=new Array(i+1),u=0;i>=u;++u)l[u]=u;0>a&&(l[0]=1,l[1]=0);for(var h=new n(l,new Array(i+1),!1),f=h.adjacent,d=new Array(i+2),u=0;i>=u;++u){for(var p=l.slice(),g=0;i>=g;++g)g===u&&(p[g]=-1);var v=p[0];p[0]=p[1],p[1]=v;var m=new n(p,new Array(i+1),!0);f[u]=m,d[u]=m}d[i+1]=h;for(var u=0;i>=u;++u)for(var p=f[u].vertices,y=f[u].adjacent,g=0;i>=g;++g){var b=p[g];if(0>b)y[g]=h;else for(var x=0;i>=x;++x)f[x].vertices.indexOf(b)<0&&(y[g]=f[x])}for(var _=new s(i,o,d),w=!!e,u=i+1;r>u;++u)_.insert(t[u],w);return _.boundary()}e.exports=l;var c=t("robust-orientation"),u=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 c=s[l];if(c.boundary&&!(c.lastVisited<=-n)){for(var u=c.vertices,h=0;r>=h;++h){var f=u[h];0>f?i[h]=e:i[h]=o[f]}var d=this.orient();if(d>0)return c;c.lastVisited=-n,0===d&&a.push(c)}}}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,c=s.adjacent,u=0;n>=u;++u)o[u]=i[l[u]];s.lastVisited=r;for(var u=0;n>=u;++u){var h=c[u];if(!(h.lastVisited>=r)){var f=o[u];o[u]=t;var d=this.orient();if(o[u]=f,0>d){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,c=this.interior,u=this.simplices,h=[e];e.lastVisited=r,e.vertices[e.vertices.indexOf(-1)]=r,e.boundary=!1,c.push(e);for(var f=[];h.length>0;){var e=h.pop(),d=e.vertices,p=e.adjacent,g=d.indexOf(r);if(!(0>g))for(var v=0;a>=v;++v)if(v!==g){var m=p[v];if(m.boundary&&!(m.lastVisited>=r)){var y=m.vertices;if(m.lastVisited!==-r){for(var b=0,x=0;a>=x;++x)y[x]<0?(b=x,l[x]=t):l[x]=s[y[x]];var _=this.orient();if(_>0){y[b]=r,m.boundary=!1,c.push(m),h.push(m),m.lastVisited=r;continue}m.lastVisited=-r}var w=m.adjacent,k=d.slice(),A=p.slice(),M=new n(k,A,!0);u.push(M);var T=w.indexOf(e);if(!(0>T)){w[T]=M,A[g]=m,k[v]=-1,A[v]=e,p[v]=M,M.flip();for(var x=0;a>=x;++x){var E=k[x];if(!(0>E||E===r)){for(var L=new Array(a-1),S=0,C=0;a>=C;++C){var z=k[C];0>z||C===x||(L[S++]=z)}f.push(new i(L,M,x))}}}}}}f.sort(o);for(var v=0;v+1<f.length;v+=2){var j=f[v],P=f[v+1],I=j.index,R=P.index;0>I||0>R||(j.cell.adjacent[j.index]=P.cell,P.cell.adjacent[P.index]=j.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,c=0,u=0;t>=u;++u)s[u]>=0?a[l++]=s[u]:c=1&u;if(c===(1&t)){var h=a[0];a[0]=a[1],a[1]=h}e.push(a)}}return e}},{"robust-orientation":214,"simplicial-complex":194}],192:[function(t,e,r){arguments[4][49][0].apply(r,arguments)},{dup:49}],193:[function(t,e,r){"use strict";"use restrict";function n(t){this.roots=new Array(t),this.ranks=new Array(t);for(var e=0;t>e;++e)this.roots[e]=e,this.ranks[e]=0}e.exports=n;var i=n.prototype;Object.defineProperty(i,"length",{get:function(){return this.roots.length}}),i.makeSet=function(){var t=this.roots.length;return this.roots.push(t),this.ranks.push(0),t},i.find=function(t){for(var e=t,r=this.roots;r[t]!==t;)t=r[t];for(;r[e]!==t;){var n=r[e];r[e]=t,e=n}return t},i.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])}}},{}],194:[function(t,e,r){"use strict";"use restrict";function n(t){for(var e=0,r=Math.max,n=0,i=t.length;i>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]),c=i(e[0],e[1]),o=i(l,t[2])-i(c,e[2]);return o?o:i(l+t[2],a)-i(c+e[2],s);default:var u=t.slice(0);u.sort();var h=e.slice(0);h.sort();for(var f=0;r>f;++f)if(n=u[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 c(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 u(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],c=l.length,h=1,f=1<<c;f>h;++h){o.length=b.popCount(h);for(var d=0,p=0;c>p;++p)h&1<<p&&(o[d++]=l[p]);var g=u(t,o);if(!(0>g))for(;;)if(r[g++].push(n),g>=t.length||0!==a(t[g],o))break}return r}function f(t,e){if(!e)return h(c(p(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 d(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<<o;s>a;++a){for(var c=[],u=0;o>u;++u)a>>>u&1&&c.push(i[u]);e.push(c)}return l(e)}function p(t,e){if(0>e)return[];for(var r=[],n=(1<<e+1)-1,i=0;i<t.length;++i)for(var o=t[i],a=n;a<1<<o.length;a=b.nextCombination(a)){for(var s=new Array(e+1),c=0,u=0;u<o.length;++u)a&1<<u&&(s[c++]=o[u]);r.push(s)}return l(r)}function g(t){for(var e=[],r=0,n=t.length;n>r;++r)for(var i=t[r],o=0,a=i.length;a>o;++o){for(var s=new Array(i.length-1),c=0,u=0;a>c;++c)c!==o&&(s[u++]=i[c]);e.push(s)}return l(e)}function v(t,e){for(var r=new x(e),n=0;n<t.length;++n)for(var i=t[n],o=0;o<i.length;++o)for(var a=o+1;a<i.length;++a)r.link(i[o],i[a]);for(var s=[],l=r.ranks,n=0;n<l.length;++n)l[n]=-1;for(var n=0;n<t.length;++n){var c=r.find(t[n][0]);l[c]<0?(l[c]=s.length,s.push([t[n].slice(0)])):s[l[c]].push(t[n].slice(0))}return s}function m(t){for(var e=c(l(p(t,0))),r=new x(e.length),n=0;n<t.length;++n)for(var i=t[n],o=0;o<i.length;++o)for(var a=u(e,[i[o]]),s=o+1;s<i.length;++s)r.link(a,u(e,[i[s]]));for(var h=[],f=r.ranks,n=0;n<f.length;++n)f[n]=-1;for(var n=0;n<t.length;++n){var d=r.find(u(e,[t[n][0]]));f[d]<0?(f[d]=h.length,h.push([t[n].slice(0)])):h[f[d]].push(t[n].slice(0))}return h}function y(t,e){return e?v(t,e):m(t)}var b=t("bit-twiddle"),x=t("union-find");r.dimension=n,r.countVertices=i,r.cloneCells=o,r.compareCells=a,r.normalize=l,r.unique=c,r.findCell=u,r.incidence=h,r.dual=f,r.explode=d,r.skeleton=p,r.boundary=g,r.connectedComponents=y},{"bit-twiddle":192,"union-find":193}],195:[function(t,e,r){"use strict";function n(t){for(var e=new Array(t),r=0;t>r;++r)e[r]=r;return e}e.exports=n},{}],196:[function(t,e,r){"use strict";function n(t,e){function r(t){var e=!1;return"altKey"in t&&(e=e||t.altKey!==g.alt,g.alt=!!t.altKey),"shiftKey"in t&&(e=e||t.shiftKey!==g.shift,g.shift=!!t.shiftKey),"ctrlKey"in t&&(e=e||t.ctrlKey!==g.control,g.control=!!t.ctrlKey),"metaKey"in t&&(e=e||t.metaKey!==g.meta,g.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!==d||a!==p||r(n))&&(f=0|t,d=o||0,p=a||0,e(f,d,p,g))}function o(t){n(0,t)}function a(){(f||d||p||g.shift||g.alt||g.meta||g.control)&&(d=p=0,f=0,g.shift=g.alt=g.control=g.meta=!1,e(0,0,0,g))}function s(t){r(t)&&e(f,d,p,g)}function l(t){0===i.buttons(t)?n(0,t):n(f,t)}function c(t){n(f|i.buttons(t),t)}function u(t){n(f&~i.buttons(t),t)}function h(){v||(v=!0,t.addEventListener("mousemove",l),t.addEventListener("mousedown",c),t.addEventListener("mouseup",u),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,d=0,p=0,g={shift:!1,alt:!1,control:!1,meta:!1},v=!1;h();var m={element:t};return Object.defineProperties(m,{enabled:{get:function(){return v},set:function(t){t&&h()},enumerable:!0},buttons:{get:function(){return f},enumerable:!0},x:{get:function(){return d},enumerable:!0},y:{get:function(){return p},enumerable:!0},mods:{get:function(){return g},enumerable:!0}}),m}e.exports=n;var i=t("mouse-event")},{"mouse-event":197}],197:[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<<e-1}else if("button"in t){var e=t.button;if(1===e)return 4;if(2===e)return 2;if(e>=0)return 1<<e}}return 0}function i(t){return t.target||t.srcElement||window}function o(t){if("object"==typeof t){if("offsetX"in t)return t.offsetX;var e=i(t),r=e.getBoundingClientRect();return t.clientX-r.left}return 0}function a(t){if("object"==typeof t){if("offsetY"in t)return t.offsetY;var e=i(t),r=e.getBoundingClientRect();return t.clientY-r.top}return 0}r.buttons=n,r.element=i,r.x=o,r.y=a},{}],198:[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}},{}],199:[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":198}],200:[function(t,e,r){"use strict";function n(t,e,r){"function"==typeof t&&(r=!!e,e=t,t=window);var n=i("ex",t);t.addEventListener("wheel",function(t){r&&t.preventDefault();var i=t.deltaX||0,o=t.deltaY||0,a=t.deltaZ||0,s=t.deltaMode,l=1;switch(s){case 1:l=n;break;case 2:l=window.innerHeight}return i*=l,o*=l,a*=l,i||o||a?e(i,o,a):void 0})}var i=t("to-px");e.exports=n},{"to-px":199}],201:[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":69}],202:[function(t,e,r){"use strict";function n(t,e){switch(e.length){case 0:break;case 1:t[0]=1/e[0];break;case 4:i(t,e);break;case 9:o(t,e);break;case 16:a(t,e);break;default:throw new Error("currently supports matrices up to 4x4")}return t}e.exports=n;var i=t("gl-mat2/invert"),o=t("gl-mat3/invert"),a=t("gl-mat4/invert")},{"gl-mat2/invert":203,"gl-mat3/invert":87,"gl-mat4/invert":94}],203:[function(t,e,r){function n(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r*o-i*n;return a?(a=1/a,t[0]=o*a,t[1]=-n*a,t[2]=-i*a,t[3]=r*a,t):null}e.exports=n},{}],204:[function(t,e,r){"use strict";function n(t,e){var r=Math.floor(e),n=e-r,i=r>=0&&r<t.shape[0],o=r+1>=0&&r+1<t.shape[0],a=i?+t.get(r):0,s=o?+t.get(r+1):0;return(1-n)*a+n*s}function i(t,e,r){var n=Math.floor(e),i=e-n,o=n>=0&&n<t.shape[0],a=n+1>=0&&n+1<t.shape[0],s=Math.floor(r),l=r-s,c=s>=0&&s<t.shape[1],u=s+1>=0&&s+1<t.shape[1],h=o&&c?t.get(n,s):0,f=o&&u?t.get(n,s+1):0,d=a&&c?t.get(n+1,s):0,p=a&&u?t.get(n+1,s+1):0;return(1-l)*((1-i)*h+i*d)+l*((1-i)*f+i*p)}function o(t,e,r,n){var i=Math.floor(e),o=e-i,a=i>=0&&i<t.shape[0],s=i+1>=0&&i+1<t.shape[0],l=Math.floor(r),c=r-l,u=l>=0&&l<t.shape[1],h=l+1>=0&&l+1<t.shape[1],f=Math.floor(n),d=n-f,p=f>=0&&f<t.shape[2],g=f+1>=0&&f+1<t.shape[2],v=a&&u&&p?t.get(i,l,f):0,m=a&&h&&p?t.get(i,l+1,f):0,y=s&&u&&p?t.get(i+1,l,f):0,b=s&&h&&p?t.get(i+1,l+1,f):0,x=a&&u&&g?t.get(i,l,f+1):0,_=a&&h&&g?t.get(i,l+1,f+1):0,w=s&&u&&g?t.get(i+1,l,f+1):0,k=s&&h&&g?t.get(i+1,l+1,f+1):0;return(1-d)*((1-c)*((1-o)*v+o*y)+c*((1-o)*m+o*b))+d*((1-c)*((1-o)*x+o*w)+c*((1-o)*_+o*k))}function a(t){var e,r,n=0|t.shape.length,i=new Array(n),o=new Array(n),a=new Array(n),s=new Array(n);for(e=0;n>e;++e)r=+arguments[e+1],i[e]=Math.floor(r),o[e]=r-i[e],a[e]=0<=i[e]&&i[e]<t.shape[e],s[e]=0<=i[e]+1&&i[e]+1<t.shape[e];var l,c,u,h=0;t:for(e=0;1<<n>e;++e){for(c=1,u=t.offset,l=0;n>l;++l)if(e&1<<l){if(!s[l])continue t;c*=o[l],u+=t.stride[l]*(i[l]+1)}else{if(!a[l])continue t;c*=1-o[l],u+=t.stride[l]*i[l]}h+=c*t.data[u]}return h}function s(t,e,r,s){switch(t.shape.length){case 0:return 0;case 1:return n(t,e);case 2:return i(t,e,r);case 3:return o(t,e,r,s);default:return a.apply(void 0,arguments)}}e.exports=s,e.exports.d1=n,e.exports.d2=i,e.exports.d3=o},{}],205:[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}],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":69,"ndarray-linear-interpolate":204}],206:[function(t,e,r){"use strict";function n(t,e,r){var n=e.dimension,a=o([],r);return i(t,e,function(t,e){for(var r=0;n>r;++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":202,"ndarray-warp":205}],207:[function(t,e,r){"use strict";function n(t){if(!t)return s;for(var e=0;e<t.args.length;++e){var r=t.args[e];0===e?t.args[e]={name:r,lvalue:!0,rvalue:!!t.rvalue,count:t.count||1}:t.args[e]={name:r,lvalue:!1,rvalue:!0,count:1}}return t.thisVars||(t.thisVars=[]),t.localVars||(t.localVars=[]),t}function i(t){return a({args:t.args,pre:n(t.pre),body:n(t.body),post:n(t.proc),funcName:t.funcName})}function o(t){for(var e=[],r=0;r<t.args.length;++r)e.push("a"+r);var n=new Function("P",["return function ",t.funcName,"_ndarrayops(",e.join(","),") {P(",e.join(","),");return a0}"].join(""));return n(i(t))}var a=t("cwise-compiler"),s={body:"",args:[],thisVars:[],localVars:[]},l={add:"+",sub:"-",mul:"*",div:"/",mod:"%",band:"&",bor:"|",bxor:"^",lshift:"<<",rshift:">>",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 c={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var t in c){var e=c[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 u={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};!function(){for(var t in u){var e=u[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;t<h.length;++t){var e=h[t];r[e]=o({args:["array","array"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b)",thisVars:["this_f"]},funcName:e}),r[e+"eq"]=o({args:["array"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a"],body:"a=this_f(a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:e+"eq"})}}();var f=["max","min","atan2","pow"];!function(){for(var t=0;t<f.length;++t){var e=f[t];r[e]=o({args:["array","array","array"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(b,c)",thisVars:["this_f"]},funcName:e}),r[e+"s"]=o({args:["array","array","scalar"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(b,c)",thisVars:["this_f"]},funcName:e+"s"}),r[e+"eq"]=o({args:["array","array"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(a,b)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:e+"eq"}),r[e+"seq"]=o({args:["array","scalar"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(a,b)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:e+"seq"})}}();var d=["atan2","pow"];!function(){for(var t=0;t<d.length;++t){var e=d[t];r[e+"op"]=o({args:["array","array","array"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(c,b)",thisVars:["this_f"]},funcName:e+"op"}),r[e+"ops"]=o({args:["array","array","scalar"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(c,b)",thisVars:["this_f"]},funcName:e+"ops"}),r[e+"opeq"]=o({args:["array","array"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b,a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:e+"opeq"}),r[e+"opseq"]=o({args:["array","scalar"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b,a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:e+"opseq"})}}(),r.any=a({args:["array"],pre:s,body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"if(a){return true}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return false"},funcName:"any"}),r.all=a({args:["array"],pre:s,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1}],body:"if(!x){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"all"}),r.sum=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"this_s+=a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"sum"}),r.prod=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=1"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"this_s*=a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"prod"}),r.norm2squared=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:2}],body:"this_s+=a*a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm2squared"}),r.norm2=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:2}],body:"this_s+=a*a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return Math.sqrt(this_s)"},funcName:"norm2"}),r.norminf=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:4}],body:"if(-a>this_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_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.argmin=a({args:["index","array","shape"],pre:{body:"{this_v=Infinity;this_i=_inline_0_arg2_.slice(0)}",args:[{name:"_inline_0_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_i","this_v"],localVars:[]},body:{body:"{if(_inline_1_arg1_<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.argmax=a({args:["index","array","shape"],pre:{body:"{this_v=-Infinity;this_i=_inline_0_arg2_.slice(0)}",args:[{name:"_inline_0_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_i","this_v"],localVars:[]},body:{body:"{if(_inline_1_arg1_>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":66}],208:[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;t<r.length;++t)r[t]=[Math.abs(e[t]),t];r.sort(n);var i=new Array(r.length);for(t=0;t<i.length;++t)i[t]=r[t][1];return i}function o(t,e){var r=["View",e,"d",t].join("");0>e&&(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),c=s.map(function(t){return"i"+t}),u="this.offset+"+s.map(function(t){return"this.stride["+t+"]*i"+t}).join("+"),f=s.map(function(t){return"b"+t}).join(","),d=s.map(function(t){return"c"+t}).join(",");o.push("function "+r+"(a,"+f+","+d+",d){this.data=a","this.shape=["+f+"]","this.stride=["+d+"]","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("+c.join(",")+",v){"),n?o.push("return this.data.set("+u+",v)}"):o.push("return this.data["+u+"]=v}"),o.push("proto.get=function "+r+"_get("+c.join(",")+"){"),n?o.push("return this.data.get("+u+")}"):o.push("return this.data["+u+"]}"),o.push("proto.index=function "+r+"_index(",c.join(),"){return "+u+"}"),o.push("proto.hi=function "+r+"_hi("+c.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 p=s.map(function(t){return"a"+t+"=this.shape["+t+"]"}),g=s.map(function(t){return"c"+t+"=this.stride["+t+"]"});o.push("proto.lo=function "+r+"_lo("+c.join(",")+"){var b=this.offset,d=0,"+p.join(",")+","+g.join(","));for(var v=0;e>v;++v)o.push("if(typeof i"+v+"==='number'&&i"+v+">=0){d=i"+v+"|0;b+=c"+v+"*d;a"+v+"-=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("+c.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 v=0;e>v;++v)o.push("if(typeof i"+v+"==='number'){d=i"+v+"|0;if(d<0){c+=b"+v+"*(a"+v+"-1);a"+v+"=ceil(-a"+v+"/d)}else{a"+v+"=ceil(a"+v+"/d)}b"+v+"*=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 m=new Array(e),y=new Array(e),v=0;e>v;++v)m[v]="a[i"+v+"]",y[v]="b[i"+v+"]";o.push("proto.transpose=function "+r+"_transpose("+c+"){"+c.map(function(t,e){return t+"=("+t+"===undefined?"+e+":"+t+"|0)"}).join(";"),"var a=this.shape,b=this.stride;return new "+r+"(this.data,"+m.join(",")+","+y.join(",")+",this.offset)}"),o.push("proto.pick=function "+r+"_pick("+c+"){var a=[],b=[],c=this.offset");for(var v=0;e>v;++v)o.push("if(typeof i"+v+"==='number'&&i"+v+">=0){c=(c+this.stride["+v+"]*i"+v+")|0}else{a.push(this.shape["+v+"]);b.push(this.stride["+v+"])}");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(c(t))return"buffer";if(u)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,c=1;l>=0;--l)r[l]=c,c*=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 u=a(t),f=h[u];f.length<=s+1;)f.push(o(u,f.length-1));var i=f[s+1];return i(t,e,r,n)}var l=t("iota-array"),c=t("is-buffer"),u="undefined"!=typeof Float64Array,h={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],buffer:[],generic:[]};e.exports=s},{"iota-array":195,"is-buffer":209}],209:[function(t,e,r){e.exports=function(t){return!(null==t||!(t._isBuffer||t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)))}},{}],210:[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:{})},{}],211:[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(;c.length<l;)c.push(n(c.length));for(var t=[],r=["function dispatchLinearSolve(A,b){switch(A.length){"],i=0;l>i;++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,c.concat([c,n]));for(var i=0;l>i;++i)e.exports[i]=c[i]}var s=t("robust-determinant"),l=6,c=[i,o];a()},{"robust-determinant":213}],212:[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 c=0,i=n;e>i;++i){var o=t[i],a=r;r=o+a;var s=r-o,l=a-s;l&&(t[c++]=l)}return t[c++]=r,t.length=c,t}e.exports=n},{}],213:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t.length-1),n=1;n<t.length;++n)for(var i=r[n-1]=new Array(t.length-1),o=0,a=0;o<t.length;++o)o!==e&&(i[a++]=t[n][o]);return r}function i(t){for(var e=new Array(t),r=0;t>r;++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;r<t.length;++r)e.push(["scale(",s(n(t,r)),",",o(r),t[0][r],")"].join(""));return a(e)}function l(t){var e=new Function("sum","scale","prod","compress",["function robustDeterminant",t,"(m){return compress(",s(i(t)),")};return robustDeterminant",t].join(""));return e(h,f,u,d)}function c(){for(;g.length<p;)g.push(l(g.length));for(var t=[],r=["function robustDeterminant(m){switch(m.length){"],n=0;p>n;++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,g.concat([g,l]));for(var n=0;n<g.length;++n)e.exports[n]=g[n]}var u=t("two-product"),h=t("robust-sum"),f=t("robust-scale"),d=t("robust-compress"),p=6,g=[function(){return[0]},function(t){return[t[0][0]]}];c()},{"robust-compress":212,"robust-scale":215,"robust-sum":217,"two-product":231}],214:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t.length-1),n=1;n<t.length;++n)for(var i=r[n-1]=new Array(t.length-1),o=0,a=0;o<t.length;++o)o!==e&&(i[a++]=t[n][o]);return r}function i(t){for(var e=new Array(t),r=0;t>r;++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;r<t.length;++r)e.push(["scale(",a(s(n(t,r))),",",o(r),t[0][r],")"].join(""));return e}function l(t){for(var e=[],r=[],o=i(t),l=[],c=0;t>c;++c)0===(1&c)?e.push.apply(e,s(n(o,c))):r.push.apply(r,s(n(o,c))),l.push("m"+c);var u=a(e),g=a(r),v="orientation"+t+"Exact",m=["function ",v,"(",l.join(),"){var p=",u,",n=",g,",d=sub(p,n);return d[d.length-1];};return ",v].join(""),y=new Function("sum","prod","scale","sub",m);return y(f,h,d,p)}function c(t){var e=_[t.length];return e||(e=_[t.length]=l(t.length)),e.apply(void 0,t)}function u(){for(;_.length<=g;)_.push(l(_.length));for(var t=[],r=["slow"],n=0;g>=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;g>=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<arguments.length;++i){s[i]=arguments[i]};return slow(s);}return getOrientation"),r.push(i.join(""));var o=Function.apply(void 0,r);e.exports=o.apply(void 0,[c].concat(_));for(var n=0;g>=n;++n)e.exports[n]=_[n]}var h=t("two-product"),f=t("robust-sum"),d=t("robust-scale"),p=t("robust-subtract"),g=5,v=1.1102230246251565e-16,m=(3+16*v)*v,y=(7+56*v)*v,b=l(3),x=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=m*n;return a>=s||-s>=a?a:b(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],c=r[1]-n[1],u=t[2]-n[2],h=e[2]-n[2],f=r[2]-n[2],d=o*c,p=a*l,g=a*s,v=i*c,m=i*l,b=o*s,_=u*(d-p)+h*(g-v)+f*(m-b),w=(Math.abs(d)+Math.abs(p))*Math.abs(u)+(Math.abs(g)+Math.abs(v))*Math.abs(h)+(Math.abs(m)+Math.abs(b))*Math.abs(f),k=y*w;return _>k||-_>k?_:x(t,e,r,n)}];u()},{"robust-scale":215,"robust-subtract":216,"robust-sum":217,"two-product":231}],215:[function(t,e,r){"use strict";function n(t,e){var r=t.length;if(1===r){var n=i(t[0],e);return n[0]?n:[n[1]]}var a=new Array(2*r),s=[.1,.1],l=[.1,.1],c=0;i(t[0],e,s),s[0]&&(a[c++]=s[0]);for(var u=1;r>u;++u){i(t[u],e,l);var h=s[1];o(h,l[0],s),s[0]&&(a[c++]=s[0]);var f=l[1],d=s[1],p=f+d,g=p-f,v=d-g;s[1]=p,v&&(a[c++]=v)}return s[1]&&(a[c++]=s[1]),0===c&&(a[c++]=0),a.length=c,a}var i=t("two-product"),o=t("two-sum");e.exports=n},{"two-product":231,"two-sum":232}],216:[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),c=0,u=0,h=0,f=Math.abs,d=t[u],p=f(d),g=-e[h],v=f(g);v>p?(a=d,u+=1,r>u&&(d=t[u],p=f(d))):(a=g,h+=1,i>h&&(g=-e[h],v=f(g))),r>u&&v>p||h>=i?(o=d,u+=1,r>u&&(d=t[u],p=f(d))):(o=g,h+=1,i>h&&(g=-e[h],v=f(g)));for(var m,y,b,x,_,w=o+a,k=w-o,A=a-k,M=A,T=w;r>u&&i>h;)v>p?(o=d,u+=1,r>u&&(d=t[u],p=f(d))):(o=g,h+=1,i>h&&(g=-e[h],v=f(g))),a=M,w=o+a,k=w-o,A=a-k,A&&(l[c++]=A),m=T+w,y=m-T,b=m-y,x=w-y,_=T-b,M=_+x,T=m;for(;r>u;)o=d,a=M,w=o+a,k=w-o,A=a-k,A&&(l[c++]=A),m=T+w,y=m-T,b=m-y,x=w-y,_=T-b,M=_+x,T=m,u+=1,r>u&&(d=t[u]);for(;i>h;)o=g,a=M,w=o+a,k=w-o,A=a-k,A&&(l[c++]=A),m=T+w,y=m-T,b=m-y,x=w-y,_=T-b,M=_+x,T=m,h+=1,i>h&&(g=-e[h]);return M&&(l[c++]=M),T&&(l[c++]=T),c||(l[c++]=0),l.length=c,l}e.exports=i},{}],217:[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),c=0,u=0,h=0,f=Math.abs,d=t[u],p=f(d),g=e[h],v=f(g);v>p?(a=d,u+=1,r>u&&(d=t[u],p=f(d))):(a=g,h+=1,i>h&&(g=e[h],v=f(g))),r>u&&v>p||h>=i?(o=d,u+=1,r>u&&(d=t[u],p=f(d))):(o=g,h+=1,i>h&&(g=e[h],v=f(g)));for(var m,y,b,x,_,w=o+a,k=w-o,A=a-k,M=A,T=w;r>u&&i>h;)v>p?(o=d,u+=1,r>u&&(d=t[u],p=f(d))):(o=g,h+=1,i>h&&(g=e[h],v=f(g))),a=M,w=o+a,k=w-o,A=a-k,A&&(l[c++]=A),m=T+w,y=m-T,b=m-y,x=w-y,_=T-b,M=_+x,T=m;for(;r>u;)o=d,a=M,w=o+a,k=w-o,A=a-k,A&&(l[c++]=A),m=T+w,y=m-T,b=m-y,x=w-y,_=T-b,M=_+x,T=m,u+=1,r>u&&(d=t[u]);for(;i>h;)o=g,a=M,w=o+a,k=w-o,A=a-k,A&&(l[c++]=A),m=T+w,y=m-T,b=m-y,x=w-y,_=T-b,M=_+x,T=m,h+=1,i>h&&(g=e[h]);return M&&(l[c++]=M),T&&(l[c++]=T),c||(l[c++]=0),l.length=c,l}e.exports=i},{}],218:[function(t,e,r){"use strict";function n(t){return t.split("").map(function(t){return t in i?i[t]:""}).join("")}e.exports=n;var i={" ":" ",0:"\u2070",1:"\xb9",2:"\xb2",3:"\xb3",4:"\u2074",5:"\u2075",6:"\u2076",7:"\u2077",8:"\u2078",9:"\u2079","+":"\u207a","-":"\u207b",a:"\u1d43",b:"\u1d47",c:"\u1d9c",d:"\u1d48",e:"\u1d49",f:"\u1da0",g:"\u1d4d",h:"\u02b0",i:"\u2071",j:"\u02b2",k:"\u1d4f",l:"\u02e1",m:"\u1d50",n:"\u207f",o:"\u1d52",p:"\u1d56",r:"\u02b3",s:"\u02e2",t:"\u1d57",u:"\u1d58",v:"\u1d5b",w:"\u02b7",x:"\u02e3",y:"\u02b8",z:"\u1dbb"}},{}],219:[function(t,e,r){"use strict";function n(t){return"a"+t}function i(t){return"d"+t}function o(t,e){return"c"+t+"_"+e}function a(t){return"s"+t}function s(t,e){return"t"+t+"_"+e}function l(t){return"o"+t}function c(t){return"x"+t}function u(t){return"p"+t}function h(t,e){return"d"+t+"_"+e}function f(t){return"i"+t}function d(t,e){return"u"+t+"_"+e}function p(t){return"b"+t}function g(t){return"y"+t}function v(t){return"e"+t}function m(t){return"v"+t}function y(t,e,r){for(var n=0,i=0;t>i;++i)e&1<<i&&(n|=1<<r[i]);return n}function b(t,e,r,b,x,L){function S(t,e){D.push("for(",f(x[t]),"=",e,";",f(x[t]),"<",a(x[t]),";","++",f(x[t]),"){")}function C(t){for(var e=0;R>e;++e)D.push(u(e),"+=",d(e,x[t]),";");D.push("}")}function z(t){for(var e=t-1;e>=0;--e)S(e,0);for(var r=[],e=0;R>e;++e)L[e]?r.push(i(e)+".get("+u(e)+")"):r.push(i(e)+"["+u(e)+"]");for(var e=0;b>e;++e)r.push(c(e));D.push(k,"[",T,"++]=phase(",r.join(),");");for(var e=0;t>e;++e)C(e);for(var n=0;R>n;++n)D.push(u(n),"+=",d(n,x[t]),";")}function j(t){for(var e=0;R>e;++e)L[e]?D.push(o(e,0),"=",i(e),".get(",u(e),");"):D.push(o(e,0),"=",i(e),"[",u(e),"];");for(var r=[],e=0;R>e;++e)r.push(o(e,0));for(var e=0;b>e;++e)r.push(c(e));D.push(p(0),"=",k,"[",T,"]=phase(",r.join(),");");for(var n=1;1<<O>n;++n)D.push(p(n),"=",k,"[",T,"+",v(n),"];");for(var a=[],n=1;1<<O>n;++n)a.push("("+p(0)+"!=="+p(n)+")");
D.push("if(",a.join("||"),"){");for(var s=[],e=0;O>e;++e)s.push(f(e));for(var e=0;R>e;++e){s.push(o(e,0));for(var n=1;1<<O>n;++n)L[e]?D.push(o(e,n),"=",i(e),".get(",u(e),"+",h(e,n),");"):D.push(o(e,n),"=",i(e),"[",u(e),"+",h(e,n),"];"),s.push(o(e,n))}for(var e=0;1<<O>e;++e)s.push(p(e));for(var e=0;b>e;++e)s.push(c(e));D.push("vertex(",s.join(),");",m(0),"=",w,"[",T,"]=",A,"++;");for(var l=(1<<O)-1,d=p(l),n=0;O>n;++n)if(0===(t&~(1<<n))){for(var g=l^1<<n,y=p(g),x=[],_=g;_>0;_=_-1&g)x.push(w+"["+T+"+"+v(_)+"]");x.push(m(0));for(var _=0;R>_;++_)1&n?x.push(o(_,l),o(_,g)):x.push(o(_,g),o(_,l));1&n?x.push(d,y):x.push(y,d);for(var _=0;b>_;++_)x.push(c(_));D.push("if(",d,"!==",y,"){","face(",x.join(),")}")}D.push("}",T,"+=1;")}function P(){for(var t=1;1<<O>t;++t)D.push(E,"=",v(t),";",v(t),"=",g(t),";",g(t),"=",E,";")}function I(t,e){if(0>t)return void j(e);z(t),D.push("if(",a(x[t]),">0){",f(x[t]),"=1;"),I(t-1,e|1<<x[t]);for(var r=0;R>r;++r)D.push(u(r),"+=",d(r,x[t]),";");t===O-1&&(D.push(T,"=0;"),P()),S(t,2),I(t-1,e),t===O-1&&(D.push("if(",f(x[O-1]),"&1){",T,"=0;}"),P()),C(t),D.push("}")}var R=L.length,O=x.length;if(2>O)throw new Error("ndarray-extract-contour: Dimension must be at least 2");for(var N="extractContour"+x.join("_"),D=[],F=[],B=[],U=0;R>U;++U)B.push(n(U));for(var U=0;b>U;++U)B.push(c(U));for(var U=0;O>U;++U)F.push(a(U)+"="+n(0)+".shape["+U+"]|0");for(var U=0;R>U;++U){F.push(i(U)+"="+n(U)+".data",l(U)+"="+n(U)+".offset|0");for(var V=0;O>V;++V)F.push(s(U,V)+"="+n(U)+".stride["+V+"]|0")}for(var U=0;R>U;++U){F.push(u(U)+"="+l(U)),F.push(o(U,0));for(var V=1;1<<O>V;++V){for(var q=[],H=0;O>H;++H)V&1<<H&&q.push("-"+s(U,H));F.push(h(U,V)+"=("+q.join("")+")|0"),F.push(o(U,V)+"=0")}}for(var U=0;R>U;++U)for(var V=0;O>V;++V){var G=[s(U,x[V])];V>0&&G.push(s(U,x[V-1])+"*"+a(x[V-1])),F.push(d(U,x[V])+"=("+G.join("-")+")|0")}for(var U=0;O>U;++U)F.push(f(U)+"=0");F.push(A+"=0");for(var Y=["2"],U=O-2;U>=0;--U)Y.push(a(x[U]));F.push(M+"=("+Y.join("*")+")|0",k+"=mallocUint32("+M+")",w+"=mallocUint32("+M+")",T+"=0"),F.push(p(0)+"=0");for(var V=1;1<<O>V;++V){for(var X=[],W=[],H=0;O>H;++H)V&1<<H&&(0===W.length?X.push("1"):X.unshift(W.join("*"))),W.push(a(x[H]));var Z="";X[0].indexOf(a(x[O-2]))<0&&(Z="-");var Q=y(O,V,x);F.push(v(Q)+"=(-"+X.join("-")+")|0",g(Q)+"=("+Z+X.join("-")+")|0",p(Q)+"=0")}F.push(m(0)+"=0",E+"=0"),I(O-1,0),D.push("freeUint32(",w,");freeUint32(",k,");");var $=["'use strict';","function ",N,"(",B.join(),"){","var ",F.join(),";",D.join(""),"}","return ",N].join(""),K=new Function("vertex","face","phase","mallocUint32","freeUint32",$);return K(t,e,r,_.mallocUint32,_.freeUint32)}function x(t){function e(t){throw new Error("ndarray-extract-contour: "+t)}"object"!=typeof t&&e("Must specify arguments");var r=t.order;Array.isArray(r)||e("Must specify order");var n=t.arrayArguments||1;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 b(t.vertex,t.cell,t.phase,i,r,a)}var _=t("typedarray-pool");e.exports=x;var w="V",k="P",A="N",M="Q",T="X",E="T"},{"typedarray-pool":233}],220:[function(t,e,r){function n(t){if(0>t)return Number("0/0");for(var e=s[0],r=s.length-1;r>0;--r)e+=s[r]/(t+r);var n=t+a+.5;return.5*Math.log(2*Math.PI)+(t+.5)*Math.log(n)-n+Math.log(e)-Math.log(t)}var i=7,o=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],a=607/128,s=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];e.exports=function l(t){if(.5>t)return Math.PI/(Math.sin(Math.PI*t)*l(1-t));if(t>100)return Math.exp(n(t));t-=1;for(var e=o[0],r=1;i+2>r;r++)e+=o[r]/(t+r);var a=t+i+.5;return Math.sqrt(2*Math.PI)*Math.pow(a,t+.5)*Math.exp(-a)*e},e.exports.log=n},{}],221:[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]<t[a])r=-r;else if(t[n]===t[a])return 0;return r}for(var s=o.mallocUint8(e),n=0;e>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":233}],222:[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),c=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,c=(c+r)*i;return o.freeUint32(l),o.freeUint32(s),c}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":223,"typedarray-pool":233}],223:[function(t,e,r){"use strict";function n(t,e){e=e||new Array(t.length);for(var r=0;r<t.length;++r)e[t[r]]=r;return e}e.exports=n},{}],224:[function(t,e,r){"use strict";function n(t){if(0>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],c=0,u=0;u<s.length;++u)c+=1<<s[u],l.push(c);o(s)<1&&(l[0]=c,l[t]=0),r.push(l)}return r}e.exports=n;var i=t("permutation-rank"),o=t("permutation-parity"),a=t("gamma")},{gamma:220,"permutation-parity":221,"permutation-rank":222}],225:[function(t,e,r){e.exports=t("cwise-compiler")({args:["array",{offset:[1],array:0},"scalar","scalar","index"],pre:{body:"{}",args:[],thisVars:[],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},body:{body:"{\n var _inline_1_da = _inline_1_arg0_ - _inline_1_arg3_\n var _inline_1_db = _inline_1_arg1_ - _inline_1_arg3_\n if((_inline_1_da >= 0) !== (_inline_1_db >= 0)) {\n _inline_1_arg2_.push(_inline_1_arg4_[0] + 0.5 + 0.5 * (_inline_1_da + _inline_1_db) / (_inline_1_da - _inline_1_db))\n }\n }",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg3_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:[],localVars:["_inline_1_da","_inline_1_db"]},funcName:"zeroCrossings"})},{"cwise-compiler":66}],226:[function(t,e,r){"use strict";function n(t,e){var r=[];return e=+e||0,i(t.hi(t.shape[0]-1),r,e),r}e.exports=n;var i=t("./lib/zc-core")},{"./lib/zc-core":225}],227:[function(t,e,r){"use strict";function n(t,e){var r=t.length,n=["'use strict';"],i="surfaceNets"+t.join("_")+"d"+e;n.push("var contour=genContour({","order:[",t.join(),"],","scalarArguments: 3,","phase:function phaseFunc(p,a,b,c) { return (p > c)|0 },"),"generic"===e&&n.push("getters:[0],");for(var o=[],l=[],c=0;r>c;++c)o.push("d"+c),l.push("d"+c);for(var c=0;1<<r>c;++c)o.push("v"+c),l.push("v"+c);for(var c=0;1<<r>c;++c)o.push("p"+c),l.push("p"+c);o.push("a","b","c"),l.push("a","c"),n.push("vertex:function vertexFunc(",o.join(),"){");for(var u=[],c=0;1<<r>c;++c)u.push("(p"+c+"<<"+c+")");n.push("var m=(",u.join("+"),")|0;if(m===0||m===",(1<<(1<<r))-1,"){return}");var h=[],f=[];128>=1<<(1<<r)?(n.push("switch(m){"),f=n):n.push("switch(m>>>7){");for(var c=0;1<<(1<<r)>c;++c){if(1<<(1<<r)>128&&c%128===0){h.length>0&&f.push("}}");var d="vExtra"+h.length;n.push("case ",c>>>7,":",d,"(m&0x7f,",l.join(),");break;"),f=["function ",d,"(m,",l.join(),"){switch(m){"],h.push(f)}f.push("case ",127&c,":");for(var p=new Array(r),g=new Array(r),v=new Array(r),m=new Array(r),y=0,b=0;r>b;++b)p[b]=[],g[b]=[],v[b]=0,m[b]=0;for(var b=0;1<<r>b;++b)for(var x=0;r>x;++x){var _=b^1<<x;if(!(_>b)&&!(c&1<<_)!=!(c&1<<b)){var w=1;c&1<<_?g[x].push("v"+_+"-v"+b):(g[x].push("v"+b+"-v"+_),w=-w),0>w?(p[x].push("-v"+b+"-v"+_),v[x]+=2):(p[x].push("v"+b+"+v"+_),v[x]-=2),y+=1;for(var k=0;r>k;++k)k!==x&&(_&1<<k?m[k]+=1:m[k]-=1)}}for(var A=[],x=0;r>x;++x)if(0===p[x].length)A.push("d"+x+"-0.5");else{var M="";v[x]<0?M=v[x]+"*c":v[x]>0&&(M="+"+v[x]+"*c");var T=.5*(p[x].length/y),E=.5+.5*(m[x]/y);A.push("d"+x+"-"+E+"-"+T+"*("+p[x].join("+")+M+")/("+g[x].join("+")+")")}f.push("a.push([",A.join(),"]);","break;")}n.push("}},"),h.length>0&&f.push("}}");for(var L=[],c=0;1<<r-1>c;++c)L.push("v"+c);L.push("c0","c1","p0","p1","a","b","c"),n.push("cell:function cellFunc(",L.join(),"){");var S=s(r-1);n.push("if(p0){b.push(",S.map(function(t){return"["+t.map(function(t){return"v"+t})+"]"}).join(),")}else{b.push(",S.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 c=0;c<h.length;++c)n.push(h[c].join(""));var C=new Function("genContour",n.join(""));return C(a)}function i(t,e){for(var r=l(t,e),n=r.length,i=new Array(n),o=new Array(n),a=0;n>a;++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=c[r],e=+e||0;return o||(o=c[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"),c={}},{"ndarray-extract-contour":219,"triangulate-hypercube":224,"zero-crossings":226}],228:[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;a<e.length;++a)for(var s=e[a],l=0;3>l;++l){var c=r[s[l]];n[i++]=c[0],n[i++]=c[1]+1.4,o=Math.max(c[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)/),c=new Array(l.length),u=0,h=0,f=0;f<l.length;++f)c[f]=i(t,l[f]),u+=c[f].data.length,h+=c[f].shape,f>0&&(h+=.02);for(var d=new Float32Array(u),p=0,g=-.5*h,f=0;f<c.length;++f){for(var v=c[f].data,m=0;m<v.length;m+=2)d[p++]=v[m]+g,d[p++]=v[m+1];g+=c[f].shape+.02}a=r[e]={data:d,shape:h}}return a}e.exports=i;var o=t("vectorize-text"),a=window||r.global||{},s=a.__TEXT_CACHE||{};a.__TEXT_CACHE={}}).call(this,t("_process"))},{_process:55,"vectorize-text":235}],229:[function(e,r,n){!function(){function e(t,r){if(t=t?t:"",r=r||{},t instanceof e)return t;if(!(this instanceof e))return new e(t,r);var i=n(t);this._originalInput=t,this._r=i.r,this._g=i.g,this._b=i.b,this._a=i.a,this._roundA=U(100*this._a)/100,this._format=r.format||i.format,this._gradientType=r.gradientType,this._r<1&&(this._r=U(this._r)),this._g<1&&(this._g=U(this._g)),this._b<1&&(this._b=U(this._b)),this._ok=i.ok,this._tc_id=F++}function n(t){var e={r:0,g:0,b:0},r=1,n=!1,o=!1;return"string"==typeof t&&(t=R(t)),"object"==typeof t&&(t.hasOwnProperty("r")&&t.hasOwnProperty("g")&&t.hasOwnProperty("b")?(e=i(t.r,t.g,t.b),n=!0,o="%"===String(t.r).substr(-1)?"prgb":"rgb"):t.hasOwnProperty("h")&&t.hasOwnProperty("s")&&t.hasOwnProperty("v")?(t.s=j(t.s),t.v=j(t.v),e=l(t.h,t.s,t.v),n=!0,o="hsv"):t.hasOwnProperty("h")&&t.hasOwnProperty("s")&&t.hasOwnProperty("l")&&(t.s=j(t.s),t.l=j(t.l),e=a(t.h,t.s,t.l),n=!0,o="hsl"),t.hasOwnProperty("a")&&(r=t.a)),r=M(r),{ok:n,format:t.format||o,r:V(255,q(e.r,0)),g:V(255,q(e.g,0)),b:V(255,q(e.b,0)),a:r}}function i(t,e,r){return{r:255*T(t,255),g:255*T(e,255),b:255*T(r,255)}}function o(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+a)/2;if(o==a)n=i=0;else{var l=o-a;switch(i=s>.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,c=[r,a,o,o,s,r][l],u=[s,r,r,a,o,o][l],h=[o,o,s,r,r,a][l];return{r:255*c,g:255*u,b:255*h}}function c(t,e,r,n){var i=[z(U(t).toString(16)),z(U(e).toString(16)),z(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 u(t,e,r,n){var i=[z(P(n)),z(U(t).toString(16)),z(U(e).toString(16)),z(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 d(t){return e(t).desaturate(100)}function p(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 g(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 v(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){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 b(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 x(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 k(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 M(t){return t=parseFloat(t),(isNaN(t)||0>t||t>1)&&(t=1),t}function T(t,e){S(t)&&(t="100%");var r=C(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 L(t){return parseInt(t,16)}function S(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)}function C(t){return"string"==typeof t&&-1!=t.indexOf("%")}function z(t){return 1==t.length?"0"+t:""+t}function j(t){return 1>=t&&(t=100*t+"%"),t}function P(t){return Math.round(255*parseFloat(t)).toString(16)}function I(t){return L(t)/255}function R(t){t=t.replace(N,"").replace(D,"").toLowerCase();var e=!1;if(G[t])t=G[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=X.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=X.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=X.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=X.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=X.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=X.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=X.hex8.exec(t))?{a:I(r[1]),r:L(r[2]),g:L(r[3]),b:L(r[4]),format:e?"name":"hex8"}:(r=X.hex6.exec(t))?{r:L(r[1]),g:L(r[2]),b:L(r[3]),format:e?"name":"hex"}:(r=X.hex3.exec(t))?{r:L(r[1]+""+r[1]),g:L(r[2]+""+r[2]),b:L(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 N=/^\s+/,D=/\s+$/,F=0,B=Math,U=B.round,V=B.min,q=B.max,H=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=M(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 c(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(){return u(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:Y[c(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var r="#"+u(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(p,arguments)},brighten:function(){return this._applyModification(g,arguments)},darken:function(){return this._applyModification(v,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(f,arguments)},greyscale:function(){return this._applyModification(d,arguments)},spin:function(){return this._applyModification(m,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(k,arguments)},splitcomplement:function(){return this._applyCombination(_,arguments)},triad:function(){return this._applyCombination(b,arguments)},tetrad:function(){return this._applyCombination(x,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]=j(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:H(),g:H(),b:H()})},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,c=a.a-o.a;i=l*c==-1?l:(l+c)/(1+l*c),i=(i+1)/2;var u=1-i,h={r:a.r*i+o.r*u,g:a.g*i+o.g*u,b:a.b*i+o.b*u,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,c=0;n=n||{},o=n.includeFallbackColors,a=n.level,s=n.size;for(var u=0;u<r.length;u++)i=e.readability(t,r[u]),i>c&&(c=i,l=e(r[u]));return e.isReadable(t,l,{level:a,size:s})||!o?l:(n.includeFallbackColors=!1,e.mostReadable(t,["#fff","#000"],n))};var G=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"},Y=e.hexNames=A(G),X=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}()},{}],230:[function(e,r,n){!function(){function e(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 c=n===e?e:e.concat(n);o[c.start=e.start]=a[c.end=n.end]=c}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 u=n===e?e:n.concat(e);o[u.start=n.start]=a[u.end=e.end]=u}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 n(t,r,n){function i(t){var e=0>t?~t:t;(u[e]||(u[e]=[])).push({i:t,g:c})}function o(t){t.forEach(i)}function a(t){t.forEach(o)}function s(t){"GeometryCollection"===t.type?t.geometries.forEach(s):t.type in h&&(c=t,h[t.type](t.arcs))}var l=[];if(arguments.length>1){var c,u=[],h={LineString:o,MultiLineString:a,Polygon:a,MultiPolygon:function(t){t.forEach(a)}};s(r),u.forEach(arguments.length<3?function(t){l.push(t[0].i)}:function(t){n(t[0].g,t[t.length-1].g)&&l.push(t[0].i)})}else for(var f=0,d=t.arcs.length;d>f;++f)l.push(f);return{type:"MultiLineString",arcs:e(t,l)}}function i(t,r){function n(t){t.forEach(function(e){e.forEach(function(e){(o[e=0>e?~e:e]||(o[e]=[])).push(t)})}),a.push(t)}function i(e){return f(s(t,{type:"Polygon",arcs:[e]}).coordinates[0])>0}var o={},a=[],l=[];return r.forEach(function(t){"Polygon"===t.type?n(t.arcs):"MultiPolygon"===t.type&&t.arcs.forEach(n)}),a.forEach(function(t){if(!t._){var e=[],r=[t];for(t._=1,l.push(e);t=r.pop();)e.push(t),t.forEach(function(t){t.forEach(function(t){o[0>t?~t:t].forEach(function(t){t._||(t._=1,r.push(t))})})})}}),a.forEach(function(t){delete t._}),{type:"MultiPolygon",arcs:l.map(function(r){var n,a=[];if(r.forEach(function(t){t.forEach(function(t){t.forEach(function(t){o[0>t?~t:t].length<2&&a.push(t)})})}),a=e(t,a),(n=a.length)>1)for(var s,l=i(r[0][0]),c=0;n>c;++c)if(l===i(a[c])){s=a[0],a[0]=a[c],a[c]=s;break}return a})}}function o(t,e){return"GeometryCollection"===e.type?{type:"FeatureCollection",features:e.geometries.map(function(e){return a(t,e)})}:a(t,e)}function a(t,e){var r={type:"Feature",id:e.id,properties:e.properties||{},geometry:s(t,e)};return null==e.id&&delete r.id,r}function s(t,e){function r(t,e){e.length&&e.pop();for(var r,n=u[0>t?~t:t],i=0,o=n.length;o>i;++i)e.push(r=n[i].slice()),c(r,i);0>t&&l(e,o)}function n(t){return t=t.slice(),c(t,0),t}function i(t){for(var e=[],n=0,i=t.length;i>n;++n)r(t[n],e);return e.length<2&&e.push(e[0].slice()),e}function o(t){for(var e=i(t);e.length<4;)e.push(e[0].slice());return e}function a(t){return t.map(o)}function s(t){var e=t.type;return"GeometryCollection"===e?{type:e,geometries:t.geometries.map(s)}:e in h?{type:e,coordinates:h[e](t)}:null}var c=v(t.transform),u=t.arcs,h={Point:function(t){return n(t.coordinates)},MultiPoint:function(t){return t.coordinates.map(n)},LineString:function(t){return i(t.arcs)},MultiLineString:function(t){return t.arcs.map(i)},Polygon:function(t){return a(t.arcs)},MultiPolygon:function(t){return t.arcs.map(a)}};return s(e)}function l(t,e){for(var r,n=t.length,i=n-e;i<--n;)r=t[i],t[i++]=t[n],t[n]=r}function c(t,e){for(var r=0,n=t.length;n>r;){var i=r+n>>>1;t[i]<e?r=i+1:n=i}return r}function u(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 a&&a[t.type](t.arcs,e)}var i={},o=t.map(function(){return[]}),a={LineString:e,MultiLineString:r,Polygon:r,MultiPolygon:function(t,e){t.forEach(function(t){r(t,e)})}};t.forEach(n);for(var s in i)for(var l=i[s],u=l.length,h=0;u>h;++h)for(var f=h+1;u>f;++f){var d,p=l[h],g=l[f];(d=o[p])[s=c(d,g)]!==g&&d.splice(s,0,g),(d=o[g])[s=c(d,p)]!==p&&d.splice(s,0,p)}return o}function h(t,e){function r(t){o.remove(t),t[1][2]=e(t),o.push(t)}var n=v(t.transform),i=m(t.transform),o=g();return e||(e=d),t.arcs.forEach(function(t){for(var a,s,l=[],c=0,u=0,h=t.length;h>u;++u)s=t[u],n(t[u]=[s[0],s[1],1/0],u);for(var u=1,h=t.length-1;h>u;++u)a=t.slice(u-1,u+2),a[1][2]=e(a),l.push(a),o.push(a);for(var u=0,h=l.length;h>u;++u)a=l[u],a.previous=l[u-1],a.next=l[u+1];for(;a=o.pop();){var f=a.previous,d=a.next;a[1][2]<c?a[1][2]=c:c=a[1][2],f&&(f.next=d,f[2]=a[2],r(f)),d&&(d.previous=f,d[0]=a[0],r(d))}t.forEach(i)}),t}function f(t){for(var e,r=-1,n=t.length,i=t[n-1],o=0;++r<n;)e=i,i=t[r],o+=e[0]*i[1]-e[1]*i[0];return o/2}function d(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,e){return t[1][2]-e[1][2]}function g(){function t(t,e){for(;e>0;){var r=(e+1>>1)-1,i=n[r];if(p(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&&p(n[o],s)<0&&(s=n[a=o]),i>r&&p(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],(p(o,r)<0?t:e)(n[o._=a]=o,a)),a},r}function v(t){if(!t)return y;var e,r,n=t.scale[0],i=t.scale[1],o=t.translate[0],a=t.translate[1];return function(t,s){s||(e=r=0),t[0]=(e+=t[0])*n+o,t[1]=(r+=t[1])*i+a}}function m(t){if(!t)return y;var e,r,n=t.scale[0],i=t.scale[1],o=t.translate[0],a=t.translate[1];return function(t,s){s||(e=r=0);var l=(t[0]-o)/n|0,c=(t[1]-a)/i|0;t[0]=l-e,t[1]=c-r,e=l,r=c}}function y(){}var b={version:"1.6.20",mesh:function(t){return s(t,n.apply(this,arguments))},meshArcs:n,merge:function(t){return s(t,i.apply(this,arguments))},mergeArcs:i,feature:o,neighbors:u,presimplify:h};"function"==typeof t&&t.amd?t(b):"object"==typeof r&&r.exports?r.exports=b:this.topojson=b}()},{}],231:[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,c=i*e,u=c-e,h=c-u,f=e-h,d=n-s*h,p=d-l*h,g=p-s*f,v=l*f-g;return r?(r[0]=v,r[1]=n,r):[v,n]}e.exports=n;var i=+(Math.pow(2,27)+1)},{}],232:[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},{}],233:[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 c(t){return new Uint32Array(a(4*t),0,t)}function u(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 d(t){return new Float32Array(a(4*t),0,t)}function p(t){return new Float64Array(a(8*t),0,t)}function g(t){return x?new Uint8ClampedArray(a(t),0,t):s(t)}function v(t){return new DataView(a(t),0,t)}function m(t){t=y.nextPow2(t);var e=y.log2(t),r=k[e];return r.length>0?r.pop():new n(t)}var y=t("bit-twiddle"),b=t("dup");e.__TYPEDARRAY_POOL||(e.__TYPEDARRAY_POOL={UINT8:b([32,0]),UINT16:b([32,0]),UINT32:b([32,0]),INT8:b([32,0]),INT16:b([32,0]),INT32:b([32,0]),FLOAT:b([32,0]),DOUBLE:b([32,0]),DATA:b([32,0]),UINT8C:b([32,0]),BUFFER:b([32,0])});var x="undefined"!=typeof Uint8ClampedArray,_=e.__TYPEDARRAY_POOL;_.UINT8C||(_.UINT8C=b([32,0])),_.BUFFER||(_.BUFFER=b([32,0]));var w=_.DATA,k=_.BUFFER;r.free=function(t){if(n.isBuffer(t))k[y.log2(t.length)].push(t);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(t)&&(t=t.buffer),!t)return;var e=t.length||t.byteLength,r=0|y.log2(e);w[r].push(t)}},r.freeUint8=r.freeUint16=r.freeUint32=r.freeInt8=r.freeInt16=r.freeInt32=r.freeFloat32=r.freeFloat=r.freeFloat64=r.freeDouble=r.freeUint8Clamped=r.freeDataView=o,r.freeArrayBuffer=i,r.freeBuffer=function(t){k[y.log2(t.length)].push(t)},r.malloc=function(t,e){if(void 0===e||"arraybuffer"===e)return a(t);switch(e){case"uint8":return s(t);case"uint16":return l(t);case"uint32":return c(t);case"int8":return u(t);case"int16":return h(t);case"int32":return f(t);case"float":case"float32":return d(t);case"double":case"float64":return p(t);case"uint8_clamped":return g(t);case"buffer":return m(t);case"data":case"dataview":return v(t);default:return null}return null},r.mallocArrayBuffer=a,r.mallocUint8=s,r.mallocUint16=l,r.mallocUint32=c,r.mallocInt8=u,r.mallocInt16=h,r.mallocInt32=f,r.mallocFloat32=r.mallocFloat=d,r.mallocFloat64=r.mallocDouble=p,r.mallocUint8Clamped=g,r.mallocDataView=v,r.mallocBuffer=m,r.clearCache=function(){for(var t=0;32>t;++t)_.UINT8[t].length=0,_.UINT16[t].length=0,_.UINT32[t].length=0,_.INT8[t].length=0,_.INT16[t].length=0,_.INT32[t].length=0,_.FLOAT[t].length=0,_.DOUBLE[t].length=0,_.UINT8C[t].length=0,w[t].length=0,k[t].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"bit-twiddle":49,buffer:50,dup:72}],234:[function(t,e,r){"use strict";function n(t,e){for(var r=1,n=t.length,i=t[0],o=t[0],a=1;n>a;++a)if(o=i,i=t[a],e(i,o)){if(a===r){r++;continue}t[r++]=i}return t.length=r,t}function i(t){for(var e=1,r=t.length,n=t[0],i=t[0],o=1;r>o;++o,i=n)if(i=n,n=t[o],n!==i){if(o===e){e++;continue}t[e++]=n}return t.length=e,t}function o(t,e,r){return 0===t.length?t:e?(r||t.sort(e),n(t,e)):(r||t.sort(),i(t))}e.exports=o},{}],235:[function(t,e,r){"use strict";function n(t,e){return("object"!=typeof e||null===e)&&(e={}),i(t,e.canvas||o,e.context||a,e)}e.exports=n;var i=t("./lib/vtext"),o=null,a=null;"undefined"!=typeof document&&(o=document.createElement("canvas"),o.width=8192,o.height=1024,a=o.getContext("2d"))},{"./lib/vtext":236}],236:[function(t,e,r){"use strict";function n(t,e,r){for(var n=e.textAlign||"start",i=e.textBaseline||"alphabetic",o=[1<<30,1<<30],a=[0,0],s=t.length,l=0;s>l;++l)for(var c=t[l],u=0;2>u;++u)o[u]=0|Math.min(o[u],c[u]),a[u]=0|Math.max(a[u],c[u]);var h=0;switch(n){case"center":h=-.5*(o[0]+a[0]);break;case"right":case"end":h=-a[0];break;case"left":case"start":h=-o[0];break;default:throw new Error("vectorize-text: Unrecognized textAlign: '"+n+"'")}var f=0;switch(i){case"hanging":case"top":f=-o[1];break;case"middle":f=-.5*(o[1]+a[1]);break;case"alphabetic":case"ideographic":f=-3*r;break;case"bottom":f=-a[1];break;default:throw new Error("vectorize-text: Unrecoginized textBaseline: '"+i+"'")}var d=1/r;return"lineHeight"in e?d*=+e.lineHeight:"width"in e?d=e.width/(a[0]-o[0]):"height"in e&&(d=e.height/(a[1]-o[1])),t.map(function(t){return[d*(t[0]+h),d*(t[1]+f)]})}function i(t,e,r,n){var i=0|Math.ceil(e.measureText(r).width+2*n);if(i>8192)throw new Error("vectorize-text: String too long (sorry, this will get fixed later)");var o=3*n;t.height<o&&(t.height=o),e.fillStyle="#000",e.fillRect(0,0,t.width,t.height),e.fillStyle="#fff",e.fillText(r,n,2*n);var a=e.getImageData(0,0,i,o),s=u(a.data,[o,i,4]);return s.pick(-1,-1,0).transpose(1,0)}function o(t,e){var r=c(t,128);return e?h(r.cells,r.positions,.25):{edges:r.cells,positions:r.positions}}function a(t,e,r,i){var a=o(t,i),s=n(a.positions,e,r),l=a.edges,c="ccw"===e.orientation;if(f(s,l),e.polygons||e.polygon||e.polyline){for(var u=p(l,s),h=new Array(u.length),g=0;g<u.length;++g){for(var v=u[g],m=new Array(v.length),y=0;y<v.length;++y){for(var b=v[y],x=new Array(b.length),_=0;_<b.length;++_)x[_]=s[b[_]].slice();c&&x.reverse(),m[y]=x}h[g]=m}return h}return e.triangles||e.triangulate||e.triangle?{cells:d(s,l,{delaunay:!1,exterior:!1,interior:!0}),positions:s}:{edges:l,positions:s}}function s(t,e,r){try{return a(t,e,r,!0)}catch(n){}try{return a(t,e,r,!1)}catch(n){}return e.polygons||e.polyline||e.polygon?[]:e.triangles||e.triangulate||e.triangle?{cells:[],positions:[]}:{edges:[],positions:[]}}function l(t,e,r,n){var o=n.size||64,a=n.font||"normal";r.font=o+"px "+a,r.textAlign="start",r.textBaseline="alphabetic",r.direction="ltr";var l=i(e,r,t,o);return s(l,n,o)}e.exports=l,e.exports.processPixels=s;var c=t("surface-nets"),u=t("ndarray"),h=t("simplify-planar-graph"),f=t("clean-pslg"),d=t("cdt2d"),p=t("planar-graph-to-polyline")},{cdt2d:237,"clean-pslg":244,ndarray:208,"planar-graph-to-polyline":290,"simplify-planar-graph":294,"surface-nets":227}],237:[function(t,e,r){"use strict";function n(t){return[Math.min(t[0],t[1]),Math.max(t[0],t[1])]}function i(t,e){return t[0]-e[0]||t[1]-e[1]}function o(t){return t.map(n).sort(i)}function a(t,e,r){return e in t?t[e]:r}function s(t,e,r){Array.isArray(e)?(r=r||{},e=e||[]):(r=e||{},e=[]);var n=!!a(r,"delaunay",!0),i=!!a(r,"interior",!0),s=!!a(r,"exterior",!0),f=!!a(r,"infinity",!1);if(!i&&!s||0===t.length)return[];var d=l(t,e);if(n||i!==s||f){for(var p=c(t.length,o(e)),g=0;g<d.length;++g){var v=d[g];p.addTriangle(v[0],v[1],v[2])}return n&&u(t,p),s?i?f?h(p,0,f):p.cells():h(p,1,f):h(p,-1)}return d}var l=t("./lib/monotone"),c=t("./lib/triangulation"),u=t("./lib/delaunay"),h=t("./lib/filter");e.exports=s},{"./lib/delaunay":238,"./lib/filter":239,"./lib/monotone":240,"./lib/triangulation":241}],238:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){var s=e.opposite(n,i);if(!(0>s)){if(n>i){var l=n;n=i,i=l,l=a,a=s,s=l}e.isConstraint(n,i)||o(t[n],t[i],t[a],t[s])<0&&r.push(n,i)}}function i(t,e){for(var r=[],i=t.length,a=e.stars,s=0;i>s;++s)for(var l=a[s],c=1;c<l.length;c+=2){var u=l[c];if(!(s>u||e.isConstraint(s,u))){for(var h=l[c-1],f=-1,d=1;d<l.length;d+=2)if(l[d-1]===u){f=l[d];break}0>f||o(t[s],t[u],t[h],t[f])<0&&r.push(s,u)}}for(;r.length>0;){for(var u=r.pop(),s=r.pop(),h=-1,f=-1,l=a[s],p=1;p<l.length;p+=2){var g=l[p-1],v=l[p];g===u?f=v:v===u&&(h=g)}0>h||0>f||o(t[s],t[u],t[h],t[f])>=0||(e.flip(s,u),n(t,e,r,h,s,f),n(t,e,r,s,f,h),n(t,e,r,f,u,h),n(t,e,r,u,h,f))}}var o=t("robust-in-sphere")[4];t("binary-search-bounds");e.exports=i},{"binary-search-bounds":242,"robust-in-sphere":243}],239:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a){this.cells=t,this.neighbor=e,this.flags=n,this.constraint=r,this.active=i,this.next=o,this.boundary=a}function i(t,e){return t[0]-e[0]||t[1]-e[1]||t[2]-e[2]}function o(t,e){for(var r=t.cells(),o=r.length,a=0;o>a;++a){var s=r[a],l=s[0],c=s[1],u=s[2];u>c?l>c&&(s[0]=c,s[1]=u,s[2]=l):l>u&&(s[0]=u,s[1]=l,s[2]=c)}r.sort(i);for(var h=new Array(o),a=0;a<h.length;++a)h[a]=0;var f=[],d=[],p=new Array(3*o),g=new Array(3*o),v=null;e&&(v=[]);for(var m=new n(r,p,g,h,f,d,v),a=0;o>a;++a)for(var s=r[a],y=0;3>y;++y){var l=s[y],c=s[(y+1)%3],b=p[3*a+y]=m.locate(c,l,t.opposite(c,l)),x=g[3*a+y]=t.isConstraint(l,c);0>b&&(x?d.push(a):(f.push(a),h[a]=1),e&&v.push([c,l,-1]))}return m}function a(t,e,r){for(var n=0,i=0;i<t.length;++i)e[i]===r&&(t[n++]=t[i]);return t.length=n,t}function s(t,e,r){var n=o(t,r);if(0===e)return r?n.cells.concat(n.boundary):n.cells;for(var i=1,s=n.active,l=n.next,c=n.flags,u=n.cells,h=n.constraint,f=n.neighbor;s.length>0||l.length>0;){for(;s.length>0;){var d=s.pop();if(c[d]!==-i){c[d]=i;for(var p=(u[d],0);3>p;++p){var g=f[3*d+p];g>=0&&0===c[g]&&(h[3*d+p]?l.push(g):(s.push(g),c[g]=i))}}}var v=l;l=s,s=v,l.length=0,i=-i}var m=a(u,c,e);return r?m.concat(n.boundary):m}var l=t("binary-search-bounds");e.exports=s;var c=n.prototype;c.locate=function(){var t=[0,0,0];return function(e,r,n){var o=e,a=r,s=n;return n>r?e>r&&(o=r,a=n,s=e):e>n&&(o=n,a=e,s=r),0>o?-1:(t[0]=o,t[1]=a,t[2]=s,l.eq(this.cells,t,i))}}()},{"binary-search-bounds":242}],240:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.a=t,this.b=e,this.idx=r,this.lowerIds=n,this.upperIds=i}function i(t,e,r,n){this.a=t,this.b=e,this.type=r,this.idx=n}function o(t,e){var r=t.a[0]-e.a[0]||t.a[1]-e.a[1]||t.type-e.type;return r?r:t.type!==p&&(r=d(t.a,t.b,e.b))?r:t.idx-e.idx}function a(t,e){return d(t.a,t.b,e)}function s(t,e,r,n,i){for(var o=f.lt(e,n,a),s=f.gt(e,n,a),l=o;s>l;++l){for(var c=e[l],u=c.lowerIds,h=u.length;h>1&&d(r[u[h-2]],r[u[h-1]],n)>0;)t.push([u[h-1],u[h-2],i]),h-=1;u.length=h,u.push(i);for(var p=c.upperIds,h=p.length;h>1&&d(r[p[h-2]],r[p[h-1]],n)<0;)t.push([p[h-2],p[h-1],i]),h-=1;p.length=h,p.push(i)}}function l(t,e){var r;return(r=t.a[0]<e.a[0]?d(t.a,t.b,e.a):d(e.b,e.a,t.a))?r:(r=e.b[0]<t.b[0]?d(t.a,t.b,e.b):d(e.b,e.a,t.b),r||t.idx-e.idx)}function c(t,e,r){var i=f.le(t,r,l),o=t[i],a=o.upperIds,s=a[a.length-1];o.upperIds=[s],t.splice(i+1,0,new n(r.a,r.b,r.idx,[s],a))}function u(t,e,r){var n=r.a;r.a=r.b,r.b=n;var i=f.eq(t,r,l),o=t[i],a=t[i-1];a.upperIds=o.upperIds,t.splice(i,1)}function h(t,e){for(var r=t.length,a=e.length,l=[],h=0;r>h;++h)l.push(new i(t[h],null,p,h));for(var h=0;a>h;++h){var f=e[h],d=t[f[0]],m=t[f[1]];d[0]<m[0]?l.push(new i(d,m,v,h),new i(m,d,g,h)):d[0]>m[0]&&l.push(new i(m,d,v,h),new i(d,m,g,h))}l.sort(o);for(var y=l[0].a[0]-(1+Math.abs(l[0].a[0]))*Math.pow(2,-52),b=[new n([y,1],[y,0],-1,[],[],[],[])],x=[],h=0,_=l.length;_>h;++h){var w=l[h],k=w.type;k===p?s(x,b,t,w.a,w.idx):k===v?c(b,t,w):u(b,t,w)}return x}var f=t("binary-search-bounds"),d=t("robust-orientation")[3],p=0,g=1,v=2;e.exports=h},{"binary-search-bounds":242,"robust-orientation":214}],241:[function(t,e,r){"use strict";function n(t,e){this.stars=t,this.edges=e}function i(t,e,r){for(var n=1,i=t.length;i>n;n+=2)if(t[n-1]===e&&t[n]===r)return t[n-1]=t[i-2],t[n]=t[i-1],void(t.length=i-2)}function o(t,e){for(var r=new Array(t),i=0;t>i;++i)r[i]=[];return new n(r,e)}var a=t("binary-search-bounds");e.exports=o;var s=n.prototype;s.isConstraint=function(){function t(t,e){return t[0]-e[0]||t[1]-e[1]}var e=[0,0];return function(r,n){return e[0]=Math.min(r,n),e[1]=Math.max(r,n),a.eq(this.edges,e,t)>=0}}(),s.removeTriangle=function(t,e,r){var n=this.stars;i(n[t],e,r),i(n[e],r,t),i(n[r],t,e)},s.addTriangle=function(t,e,r){var n=this.stars;n[t].push(e,r),n[e].push(r,t),n[r].push(t,e)},s.opposite=function(t,e){for(var r=this.stars[e],n=1,i=r.length;i>n;n+=2)if(r[n]===t)return r[n-1];return-1},s.flip=function(t,e){var r=this.opposite(t,e),n=this.opposite(e,t);this.removeTriangle(t,e,r),this.removeTriangle(e,t,n),this.addTriangle(t,n,r),this.addTriangle(e,r,n)},s.edges=function(){for(var t=this.stars,e=[],r=0,n=t.length;n>r;++r)for(var i=t[r],o=0,a=i.length;a>o;o+=2)e.push([i[o],i[o+1]]);return e},s.cells=function(){for(var t=this.stars,e=[],r=0,n=t.length;n>r;++r)for(var i=t[r],o=0,a=i.length;a>o;o+=2){var s=i[o],l=i[o+1];r<Math.min(s,l)&&e.push([r,s,l])}return e}},{"binary-search-bounds":242}],242:[function(t,e,r){arguments[4][121][0].apply(r,arguments)},{dup:121}],243:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t.length-1),n=1;n<t.length;++n)for(var i=r[n-1]=new Array(t.length-1),o=0,a=0;o<t.length;++o)o!==e&&(i[a++]=t[n][o]);return r}function i(t){for(var e=new Array(t),r=0;t>r;++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;r<t.length;++r)e.push(["scale(",o(l(n(t,r))),",",s(r),t[0][r],")"].join(""));return e}function c(t,e){for(var r=[],n=0;e-2>n;++n)r.push(["prod(m",t,"[",n,"],m",t,"[",n,"])"].join(""));return o(r)}function u(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 u=o(e),h=o(r),f="exactInSphere"+t,d=[],s=0;t>s;++s)d.push("m"+s);for(var p=["function ",f,"(",d.join(),"){"],s=0;t>s;++s){p.push("var w",s,"=",c(s,t),";");for(var g=0;t>g;++g)g!==s&&p.push("var w",s,"m",g,"=scale(w",s,",m",g,"[0]);")}p.push("var p=",u,",n=",h,",d=diff(p,n);return d[d.length-1];}return ",f);var x=new Function("sum","diff","prod","scale",p.join(""));return x(m,y,v,b)}function h(){return 0}function f(){return 0}function d(){return 0}function p(t){var e=_[t.length];return e||(e=_[t.length]=u(t.length)),e.apply(void 0,t)}function g(){for(;_.length<=x;)_.push(u(_.length));for(var t=[],r=["slow"],n=0;x>=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;x>=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<arguments.length;++i){s[i]=arguments[i]};return slow(s);}return testInSphere"),r.push(i.join(""));var o=Function.apply(void 0,r);e.exports=o.apply(void 0,[p].concat(_));for(var n=0;x>=n;++n)e.exports[n]=_[n]}var v=t("two-product"),m=t("robust-sum"),y=t("robust-subtract"),b=t("robust-scale"),x=6,_=[h,f,d];g()},{"robust-scale":215,"robust-subtract":216,"robust-sum":217,"two-product":231}],244:[function(t,e,r){"use strict";function n(t){var e=x(t),r=b(y(e),t);return 0>r?[e,w(e,1/0)]:r>0?[w(e,-(1/0)),e]:[e,e]}function i(t,e){for(var r=new Array(e.length),n=0;n<e.length;++n){var i=e[n],o=t[i[0]],a=t[i[1]];r[n]=[Math.min(o[0],a[0]),Math.min(o[1],a[1]),Math.max(o[0],a[0]),Math.max(o[1],a[1])]}return r}function o(t){for(var e=new Array(t.length),r=0;r<t.length;++r){var n=t[r];e[r]=[n[0],n[1],n[0],n[1]]}return e}function a(t,e,r){var n=[];return v(r,function(r,i){var o=e[r],a=e[i];if(o[0]!==a[0]&&o[0]!==a[1]&&o[1]!==a[0]&&o[1]!==a[1]){var s=t[o[0]],l=t[o[1]],c=t[a[0]],u=t[a[1]];m(s,l,c,u)&&n.push([r,i])}}),n}function s(t,e,r,n){var i=[];return v(r,n,function(r,n){var o=e[r];if(o[0]!==n&&o[1]!==n){var a=t[n],s=t[o[0]],l=t[o[1]];m(s,l,a,a)&&i.push([r,n])}}),i}function l(t,e,r,n,i){function o(e){if(e>=t.length)return a[e-t.length];var r=t[e];return[y(r[0]),y(r[1])]}for(var a=[],s=0;s<r.length;++s){var l=r[s],c=l[0],u=l[1],h=e[c],f=e[u],d=k(_(t[h[0]]),_(t[h[1]]),_(t[f[0]]),_(t[f[1]]));if(d){var p=a.length+t.length;a.push(d),n.push([c,p],[u,p])}}n.sort(function(t,e){if(t[0]!==e[0])return t[0]-e[0];var r=o(t[1]),n=o(e[1]);return b(r[0],n[0])||b(r[1],n[1])});for(var s=n.length-1;s>=0;--s){var g=n[s],c=g[0],v=e[c],m=v[0],x=v[1],w=t[m],A=t[x];if((w[0]-A[0]||w[1]-A[1])<0){var M=m;m=x,x=M}v[0]=m;var T,E=v[1]=g[1];for(i&&(T=v[2]);s>0&&n[s-1][0]===c;){var g=n[--s],L=g[1];i?e.push([E,L,T]):e.push([E,L]),E=L}i?e.push([E,x,T]):e.push([E,x])}return a}function c(t,e,r){for(var i=t.length+e.length,o=new g(i),a=r,s=0;s<e.length;++s){var l=e[s],c=n(l[0]),u=n(l[1]);a.push([c[0],u[0],c[1],u[1]]),t.push([x(l[0]),x(l[1])])}v(a,function(t,e){o.link(t,e)});for(var h=0,f=!0,d=new Array(i),s=0;i>s;++s){var p=o.find(s);p===s?(d[s]=h,t[h++]=t[s]):(f=!1,d[s]=-1)}if(t.length=h,f)return null;for(var s=0;i>s;++s)d[s]<0&&(d[s]=d[o.find(s)]);return d}function u(t,e){return t[0]-e[0]||t[1]-e[1]}function h(t,e){var r=t[0]-e[0]||t[1]-e[1];return r?r:t[2]<e[2]?-1:t[2]>e[2]?1:0}function f(t,e,r){if(0!==t.length){if(e)for(var n=0;n<t.length;++n){var i=t[n],o=e[i[0]],a=e[i[1]];i[0]=Math.min(o,a),i[1]=Math.max(o,a)}else for(var n=0;n<t.length;++n){var i=t[n],o=i[0],a=i[1];i[0]=Math.min(o,a),i[1]=Math.max(o,a)}r?t.sort(h):t.sort(u);for(var s=1,n=1;n<t.length;++n){var l=t[n-1],c=t[n];(c[0]!==l[0]||c[1]!==l[1]||r&&c[2]!==l[2])&&(t[s++]=c)}t.length=s}}function d(t,e,r){var n=i(t,e),u=a(t,e,n),h=o(t),d=s(t,e,n,h),p=l(t,e,u,d,r),g=c(t,p,h);return f(e,g,r),g?!0:u.length>0||d.length>0}function p(t,e,r){var n,i=!1;if(r){n=e;for(var o=new Array(e.length),a=0;a<e.length;++a){var s=e[a];o[a]=[s[0],s[1],r[a]]}e=o}for(;d(t,e,!!r);)i=!0;if(r&&i){n.length=0,r.length=0;for(var a=0;a<e.length;++a){var s=e[a];n.push([s[0],s[1]]),r.push(s[2])}}return i}e.exports=p;var g=t("union-find"),v=t("box-intersect"),m=(t("compare-cell"),t("robust-segment-intersect")),y=t("big-rat"),b=t("big-rat/cmp"),x=t("big-rat/to-float"),_=t("rat-vec"),w=t("nextafter"),k=t("./lib/rat-seg-intersect")},{"./lib/rat-seg-intersect":245,"big-rat":249,"big-rat/cmp":247,"big-rat/to-float":262,"box-intersect":263,"compare-cell":59,nextafter:271,"rat-vec":273,"robust-segment-intersect":276,"union-find":277}],245:[function(t,e,r){"use strict";function n(t,e){return s(o(t[0],e[1]),o(t[1],e[0]))}function i(t,e,r,i){var o=c(e,t),s=c(i,r),f=n(o,s);if(0===l(f))return null;var d=c(t,r),p=n(s,d),g=a(p,f);return u(t,h(o,g))}e.exports=i;var o=t("big-rat/mul"),a=t("big-rat/div"),s=t("big-rat/sub"),l=t("big-rat/sign"),c=t("rat-vec/sub"),u=t("rat-vec/add"),h=t("rat-vec/muls");t("big-rat/to-float")},{"big-rat/div":248,"big-rat/mul":258,"big-rat/sign":260,"big-rat/sub":261,"big-rat/to-float":262,"rat-vec/add":272,"rat-vec/muls":274,"rat-vec/sub":275}],246:[function(t,e,r){"use strict";function n(t,e){return i(t[0].mul(e[1]).add(e[0].mul(t[1])),t[1].mul(e[1]))}var i=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":256}],247:[function(t,e,r){"use strict";function n(t,e){return t[0].mul(e[1]).cmp(e[0].mul(t[1]))}e.exports=n},{}],248:[function(t,e,r){"use strict";function n(t,e){return i(t[0].mul(e[1]),t[1].mul(e[0]))}var i=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":256}],249:[function(t,e,r){"use strict";function n(t,e){if(i(t))return e?c(t,n(e)):[t[0].clone(),t[1].clone()];var r,u,h=0;if(o(t))r=t.clone();else if("string"==typeof t)r=s(t);else{if(0===t)return[a(0),a(1)];if(t===Math.floor(t))r=a(t);else{for(;t!==Math.floor(t);)t*=Math.pow(2,256),h-=256;r=a(t)}}if(i(e))r.mul(e[1]),u=e[0].clone();else if(o(e))u=e.clone();else if("string"==typeof e)u=s(e);else if(e)if(e===Math.floor(e))u=a(e);else{for(;e!==Math.floor(e);)e*=Math.pow(2,256),h+=256;u=a(e)}else u=a(1);return h>0?r=r.shln(h):0>h&&(u=u.shln(-h)),l(r,u)}var i=t("./is-rat"),o=t("./lib/is-bn"),a=t("./lib/num-to-bn"),s=t("./lib/str-to-bn"),l=t("./lib/rationalize"),c=t("./div");e.exports=n},{"./div":248,"./is-rat":250,"./lib/is-bn":254,"./lib/num-to-bn":255,"./lib/rationalize":256,"./lib/str-to-bn":257}],250:[function(t,e,r){"use strict";function n(t){return Array.isArray(t)&&2===t.length&&i(t[0])&&i(t[1])}var i=t("./lib/is-bn");e.exports=n},{"./lib/is-bn":254}],251:[function(t,e,r){"use strict";function n(t){return t.cmp(new i(0))}var i=t("bn.js");e.exports=n},{"bn.js":259}],252:[function(t,e,r){"use strict";function n(t){var e=t.length,r=t.words,n=0;if(1===e)n=r[0];else if(2===e)n=r[0]+67108864*r[1];else for(var n=0,i=0;e>i;i++){var o=r[i];n+=o*Math.pow(67108864,i)}return t.sign?-n:n}e.exports=n},{}],253:[function(t,e,r){"use strict";function n(t){var e=o(i.lo(t));if(32>e)return e;var r=o(i.hi(t));return r>20?52:r+32}var i=t("double-bits"),o=t("bit-twiddle").countTrailingZeros;e.exports=n},{"bit-twiddle":49,"double-bits":270}],254:[function(t,e,r){"use strict";function n(t){return t&&"object"==typeof t&&Boolean(t.words)}t("bn.js");e.exports=n},{"bn.js":259}],255:[function(t,e,r){"use strict";function n(t){var e=o.exponent(t);return 52>e?new i(t):new i(t*Math.pow(2,52-e)).shln(e-52)}var i=t("bn.js"),o=t("double-bits");e.exports=n},{"bn.js":259,"double-bits":270}],256:[function(t,e,r){"use strict";function n(t,e){var r=o(t),n=o(e);if(0===r)return[i(0),i(1)];if(0===n)return[i(0),i(0)];0>n&&(t=t.neg(),e=e.neg());var a=t.gcd(e);return a.cmpn(1)?[t.div(a),e.div(a)]:[t,e]}var i=t("./num-to-bn"),o=t("./bn-sign");e.exports=n},{"./bn-sign":251,"./num-to-bn":255}],257:[function(t,e,r){"use strict";function n(t){return new i(t)}var i=t("bn.js");e.exports=n},{"bn.js":259}],258:[function(t,e,r){"use strict";function n(t,e){return i(t[0].mul(e[0]),t[1].mul(e[1]))}var i=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":256}],259:[function(t,e,r){!function(t,e){"use strict";function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function i(t,e,r){return null!==t&&"object"==typeof t&&Array.isArray(t.words)?t:(this.sign=!1,this.words=null,this.length=0,this.red=null,("le"===e||"be"===e)&&(r=e,e=10),void(null!==t&&this._init(t||0,e||10,r||"be")))}function o(t,e,r){for(var n=0,i=Math.min(t.length,r),o=e;i>o;o++){var a=t.charCodeAt(o)-48;n<<=4,n|=a>=49&&54>=a?a-49+10:a>=17&&22>=a?a-17+10:15&a}return n}function a(t,e,r,n){for(var i=0,o=Math.min(t.length,r),a=e;o>a;a++){var s=t.charCodeAt(a)-48;i*=n,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}function s(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).ishln(this.n).isub(this.p),this.tmp=this._tmp()}function l(){s.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function c(){s.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function u(){s.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function h(){s.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function f(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function d(t){f.call(this,t),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).ishln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv.sign=!0,this.minv=this.minv.mod(this.r)}"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26,i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&36>=e),t=t.toString().replace(/\s+/g,"");var i=0;"-"===t[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.sign=!0),this.strip(),"le"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initNumber=function(t,e,n){0>t&&(this.sign=!0,t=-t),67108864>t?(this.words=[67108863&t],this.length=1):4503599627370496>t?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(9007199254740992>t),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initArray=function(t,e,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o=0;if("be"===n)for(var i=t.length-1,a=0;i>=0;i-=3){var s=t[i]|t[i-1]<<8|t[i-2]<<16;this.words[a]|=s<<o&67108863,this.words[a+1]=s>>>26-o&67108863,o+=24,o>=26&&(o-=26,a++)}else if("le"===n)for(var i=0,a=0;i<t.length;i+=3){var s=t[i]|t[i+1]<<8|t[i+2]<<16;this.words[a]|=s<<o&67108863,this.words[a+1]=s>>>26-o&67108863,o+=24,o>=26&&(o-=26,a++)}return this.strip()},i.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;for(var n=0,r=t.length-6,i=0;r>=e;r-=6){var a=o(t,r,r+6);this.words[i]|=a<<n&67108863,this.words[i+1]|=a>>>26-n&4194303,n+=24,n>=26&&(n-=26,i++)}if(r+6!==e){var a=o(t,e,r+6);this.words[i]|=a<<n&67108863,this.words[i+1]|=a>>>26-n&4194303}this.strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;67108863>=i;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,l=Math.min(o,o-s)+r,c=0,u=r;l>u;u+=n)c=a(t,u,u+n,e),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==s){for(var h=1,c=a(t,u,t.length,e),u=0;s>u;u++)h*=e;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}},i.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.sign=this.sign,t.red=this.red},i.prototype.clone=function(){var t=new i(null);return this.copy(t),t},i.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.sign=!1),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var p=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],g=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],v=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(t,e){if(t=t||10,16===t||"hex"===t){for(var n="",i=0,e=0|e||1,o=0,a=0;a<this.length;a++){var s=this.words[a],l=(16777215&(s<<i|o)).toString(16);o=s>>>24-i&16777215,n=0!==o||a!==this.length-1?p[6-l.length]+l+n:l+n,i+=2,i>=26&&(i-=26,a--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!==0;)n="0"+n;return this.sign&&(n="-"+n),n}if(t===(0|t)&&t>=2&&36>=t){var c=g[t],u=v[t],n="",h=this.clone();for(h.sign=!1;0!==h.cmpn(0);){var f=h.modn(u).toString(t);h=h.idivn(u),n=0!==h.cmpn(0)?p[c-f.length]+f+n:f+n}return 0===this.cmpn(0)&&(n="0"+n),this.sign&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toArray=function(t){this.strip();var e=new Array(this.byteLength());e[0]=0;var r=this.clone();if("le"!==t)for(var n=0;0!==r.cmpn(0);n++){var i=r.andln(255);r.ishrn(8),e[e.length-n-1]=i}else for(var n=0;0!==r.cmpn(0);n++){var i=r.andln(255);r.ishrn(8),e[n]=i}return e},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0===(8191&e)&&(r+=13,e>>>=13),0===(127&e)&&(r+=7,e>>>=7),0===(15&e)&&(r+=4,e>>>=4),0===(3&e)&&(r+=2,e>>>=2),0===(1&e)&&r++,r},i.prototype.bitLength=function(){var t=0,e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(0===this.cmpn(0))return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.neg=function(){if(0===this.cmpn(0))return this.clone();var t=this.clone();return t.sign=!this.sign,t},i.prototype.ior=function(t){for(this.sign=this.sign||t.sign;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},i.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.iand=function(t){this.sign=this.sign&&t.sign;var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},i.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.ixor=function(t){this.sign=this.sign||t.sign;var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this.strip()},i.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);for(var n=t/26|0,i=t%26;this.length<=n;)this.words[this.length++]=0;return e?this.words[n]=this.words[n]|1<<i:this.words[n]=this.words[n]&~(1<<i),this.strip()},i.prototype.iadd=function(t){if(this.sign&&!t.sign){this.sign=!1;var e=this.isub(t);return this.sign=!this.sign,this._normSign()}if(!this.sign&&t.sign){t.sign=!1;var e=this.isub(t);return t.sign=!0,e._normSign()}var r,n;this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++){var e=r.words[o]+n.words[o]+i;this.words[o]=67108863&e,i=e>>>26}for(;0!==i&&o<r.length;o++){var e=r.words[o]+i;this.words[o]=67108863&e,i=e>>>26}if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},i.prototype.add=function(t){if(t.sign&&!this.sign){t.sign=!1;var e=this.sub(t);return t.sign=!0,e}if(!t.sign&&this.sign){this.sign=!1;var e=t.sub(this);return this.sign=!0,e}return this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(t.sign){t.sign=!1;var e=this.iadd(t);return t.sign=!0,e._normSign()}if(this.sign)return this.sign=!1,this.iadd(t),this.sign=!0,this._normSign();var r=this.cmp(t);if(0===r)return this.sign=!1,this.length=1,this.words[0]=0,this;var n,i;r>0?(n=this,i=t):(n=t,i=this);for(var o=0,a=0;a<i.length;a++){var e=n.words[a]-i.words[a]+o;o=e>>26,this.words[a]=67108863&e}for(;0!==o&&a<n.length;a++){var e=n.words[a]+o;o=e>>26,this.words[a]=67108863&e}if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.sign=!0),this.strip()},i.prototype.sub=function(t){return this.clone().isub(t)},i.prototype._smallMulTo=function(t,e){e.sign=t.sign!==this.sign,e.length=this.length+t.length;for(var r=0,n=0;n<e.length-1;n++){for(var i=r>>>26,o=67108863&r,a=Math.min(n,t.length-1),s=Math.max(0,n-this.length+1);a>=s;s++){var l=n-s,c=0|this.words[l],u=0|t.words[s],h=c*u,f=67108863&h;i=i+(h/67108864|0)|0,f=f+o|0,o=67108863&f,i=i+(f>>>26)|0}e.words[n]=o,r=i}return 0!==r?e.words[n]=r:e.length--,e.strip()},i.prototype._bigMulTo=function(t,e){e.sign=t.sign!==this.sign,e.length=this.length+t.length;for(var r=0,n=0,i=0;i<e.length-1;i++){var o=n;n=0;for(var a=67108863&r,s=Math.min(i,t.length-1),l=Math.max(0,i-this.length+1);s>=l;l++){var c=i-l,u=0|this.words[c],h=0|t.words[l],f=u*h,d=67108863&f;o=o+(f/67108864|0)|0,d=d+a|0,a=67108863&d,o=o+(d>>>26)|0,n+=o>>>26,o&=67108863}e.words[i]=a,r=o,o=n}return 0!==r?e.words[i]=r:e.length--,e.strip()},i.prototype.mulTo=function(t,e){var r;return r=this.length+t.length<63?this._smallMulTo(t,e):this._bigMulTo(t,e)},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.imul=function(t){if(0===this.cmpn(0)||0===t.cmpn(0))return this.words[0]=0,this.length=1,this;var e=this.length,r=t.length;this.sign=t.sign!==this.sign,
this.length=this.length+t.length,this.words[this.length-1]=0;for(var n=this.length-2;n>=0;n--){for(var i=0,o=0,a=Math.min(n,r-1),s=Math.max(0,n-e+1);a>=s;s++){var l=n-s,c=this.words[l],u=t.words[s],h=c*u,f=67108863&h;i+=h/67108864|0,f+=o,o=67108863&f,i+=f>>>26}this.words[n]=o,this.words[n+1]+=i,i=0}for(var i=0,l=1;l<this.length;l++){var d=this.words[l]+i;this.words[l]=67108863&d,i=d>>>26}return this.strip()},i.prototype.imuln=function(t){r("number"==typeof t);for(var e=0,n=0;n<this.length;n++){var i=this.words[n]*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.mul(this)},i.prototype.ishln=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=67108863>>>26-e<<26-e;if(0!==e){for(var o=0,a=0;a<this.length;a++){var s=this.words[a]&i,l=this.words[a]-s<<e;this.words[a]=l|o,o=s>>>26-e}o&&(this.words[a]=o,this.length++)}if(0!==n){for(var a=this.length-1;a>=0;a--)this.words[a+n]=this.words[a];for(var a=0;n>a;a++)this.words[a]=0;this.length+=n}return this.strip()},i.prototype.ishrn=function(t,e,n){r("number"==typeof t&&t>=0);var i;i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,l=n;if(i-=a,i=Math.max(0,i),l){for(var c=0;a>c;c++)l.words[c]=this.words[c];l.length=a}if(0===a);else if(this.length>a){this.length-=a;for(var c=0;c<this.length;c++)this.words[c]=this.words[c+a]}else this.words[0]=0,this.length=1;for(var u=0,c=this.length-1;c>=0&&(0!==u||c>=i);c--){var h=this.words[c];this.words[c]=u<<26-o|h>>>o,u=h&s}return l&&0!==u&&(l.words[l.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip(),this},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n)return!1;var o=this.words[n];return!!(o&i)},i.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;if(r(!this.sign,"imaskn works only with positive numbers"),0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this.strip()},i.prototype.maskn=function(t){return this.clone().imaskn(t)},i.prototype.iaddn=function(t){return r("number"==typeof t),0>t?this.isubn(-t):this.sign?1===this.length&&this.words[0]<t?(this.words[0]=t-this.words[0],this.sign=!1,this):(this.sign=!1,this.isubn(t),this.sign=!0,this):this._iaddn(t)},i.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(r("number"==typeof t),0>t)return this.iaddn(-t);if(this.sign)return this.sign=!1,this.iaddn(t),this.sign=!0,this;this.words[0]-=t;for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},i.prototype.addn=function(t){return this.clone().iaddn(t)},i.prototype.subn=function(t){return this.clone().isubn(t)},i.prototype.iabs=function(){return this.sign=!1,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(t,e,n){var i,o=t.length+n;if(this.words.length<o){for(var a=new Array(o),i=0;i<this.length;i++)a[i]=this.words[i];this.words=a}else i=this.length;for(this.length=Math.max(this.length,o);i<this.length;i++)this.words[i]=0;for(var s=0,i=0;i<t.length;i++){var l=this.words[i+n]+s,c=t.words[i]*e;l-=67108863&c,s=(l>>26)-(c/67108864|0),this.words[i+n]=67108863&l}for(;i<this.length-n;i++){var l=this.words[i+n]+s;s=l>>26,this.words[i+n]=67108863&l}if(0===s)return this.strip();r(-1===s),s=0;for(var i=0;i<this.length;i++){var l=-this.words[i]+s;s=l>>26,this.words[i]=67108863&l}return this.sign=!0,this.strip()},i.prototype._wordDiv=function(t,e){var r=this.length-t.length,n=this.clone(),o=t,a=o.words[o.length-1],s=this._countBits(a);r=26-s,0!==r&&(o=o.shln(r),n.ishln(r),a=o.words[o.length-1]);var l,c=n.length-o.length;if("mod"!==e){l=new i(null),l.length=c+1,l.words=new Array(l.length);for(var u=0;u<l.length;u++)l.words[u]=0}var h=n.clone()._ishlnsubmul(o,1,c);h.sign||(n=h,l&&(l.words[c]=1));for(var f=c-1;f>=0;f--){var d=67108864*n.words[o.length+f]+n.words[o.length+f-1];for(d=Math.min(d/a|0,67108863),n._ishlnsubmul(o,d,f);n.sign;)d--,n.sign=!1,n._ishlnsubmul(o,1,f),0!==n.cmpn(0)&&(n.sign=!n.sign);l&&(l.words[f]=d)}return l&&l.strip(),n.strip(),"div"!==e&&0!==r&&n.ishrn(r),{div:l?l:null,mod:n}},i.prototype.divmod=function(t,e){if(r(0!==t.cmpn(0)),this.sign&&!t.sign){var n,o,a=this.neg().divmod(t,e);return"mod"!==e&&(n=a.div.neg()),"div"!==e&&(o=0===a.mod.cmpn(0)?a.mod:t.sub(a.mod)),{div:n,mod:o}}if(!this.sign&&t.sign){var n,a=this.divmod(t.neg(),e);return"mod"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}}return this.sign&&t.sign?this.neg().divmod(t.neg(),e):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,e)},i.prototype.div=function(t){return this.divmod(t,"div").div},i.prototype.mod=function(t){return this.divmod(t,"mod").mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(0===e.mod.cmpn(0))return e.div;var r=e.div.sign?e.mod.isub(t):e.mod,n=t.shrn(1),i=t.andln(1),o=r.cmp(n);return 0>o||1===i&&0===o?e.div:e.div.sign?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(t){r(67108863>=t);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+this.words[i])%t;return n},i.prototype.idivn=function(t){r(67108863>=t);for(var e=0,n=this.length-1;n>=0;n--){var i=this.words[n]+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(!t.sign),r(0!==t.cmpn(0));var e=this,n=t.clone();e=e.sign?e.mod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),l=new i(1),c=0;e.isEven()&&n.isEven();)e.ishrn(1),n.ishrn(1),++c;for(var u=n.clone(),h=e.clone();0!==e.cmpn(0);){for(;e.isEven();)e.ishrn(1),o.isEven()&&a.isEven()?(o.ishrn(1),a.ishrn(1)):(o.iadd(u).ishrn(1),a.isub(h).ishrn(1));for(;n.isEven();)n.ishrn(1),s.isEven()&&l.isEven()?(s.ishrn(1),l.ishrn(1)):(s.iadd(u).ishrn(1),l.isub(h).ishrn(1));e.cmp(n)>=0?(e.isub(n),o.isub(s),a.isub(l)):(n.isub(e),s.isub(o),l.isub(a))}return{a:s,b:l,gcd:n.ishln(c)}},i.prototype._invmp=function(t){r(!t.sign),r(0!==t.cmpn(0));var e=this,n=t.clone();e=e.sign?e.mod(t):e.clone();for(var o=new i(1),a=new i(0),s=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(;e.isEven();)e.ishrn(1),o.isEven()?o.ishrn(1):o.iadd(s).ishrn(1);for(;n.isEven();)n.ishrn(1),a.isEven()?a.ishrn(1):a.iadd(s).ishrn(1);e.cmp(n)>=0?(e.isub(n),o.isub(a)):(n.isub(e),a.isub(o))}return 0===e.cmpn(1)?o:a},i.prototype.gcd=function(t){if(0===this.cmpn(0))return t.clone();if(0===t.cmpn(0))return this.clone();var e=this.clone(),r=t.clone();e.sign=!1,r.sign=!1;for(var n=0;e.isEven()&&r.isEven();n++)e.ishrn(1),r.ishrn(1);for(;;){for(;e.isEven();)e.ishrn(1);for(;r.isEven();)r.ishrn(1);var i=e.cmp(r);if(0>i){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.ishln(n)},i.prototype.invm=function(t){return this.egcd(t).a.mod(t)},i.prototype.isEven=function(){return 0===(1&this.words[0])},i.prototype.isOdd=function(){return 1===(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n){for(var o=this.length;n+1>o;o++)this.words[o]=0;return this.words[n]|=i,this.length=n+1,this}for(var a=i,o=n;0!==a&&o<this.length;o++){var s=this.words[o];s+=a,a=s>>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},i.prototype.cmpn=function(t){var e=0>t;if(e&&(t=-t),this.sign&&!e)return-1;if(!this.sign&&e)return 1;t&=67108863,this.strip();var r;if(this.length>1)r=1;else{var n=this.words[0];r=n===t?0:t>n?-1:1}return this.sign&&(r=-r),r},i.prototype.cmp=function(t){if(this.sign&&!t.sign)return-1;if(!this.sign&&t.sign)return 1;var e=this.ucmp(t);return this.sign?-e:e},i.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=this.words[r],i=t.words[r];if(n!==i){i>n?e=-1:n>i&&(e=1);break}}return e},i.red=function(t){return new f(t)},i.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(!this.sign,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var m={k256:null,p224:null,p192:null,p25519:null};s.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},s.prototype.ireduce=function(t){var e,r=t;do this.split(r,this.tmp),r=this.imulK(r),r=r.iadd(this.tmp),e=r.bitLength();while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):r.strip(),r},s.prototype.split=function(t,e){t.ishrn(this.n,0,e)},s.prototype.imulK=function(t){return t.imul(this.k)},n(l,s),l.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;n>i;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];e.words[e.length++]=o&r;for(var i=10;i<t.length;i++){var a=t.words[i];t.words[i-10]=(a&r)<<4|o>>>22,o=a}t.words[i-10]=o>>>22,t.length-=9},l.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e,r=0,n=0;n<t.length;n++){var i=t.words[n];e=64*i,r+=977*i,e+=r/67108864|0,r&=67108863,t.words[n]=r,r=e}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(c,s),n(u,s),n(h,s),h.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*t.words[r]+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function y(t){if(m[t])return m[t];var y;if("k256"===t)y=new l;else if("p224"===t)y=new c;else if("p192"===t)y=new u;else{if("p25519"!==t)throw new Error("Unknown prime "+t);y=new h}return m[t]=y,y},f.prototype._verify1=function(t){r(!t.sign,"red works only with positives"),r(t.red,"red works only with red numbers")},f.prototype._verify2=function(t,e){r(!t.sign&&!e.sign,"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},f.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.mod(this.m)._forceRed(this)},f.prototype.neg=function(t){var e=t.clone();return e.sign=!e.sign,e.iadd(this.m)._forceRed(this)},f.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},f.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},f.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},f.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},f.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.shln(e))},f.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},f.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},f.prototype.isqr=function(t){return this.imul(t,t)},f.prototype.sqr=function(t){return this.mul(t,t)},f.prototype.sqrt=function(t){if(0===t.cmpn(0))return t.clone();var e=this.m.andln(3);if(r(e%2===1),3===e){var n=this.m.add(new i(1)).ishrn(2),o=this.pow(t,n);return o}for(var a=this.m.subn(1),s=0;0!==a.cmpn(0)&&0===a.andln(1);)s++,a.ishrn(1);r(0!==a.cmpn(0));var l=new i(1).toRed(this),c=l.redNeg(),u=this.m.subn(1).ishrn(1),h=this.m.bitLength();for(h=new i(2*h*h).toRed(this);0!==this.pow(h,u).cmp(c);)h.redIAdd(c);for(var f=this.pow(h,a),o=this.pow(t,a.addn(1).ishrn(1)),d=this.pow(t,a),p=s;0!==d.cmp(l);){for(var g=d,v=0;0!==g.cmp(l);v++)g=g.redSqr();r(p>v);var m=this.pow(f,new i(1).ishln(p-v-1));o=o.redMul(m),f=m.redSqr(),d=d.redMul(f),p=v}return o},f.prototype.invm=function(t){var e=t._invmp(this.m);return e.sign?(e.sign=!1,this.imod(e).redNeg()):this.imod(e)},f.prototype.pow=function(t,e){var r=[];if(0===e.cmpn(0))return new i(1);for(var n=e.clone();0!==n.cmpn(0);)r.push(n.andln(1)),n.ishrn(1);for(var o=t,a=0;a<r.length&&0===r[a];a++,o=this.sqr(o));if(++a<r.length)for(var n=this.sqr(o);a<r.length;a++,n=this.sqr(n))0!==r[a]&&(o=this.mul(o,n));return o},f.prototype.convertTo=function(t){var e=t.mod(this.m);return e===t?e.clone():e},f.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new d(t)},n(d,f),d.prototype.convertTo=function(t){return this.imod(t.shln(this.shift))},d.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},d.prototype.imul=function(t,e){if(0===t.cmpn(0)||0===e.cmpn(0))return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).ishrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},d.prototype.mul=function(t,e){if(0===t.cmpn(0)||0===e.cmpn(0))return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).ishrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},d.prototype.invm=function(t){var e=this.imod(t._invmp(this.m).mul(this.r2));return e._forceRed(this)}}("undefined"==typeof e||e,this)},{}],260:[function(t,e,r){"use strict";function n(t){return i(t[0])*i(t[1])}var i=t("./lib/bn-sign");e.exports=n},{"./lib/bn-sign":251}],261:[function(t,e,r){"use strict";function n(t,e){return i(t[0].mul(e[1]).sub(t[1].mul(e[0])),t[1].mul(e[1]))}var i=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":256}],262:[function(t,e,r){"use strict";function n(t){var e=t[0],r=t[1];if(0===e.cmpn(0))return 0;var n=e.divmod(r),a=n.div,s=i(a),l=n.mod;if(0===l.cmpn(0))return s;if(s){var c=o(s)+4,u=i(l.shln(c).divRound(r));return 0>s&&(u=-u),s+u*Math.pow(2,-c)}var h=r.bitLength()-l.bitLength()+53,u=i(l.shln(h).divRound(r));return 1023>h?u*Math.pow(2,-h):(u*=Math.pow(2,-1023),u*Math.pow(2,1023-h))}var i=t("./lib/bn-to-num"),o=t("./lib/ctz");e.exports=n},{"./lib/bn-to-num":252,"./lib/ctz":253}],263:[function(t,e,r){"use strict";function n(t,e){for(var r=0;t>r;++r)if(!(e[r]<=e[r+t]))return!0;return!1}function i(t,e,r,i){for(var o=0,a=0,s=0,l=t.length;l>s;++s){var c=t[s];if(!n(e,c)){for(var u=0;2*e>u;++u)r[o++]=c[u];i[a++]=s}}return a}function o(t,e,r,n){var o=t.length,a=e.length;if(!(0>=o||0>=a)){var s=t[0].length>>>1;if(!(0>=s)){var l,c=h.mallocDouble(2*s*o),u=h.mallocInt32(o);if(o=i(t,s,c,u),o>0){if(1===s&&n)f.init(o),l=f.sweepComplete(s,r,0,o,c,u,0,o,c,u);else{var p=h.mallocDouble(2*s*a),g=h.mallocInt32(a);a=i(e,s,p,g),a>0&&(f.init(o+a),l=1===s?f.sweepBipartite(s,r,0,o,c,u,0,a,p,g):d(s,r,n,o,c,u,a,p,g),h.free(p),h.free(g))}h.free(c),h.free(u)}return l}}}function a(t,e){u.push([t,e])}function s(t){return u=[],o(t,t,a,!0),u}function l(t,e){return u=[],o(t,e,a,!1),u}function c(t,e,r){switch(arguments.length){case 1:return s(t);case 2:return"function"==typeof e?o(t,t,e,!0):l(t,e);case 3:return o(t,e,r,!1);default:throw new Error("box-intersect: Invalid arguments")}}e.exports=c;var u,h=t("typedarray-pool"),f=t("./lib/sweep"),d=t("./lib/intersect")},{"./lib/intersect":265,"./lib/sweep":269,"typedarray-pool":233}],264:[function(t,e,r){"use strict";function n(t,e,r){var n="bruteForce"+(t?"Red":"Blue")+(e?"Flip":"")+(r?"Full":""),i=["function ",n,"(",w.join(),"){","var ",c,"=2*",o,";"],l="for(var i="+u+","+p+"="+c+"*"+u+";i<"+h+";++i,"+p+"+="+c+"){var x0="+f+"["+a+"+"+p+"],x1="+f+"["+a+"+"+p+"+"+o+"],xi="+d+"[i];",k="for(var j="+g+","+b+"="+c+"*"+g+";j<"+v+";++j,"+b+"+="+c+"){var y0="+m+"["+a+"+"+b+"],"+(r?"y1="+m+"["+a+"+"+b+"+"+o+"],":"")+"yi="+y+"[j];";return t?i.push(l,_,":",k):i.push(k,_,":",l),r?i.push("if(y1<x0||x1<y0)continue;"):e?i.push("if(y0<=x0||x1<y0)continue;"):i.push("if(y0<x0||x1<y0)continue;"),i.push("for(var k="+a+"+1;k<"+o+";++k){var r0="+f+"[k+"+p+"],r1="+f+"[k+"+o+"+"+p+"],b0="+m+"[k+"+b+"],b1="+m+"[k+"+o+"+"+b+"];if(r1<b0||b1<r0)continue "+_+";}var "+x+"="+s+"("),e?i.push("yi,xi"):i.push("xi,yi"),i.push(");if("+x+"!==void 0)return "+x+";}}}"),{name:n,code:i.join("")}}function i(t){function e(e,r){var o=n(e,r,t);i.push(o.code),a.push("return "+o.name+"("+w.join()+");")}var r="bruteForce"+(t?"Full":"Partial"),i=[],o=w.slice();t||o.splice(3,0,l);var a=["function "+r+"("+o.join()+"){"];a.push("if("+h+"-"+u+">"+v+"-"+g+"){"),t?(e(!0,!1),a.push("}else{"),e(!1,!1)):(a.push("if("+l+"){"),e(!0,!0),a.push("}else{"),e(!0,!1),a.push("}}else{if("+l+"){"),e(!1,!0),a.push("}else{"),e(!1,!1),a.push("}")),a.push("}}return "+r);var s=i.join("")+a.join(""),c=new Function(s);return c()}var o="d",a="ax",s="vv",l="fp",c="es",u="rs",h="re",f="rb",d="ri",p="rp",g="bs",v="be",m="bb",y="bi",b="bp",x="rv",_="Q",w=[o,a,s,u,h,f,d,g,v,m,y];r.partial=i(!1),r.full=i(!0)},{}],265:[function(t,e,r){"use strict";function n(t,e){var r=8*c.log2(e+1)*(t+1)|0,n=c.nextPow2(M*r);L.length<n&&(l.free(L),L=l.mallocInt32(n));var i=c.nextPow2(T*r);i>S&&(l.free(S),S=l.mallocDouble(i))}function i(t,e,r,n,i,o,a,s,l){var c=M*t;L[c]=e,L[c+1]=r,L[c+2]=n,L[c+3]=i,L[c+4]=o,L[c+5]=a;var u=T*t;S[u]=s,S[u+1]=l}function o(t,e,r,n,i,o,a,s,l,c,u){var h=2*t,f=l*h,d=c[f+e];t:for(var p=i,g=i*h;o>p;++p,g+=h){var v=a[g+e],m=a[g+e+t];if(!(v>d||d>m||n&&d===v)){for(var y=s[p],b=e+1;t>b;++b){var v=a[g+b],m=a[g+b+t],x=c[f+b],_=c[f+b+t];if(x>m||v>_)continue t}var w;if(w=n?r(u,y):r(y,u),void 0!==w)return w}}}function a(t,e,r,n,i,o,a,s,l,c){var u=2*t,h=s*u,f=l[h+e];t:for(var d=n,p=n*u;i>d;++d,p+=u){var g=a[d];if(g!==c){var v=o[p+e],m=o[p+e+t];if(!(v>f||f>m)){for(var y=e+1;t>y;++y){var v=o[p+y],m=o[p+y+t],b=l[h+y],x=l[h+y+t];if(b>m||v>x)continue t}var _=r(g,c);if(void 0!==_)return _}}}}function s(t,e,r,s,l,c,u,g,E){n(t,s+u);var C,z=0,j=2*t;for(i(z++,0,0,s,0,u,r?16:0,-(1/0),1/0),r||i(z++,0,0,u,0,s,1,-(1/0),1/0);z>0;){z-=1;var P=z*M,I=L[P],R=L[P+1],O=L[P+2],N=L[P+3],D=L[P+4],F=L[P+5],B=z*T,U=S[B],V=S[B+1],q=1&F,H=!!(16&F),G=l,Y=c,X=g,W=E;if(q&&(G=g,Y=E,X=l,W=c),!(2&F&&(O=_(t,I,R,O,G,Y,V),R>=O)||4&F&&(R=w(t,I,R,O,G,Y,U),R>=O))){var Z=O-R,Q=D-N;if(H){if(y>t*Z*(Z+Q)){if(C=d.scanComplete(t,I,e,R,O,G,Y,N,D,X,W),void 0!==C)return C;continue}}else{if(t*Math.min(Z,Q)<v){if(C=h(t,I,e,q,R,O,G,Y,N,D,X,W),void 0!==C)return C;continue}if(m>t*Z*Q){if(C=d.scanBipartite(t,I,e,q,R,O,G,Y,N,D,X,W),void 0!==C)return C;continue}}var $=b(t,I,R,O,G,Y,U,V);if($>R)if(v>t*($-R)){if(C=f(t,I+1,e,R,$,G,Y,N,D,X,W),void 0!==C)return C}else if(I===t-2){if(C=q?d.sweepBipartite(t,e,N,D,X,W,R,$,G,Y):d.sweepBipartite(t,e,R,$,G,Y,N,D,X,W),void 0!==C)return C}else i(z++,I+1,R,$,N,D,q,-(1/0),1/0),i(z++,I+1,N,D,R,$,1^q,-(1/0),1/0);if(O>$){var K=p(t,I,N,D,X,W),J=X[j*K+I],tt=x(t,I,K,D,X,W,J);if(D>tt&&i(z++,I,$,O,tt,D,(4|q)+(H?16:0),J,V),K>N&&i(z++,I,$,O,N,K,(2|q)+(H?16:0),U,J),K+1===tt){if(C=H?a(t,I,e,$,O,G,Y,K,X,W[K]):o(t,I,e,q,$,O,G,Y,K,X,W[K]),void 0!==C)return C}else if(tt>K){var et;if(H){if(et=k(t,I,$,O,G,Y,J),et>$){var rt=x(t,I,$,et,G,Y,J);if(I===t-2){if(rt>$&&(C=d.sweepComplete(t,e,$,rt,G,Y,K,tt,X,W),void 0!==C))return C;if(et>rt&&(C=d.sweepBipartite(t,e,rt,et,G,Y,K,tt,X,W),void 0!==C))return C}else rt>$&&i(z++,I+1,$,rt,K,tt,16,-(1/0),1/0),et>rt&&(i(z++,I+1,rt,et,K,tt,0,-(1/0),1/0),i(z++,I+1,K,tt,rt,et,1,-(1/0),1/0))}}else et=q?A(t,I,$,O,G,Y,J):k(t,I,$,O,G,Y,J),et>$&&(I===t-2?C=q?d.sweepBipartite(t,e,K,tt,X,W,$,et,G,Y):d.sweepBipartite(t,e,$,et,G,Y,K,tt,X,W):(i(z++,I+1,$,et,K,tt,q,-(1/0),1/0),i(z++,I+1,K,tt,$,et,1^q,-(1/0),1/0)))}}}}}e.exports=s;var l=t("typedarray-pool"),c=t("bit-twiddle"),u=t("./brute"),h=u.partial,f=u.full,d=t("./sweep"),p=t("./median"),g=t("./partition"),v=128,m=1<<22,y=1<<22,b=g("!(lo>=p0)&&!(p1>=hi)",["p0","p1"]),x=g("lo===p0",["p0"]),_=g("lo<p0",["p0"]),w=g("hi<=p0",["p0"]),k=g("lo<=p0&&p0<=hi",["p0"]),A=g("lo<p0&&p0<=hi",["p0"]),M=6,T=2,E=1024,L=l.mallocInt32(E),S=l.mallocDouble(E)},{"./brute":264,"./median":266,"./partition":267,"./sweep":269,"bit-twiddle":49,"typedarray-pool":233}],266:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){for(var a=2*t,s=a*(r+1)+e,l=r+1;n>l;++l,s+=a)for(var c=i[s],u=l,h=a*(l-1);u>r&&i[h+e]>c;--u,h-=a){for(var f=h,d=h+a,p=0;a>p;++p,++f,++d){var g=i[f];i[f]=i[d],i[d]=g}var v=o[u];o[u]=o[u-1],o[u-1]=v}}function i(t,e,r,i,o,l){if(r+1>=i)return r;for(var c=r,u=i,h=i+r>>>1,f=2*t,d=h,p=o[f*h+e];u>c;){if(s>u-c){n(t,e,c,u,o,l),p=o[f*h+e];break}var g=u-c,v=Math.random()*g+c|0,m=o[f*v+e],y=Math.random()*g+c|0,b=o[f*y+e],x=Math.random()*g+c|0,_=o[f*x+e];b>=m?_>=b?(d=y,p=b):m>=_?(d=v,p=m):(d=x,p=_):b>=_?(d=y,p=b):_>=m?(d=v,p=m):(d=x,p=_);for(var w=f*(u-1),k=f*d,A=0;f>A;++A,++w,++k){var M=o[w];o[w]=o[k],o[k]=M}var T=l[u-1];l[u-1]=l[d],l[d]=T,d=a(t,e,c,u-1,o,l,p);for(var w=f*(u-1),k=f*d,A=0;f>A;++A,++w,++k){var M=o[w];o[w]=o[k],o[k]=M}var T=l[u-1];if(l[u-1]=l[d],l[d]=T,d>h){for(u=d-1;u>c&&o[f*(u-1)+e]===p;)u-=1;u+=1}else{if(!(h>d))break;for(c=d+1;u>c&&o[f*c+e]===p;)c+=1}}return a(t,e,r,h,o,l,o[f*h+e])}e.exports=i;var o=t("./partition"),a=o("lo<p0",["p0"]),s=8},{"./partition":267}],267:[function(t,e,r){"use strict";function n(t,e){var r="abcdef".split("").concat(e),n=[];return t.indexOf("lo")>=0&&n.push("lo=e[k+n]"),t.indexOf("hi")>=0&&n.push("hi=e[k+o]"),r.push(i.replace("_",n.join()).replace("$",t)),Function.apply(void 0,r)}e.exports=n;var i="for(var j=2*a,k=j*c,l=k,m=c,n=b,o=a+b,p=c;d>p;++p,k+=j){var _;if($)if(m===p)m+=1,l+=j;else{for(var s=0;j>s;++s){var t=e[k+s];e[k+s]=e[l],e[l++]=t}var u=f[p];f[p]=f[m],f[m++]=u}}return m"},{}],268:[function(t,e,r){"use strict";function n(t,e){4*f>=e?i(0,e-1,t):h(0,e-1,t)}function i(t,e,r){for(var n=2*(t+1),i=t+1;e>=i;++i){for(var o=r[n++],a=r[n++],s=i,l=n-2;s-- >t;){var c=r[l-2],u=r[l-1];if(o>c)break;if(c===o&&a>u)break;r[l]=c,r[l+1]=u,l-=2}r[l]=o,r[l+1]=a}}function o(t,e,r){t*=2,e*=2;var n=r[t],i=r[t+1];r[t]=r[e],r[t+1]=r[e+1],r[e]=n,r[e+1]=i}function a(t,e,r){t*=2,e*=2,r[t]=r[e],r[t+1]=r[e+1]}function s(t,e,r,n){t*=2,e*=2,r*=2;var i=n[t],o=n[t+1];n[t]=n[e],n[t+1]=n[e+1],n[e]=n[r],n[e+1]=n[r+1],n[r]=i,n[r+1]=o}function l(t,e,r,n,i){t*=2,e*=2,i[t]=i[e],i[e]=r,i[t+1]=i[e+1],i[e+1]=n}function c(t,e,r){t*=2,e*=2;var n=r[t],i=r[e];return i>n?!1:n===i?r[t+1]>r[e+1]:!0}function u(t,e,r,n){t*=2;var i=n[t];return e>i?!0:i===e?n[t+1]<r:!1}function h(t,e,r){var n=(e-t+1)/6|0,d=t+n,p=e-n,g=t+e>>1,v=g-n,m=g+n,y=d,b=v,x=g,_=m,w=p,k=t+1,A=e-1,M=0;c(y,b,r)&&(M=y,y=b,b=M),c(_,w,r)&&(M=_,_=w,w=M),c(y,x,r)&&(M=y,y=x,x=M),c(b,x,r)&&(M=b,b=x,x=M),c(y,_,r)&&(M=y,y=_,_=M),c(x,_,r)&&(M=x,x=_,_=M),c(b,w,r)&&(M=b,b=w,w=M),c(b,x,r)&&(M=b,b=x,x=M),c(_,w,r)&&(M=_,_=w,w=M);for(var T=r[2*b],E=r[2*b+1],L=r[2*_],S=r[2*_+1],C=2*y,z=2*x,j=2*w,P=2*d,I=2*g,R=2*p,O=0;2>O;++O){var N=r[C+O],D=r[z+O],F=r[j+O];r[P+O]=N,r[I+O]=D,r[R+O]=F}a(v,t,r),a(m,e,r);for(var B=k;A>=B;++B)if(u(B,T,E,r))B!==k&&o(B,k,r),++k;else if(!u(B,L,S,r))for(;;){if(u(A,L,S,r)){u(A,T,E,r)?(s(B,k,A,r),++k,--A):(o(B,A,r),--A);break}if(--A<B)break}l(t,k-1,T,E,r),l(e,A+1,L,S,r),f>=k-2-t?i(t,k-2,r):h(t,k-2,r),f>=e-(A+2)?i(A+2,e,r):h(A+2,e,r),f>=A-k?i(k,A,r):h(k,A,r)}e.exports=n;var f=32},{}],269:[function(t,e,r){"use strict";function n(t){var e=h.nextPow2(t);g.length<e&&(u.free(g),g=u.mallocInt32(e)),v.length<e&&(u.free(v),v=u.mallocInt32(e)),m.length<e&&(u.free(m),m=u.mallocInt32(e)),y.length<e&&(u.free(y),y=u.mallocInt32(e)),b.length<e&&(u.free(b),b=u.mallocInt32(e)),x.length<e&&(u.free(x),x=u.mallocInt32(e));var r=8*e;_.length<r&&(u.free(_),_=u.mallocDouble(r))}function i(t,e,r,n){var i=e[n],o=t[r-1];t[i]=o,e[o]=i}function o(t,e,r,n){t[r]=n,e[n]=r}function a(t,e,r,n,a,s,l,c,u,h){for(var p=0,b=2*t,x=t-1,w=b-1,k=r;n>k;++k){var A=s[k],M=b*k;_[p++]=a[M+x],_[p++]=-(A+1),_[p++]=a[M+w],_[p++]=A}for(var k=l;c>k;++k){var A=h[k]+d,T=b*k;_[p++]=u[T+x],_[p++]=-A,_[p++]=u[T+w],_[p++]=A}var E=p>>>1;f(_,E);for(var L=0,S=0,k=0;E>k;++k){var C=0|_[2*k+1];if(C>=d)C=C-d|0,i(m,y,S--,C);else if(C>=0)i(g,v,L--,C);else if(-d>=C){C=-C-d|0;for(var z=0;L>z;++z){var j=e(g[z],C);if(void 0!==j)return j}o(m,y,S++,C)}else{C=-C-1|0;for(var z=0;S>z;++z){var j=e(C,m[z]);if(void 0!==j)return j}o(g,v,L++,C)}}}function s(t,e,r,n,a,s,l,c,u,h){for(var d=0,p=2*t,w=t-1,k=p-1,A=r;n>A;++A){var M=s[A]+1<<1,T=p*A;_[d++]=a[T+w],_[d++]=-M,_[d++]=a[T+k],_[d++]=M}for(var A=l;c>A;++A){var M=h[A]+1<<1,E=p*A;_[d++]=u[E+w],_[d++]=1|-M,_[d++]=u[E+k],_[d++]=1|M}var L=d>>>1;f(_,L);for(var S=0,C=0,z=0,A=0;L>A;++A){var j=0|_[2*A+1],P=1&j;if(L-1>A&&j>>1===_[2*A+3]>>1&&(P=2,A+=1),0>j){for(var I=-(j>>1)-1,R=0;z>R;++R){var O=e(b[R],I);if(void 0!==O)return O}if(0!==P)for(var R=0;S>R;++R){var O=e(g[R],I);if(void 0!==O)return O}if(1!==P)for(var R=0;C>R;++R){var O=e(m[R],I);if(void 0!==O)return O}0===P?o(g,v,S++,I):1===P?o(m,y,C++,I):2===P&&o(b,x,z++,I)}else{var I=(j>>1)-1;0===P?i(g,v,S--,I):1===P?i(m,y,C--,I):2===P&&i(b,x,z--,I)}}}function l(t,e,r,n,a,s,l,c,u,h,p,m){var y=0,b=2*t,x=e,w=e+t,k=1,A=1;n?A=d:k=d;for(var M=a;s>M;++M){var T=M+k,E=b*M;_[y++]=l[E+x],_[y++]=-T,_[y++]=l[E+w],_[y++]=T}for(var M=u;h>M;++M){var T=M+A,L=b*M;_[y++]=p[L+x],_[y++]=-T}var S=y>>>1;f(_,S);for(var C=0,M=0;S>M;++M){var z=0|_[2*M+1];if(0>z){var T=-z,j=!1;if(T>=d?(j=!n,T-=d):(j=!!n,T-=1),j)o(g,v,C++,T);else{var P=m[T],I=b*T,R=p[I+e+1],O=p[I+e+1+t];t:for(var N=0;C>N;++N){var D=g[N],F=b*D;if(!(O<l[F+e+1]||l[F+e+1+t]<R)){for(var B=e+2;t>B;++B)if(p[I+B+t]<l[F+B]||l[F+B+t]<p[I+B])continue t;var U,V=c[D];if(U=n?r(P,V):r(V,P),void 0!==U)return U}}}}else i(g,v,C--,z-k)}}function c(t,e,r,n,i,o,a,s,l,c,u){for(var h=0,p=2*t,v=e,m=e+t,y=n;i>y;++y){var b=y+d,x=p*y;_[h++]=o[x+v],_[h++]=-b,_[h++]=o[x+m],_[h++]=b}for(var y=s;l>y;++y){var b=y+1,w=p*y;_[h++]=c[w+v],_[h++]=-b}var k=h>>>1;f(_,k);for(var A=0,y=0;k>y;++y){var M=0|_[2*y+1];if(0>M){var b=-M;if(b>=d)g[A++]=b-d;else{b-=1;var T=u[b],E=p*b,L=c[E+e+1],S=c[E+e+1+t];t:for(var C=0;A>C;++C){var z=g[C],j=a[z];if(j===T)break;var P=p*z;if(!(S<o[P+e+1]||o[P+e+1+t]<L)){for(var I=e+2;t>I;++I)if(c[E+I+t]<o[P+I]||o[P+I+t]<c[E+I])continue t;var R=r(j,T);if(void 0!==R)return R}}}}else{for(var b=M-d,C=A-1;C>=0;--C)if(g[C]===b){for(var I=C+1;A>I;++I)g[I-1]=g[I];break}--A}}}e.exports={init:n,sweepBipartite:a,sweepComplete:s,scanBipartite:l,scanComplete:c};var u=t("typedarray-pool"),h=t("bit-twiddle"),f=t("./sort"),d=1<<28,p=1024,g=u.mallocInt32(p),v=u.mallocInt32(p),m=u.mallocInt32(p),y=u.mallocInt32(p),b=u.mallocInt32(p),x=u.mallocInt32(p),_=u.mallocDouble(8*p)},{"./sort":268,"bit-twiddle":49,"typedarray-pool":233}],270:[function(t,e,r){(function(t){function r(t,e){return d[0]=t,d[1]=e,f[0]}function n(t){return f[0]=t,d[0]}function i(t){return f[0]=t,d[1]}function o(t,e){return d[1]=t,d[0]=e,f[0]}function a(t){return f[0]=t,d[1]}function s(t){return f[0]=t,d[0]}function l(t,e){return p.writeUInt32LE(t,0,!0),p.writeUInt32LE(e,4,!0),p.readDoubleLE(0,!0)}function c(t){return p.writeDoubleLE(t,0,!0),p.readUInt32LE(0,!0)}function u(t){return p.writeDoubleLE(t,0,!0),p.readUInt32LE(4,!0)}var h=!1;if("undefined"!=typeof Float64Array){var f=new Float64Array(1),d=new Uint32Array(f.buffer);f[0]=1,h=!0,1072693248===d[1]?(e.exports=function(t){return f[0]=t,[d[0],d[1]]},e.exports.pack=r,e.exports.lo=n,e.exports.hi=i):1072693248===d[0]?(e.exports=function(t){return f[0]=t,[d[1],d[0]]},e.exports.pack=o,e.exports.lo=a,e.exports.hi=s):h=!1}if(!h){var p=new t(8);e.exports=function(t){return p.writeDoubleLE(t,0,!0),[p.readUInt32LE(0,!0),p.readUInt32LE(4,!0)]},e.exports.pack=l,e.exports.lo=c,e.exports.hi=u}e.exports.sign=function(t){return e.exports.hi(t)>>>31},e.exports.exponent=function(t){var r=e.exports.hi(t);return(r<<1>>>21)-1023},e.exports.fraction=function(t){var r=e.exports.lo(t),n=e.exports.hi(t),i=1048575&n;return 2146435072&n&&(i+=1<<20),[r,i]},e.exports.denormalized=function(t){var r=e.exports.hi(t);return!(2146435072&r)}}).call(this,t("buffer").Buffer)},{buffer:50}],271:[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":270}],272:[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":246}],273:[function(t,e,r){"use strict";function n(t){for(var e=new Array(t.length),r=0;r<t.length;++r)e[r]=i(t[r]);return e}e.exports=n;var i=t("big-rat")},{"big-rat":249}],274:[function(t,e,r){"use strict";function n(t,e){for(var r=i(e),n=t.length,a=new Array(n),s=0;n>s;++s)a[s]=o(t[s],r);return a}var i=t("big-rat"),o=t("big-rat/mul");e.exports=n},{"big-rat":249,"big-rat/mul":258}],275:[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":261}],276:[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),c=r[i],u=n[i],h=Math.min(c,u),f=Math.max(c,u);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),c=o(i,t,e);return l>0&&c>0||0>l&&0>c?!1:0===a&&0===s&&0===l&&0===c?n(t,e,r,i):!0}e.exports=i;var o=t("robust-orientation")[3]},{"robust-orientation":214}],277:[function(t,e,r){arguments[4][193][0].apply(r,arguments)},{dup:193}],278:[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<e.length;++s){var l=r[s].length;o[s]=l,n[s]=!0,1>=l&&a.push(s)}for(;a.length>0;){var c=a.pop();n[c]=!1;for(var u=r[c],s=0;s<u.length;++s){var h=u[s];0===--o[h]&&a.push(h)}}for(var f=new Array(e.length),d=[],s=0;s<e.length;++s)if(n[s]){var c=d.length;f[s]=c,d.push(e[s])}else f[s]=-1;for(var p=[],s=0;s<t.length;++s){
var g=t[s];n[g[0]]&&n[g[1]]&&p.push([f[g[0]],f[g[1]]])}return[p,d]}e.exports=n;var i=t("edges-to-adjacency-list")},{"edges-to-adjacency-list":279}],279:[function(t,e,r){"use strict";function n(t,e){var r=t.length;if("number"!=typeof e){e=0;for(var n=0;r>n;++n){var o=t[n];e=Math.max(e,o[0],o[1])}e=(0|e)+1}e=0|e;for(var a=new Array(e),n=0;e>n;++n)a[n]=[];for(var n=0;r>n;++n){var o=t[n];a[o[0]].push(o[1]),a[o[1]].push(o[0])}for(var s=0;e>s;++s)i(a[s],function(t,e){return t-e});return a}e.exports=n;var i=t("uniq")},{uniq:234}],280:[function(t,e,r){"use strict";function n(t,e){function r(t,e){var r=c[e][t[e]];r.splice(r.indexOf(t),1)}function n(t,n,o){for(var a,s,l,u=0;2>u;++u)if(c[u][n].length>0){a=c[u][n][0],l=u;break}s=a[1^l];for(var h=0;2>h;++h)for(var f=c[h][n],d=0;d<f.length;++d){var p=f[d],g=p[1^h],v=i(e[t],e[n],e[s],e[g]);v>0&&(a=p,s=g,l=h)}return o?s:(a&&r(a,l),s)}function o(t,o){var a=c[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(c[0][t].length+c[1][t].length===0)break;var u=s[s.length-1],h=t,f=s[1],d=n(u,h,!0);if(i(e[u],e[h],e[f],e[d])<0)break;s.push(t),l=n(u,h)}return s}function a(t,e){return e[1]===e[e.length-1]}for(var s=0|e.length,l=t.length,c=[new Array(s),new Array(s)],u=0;s>u;++u)c[0][u]=[],c[1][u]=[];for(var u=0;l>u;++u){var h=t[u];c[0][h[0]].push(h),c[1][h[1]].push(h)}for(var f=[],u=0;s>u;++u)c[0][u].length+c[1][u].length===0&&f.push([u]);for(var u=0;s>u;++u)for(var d=0;2>d;++d){for(var p=[];c[d][u].length>0;){var g=(c[0][u].length,o(u,d));a(p,g)?p.push.apply(p,g):(p.length>0&&f.push(p),p=g)}p.length>0&&f.push(p)}return f}e.exports=n;var i=t("compare-angle")},{"compare-angle":281}],281:[function(t,e,r){"use strict";function n(t,e,r){var n=s(t[0],-e[0]),i=s(t[1],-e[1]),o=s(r[0],-e[0]),a=s(r[1],-e[1]),u=c(l(n,o),l(i,a));return u[u.length-1]>=0}function i(t,e,r,i){var s=o(e,r,i);if(0===s){var l=a(o(t,e,r)),c=a(o(t,e,i));if(l===c){if(0===l){var u=n(t,e,r),h=n(t,e,i);return u===h?0:u?1:-1}return 0}return 0===c?l>0?-1:n(t,e,i)?-1:1:0===l?c>0?1:n(t,e,r)?1:-1:a(c-l)}var f=o(t,e,r);if(f>0)return s>0&&o(t,e,i)>0?1:-1;if(0>f)return s>0||o(t,e,i)>0?1:-1;var d=o(t,e,i);return d>0?1:n(t,e,r)?1:-1}e.exports=i;var o=t("robust-orientation"),a=t("signum"),s=t("two-sum"),l=t("robust-product"),c=t("robust-sum")},{"robust-orientation":214,"robust-product":282,"robust-sum":217,signum:283,"two-sum":232}],282:[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.length<e.length)for(var n=0;n<t.length;++n)r=i(r,o(e,t[n]));else for(var n=0;n<e.length;++n)r=i(r,o(t,e[n]));return r}var i=t("robust-sum"),o=t("robust-scale");e.exports=n},{"robust-scale":215,"robust-sum":217}],283:[function(t,e,r){"use strict";e.exports=function(t){return 0>t?-1:t>0?1:0}},{}],284:[function(t,e,r){arguments[4][20][0].apply(r,arguments)},{dup:20}],285:[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=p(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),b)}function l(t,e,r){for(var n=0;n<t.length&&t[n][0]<=e;++n){var i=r(t[n]);if(i)return i}}function c(t,e,r){for(var n=t.length-1;n>=0&&t[n][1]>=e;--n){var i=r(t[n]);if(i)return i}}function u(t,e){for(var r=0;r<t.length;++r){var n=e(t[r]);if(n)return n}}function h(t,e){return t-e}function f(t,e){var r=t[0]-e[0];return r?r:t[1]-e[1]}function d(t,e){var r=t[1]-e[1];return r?r:t[0]-e[0]}function p(t){if(0===t.length)return null;for(var e=[],r=0;r<t.length;++r)e.push(t[r][0],t[r][1]);e.sort(h);for(var i=e[e.length>>1],o=[],a=[],s=[],r=0;r<t.length;++r){var l=t[r];l[1]<i?o.push(l):i<l[0]?a.push(l):s.push(l)}var c=s,u=s.slice();return c.sort(f),u.sort(d),new n(i,p(o),p(a),c,u)}function g(t){this.root=t}function v(t){return new g(t&&0!==t.length?p(t):null)}var m=t("binary-search-bounds"),y=0,b=1,x=2;e.exports=v;var _=n.prototype;_.intervals=function(t){return t.push.apply(t,this.leftPoints),this.left&&this.left.intervals(t),this.right&&this.right.intervals(t),t},_.insert=function(t){var e=this.count-this.leftPoints.length;if(this.count+=1,t[1]<this.mid)this.left?4*(this.left.count+1)>3*(e+1)?a(this,t):this.left.insert(t):this.left=p([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=p([t]);else{var r=m.ge(this.leftPoints,t,f),n=m.ge(this.rightPoints,t,d);this.leftPoints.splice(r,0,t),this.rightPoints.splice(n,0,t)}},_.remove=function(t){var e=this.count-this.leftPoints;if(t[1]<this.mid){if(!this.left)return y;var r=this.right?this.right.count:0;if(4*r>3*(e-1))return s(this,t);var n=this.left.remove(t);return n===x?(this.left=null,this.count-=1,b):(n===b&&(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===x?(this.right=null,this.count-=1,b):(n===b&&(this.count-=1),n)}if(1===this.count)return this.leftPoints[0]===t?x: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 c=this.left,n=this.right;a.count-=l.count,a.right=l.left,l.left=c,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 b}for(var c=m.ge(this.leftPoints,t,f);c<this.leftPoints.length&&this.leftPoints[c][0]===t[0];++c)if(this.leftPoints[c]===t){this.count-=1,this.leftPoints.splice(c,1);for(var n=m.ge(this.rightPoints,t,d);n<this.rightPoints.length&&this.rightPoints[n][1]===t[1];++n)if(this.rightPoints[n]===t)return this.rightPoints.splice(n,1),b}return y},_.queryPoint=function(t,e){if(t<this.mid){if(this.left){var r=this.left.queryPoint(t,e);if(r)return r}return l(this.leftPoints,t,e)}if(t>this.mid){if(this.right){var r=this.right.queryPoint(t,e);if(r)return r}return c(this.rightPoints,t,e)}return u(this.leftPoints,e)},_.queryInterval=function(t,e,r){if(t<this.mid&&this.left){var n=this.left.queryInterval(t,e,r);if(n)return n}if(e>this.mid&&this.right){var n=this.right.queryInterval(t,e,r);if(n)return n}return e<this.mid?l(this.leftPoints,e,r):t>this.mid?c(this.rightPoints,t,r):u(this.leftPoints,r)};var w=g.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===x&&(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":284}],286:[function(t,e,r){"use strict";function n(t,e){var r,n;if(e[0][0]<e[1][0])r=e[0],n=e[1];else{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 c,u;t[0][1]<t[1][1]?(c=t[0],u=t[1]):(c=t[1],u=t[0]);var h=o(n,r,c);return h?h:(h=o(n,r,u),h?h:u-n)}function i(t,e){var r,i;if(e[0][0]<e[1][0])r=e[0],i=e[1];else{if(!(e[0][0]>e[1][0]))return n(e,t);r=e[1],i=e[0]}var a,s;if(t[0][0]<t[1][0])a=t[0],s=t[1];else{if(!(t[0][0]>t[1][0]))return-n(t,e);a=t[1],s=t[0]}var l=o(r,i,s),c=o(r,i,a);if(0>l){if(0>=c)return l}else if(l>0){if(c>=0)return l}else if(c)return c;if(l=o(s,a,i),c=o(s,a,r),0>l){if(0>=c)return l}else if(l>0){if(c>=0)return l}else if(c)return c;return i[0]-s[0]}e.exports=i;var o=t("robust-orientation")},{"robust-orientation":214}],287:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){this._color=t,this.key=e,this.value=r,this.left=n,this.right=i,this._count=o}function i(t){return new n(t._color,t.key,t.value,t.left,t.right,t._count)}function o(t,e){return new n(t,e.key,e.value,e.left,e.right,e._count)}function a(t){t._count=1+(t.left?t.left._count:0)+(t.right?t.right._count:0)}function s(t,e){this._compare=t,this.root=e}function l(t,e){if(e.left){var r=l(t,e.left);if(r)return r}var r=t(e.key,e.value);return r?r:e.right?l(t,e.right):void 0}function c(t,e,r,n){var i=e(t,n.key);if(0>=i){if(n.left){var o=c(t,e,r,n.left);if(o)return o}var o=r(n.key,n.value);if(o)return o}return n.right?c(t,e,r,n.right):void 0}function u(t,e,r,n,i){var o,a=r(t,i.key),s=r(e,i.key);if(0>=a){if(i.left&&(o=u(t,e,r,n,i.left)))return o;if(s>0&&(o=n(i.key,i.value)))return o}return s>0&&i.right?u(t,e,r,n,i.right):void 0}function h(t,e){this.tree=t,this._stack=e}function f(t,e){t.key=e.key,t.value=e.value,t.left=e.left,t.right=e.right,t._color=e._color,t._count=e._count}function d(t){for(var e,r,n,s,l=t.length-1;l>=0;--l){if(e=t[l],0===l)return void(e._color=m);if(r=t[l-1],r.left===e){if(n=r.right,n.right&&n.right._color===v){if(n=r.right=i(n),s=n.right=i(n.right),r.right=n.left,n.left=r,n.right=s,n._color=r._color,e._color=m,r._color=m,s._color=m,a(r),a(n),l>1){var c=t[l-2];c.left===r?c.left=n:c.right=n}return void(t[l-1]=n)}if(n.left&&n.left._color===v){if(n=r.right=i(n),s=n.left=i(n.left),r.right=s.left,n.left=s.right,s.left=r,s.right=n,s._color=r._color,r._color=m,n._color=m,e._color=m,a(r),a(n),a(s),l>1){var c=t[l-2];c.left===r?c.left=s:c.right=s}return void(t[l-1]=s)}if(n._color===m){if(r._color===v)return r._color=m,void(r.right=o(v,n));r.right=o(v,n);continue}if(n=i(n),r.right=n.left,n.left=r,n._color=r._color,r._color=v,a(r),a(n),l>1){var c=t[l-2];c.left===r?c.left=n:c.right=n}t[l-1]=n,t[l]=r,l+1<t.length?t[l+1]=e:t.push(e),l+=2}else{if(n=r.left,n.left&&n.left._color===v){if(n=r.left=i(n),s=n.left=i(n.left),r.left=n.right,n.right=r,n.left=s,n._color=r._color,e._color=m,r._color=m,s._color=m,a(r),a(n),l>1){var c=t[l-2];c.right===r?c.right=n:c.left=n}return void(t[l-1]=n)}if(n.right&&n.right._color===v){if(n=r.left=i(n),s=n.right=i(n.right),r.left=s.right,n.right=s.left,s.right=r,s.left=n,s._color=r._color,r._color=m,n._color=m,e._color=m,a(r),a(n),a(s),l>1){var c=t[l-2];c.right===r?c.right=s:c.left=s}return void(t[l-1]=s)}if(n._color===m){if(r._color===v)return r._color=m,void(r.left=o(v,n));r.left=o(v,n);continue}if(n=i(n),r.left=n.right,n.right=r,n._color=r._color,r._color=v,a(r),a(n),l>1){var c=t[l-2];c.right===r?c.right=n:c.left=n}t[l-1]=n,t[l]=r,l+1<t.length?t[l+1]=e:t.push(e),l+=2}}}function p(t,e){return e>t?-1:t>e?1:0}function g(t){return new s(t||p,null)}e.exports=g;var v=0,m=1,y=s.prototype;Object.defineProperty(y,"keys",{get:function(){var t=[];return this.forEach(function(e,r){t.push(e)}),t}}),Object.defineProperty(y,"values",{get:function(){var t=[];return this.forEach(function(e,r){t.push(r)}),t}}),Object.defineProperty(y,"length",{get:function(){return this.root?this.root._count:0}}),y.insert=function(t,e){for(var r=this._compare,i=this.root,l=[],c=[];i;){var u=r(t,i.key);l.push(i),c.push(u),i=0>=u?i.left:i.right}l.push(new n(v,t,e,null,null,1));for(var h=l.length-2;h>=0;--h){var i=l[h];c[h]<=0?l[h]=new n(i._color,i.key,i.value,l[h+1],i.right,i._count+1):l[h]=new n(i._color,i.key,i.value,i.left,l[h+1],i._count+1)}for(var h=l.length-1;h>1;--h){var f=l[h-1],i=l[h];if(f._color===m||i._color===m)break;var d=l[h-2];if(d.left===f)if(f.left===i){var p=d.right;if(!p||p._color!==v){if(d._color=v,d.left=f.right,f._color=m,f.right=d,l[h-2]=f,l[h-1]=i,a(d),a(f),h>=3){var g=l[h-3];g.left===d?g.left=f:g.right=f}break}f._color=m,d.right=o(m,p),d._color=v,h-=1}else{var p=d.right;if(!p||p._color!==v){if(f.right=i.left,d._color=v,d.left=i.right,i._color=m,i.left=f,i.right=d,l[h-2]=i,l[h-1]=f,a(d),a(f),a(i),h>=3){var g=l[h-3];g.left===d?g.left=i:g.right=i}break}f._color=m,d.right=o(m,p),d._color=v,h-=1}else if(f.right===i){var p=d.left;if(!p||p._color!==v){if(d._color=v,d.right=f.left,f._color=m,f.left=d,l[h-2]=f,l[h-1]=i,a(d),a(f),h>=3){var g=l[h-3];g.right===d?g.right=f:g.left=f}break}f._color=m,d.left=o(m,p),d._color=v,h-=1}else{var p=d.left;if(!p||p._color!==v){if(f.left=i.right,d._color=v,d.right=i.left,i._color=m,i.right=f,i.left=d,l[h-2]=i,l[h-1]=f,a(d),a(f),a(i),h>=3){var g=l[h-3];g.right===d?g.right=i:g.left=i}break}f._color=m,d.left=o(m,p),d._color=v,h-=1}}return l[0]._color=m,new s(r,l[0])},y.forEach=function(t,e,r){if(this.root)switch(arguments.length){case 1:return l(t,this.root);case 2:return c(e,this._compare,t,this.root);case 3:if(this._compare(e,r)>=0)return;return u(e,r,this._compare,t,this.root)}},Object.defineProperty(y,"begin",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.left;return new h(this,t)}}),Object.defineProperty(y,"end",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.right;return new h(this,t)}}),y.at=function(t){if(0>t)return new h(this,[]);for(var e=this.root,r=[];;){if(r.push(e),e.left){if(t<e.left._count){e=e.left;continue}t-=e.left._count}if(!t)return new h(this,r);if(t-=1,!e.right)break;if(t>=e.right._count)break;e=e.right}return new h(this,[])},y.ge=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var o=e(t,r.key);n.push(r),0>=o&&(i=n.length),r=0>=o?r.left:r.right}return n.length=i,new h(this,n)},y.gt=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var o=e(t,r.key);n.push(r),0>o&&(i=n.length),r=0>o?r.left:r.right}return n.length=i,new h(this,n)},y.lt=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var o=e(t,r.key);n.push(r),o>0&&(i=n.length),r=0>=o?r.left:r.right}return n.length=i,new h(this,n)},y.le=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var o=e(t,r.key);n.push(r),o>=0&&(i=n.length),r=0>o?r.left:r.right}return n.length=i,new h(this,n)},y.find=function(t){for(var e=this._compare,r=this.root,n=[];r;){var i=e(t,r.key);if(n.push(r),0===i)return new h(this,n);r=0>=i?r.left:r.right}return new h(this,[])},y.remove=function(t){var e=this.find(t);return e?e.remove():this},y.get=function(t){for(var e=this._compare,r=this.root;r;){var n=e(t,r.key);if(0===n)return r.value;r=0>=n?r.left:r.right}};var b=h.prototype;Object.defineProperty(b,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(b,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),b.clone=function(){return new h(this.tree,this._stack.slice())},b.remove=function(){var t=this._stack;if(0===t.length)return this.tree;var e=new Array(t.length),r=t[t.length-1];e[e.length-1]=new n(r._color,r.key,r.value,r.left,r.right,r._count);for(var i=t.length-2;i>=0;--i){var r=t[i];r.left===t[i+1]?e[i]=new n(r._color,r.key,r.value,e[i+1],r.right,r._count):e[i]=new n(r._color,r.key,r.value,r.left,e[i+1],r._count)}if(r=e[e.length-1],r.left&&r.right){var o=e.length;for(r=r.left;r.right;)e.push(r),r=r.right;var a=e[o-1];e.push(new n(r._color,a.key,a.value,r.left,r.right,r._count)),e[o-1].key=r.key,e[o-1].value=r.value;for(var i=e.length-2;i>=o;--i)r=e[i],e[i]=new n(r._color,r.key,r.value,r.left,e[i+1],r._count);e[o-1].left=e[o]}if(r=e[e.length-1],r._color===v){var l=e[e.length-2];l.left===r?l.left=null:l.right===r&&(l.right=null),e.pop();for(var i=0;i<e.length;++i)e[i]._count--;return new s(this.tree._compare,e[0])}if(r.left||r.right){r.left?f(r,r.left):r.right&&f(r,r.right),r._color=m;for(var i=0;i<e.length-1;++i)e[i]._count--;return new s(this.tree._compare,e[0])}if(1===e.length)return new s(this.tree._compare,null);for(var i=0;i<e.length;++i)e[i]._count--;var c=e[e.length-2];return d(e),c.left===r?c.left=null:c.right=null,new s(this.tree._compare,e[0])},Object.defineProperty(b,"key",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1].key:void 0},enumerable:!0}),Object.defineProperty(b,"value",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1].value:void 0},enumerable:!0}),Object.defineProperty(b,"index",{get:function(){var t=0,e=this._stack;if(0===e.length){var r=this.tree.root;return r?r._count:0}e[e.length-1].left&&(t=e[e.length-1].left._count);for(var n=e.length-2;n>=0;--n)e[n+1]===e[n].right&&(++t,e[n].left&&(t+=e[n].left._count));return t},enumerable:!0}),b.next=function(){var t=this._stack;if(0!==t.length){var e=t[t.length-1];if(e.right)for(e=e.right;e;)t.push(e),e=e.left;else for(t.pop();t.length>0&&t[t.length-1].right===e;)e=t[t.length-1],t.pop()}},Object.defineProperty(b,"hasNext",{get:function(){var t=this._stack;if(0===t.length)return!1;if(t[t.length-1].right)return!0;for(var e=t.length-1;e>0;--e)if(t[e-1].left===t[e])return!0;return!1}}),b.update=function(t){var e=this._stack;if(0===e.length)throw new Error("Can't update empty node!");var r=new Array(e.length),i=e[e.length-1];r[r.length-1]=new n(i._color,i.key,t,i.left,i.right,i._count);for(var o=e.length-2;o>=0;--o)i=e[o],i.left===e[o+1]?r[o]=new n(i._color,i.key,i.value,r[o+1],i.right,i._count):r[o]=new n(i._color,i.key,i.value,i.left,r[o+1],i._count);return new s(this.tree._compare,r[0])},b.prev=function(){var t=this._stack;if(0!==t.length){var e=t[t.length-1];if(e.left)for(e=e.left;e;)t.push(e),e=e.right;else for(t.pop();t.length>0&&t[t.length-1].left===e;)e=t[t.length-1],t.pop()}},Object.defineProperty(b,"hasPrev",{get:function(){var t=this._stack;if(0===t.length)return!1;if(t[t.length-1].left)return!0;for(var e=t.length-1;e>0;--e)if(t[e-1].right===t[e])return!0;return!1}})},{}],288:[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]<a[1][0]?(n=a[0],i=a[1]):(n=a[1],i=a[0]);var s=h(n,i,e);if(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],c=l[0][0]<l[1][0];i[2*o]=new s(l[0][0],l,c,o),i[2*o+1]=new s(l[1][0],l,!c,o)}i.sort(function(t,e){var r=t.x-e.x;return r?r:(r=t.create-e.create,r?r:Math.min(t.segment[0][1],t.segment[1][1])-Math.min(e.segment[0][1],e.segment[1][1]))});for(var h=u(f),d=[],p=[],g=[],o=0;r>o;){for(var v=i[o].x,m=[];r>o;){var y=i[o];if(y.x!==v)break;o+=1,y.segment[0][0]===y.x&&y.segment[1][0]===y.x?y.create&&(y.segment[0][1]<y.segment[1][1]?(m.push(new a(y.segment[0][1],y.index,!0,!0)),m.push(new a(y.segment[1][1],y.index,!1,!1))):(m.push(new a(y.segment[1][1],y.index,!0,!1)),m.push(new a(y.segment[0][1],y.index,!1,!0)))):h=y.create?h.insert(y.segment,y.index):h.remove(y.segment)}d.push(h.root),p.push(v),g.push(m)}return new n(d,p,g)}e.exports=l;var c=t("binary-search-bounds"),u=t("functional-red-black-tree"),h=t("robust-orientation"),f=t("./lib/order-segments"),d=n.prototype;d.castUp=function(t){var e=c.le(this.coordinates,t[0]);if(0>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 u=c.ge(l,t[1],i);if(u<l.length){var d=l[u];if(t[1]===d.y){if(d.closed)return d.index;for(;u<l.length-1&&l[u+1].y===t[1];)if(u+=1,d=l[u],d.closed)return d.index;if(d.y===t[1]&&!d.start){if(u+=1,u>=l.length)return n;d=l[u]}}if(d.start)if(a){var p=h(a[0],a[1],[t[0],d.y]);a[0][0]>a[1][0]&&(p=-p),p>0&&(n=d.index)}else n=d.index;else d.y!==t[1]&&(n=d.index)}}}return n}},{"./lib/order-segments":286,"binary-search-bounds":284,"functional-red-black-tree":287,"robust-orientation":214}],289:[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;r<t.length;++r){var n=t[r],o=n[0][0],a=n[0][1],s=n[1][1],l=[Math.min(a,s),Math.max(a,s)];o in e?e[o].push(l):e[o]=[l]}for(var c={},u=Object.keys(e),r=0;r<u.length;++r){var h=e[u[r]];c[u[r]]=d(h)}return i(c)}function a(t,e){return function(r){var n=p.le(e,r[0]);if(0>n)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]<a[1][0])if(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 c(t,e){return function(r){return t(r[0],r[1])?0:e(r)}}function u(t){for(var e=t.length,r=[],n=[],i=0;e>i;++i)for(var u=t[i],h=u.length,d=h-1,p=0;h>p;d=p++){var g=u[d],v=u[p];g[0]===v[0]?n.push([g,v]):r.push([g,v])}if(0===r.length)return 0===n.length?s:l(o(n));var m=f(r),y=a(m.slabs,m.coordinates);return 0===n.length?y:c(o(n),y)}e.exports=u;var h=t("robust-orientation")[3],f=t("slab-decomposition"),d=t("interval-tree-1d"),p=t("binary-search-bounds")},{"binary-search-bounds":284,"interval-tree-1d":285,"robust-orientation":214,"slab-decomposition":288}],290:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t),n=0;t>n;++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=c(-o[0],o[1]),l=c(-o[0],a[1]),h=c(a[0],o[1]),f=c(a[0],a[1]);n=u(n,u(u(s,l),u(h,f)))}return n[n.length-1]>0}function o(t){for(var e=t.length,r=0;e>r;++r)if(!I[t[r]])return!1;return!0}var d=f(t,e);t=d[0],e=d[1];for(var p=e.length,g=(t.length,a(t,e.length)),v=0;p>v;++v)if(g[v].length%2===1)throw new Error("planar-graph-to-polyline: graph must be manifold");var m=s(t,e);m=m.filter(r);for(var y=m.length,b=new Array(y),x=new Array(y),v=0;y>v;++v){b[v]=v;var _=new Array(y),w=m[v].map(function(t){return e[t]}),k=l([w]),A=0;t:for(var M=0;y>M;++M)if(_[M]=0,v!==M){for(var T=m[M],E=T.length,L=0;E>L;++L){var S=k(e[T[L]]);if(0!==S){0>S&&(_[M]=1,A+=1);continue t}}_[M]=1,A+=1}x[v]=[A,v,_]}x.sort(function(t,e){return e[0]-t[0]});for(var v=0;y>v;++v)for(var _=x[v],C=_[1],z=_[2],M=0;y>M;++M)z[M]&&(b[M]=C);for(var j=i(y),v=0;y>v;++v)j[v].push(b[v]),j[b[v]].push(v);for(var P={},I=n(p,!1),v=0;y>v;++v)for(var T=m[v],E=T.length,M=0;E>M;++M){var R=T[M],O=T[(M+1)%E],N=Math.min(R,O)+":"+Math.max(R,O);if(N in P){var D=P[N];j[D].push(v),j[v].push(D),I[R]=I[O]=!0}else P[N]=v}for(var F=[],B=n(y,-1),v=0;y>v;++v)b[v]!==v||o(m[v])?B[v]=-1:(F.push(v),B[v]=0);for(var d=[];F.length>0;){var U=F.pop(),V=j[U];h(V,function(t,e){return t-e});var q,H=V.length,G=B[U];if(0===G){var T=m[U];q=[T]}for(var v=0;H>v;++v){var Y=V[v];if(!(B[Y]>=0)&&(B[Y]=1^G,F.push(Y),0===G)){var T=m[Y];o(T)||(T.reverse(),q.push(T))}}0===G&&d.push(q)}return d}e.exports=o;var a=t("edges-to-adjacency-list"),s=t("planar-dual"),l=t("point-in-big-polygon"),c=t("two-product"),u=t("robust-sum"),h=t("uniq"),f=t("./lib/trim-leaves")},{"./lib/trim-leaves":278,"edges-to-adjacency-list":279,"planar-dual":280,"point-in-big-polygon":289,"robust-sum":217,"two-product":231,uniq:234}],291:[function(t,e,r){arguments[4][49][0].apply(r,arguments)},{dup:49}],292:[function(t,e,r){"use strict";"use restrict";function n(t){this.roots=new Array(t),this.ranks=new Array(t);for(var e=0;t>e;++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])}}},{}],293:[function(t,e,r){arguments[4][194][0].apply(r,arguments)},{"bit-twiddle":291,dup:194,"union-find":292}],294:[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(x[t])return 1/0;var r=m[t],i=y[t];return 0>r||0>i?1/0:n(e[t],e[r],e[i])}function o(t,e){var r=M[t],n=M[e];M[t]=n,M[e]=r,T[r]=e,T[n]=t}function s(t){return b[M[t]]}function l(t){return 1&t?t-1>>1:(t>>1)-1}function c(t){for(var e=s(t);;){var r=e,n=2*t+1,i=2*(t+1),a=t;if(L>n){var l=s(n);r>l&&(a=n,r=l)}if(L>i){var c=s(i);r>c&&(a=i)}if(a===t)return t;o(t,a),t=a}}function u(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(L>0){var t=M[0];return o(0,L-1),L-=1,c(0),t}return-1}function f(t,e){var r=M[t];return b[r]===e?t:(b[r]=-(1/0),u(t),h(),b[r]=e,L+=1,u(L-1))}function d(t){if(!x[t]){x[t]=!0;var e=m[t],r=y[t];m[r]>=0&&(m[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 p(t,e){if(t[e]<0)return e;var r=e,n=e;do{var i=t[n];if(!x[n]||0>i||i===n)break;if(n=i,i=t[n],!x[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 g=e.length,v=t.length,m=new Array(g),y=new Array(g),b=new Array(g),x=new Array(g),_=0;g>_;++_)m[_]=y[_]=-1,b[_]=1/0,x[_]=!1;for(var _=0;v>_;++_){var w=t[_];if(2!==w.length)throw new Error("Input must be a graph");var k=w[1],A=w[0];-1!==y[A]?y[A]=-2:y[A]=k,-1!==m[k]?m[k]=-2:m[k]=A}for(var M=[],T=new Array(g),_=0;g>_;++_){var E=b[_]=i(_);1/0>E?(T[_]=M.length,M.push(_)):T[_]=-1}for(var L=M.length,_=L>>1;_>=0;--_)c(_);for(;;){var S=h();if(0>S||b[S]>r)break;d(S)}for(var C=[],_=0;g>_;++_)x[_]||(T[_]=C.length,C.push(e[_].slice()));var z=(C.length,[]);return t.forEach(function(t){var e=p(m,t[0]),r=p(y,t[1]);if(e>=0&&r>=0&&e!==r){var n=T[e],i=T[r];n!==i&&z.push([n,i])}}),a.unique(a.normalize(z)),{positions:C,edges:z}}e.exports=i;var o=t("robust-orientation"),a=t("simplicial-complex")},{"robust-orientation":214,"simplicial-complex":293}],295:[function(t,e,r){"use strict";e.exports=["",{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],296:[function(t,e,r){"use strict";var n=t("./arrow_paths"),i=t("../../plots/cartesian"),o=t("../../plots/font_attributes"),a=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:!0,text:{valType:"string",description:["Sets the text associated with this annotation.","Plotly uses a subset of HTML tags to do things like","newline (<br>), bold (<b></b>), italics (<i></i>),","hyperlinks (<a href='...'></a>). Tags <em>, <sup>, <sub>","<span> are also supported."].join(" ")},textangle:{valType:"angle",dflt:0,description:["Sets the angle at which the `text` is drawn","with respect to the horizontal."].join(" ")},font:a({},o,{}),opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center",description:["Sets the vertical alignment of the `text` with","respect to the set `x` and `y` position.","Has only an effect if `text` spans more two or more lines","(i.e. `text` contains one or more <br> HTML tags)."].join(" ")},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)",description:["Sets the color of the border enclosing the annotation `text`."].join(" ")},borderpad:{valType:"number",min:0,dflt:1,description:["Sets the padding (in px) between the `text`","and the enclosing border."].join(" ")},borderwidth:{valType:"number",min:0,dflt:1,description:["Sets the width (in px) of the border enclosing","the annotation `text`."].join(" ")},showarrow:{valType:"boolean",dflt:!0,description:["Determines whether or not the annotation is drawn with an arrow.","If *true*, `text` is placed near the arrow's tail.","If *false*, `text` lines up with the `x` and `y` provided."].join(" ")},arrowcolor:{valType:"color"},arrowhead:{valType:"integer",min:0,max:n.length,dflt:1},arrowsize:{valType:"number",min:.3,dflt:1},arrowwidth:{valType:"number",min:.1},ax:{valType:"number",dflt:-10,description:["Sets the x component of the arrow tail about the arrow head.","A positive (negative) component corresponds to an arrow pointing","from right to left (left to right)"].join(" ")},ay:{valType:"number",dflt:-30,description:["Sets the y component of the arrow tail about the arrow head.","A positive (negative) component corresponds to an arrow pointing","from bottom to top (top to bottom)"].join(" ")},xref:{valType:"enumerated",values:["paper",i.idRegex.x.toString()],description:["Sets the annotation's x coordinate axis.","If set to an x axis id (e.g. *x* or *x2*), the `x` position","refers to an x coordinate","If set to *paper*, the `x` position refers to the distance from","the left side of the plotting area in normalized coordinates","where 0 (1) corresponds to the left (right) side."].join(" ")},x:{valType:"number",description:["Sets the annotation's x position.","Note that dates and categories are converted to numbers."].join(" ")},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto",description:["Sets the annotation's horizontal position anchor","This anchor binds the `x` position to the *left*, *center*","or *right* of the annotation.","For example, if `x` is set to 1, `xref` to *paper* and","`xanchor` to *right* then the right-most portion of the","annotation lines up with the right-most edge of the","plotting area.","If *auto*, the anchor is equivalent to *center* for","data-referenced annotations","whereas for paper-referenced, the anchor picked corresponds","to the closest side."].join(" ")},yref:{valType:"enumerated",values:["paper",i.idRegex.y.toString()],description:["Sets the annotation's y coordinate axis.","If set to an y axis id (e.g. *y* or *y2*), the `y` position","refers to an y coordinate","If set to *paper*, the `y` position refers to the distance from","the bottom of the plotting area in normalized coordinates","where 0 (1) corresponds to the bottom (top)."].join(" ")},y:{valType:"number",description:["Sets the annotation's y position.","Note that dates and categories are converted to numbers."].join(" ")},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto",description:["Sets the annotation's vertical position anchor","This anchor binds the `y` position to the *top*, *middle*","or *bottom* of the annotation.","For example, if `y` is set to 1, `yref` to *paper* and","`yanchor` to *top* then the top-most portion of the","annotation lines up with the top-most edge of the","plotting area.","If *auto*, the anchor is equivalent to *middle* for","data-referenced annotations","whereas for paper-referenced, the anchor picked corresponds","to the closest side."].join(" ")},_deprecated:{ref:{valType:"string",description:["Obsolete. Set `xref` and `yref` separately instead."].join(" ")}}}},{"../../lib/extend":344,"../../plots/cartesian":371,"../../plots/font_attributes":374,"./arrow_paths":295}],297:[function(t,e,r){"use strict";function n(t,e){function r(e,r){return a.Lib.coerce(t,n,c.layoutAttributes,e,r)}var n={};r("opacity"),r("align"),r("bgcolor");var i=r("bordercolor"),o=a.Color.opacity(i);r("borderpad");var s=r("borderwidth"),l=r("showarrow");l&&(r("arrowcolor",o?n.bordercolor:a.Color.defaultLine),r("arrowhead"),r("arrowsize"),r("arrowwidth",2*(o&&s||1)),r("ax"),r("ay"),a.Lib.noneOrAll(t,n,["ax","ay"])),r("text",l?"&nbsp;":"new text"),r("textangle"),a.Lib.coerceFont(r,"font",e.font);for(var u=["x","y"],h=0;2>h;h++){var f=u[h],d={_fullLayout:e},p=a.Axes.coerceRef(t,n,d,f),g=.5;
if("paper"!==p){var v=a.Axes.getFromId(d,p);if(g=v.range[0]+g*(v.range[1]-v.range[0]),-1!==["date","category"].indexOf(v.type)&&"string"==typeof t[f]){var m;"date"===v.type?(m=a.Lib.dateTime2ms(t[f]),m!==!1&&(t[f]=m)):(v._categories||[]).length&&(m=v._categories.indexOf(t[f]),-1!==m&&(t[f]=m))}}r(f,g),l||r(f+"anchor")}return a.Lib.noneOrAll(t,n,["x","y"]),n}function i(t){var e=t._fullLayout;e.annotations.forEach(function(e){var r=a.Axes.getFromId(t,e.xref),n=a.Axes.getFromId(t,e.yref);if(r||n){var i=(e._xsize||0)/2,o=e._xshift||0,s=(e._ysize||0)/2,l=e._yshift||0,c=i-o,u=i+o,h=s-l,f=s+l;if(e.showarrow){var d=3*e.arrowsize*e.arrowwidth;c=Math.max(c,d),u=Math.max(u,d),h=Math.max(h,d),f=Math.max(f,d)}r&&r.autorange&&a.Axes.expand(r,[r.l2c(e.x)],{ppadplus:u,ppadminus:c}),n&&n.autorange&&a.Axes.expand(n,[n.l2c(e.y)],{ppadplus:f,ppadminus:h})}})}function o(t,e,r,n,i,o,a,s){var l=r-t,c=i-t,u=a-i,h=n-e,f=o-e,d=s-o,p=l*d-u*h;if(0===p)return null;var g=(c*d-u*f)/p,v=(c*h-l*f)/p;return 0>v||v>1||0>g||g>1?null:{x:t+l*g,y:e+h*g}}var a=t("../../plotly"),s=t("d3"),l=t("fast-isnumeric"),c=e.exports={};c.ARROWPATHS=t("./arrow_paths"),c.layoutAttributes=t("./attributes"),c.supplyLayoutDefaults=function(t,e){for(var r=t.annotations||[],i=e.annotations=[],o=0;o<r.length;o++)i.push(n(r[o]||{},e))},c.drawAll=function(t){var e=t._fullLayout;e._infolayer.selectAll(".annotation").remove();for(var r=0;r<e.annotations.length;r++)c.draw(t,r);return a.Plots.previousPromises(t)},c.add=function(t){var e=t._fullLayout.annotations.length;a.relayout(t,"annotations["+e+"]","add")},c.draw=function(t,e,r,i){function u(t){return t.call(a.Drawing.font,Y).attr({"text-anchor":{left:"start",right:"end"}[I.align]||"middle"}),a.util.convertToTspans(t,h),t}function h(){function r(t,e){return"auto"===e&&(e=1/3>t?"left":t>2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}X.selectAll("tspan.line").attr({y:0,x:0});var n=U.select(".annotation-math-group"),i=!n.empty(),l=a.Drawing.bBox((i?n:X).node()),u=l.width,h=l.height,f=Math.round(u+2*H),d=Math.round(h+2*H);I._w=u,I._h=h;var g=!1;if(["x","y"].forEach(function(e){var n,i=a.Axes.getFromId(t,I[e+"ref"]||e),o=(D+("x"===e?0:90))*Math.PI/180,s=f*Math.abs(Math.cos(o))+d*Math.abs(Math.sin(o)),l=I[e+"anchor"];if(i){if(!i.autorange&&(I[e]-i.range[0])*(I[e]-i.range[1])>0)return void(g=!0);N[e]=i._offset+i.l2p(I[e]),n=.5}else n=I[e],"y"===e&&(n=1-n),N[e]="x"===e?w.l+w.w*n:w.t+w.h*n;var c=0;c=I.showarrow?I["a"+e]:s*r(n,l),N[e]+=c,I["_"+e+"type"]=i&&i.type,I["_"+e+"size"]=s,I["_"+e+"shift"]=c}),g)return void U.remove();var v,m;I.showarrow&&(v=a.Lib.constrain(N.x-I.ax,1,p.width-1),m=a.Lib.constrain(N.y-I.ay,1,p.height-1)),N.x=a.Lib.constrain(N.x,1,p.width-1),N.y=a.Lib.constrain(N.y,1,p.height-1);var y=H-l.top,b=H-l.left;i?n.select("svg").attr({x:H-1,y:H}):(X.attr({x:b,y:y}),X.selectAll("tspan.line").attr({y:y,x:b})),G.call(a.Drawing.setRect,V/2,V/2,f-V,d-V),U.call(a.Drawing.setRect,Math.round(N.x-f/2),Math.round(N.y-d/2),f,d);var x="annotations["+e+"]",_=function(r,n){s.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var i=N.x+r,l=N.y+n,u=a.Lib.rotationXYMatrix(D,i,l),h=a.Lib.apply2DTransform(u),f=a.Lib.apply2DTransform2(u),d=G.attr("width")/2,p=G.attr("height")/2,g=[[i-d,l-p,i-d,l+p],[i-d,l+p,i+d,l+p],[i+d,l+p,i+d,l-p],[i+d,l-p,i-d,l-p]].map(f);if(!g.reduce(function(t,e){return t^!!o(v,m,v+1e6,m+1e6,e[0],e[1],e[2],e[3])},!1)){g.forEach(function(t){var e=o(i,l,v,m,t[0],t[1],t[2],t[3]);e&&(i=e.x,l=e.y)});var y=I.arrowwidth,b=I.arrowcolor,_=F.append("g").style({opacity:a.Color.opacity(b)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),k=_.append("path").attr("d","M"+i+","+l+"L"+v+","+m).style("stroke-width",y+"px").call(a.Color.stroke,a.Color.rgb(b));c.arrowhead(k,I.arrowhead,"end",I.arrowsize);var A=_.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(i-v)+","+(l-m),transform:"translate("+v+","+m+")"}).style("stroke-width",y+6+"px").call(a.Color.stroke,"rgba(0,0,0,0)").call(a.Color.fill,"rgba(0,0,0,0)");if(t._context.editable){var M,T,E;a.Fx.dragElement({element:A.node(),prepFn:function(){T=Number(U.attr("x")),E=Number(U.attr("y")),M={},R&&R.autorange&&(M[R._name+".autorange"]=!0),O&&O.autorange&&(M[O._name+".autorange"]=!0)},moveFn:function(t,e){_.attr("transform","translate("+t+","+e+")");var r=h(T,E),n=r[0]+t,i=r[1]+e;U.call(a.Drawing.setPosition,n,i),M[x+".x"]=R?I.x+t/R._m:(v+t-w.l)/w.w,M[x+".y"]=O?I.y+e/O._m:1-(m+e-w.t)/w.h,B.attr({transform:"rotate("+D+","+n+","+i+")"})},doneFn:function(e){if(e){a.relayout(t,M);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};I.showarrow&&_(0,0);var k=a.Lib.rotationXYMatrix(D,N.x,N.y),A=a.Lib.apply2DTransform(k);if(t._context.editable){var M,T,E;a.Fx.dragElement({element:U.node(),prepFn:function(){M=Number(U.attr("x")),T=Number(U.attr("y")),E={}},moveFn:function(t,e){U.call(a.Drawing.setPosition,M+t,T+e);var r="pointer";if(I.showarrow)E[x+".ax"]=I.ax+t,E[x+".ay"]=I.ay+e,_(t,e);else{if(R)E[x+".x"]=I.x+t/R._m;else{var n=I._xsize/w.w,i=I.x+I._xshift/w.w-n/2;E[x+".x"]=a.Fx.dragAlign(i+t/w.w,n,0,1,I.xanchor)}if(O)E[x+".y"]=I.y+e/O._m;else{var o=I._ysize/w.h,s=I.y-I._yshift/w.h-o/2;E[x+".y"]=a.Fx.dragAlign(s-e/w.h,o,0,1,I.yanchor)}R&&O||(r=a.Fx.dragCursors(R?.5:E[x+".x"],O?.5:E[x+".y"],I.xanchor,I.yanchor))}var l=A(M,T),c=l[0]+t,u=l[1]+e;U.call(a.Drawing.setPosition,c,u),B.attr({transform:"rotate("+D+","+c+","+u+")"}),a.Fx.setCursor(U,r)},doneFn:function(e){if(a.Fx.setCursor(U),e){a.relayout(t,E);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var f,d=t.layout,p=t._fullLayout;if(!l(e)||-1===e){if(!e&&Array.isArray(i))return d.annotations=i,c.supplyLayoutDefaults(d,p),void c.drawAll(t);if("remove"===i)return delete d.annotations,p.annotations=[],void c.drawAll(t);if(r&&"add"!==i){for(f=0;f<p.annotations.length;f++)c.draw(t,f,r,i);return}e=p.annotations.length,p.annotations.push({})}if(!r&&i){if("remove"===i){for(p._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove(),p.annotations.splice(e,1),d.annotations.splice(e,1),f=e;f<p.annotations.length;f++)p._infolayer.selectAll('.annotation[data-index="'+(f+1)+'"]').attr("data-index",String(f)),c.draw(t,f);return}if("add"===i||a.Lib.isPlainObject(i)){p.annotations.splice(e,0,{});var g=a.Lib.isPlainObject(i)?a.Lib.extendFlat({},i):{text:"New text"};for(d.annotations?d.annotations.splice(e,0,g):d.annotations=[g],f=p.annotations.length-1;f>e;f--)p._infolayer.selectAll('.annotation[data-index="'+(f-1)+'"]').attr("data-index",String(f)),c.draw(t,f)}}p._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var v=d.annotations[e],m=p.annotations[e];if(v){var y={xref:v.xref,yref:v.yref},b={};"string"==typeof r&&r?b[r]=i:a.Lib.isPlainObject(r)&&(b=r);var x=Object.keys(b);for(f=0;f<x.length;f++){var _=x[f];a.Lib.nestedProperty(v,_).set(b[_])}var w=p._size,k=["x","y"];for(f=0;2>f;f++){var A=k[f];if(void 0===b[A]&&void 0!==v[A]){var M=a.Axes.getFromId(t,a.Axes.coerceRef(y,{},t,A)),T=a.Axes.getFromId(t,a.Axes.coerceRef(v,{},t,A)),E=v[A],L=m["_"+A+"type"];if(void 0!==b[A+"ref"]){var S="auto"===v[A+"anchor"],C="x"===A?w.w:w.h,z=(m["_"+A+"size"]||0)/(2*C);if(M&&T)E=(E-M.range[0])/(M.range[1]-M.range[0]),E=T.range[0]+E*(T.range[1]-T.range[0]);else if(M){if(E=(E-M.range[0])/(M.range[1]-M.range[0]),E=M.domain[0]+E*(M.domain[1]-M.domain[0]),S){var j=E+z,P=E-z;2/3>E+P?E=P:E+j>4/3&&(E=j)}}else T&&(S&&(1/3>E?E+=z:E>2/3&&(E-=z)),E=(E-T.domain[0])/(T.domain[1]-T.domain[0]),E=T.range[0]+E*(T.range[1]-T.range[0]))}T&&T===M&&L&&("log"===L&&"log"!==T.type?E=Math.pow(10,E):"log"!==L&&"log"===T.type&&(E=E>0?Math.log(E)/Math.LN10:void 0)),v[A]=E}}var I=n(v,p);p.annotations[e]=I;var R=a.Axes.getFromId(t,I.xref),O=a.Axes.getFromId(t,I.yref),N={x:0,y:0},D=+I.textangle||0,F=p._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",I.opacity).on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:v,fullAnnotation:I})}),B=F.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),U=B.append("svg").call(a.Drawing.setPosition,0,0),V=I.borderwidth,q=I.borderpad,H=V+q,G=U.append("rect").attr("class","bg").style("stroke-width",V+"px").call(a.Color.stroke,I.bordercolor).call(a.Color.fill,I.bgcolor),Y=I.font,X=U.append("text").classed("annotation",!0).attr("data-unformatted",I.text).text(I.text);t._context.editable?X.call(a.util.makeEditable,U).call(u).on("edit",function(r){I.text=r,this.attr({"data-unformatted":I.text}),this.call(u);var n={};n["annotations["+e+"].text"]=I.text,R&&R.autorange&&(n[R._name+".autorange"]=!0),O&&O.autorange&&(n[O._name+".autorange"]=!0),a.relayout(t,n)}):X.call(u),B.attr({transform:"rotate("+D+","+N.x+","+N.y+")"}).call(a.Drawing.setPosition,N.x,N.y)}},c.arrowhead=function(t,e,r,n){l(n)||(n=1);var i=t.node(),o=c.ARROWPATHS[e||0];if(o){"string"==typeof r&&r||(r="end");var u,h,f,d,p=(a.Drawing.getPx(t,"stroke-width")||1)*n,g=t.style("stroke")||a.Color.defaultLine,v=t.style("stroke-opacity")||1,m=r.indexOf("start")>=0,y=r.indexOf("end")>=0,b=o.backoff*p;if("line"===i.nodeName){if(u={x:+t.attr("x1"),y:+t.attr("y1")},h={x:+t.attr("x2"),y:+t.attr("y2")},f=Math.atan2(u.y-h.y,u.x-h.x),d=f+Math.PI,b){var x=b*Math.cos(f),_=b*Math.sin(f);m&&(u.x-=x,u.y-=_,t.attr({x1:u.x,y1:u.y})),y&&(h.x+=x,h.y+=_,t.attr({x2:h.x,y2:h.y}))}}else if("path"===i.nodeName){var w=i.getTotalLength(),k="";if(m){var A=i.getPointAtLength(0),M=i.getPointAtLength(.1);f=Math.atan2(A.y-M.y,A.x-M.x),u=i.getPointAtLength(Math.min(b,w)),b&&(k="0px,"+b+"px,")}if(y){var T=i.getPointAtLength(w),E=i.getPointAtLength(w-.1);if(d=Math.atan2(T.y-E.y,T.x-E.x),h=i.getPointAtLength(Math.max(0,w-b)),b){var L=k?2*b:b;k+=w-L+"px,"+w+"px"}}else k&&(k+=w+"px");k&&t.style("stroke-dasharray",k)}var S=function(r,n){e>5&&(n=0),s.select(i.parentElement).append("path").attr({"class":t.attr("class"),d:o.path,transform:"translate("+r.x+","+r.y+")rotate("+180*n/Math.PI+")scale("+p+")"}).style({fill:g,opacity:v,"stroke-width":0})};m&&S(u,f),y&&S(h,d)}},c.calcAutorange=function(t){var e=t._fullLayout,r=e.annotations;if(r.length&&t._fullData.length){var n={};r.forEach(function(t){n[t.xref]=!0,n[t.yref]=!0});var o=a.Axes.list(t).filter(function(t){return t.autorange&&n[t._id]});if(o.length)return a.Lib.syncOrAsync([c.drawAll,i],t)}}},{"../../plotly":365,"./arrow_paths":295,"./attributes":296,d3:70,"fast-isnumeric":74}],298:[function(t,e,r){"use strict";r.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],r.defaultLine="#444",r.lightLine="#eee",r.background="#fff"},{}],299:[function(t,e,r){"use strict";function n(t){if(o(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var r=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!r)return t;var n=r[1].trim().split(/\s*[\s,]\s*/),i="a"===e.charAt(3)&&4===n.length;if(!i&&3!==n.length)return t;for(var a=0;a<n.length;a++){if(!n[a].length)return t;if(n[a]=Number(n[a]),!(n[a]>=0))return t;if(3===a)n[a]>1&&(n[a]=1);else if(n[a]>=1)return t}var s=Math.round(255*n[0])+", "+Math.round(255*n[1])+", "+Math.round(255*n[2]);return i?"rgba("+s+", "+n[3]+")":"rgb("+s+")"}var i=t("tinycolor2"),o=t("fast-isnumeric"),a=e.exports={},s=t("./attributes");a.defaults=s.defaults,a.defaultLine=s.defaultLine,a.lightLine=s.lightLine,a.background=s.background,a.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},a.rgb=function(t){return a.tinyRGB(i(t))},a.opacity=function(t){return t?i(t).getAlpha():0},a.addOpacity=function(t,e){var r=i(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},a.combine=function(t,e){var r=i(t).toRgb();if(1===r.a)return i(t).toRgbString();var n=i(e||a.background).toRgb(),o=1===n.a?n:{r:255*(1-n.a)+n.r*n.a,g:255*(1-n.a)+n.g*n.a,b:255*(1-n.a)+n.b*n.a},s={r:o.r*(1-r.a)+r.r*r.a,g:o.g*(1-r.a)+r.g*r.a,b:o.b*(1-r.a)+r.b*r.a};return i(s).toRgbString()},a.stroke=function(t,e){var r=i(e);t.style({stroke:a.tinyRGB(r),"stroke-opacity":r.getAlpha()})},a.fill=function(t,e){var r=i(e);t.style({fill:a.tinyRGB(r),"fill-opacity":r.getAlpha()})},a.clean=function(t){if(t&&"object"==typeof t){var e,r,i,o,s=Object.keys(t);for(e=0;e<s.length;e++)if(i=s[e],o=t[i],"color"===i.substr(i.length-5))if(Array.isArray(o))for(r=0;r<o.length;r++)o[r]=n(o[r]);else t[i]=n(o);else if("colorscale"===i.substr(i.length-10)&&Array.isArray(o))for(r=0;r<o.length;r++)Array.isArray(o[r])&&(o[r][1]=n(o[r][1]));else if(Array.isArray(o)){var l=o[0];if(!Array.isArray(l)&&l&&"object"==typeof l)for(r=0;r<o.length;r++)a.clean(o[r])}else o&&"object"==typeof o&&a.clean(o)}}},{"./attributes":298,"fast-isnumeric":74,tinycolor2:229}],300:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/layout_attributes"),i=t("../../plots/font_attributes"),o=t("../../lib/extend").extendFlat;e.exports={thicknessmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"pixels",description:["Determines whether this color bar's thickness","(i.e. the measure in the constant color direction)","is set in units of plot *fraction* or in *pixels*.","Use `thickness` to set the value."].join(" ")},thickness:{valType:"number",min:0,dflt:30,description:["Sets the thickness of the color bar","This measure excludes the size of the padding, ticks and labels."].join(" ")},lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction",description:["Determines whether this color bar's length","(i.e. the measure in the color variation direction)","is set in units of plot *fraction* or in *pixels.","Use `len` to set the value."].join(" ")},len:{valType:"number",min:0,dflt:1,description:["Sets the length of the color bar","This measure excludes the padding of both ends.","That is, the color bar length is this length minus the","padding on both ends."].join(" ")},x:{valType:"number",dflt:1.02,min:-2,max:3,description:["Sets the x position of the color bar (in plot fraction)."].join(" ")},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left",description:["Sets this color bar's horizontal position anchor.","This anchor binds the `x` position to the *left*, *center*","or *right* of the color bar."].join(" ")},xpad:{valType:"number",min:0,dflt:10},y:{valType:"number",dflt:.5,min:-2,max:3,description:["Sets the y position of the color bar (in plot fraction)."].join(" ")},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"middle",description:["Sets this color bar's vertical position anchor","This anchor binds the `y` position to the *top*, *middle*","or *bottom* of the color bar."].join(" ")},ypad:{valType:"number",min:0,dflt:10},outlinecolor:n.linecolor,outlinewidth:n.linewidth,bordercolor:n.linecolor,borderwidth:{valType:"number",min:0,dflt:0,description:["Sets the width (in px) or the border enclosing this color bar."].join(" ")},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},tickmode:n.tickmode,nticks:n.nticks,tick0:n.tick0,dtick:n.dtick,tickvals:n.tickvals,ticktext:n.ticktext,ticks:o({},n.ticks,{dflt:""}),ticklen:n.ticklen,tickwidth:n.tickwidth,tickcolor:n.tickcolor,showticklabels:n.showticklabels,tickfont:n.tickfont,tickangle:n.tickangle,tickformat:n.tickformat,tickprefix:n.tickprefix,showtickprefix:n.showtickprefix,ticksuffix:n.ticksuffix,showticksuffix:n.showticksuffix,exponentformat:n.exponentformat,showexponent:n.showexponent,title:{valType:"string",dflt:"Click to enter colorscale title"},titlefont:o({},i,{description:["Sets this color bar's title font."].join(" ")}),titleside:{valType:"enumerated",values:["right","top","bottom"],dflt:"top",description:["Determines the location of the colorbar title","with respect to the color bar."].join(" ")}}},{"../../lib/extend":344,"../../plots/cartesian/layout_attributes":372,"../../plots/font_attributes":374}],301:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes"),i=t("../../lib"),o=t("./attributes");e.exports=function(t,e,r){function a(t,e){return i.coerce(l,s,o,t,e)}var s=e.colorbar={},l=t.colorbar||{},c=a("thicknessmode");a("thickness","fraction"===c?30/(r.width-r.margin.l-r.margin.r):30);var u=a("lenmode");a("len","fraction"===u?1:r.height-r.margin.t-r.margin.b),a("x"),a("xanchor"),a("xpad"),a("y"),a("yanchor"),a("ypad"),i.noneOrAll(l,s,["x","y"]),a("outlinecolor"),a("outlinewidth"),a("bordercolor"),a("borderwidth"),a("bgcolor"),n.handleTickValueDefaults(l,s,a,"linear"),n.handleTickDefaults(l,s,a,"linear",{outerTicks:!1,font:r.font,noHover:!0}),a("title"),i.coerceFont(a,"titlefont",r.font),a("titleside")}},{"../../lib":348,"../../plots/cartesian/axes":368,"./attributes":300}],302:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../plotly"),o=t("./attributes");e.exports=function(t,e){function r(){function o(t,e){return i.Lib.coerce(R,O,i.Axes.layoutAttributes,t,e)}function s(){if(-1!==["top","bottom"].indexOf(a.titleside)){var e=V.select(".cbtitle"),r=e.select("text"),o=[-a.outlinewidth/2,a.outlinewidth/2],s=e.select(".h"+O._id+"title-math-group").node(),l=15.6;if(r.node()&&(l=1.3*parseInt(r.style("font-size"),10)),s?(H=i.Drawing.bBox(s).height,H>l&&(o[1]-=(H-l)/2)):r.node()&&!r.classed("js-placeholder")&&(H=i.Drawing.bBox(e.node()).height),H){if(H+=5,"top"===a.titleside)O.domain[1]-=H/c._size.h,o[1]*=-1;else{O.domain[0]+=H/c._size.h;var u=Math.max(1,r.selectAll("tspan.line").size());o[1]+=(1-u)*l}e.attr("transform","translate("+o+")"),O.setScale()}}V.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(c._size.h*(1-O.domain[1]))+")");var v=V.select(".cbfills").selectAll("rect.cbfill").data(d);v.enter().append("rect").classed("cbfill",!0).style("stroke","none"),v.exit().remove(),v.each(function(t,e){var r=[0===e?h[0]:(d[e]+d[e-1])/2,e===d.length-1?h[1]:(d[e]+d[e+1])/2].map(O.c2p).map(Math.round);e!==d.length-1&&(r[1]+=r[1]>r[0]?1:-1),n.select(this).attr({x:C,width:Math.max(k,2),y:n.min(r),height:Math.max(n.max(r)-n.min(r),2)}).style("fill",g(t))});var m=V.select(".cblines").selectAll("path.cbline").data(a.line.color&&a.line.width?f:[]);return m.enter().append("path").classed("cbline",!0),m.exit().remove(),m.each(function(t){n.select(this).attr("d","M"+C+","+(Math.round(O.c2p(t))+a.line.width/2%1)+"h"+k).call(i.Drawing.lineGroupStyle,a.line.width,p(t),a.line.dash)}),O._axislayer.selectAll("g."+O._id+"tick,path").remove(),O._pos=C+k+(a.outlinewidth||0)/2-("outside"===a.ticks?1:0),O.side="right",i.Axes.doTicks(t,O)}function l(){var r=k+a.outlinewidth/2+i.Drawing.bBox(O._axislayer.node()).width;if(x=q.select("text"),x.node()&&!x.classed("js-placeholder")){var n,o=q.select(".h"+O._id+"title-math-group").node();n=o&&-1!==["top","bottom"].indexOf(a.titleside)?i.Drawing.bBox(o).width:i.Drawing.bBox(q.node()).right-C-c._size.l,r=Math.max(r,n)}var s=2*a.xpad+r+a.borderwidth+a.outlinewidth/2,l=P-I;V.select(".cbbg").attr({x:C-a.xpad-(a.borderwidth+a.outlinewidth)/2,y:I-L,width:Math.max(s,2),height:Math.max(l+2*L,2)}).call(i.Color.fill,a.bgcolor).call(i.Color.stroke,a.bordercolor).style({"stroke-width":a.borderwidth}),V.selectAll(".cboutline").attr({x:C,y:I+a.ypad+("top"===a.titleside?H:0),width:Math.max(k,2),height:Math.max(l-2*a.ypad-H,2)}).call(i.Color.stroke,a.outlinecolor).style({fill:"None","stroke-width":a.outlinewidth});var u=({center:.5,right:1}[a.xanchor]||0)*s;V.attr("transform","translate("+(c._size.l-u)+","+c._size.t+")"),i.Plots.autoMargin(t,e,{x:a.x,y:a.y,l:s*({right:1,center:.5}[a.xanchor]||0),r:s*({left:1,center:.5}[a.xanchor]||0),t:l*({bottom:1,middle:.5}[a.yanchor]||0),b:l*({top:1,middle:.5}[a.yanchor]||0)})}var c=t._fullLayout;if("function"!=typeof a.fillcolor&&"function"!=typeof a.line.color)return void c._infolayer.selectAll("g."+e).remove();var u,h=n.extent(("function"==typeof a.fillcolor?a.fillcolor:a.line.color).domain()),f=[],d=[],p="function"==typeof a.line.color?a.line.color:function(){return a.line.color},g="function"==typeof a.fillcolor?a.fillcolor:function(){return a.fillcolor},v=a.levels.end+a.levels.size/100,m=a.levels.size,y=1.001*h[0]-.001*h[1],b=1.001*h[1]-.001*h[0];for(u=a.levels.start;0>(u-v)*m;u+=m)u>y&&b>u&&f.push(u);if("function"==typeof a.fillcolor)if(a.filllevels)for(v=a.filllevels.end+a.filllevels.size/100,m=a.filllevels.size,u=a.filllevels.start;0>(u-v)*m;u+=m)u>h[0]&&u<h[1]&&d.push(u);else d=f.map(function(t){return t-a.levels.size/2}),d.push(d[d.length-1]+a.levels.size);else a.fillcolor&&"string"==typeof a.fillcolor&&(d=[0]);a.levels.size<0&&(f.reverse(),d.reverse());var x,_=c.height-c.margin.t-c.margin.b,w=c.width-c.margin.l-c.margin.r,k=Math.round(a.thickness*("fraction"===a.thicknessmode?w:1)),A=k/c._size.w,M=Math.round(a.len*("fraction"===a.lenmode?_:1)),T=M/c._size.h,E=a.xpad/c._size.w,L=(a.borderwidth+a.outlinewidth)/2,S=a.ypad/c._size.h,C=Math.round(a.x*c._size.w+a.xpad),z=a.x-A*({middle:.5,right:1}[a.xanchor]||0),j=a.y+T*(({top:-.5,bottom:.5}[a.yanchor]||0)-.5),P=Math.round(c._size.h*(1-j)),I=P-M,R={type:"linear",range:h,tickmode:a.tickmode,nticks:a.nticks,tick0:a.tick0,dtick:a.dtick,tickvals:a.tickvals,ticktext:a.ticktext,ticks:a.ticks,ticklen:a.ticklen,tickwidth:a.tickwidth,tickcolor:a.tickcolor,showticklabels:a.showticklabels,tickfont:a.tickfont,tickangle:a.tickangle,tickformat:a.tickformat,exponentformat:a.exponentformat,showexponent:a.showexponent,showtickprefix:a.showtickprefix,tickprefix:a.tickprefix,showticksuffix:a.showticksuffix,ticksuffix:a.ticksuffix,title:a.title,titlefont:a.titlefont,anchor:"free",position:1},O={},N={letter:"y",font:c.font,noHover:!0};if(i.Axes.handleAxisDefaults(R,O,o,N),i.Axes.handleAxisPositioningDefaults(R,O,o,N),O._id="y"+e,O._td=t,O.position=a.x+E+A,r.axis=O,-1!==["top","bottom"].indexOf(a.titleside)&&(O.titleside=a.titleside,O.titlex=a.x+E,O.titley=j+("top"===a.titleside?T-S:S)),a.line.color&&"auto"===a.tickmode){O.tickmode="linear",O.tick0=a.levels.start;var D=a.levels.size,F=i.Lib.constrain((P-I)/50,4,15)+1,B=(h[1]-h[0])/((a.nticks||F)*D);if(B>1){var U=Math.pow(10,Math.floor(Math.log(B)/Math.LN10));D*=U*i.Lib.roundUp(B/U,[2,5,10]),(Math.abs(a.levels.start)/a.levels.size+1e-6)%1<2e-6&&(O.tick0=0)}O.dtick=D}O.domain=[j+S,j+T-S],O.setScale();var V=c._infolayer.selectAll("g."+e).data([0]);V.enter().append("g").classed(e,!0).each(function(){var t=n.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)}),V.attr("transform","translate("+Math.round(c._size.l)+","+Math.round(c._size.t)+")");var q=V.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(c._size.l)+",-"+Math.round(c._size.t)+")");O._axislayer=V.select(".cbaxis");var H=0;-1!==["top","bottom"].indexOf(a.titleside)&&i.Titles.draw(t,O._id+"title");var G=i.Lib.syncOrAsync([i.Plots.previousPromises,s,i.Plots.previousPromises,l],t);if(G&&G.then&&(t._promises||[]).push(G),t._context.editable){var Y,X,W;i.Fx.dragElement({element:V.node(),prepFn:function(){Y=V.attr("transform"),i.Fx.setCursor(V)},moveFn:function(e,r){var n=t._fullLayout._size;V.attr("transform",Y+" translate("+e+","+r+")"),X=i.Fx.dragAlign(z+e/n.w,A,0,1,a.xanchor),W=i.Fx.dragAlign(j-r/n.h,T,0,1,a.yanchor);var o=i.Fx.dragCursors(X,W,a.xanchor,a.yanchor);i.Fx.setCursor(V,o)},doneFn:function(r){if(i.Fx.setCursor(V),r&&void 0!==X&&void 0!==W){var n,o=e.substr(2);t._fullData.some(function(t){return t.uid===o?(n=t.index,!0):void 0}),i.restyle(t,{"colorbar.x":X,"colorbar.y":W},n)}}})}return G}var a={};return Object.keys(o).forEach(function(t){a[t]=null}),a.fillcolor=null,a.line={color:null,width:null,dash:null},a.levels={start:null,end:null,size:null},a.filllevels=null,Object.keys(a).forEach(function(t){r[t]=function(e){return arguments.length?(a[t]=i.Lib.isPlainObject(a[t])?i.Lib.extendFlat(a[t],e):e,r):a[t]}}),r.options=function(t){return Object.keys(t).forEach(function(e){"function"==typeof r[e]&&r[e](t[e])}),r},r._opts=a,r}},{"../../plotly":365,"./attributes":300,d3:70}],303:[function(t,e,r){"use strict";e.exports=function(t){return"object"==typeof t.colorbar&&null!==t.colorbar}},{}],304:[function(t,e,r){"use strict";r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.draw=t("./draw"),r.hasColorbar=t("./has_colorbar")},{"./attributes":300,"./defaults":301,"./draw":302,"./has_colorbar":303}],305:[function(t,e,r){"use strict";e.exports={zauto:{valType:"boolean",dflt:!0,description:["Determines the whether or not the color domain is computed","with respect to the input data."].join(" ")},zmin:{valType:"number",dflt:null},zmax:{valType:"number",dflt:null},colorscale:{valType:"colorscale",description:["Sets the colorscale.","The colorscale must be an array containing","arrays mapping a normalized value to an","rgb, rgba, hex, hsl, hsv, or named color string.","At minimum, a mapping for the lowest (0) and highest (1)","values are required. For example,","`[[0, 'rgb(0,0,255)', [1, 'rgb(255,0,0)']]`.","To control the bounds of the colorscale in z space,","use zmin and zmax"].join(" ")},autocolorscale:{valType:"boolean",dflt:!0,description:["Determines whether or not the colorscale is picked using the sign of","the input z values."].join(" ")},reversescale:{valType:"boolean",dflt:!1},showscale:{valType:"boolean",dflt:!0,description:["Determines whether or not a colorbar is displayed for this trace."].join(" ")},_deprecated:{scl:{valType:"colorscale"},reversescl:{valType:"boolean"}}}},{}],306:[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 c=s[a+"auto"],u=s[a+"min"],h=s[a+"max"],f=s.colorscale;(c!==!1||void 0===u)&&(u=n.aggNums(Math.min,null,e)),(c!==!1||void 0===h)&&(h=n.aggNums(Math.max,null,e)),u===h&&(u-=.5,h+=.5),s[a+"min"]=u,s[a+"max"]=h,l[a+"min"]=u,l[a+"max"]=h,s.autocolorscale&&(f=0>u*h?i.RdBu:u>=0?i.Reds:i.Blues,l.colorscale=f,s.reversescale&&(f=o(f)),s.colorscale=f)}},{"../../lib":348,"./flip_scale":309,"./scales":316}],307:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":316}],308:[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,c,u){var h=u.prefix,f=u.cLetter,d=h.slice(0,h.length-1),p=h?i.nestedProperty(t,d).get()||{}:t,g=h?i.nestedProperty(e,d).get()||{}:e,v=p[f+"min"],m=p[f+"max"],y=p.colorscale,b=n(v)&&n(m)&&m>v;c(h+f+"auto",!b),c(h+f+"min"),c(h+f+"max");var x;void 0!==y&&(x=!s(y)),c(h+"autocolorscale",x);var _=c(h+"colorscale"),w=c(h+"reversescale");if(w&&(g.colorscale=l(_)),"marker.line."!==h){var k;h&&(k=o(p));var A=c(h+"showscale",k);A&&a(p,g,r)}}},{"../../lib":348,"../colorbar/defaults":301,"../colorbar/has_colorbar":303,"./flip_scale":309,"./is_valid_scale":313,"fast-isnumeric":74}],309:[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}},{}],310:[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":307,"./is_valid_scale_array":314,"./scales":316}],311:[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;l<a.length;l++)if(n(a[l])){s=!0;break}return"object"==typeof r&&null!==r&&(s||r.showscale===!0||n(r.cmin)&&n(r.cmax)||o(r.colorscale)||"object"==typeof r.colorbar&&null!==r.colorbar)}},{"../../lib":348,"./is_valid_scale":313,"fast-isnumeric":74}],312:[function(t,e,r){"use strict";r.scales=t("./scales"),r.defaultScale=t("./default_scale"),r.attributes=t("./attributes"),r.handleDefaults=t("./defaults"),r.calc=t("./calc"),r.hasColorscale=t("./has_colorscale"),r.isValidScale=t("./is_valid_scale"),r.getScale=t("./get_scale"),r.flipScale=t("./flip_scale"),r.makeScaleFunction=t("./make_scale_function")},{"./attributes":305,"./calc":306,"./default_scale":307,"./defaults":308,"./flip_scale":309,"./get_scale":310,"./has_colorscale":311,"./is_valid_scale":313,"./make_scale_function":315,"./scales":316}],313:[function(t,e,r){"use strict";var n=t("./scales"),i=t("./is_valid_scale_array");e.exports=function(t){return void 0!==n[t]?!0:i(t)}},{"./is_valid_scale_array":314,"./scales":316}],314:[function(t,e,r){"use strict";var n=t("tinycolor2");e.exports=function(t){var e,r=!0,i=0;if(Array.isArray(t)){if(0!==+t[0][0]||1!==+t[t.length-1][0])return!1;for(var o=0;o<t.length;o++){if(e=t[o],2!==e.length||+e[0]<i||!n(e[1]).isValid()){r=!1;break}i=+e[0]}return r}return!1}},{tinycolor2:229}],315:[function(t,e,r){"use strict";var n=t("d3"),i=t("tinycolor2"),o=t("fast-isnumeric"),a=t("../color");e.exports=function(t,e,r){for(var s,l=t.length,c=new Array(l),u=new Array(l),h=0;l>h;h++)s=t[h],c[h]=e+s[0]*(r-e),u[h]=s[1];var f=n.scale.linear().domain(c).interpolate(n.interpolateRgb).range(u);return function(t){return o(t)?f(t):i(t).isValid()?t:a.defaultLine}}},{"../color":299,d3:70,"fast-isnumeric":74,tinycolor2:229}],316:[function(t,e,r){"use strict";e.exports={Greys:[[0,"rgb(0,0,0)"],[1,"rgb(255,255,255)"]],YIGnBu:[[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)"]],YIOrRd:[[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"]]}},{}],317:[function(t,e,r){"use strict";function n(t,e,r,n){var i=t[0]-e[0],a=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],c=Math.pow(i*i+a*a,v/2),u=Math.pow(s*s+l*l,v/2),h=(u*u*i-c*c*s)*n,f=(u*u*a-c*c*l)*n,d=3*u*(c+u),p=3*c*(c+u);return[[o.round(e[0]+(d&&h/d),2),o.round(e[1]+(d&&f/d),2)],[o.round(e[0]-(p&&h/p),2),o.round(e[1]-(p&&f/p),2)]]}var i=t("../../plotly"),o=t("d3"),a=t("fast-isnumeric"),s=t("../../constants/xmlns_namespaces"),l=t("../../traces/scatter/subtypes"),c=t("../../traces/scatter/make_bubble_size_func"),u=e.exports={};u.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(i.Color.fill,n)},u.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},u.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},u.setRect=function(t,e,r,n,i){t.call(u.setPosition,e,r).call(u.setSize,n,i)},u.translatePoints=function(t,e,r){t.each(function(t){var n=t.xp||e.c2p(t.x),i=t.yp||r.c2p(t.y),s=o.select(this);a(n)&&a(i)?"text"===this.nodeName?s.attr("x",n).attr("y",i):s.attr("transform","translate("+n+","+i+")"):s.remove()})},u.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},u.crispRound=function(t,e,r){return e&&a(e)?t._context.staticPlot?e:1>e?1:Math.round(e):r||0},u.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var a=(((t||[])[0]||{}).trace||{}).line||{},s=e||a.width||0,l=n||a.dash||"";o.select(this).call(i.Color.stroke,r||a.color).call(u.dashLine,l,s)})},u.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"})},u.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=o.select(this);try{r.call(i.Color.fill,e[0].trace.fillcolor)}catch(n){console.log(n,t),r.remove()}})};var h=t("./symbol_defs");u.symbolNames=[],u.symbolFuncs=[],u.symbolNeedLines={},u.symbolNoDot={},u.symbolList=[],Object.keys(h).forEach(function(t){var e=h[t];u.symbolList=u.symbolList.concat([e.n,t,e.n+100,t+"-open"]),u.symbolNames[e.n]=t,u.symbolFuncs[e.n]=e.f,e.needLine&&(u.symbolNeedLines[e.n]=!0),e.noDot?u.symbolNoDot[e.n]=!0:u.symbolList=u.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var f=u.symbolNames.length,d="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";u.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=u.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=f||t>=400?0:Math.floor(Math.max(t,0))},u.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=r.line;if(i.Plots.traceIs(e,"symbols")){var a=c(e);t.attr("d",function(t){var n;n="various"===t.ms||"various"===r.size?3:l.isBubble(e)?a(t.ms):(r.size||6)/2,t.mrc=n;var i=u.symbolNumber(t.mx||r.symbol)||0,o=i%100;return t.om=i%200>=100,u.symbolFuncs[o](n)+(i>=200?d:"")}).style("opacity",function(t){return(t.mo+1||r.opacity+1)-1})}var s=(e._input||{}).marker||{},h=u.tryColorscale(r,s,""),f=u.tryColorscale(r,s,"line.");t.each(function(t){var e,a,s;t.so?(s=n.outlierwidth,a=n.outliercolor,e=r.outliercolor):(s=(t.mlw+1||n.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,a="mlc"in t?t.mlcc=f(t.mlc):Array.isArray(n.color)?i.Color.defaultLine:n.color,e="mc"in t?t.mcc=h(t.mc):Array.isArray(r.color)?i.Color.defaultLine:r.color||"rgba(0,0,0,0)");var l=o.select(this);t.om?l.call(i.Color.stroke,e).style({"stroke-width":(s||1)+"px",fill:"none"}):(l.style("stroke-width",s+"px").call(i.Color.fill,e),s&&l.call(i.Color.stroke,a))})}},u.tryColorscale=function(t,e,r){var n=i.Lib.nestedProperty(t,r+"color").get(),o=i.Lib.nestedProperty(t,r+"colorscale").get(),s=i.Lib.nestedProperty(t,r+"cauto").get(),l=i.Lib.nestedProperty(t,r+"cmin"),c=i.Lib.nestedProperty(t,r+"cmax"),u=l.get(),h=c.get();return o&&Array.isArray(n)?(!s&&a(u)&&a(h)||(u=1/0,h=-(1/0),n.forEach(function(t){a(t)&&(u>t&&(u=+t),t>h&&(h=+t))}),u>h&&(u=0,h=1),l.set(u),c.set(h),i.Lib.nestedProperty(e,r+"cmin").set(u),i.Lib.nestedProperty(e,r+"cmax").set(h)),i.Colorscale.makeScaleFunction(o,u,h)):i.Lib.identity};var p={start:1,end:-1,middle:0,bottom:1,top:-1},g=1.3;u.textPointStyle=function(t,e){t.each(function(t){var r=o.select(this),n=t.tx||e.text;if(!n||Array.isArray(n))return void r.remove();var s=t.tp||e.textposition,l=-1!==s.indexOf("top")?"top":-1!==s.indexOf("bottom")?"bottom":"middle",c=-1!==s.indexOf("left")?"end":-1!==s.indexOf("right")?"start":"middle",h=t.ts||e.textfont.size,f=t.mrc?t.mrc/.8+1:0;h=a(h)&&h>0?h:0,r.call(u.font,t.tf||e.textfont.family,h,t.tc||e.textfont.color).attr("text-anchor",c).text(n).call(i.util.convertToTspans);var d=o.select(this.parentNode),v=r.selectAll("tspan.line"),m=((v[0].length||1)-1)*g+1,y=p[c]*f,b=.75*h+p[l]*f+(p[l]-1)*m*h/2;d.attr("transform","translate("+y+","+b+")"),m>1&&v.attr({x:r.attr("x"),y:r.attr("y")})})};var v=.5;u.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,i="M"+t[0],o=[];for(r=1;r<t.length-1;r++)o.push(n(t[r-1],t[r],t[r+1],e));for(i+="Q"+o[0][0]+" "+t[1],r=2;r<t.length-1;r++)i+="C"+o[r-2][1]+" "+o[r-1][0]+" "+t[r];return i+="Q"+o[t.length-3][1]+" "+t[t.length-1]},u.smoothclosed=function(t,e){if(t.length<3)return"M"+t.join("L")+"Z";var r,i="M"+t[0],o=t.length-1,a=[n(t[o],t[0],t[1],e)];for(r=1;o>r;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 m={hv:function(t,e){return"H"+o.round(e[0],2)+"V"+o.round(e[1],2)},vh:function(t,e){return"V"+o.round(e[1],2)+"H"+o.round(e[0],2)},hvh:function(t,e){return"H"+o.round((t[0]+e[0])/2,2)+"V"+o.round(e[1],2)+"H"+o.round(e[0],2)},vhv:function(t,e){return"V"+o.round((t[1]+e[1])/2,2)+"H"+o.round(e[0],2)+"V"+o.round(e[1],2)}},y=function(t,e){return"L"+o.round(e[0],2)+","+o.round(e[1],2)};u.steps=function(t){var e=m[t]||y;return function(t){for(var r="M"+o.round(t[0][0],2)+","+o.round(t[0][1],2),n=1;n<t.length;n++)r+=e(t[n-1],t[n]);return r}},u.makeTester=function(t){var e=o.select("body").selectAll("#js-plotly-tester").data([0]);e.enter().append("svg").attr("id","js-plotly-tester").attr(s.svgAttrs).style({position:"absolute",left:"-10000px",top:"-10000px",width:"9000px",height:"9000px"});var r=e.selectAll(".js-reference-point").data([0]);r.enter().append("path").classed("js-reference-point",!0).attr("d","M0,0H1V1H0Z").style({"stroke-width":0,fill:"black"}),e.node()._cache||(e.node()._cache={}),t._tester=e,t._testref=r};var b=[],x=1e4;u.bBox=function(t){var e=t.attributes["data-bb"];if(e&&e.value)return i.Lib.extendFlat({},b[e.value]);var r=o.select("#js-plotly-tester"),n=r.node(),a=t.cloneNode(!0);n.appendChild(a),o.select(a).attr({x:0,y:0,transform:""});var s=a.getBoundingClientRect(),l=r.select(".js-reference-point").node().getBoundingClientRect();n.removeChild(a);var c={height:s.height,width:s.width,left:s.left-l.left,top:s.top-l.top,right:s.right-l.left,bottom:s.bottom-l.top};return b.length>=x&&(o.selectAll("[data-bb]").attr("data-bb",null),b=[]),t.setAttribute("data-bb",b.length),b.push(c),i.Lib.extendFlat({},c)},u.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=o.select("base");n.size()&&n.attr("href")&&(r=window.location.href+r),t.attr("clip-path","url("+r+")")}},{"../../constants/xmlns_namespaces":337,"../../plotly":365,"../../traces/scatter/make_bubble_size_func":505,"../../traces/scatter/subtypes":511,"./symbol_defs":318,d3:70,"fast-isnumeric":74}],318:[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),c=n.round(.118*e,2),u=n.round(.809*e,2),h=n.round(.382*e,2);return"M"+r+","+l+"H"+i+"L"+o+","+c+"L"+a+","+u+"L0,"+h+"L-"+a+","+u+"L-"+o+","+c+"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:70}],319:[function(t,e,r){"use strict";e.exports={visible:{valType:"boolean",description:["Determines whether or not this set of error bars is visible."].join(" ")},type:{valType:"enumerated",values:["percent","constant","sqrt","data"],description:["Determines the rule used to generate the error bars.","If *constant`, the bar lengths are of a constant value.","Set this constant in `value`.","If *percent*, the bar lengths correspond to a percentage of","underlying data. Set this percentage in `value`.","If *sqrt*, the bar lengths correspond to the sqaure of the","underlying data.","If *array*, the bar lengths are set with data set `array`."].join(" ")},symmetric:{valType:"boolean",description:["Determines whether or not the error bars have the same length","in both direction","(top/bottom for vertical bars, left/right for horizontal bars."].join(" ")},array:{valType:"data_array",description:["Sets the data corresponding the length of each error bar.","Values are plotted relative to the underlying data."].join(" ")},arrayminus:{valType:"data_array",description:["Sets the data corresponding the length of each error bar in the","bottom (left) direction for vertical (horizontal) bars","Values are plotted relative to the underlying data."].join(" ")},value:{valType:"number",min:0,dflt:10,description:["Sets the value of either the percentage","(if `type` is set to *percent*) or the constant","(if `type` is set to *constant*) corresponding to the lengths of","the error bars."].join(" ")},valueminus:{valType:"number",min:0,dflt:10,description:["Sets the value of either the percentage","(if `type` is set to *percent*) or the constant","(if `type` is set to *constant*) corresponding to the lengths of","the error bars in the","bottom (left) direction for vertical (horizontal) bars"].join(" ")},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,description:["Sets the width (in px) of the cross-bar at both ends","of the error bars."].join(" ")},_deprecated:{opacity:{valType:"number",description:["Obsolete.","Use the alpha channel in error bar `color` to set the opacity."].join(" ")}}}},{}],320:[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),c=[];if(l){for(var u=s(o),h=0;h<t.length;h++){var f=t[h],d=f[n];if(i(r.c2l(d))){var p=u(d,h);if(i(p[0])&&i(p[1])){var g=f[n+"s"]=d-p[0],v=f[n+"h"]=d+p[1];c.push(g,v)}}}a.expand(r,c,{padded:!0})}}var i=t("fast-isnumeric"),o=t("../../plots/plots"),a=t("../../plots/cartesian/axes"),s=t("./compute_error");e.exports=function(t){for(var e=t.calcdata,r=0;r<e.length;r++){var i=e[r],s=i[0].trace;if(o.traceIs(s,"errorBarsOK")){var l=a.getFromId(t,s.xaxis),c=a.getFromId(t,s.yaxis);n(i,s,l,"x"),n(i,s,c,"y")}}}},{"../../plots/cartesian/axes":368,"../../plots/plots":404,"./compute_error":321,"fast-isnumeric":74}],321:[function(t,e,r){"use strict";function n(t,e){return"percent"===t?function(t){return Math.abs(t*e/100)}:"constant"===t?function(){return Math.abs(e)}:"sqrt"===t?function(t){return Math.sqrt(Math.abs(t))}:void 0}e.exports=function(t){var e=t.type,r=t.symmetric;if("data"===e){var i=t.array,o=t.arrayminus;return r||void 0===o?function(t,e){var r=+i[e];return[r,r]}:function(t,e){return[+o[e],+i[e]]}}var a=n(e,t.value),s=n(e,t.valueminus);return r||void 0===t.valueminus?function(t){var e=a(t);return[e,e]}:function(t){return[s(t),a(t)]}}},{}],322:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/plots"),o=t("../../lib"),a=t("./attributes");e.exports=function(t,e,r,s){function l(t,e){return o.coerce(h,u,a,t,e)}var c="error_"+s.axis,u=e[c]={},h=t[c]||{},f=void 0!==h.array||void 0!==h.value||"sqrt"===h.type,d=l("visible",f);if(d!==!1){var p=l("type","array"in h?"data":"percent"),g=!0;if("sqrt"!==p&&(g=l("symmetric",!(("data"===p?"arrayminus":"valueminus")in h))),"data"===p){var v=l("array");if(v||(u.array=[]),l("traceref"),!g){var m=l("arrayminus");m||(u.arrayminus=[]),l("tracerefminus")}}else("percent"===p||"constant"===p)&&(l("value"),g||l("valueminus"));var y="copy_"+s.inherit+"style";if(s.inherit){var b=e["error_"+s.inherit];(b||{}).visible&&l(y,!(h.color||n(h.thickness)||n(h.width)))}s.inherit&&u[y]||(l("color",r),l("thickness"),l("width",i.traceIs(e,"gl3d")?0:4))}}},{"../../lib":348,"../../plots/plots":404,"./attributes":319,"fast-isnumeric":74}],323:[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("../color"),l=t("../../traces/scatter/subtypes"),c=e.exports={};c.attributes=t("./attributes"),c.supplyDefaults=t("./defaults"),c.calc=t("./calc"),c.calcFromTrace=function(t,e){for(var r=t.x||[],n=t.y,i=r.length||n.length,o=new Array(i),a=0;i>a;a++)o[a]={x:r[a],y:n[a]};return o[0].trace=t,c.calc({calcdata:[o],_fullLayout:e}),o},c.plot=function(t,e,r){var s=e.x(),c=e.y();e.plot.select(".errorlayer").selectAll("g.errorbars").remove();var u;e.plot.select(".errorlayer").selectAll("g.errorbars").data(r).enter().append("g").attr("class","errorbars").each(function(t){var e=t[0].trace,r=e.error_x,h=e.error_y,f=l.hasMarkers(e)&&e.marker.maxdisplayed>0;(h.visible||r.visible)&&i.select(this).selectAll("g").data(a.identity).enter().append("g").each(function(t){u=n(t,s,c);var e,a=i.select(this);if(!f||t.vis){if(h.visible&&o(u.x)&&o(u.yh)&&o(u.ys)){var l=h.width;e="M"+(u.x-l)+","+u.yh+"h"+2*l+"m-"+l+",0V"+u.ys,u.noYS||(e+="m-"+l+",0h"+2*l),a.append("path").classed("yerror",!0).attr("d",e)}if(r.visible&&o(u.y)&&o(u.xh)&&o(u.xs)){var d=(r.copy_ystyle?h:r).width;e="M"+u.xh+","+(u.y-d)+"v"+2*d+"m0,-"+d+"H"+u.xs,u.noXS||(e+="m0,-"+d+"v"+2*d),a.append("path").classed("xerror",!0).attr("d",e)}}})})},c.style=function(t){i.select(t).selectAll("g.errorbars").each(function(t){var e=i.select(this),r=t[0].trace,n=r.error_y||{},o=r.error_x||{};e.selectAll("g path.yerror").style("stroke-width",n.thickness+"px").call(s.stroke,n.color),o.copy_ystyle&&(o=n),e.selectAll("g path.xerror").style("stroke-width",o.thickness+"px").call(s.stroke,o.color)})},c.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))}},{"../../lib":348,"../../traces/scatter/subtypes":511,"../color":299,"./attributes":319,"./calc":320,"./defaults":322,d3:70,"fast-isnumeric":74}],324:[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,{}),traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"],description:["Determines the order at which the legend items are displayed.","If *normal*, the items are displayed top-to-bottom in the same","order as the input data.","If *reversed*, the items are displayed in the opposite order","as *normal*.","If *grouped*, the items are displayed in groups","(when a trace `legendgroup` is provided).","if *grouped+reversed*, the items are displayed in the opposite order","as *grouped*."].join(" ")},tracegroupgap:{valType:"number",min:0,dflt:10,description:["Sets the amount of vertical space (in px) between legend groups."].join(" ")},x:{valType:"number",min:-2,max:3,dflt:1.02},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left",description:["Sets the legend's horizontal position anchor.","This anchor binds the `x` position to the *left*, *center*","or *right* of the legend."].join(" ")},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto",description:["Sets the legend's vertical position anchor","This anchor binds the `y` position to the *top*, *middle*","or *bottom* of the legend."].join(" ")}}},{"../../lib/extend":344,"../../plots/font_attributes":374,"../color/attributes":298}],325:[function(t,e,r){"use strict";function n(t){return t.visible&&a.Plots.traceIs(t,"showLegend")}function i(t){return-1!==(t.traceorder||"").indexOf("grouped")}function o(t){return-1!==(t.traceorder||"").indexOf("reversed")}var a=t("../../plotly"),s=t("d3"),l=t("../../traces/scatter/subtypes"),c=t("../../traces/pie/style_one"),u=e.exports={};u.layoutAttributes=t("./attributes"),u.supplyLayoutDefaults=function(t,e,r){function s(t,e){return a.Lib.coerce(c,h,u.layoutAttributes,t,e)}for(var l,c=t.legend||{},h=e.legend={},f=0,d="normal",p=0;p<r.length;p++)l=r[p],n(l)&&(f++,a.Plots.traceIs(l,"pie")&&f++),(a.Plots.traceIs(l,"bar")&&"stack"===e.barmode||-1!==["tonextx","tonexty"].indexOf(l.fill))&&(d=i({traceorder:d})?"grouped+reversed":"reversed"),void 0!==l.legendgroup&&""!==l.legendgroup&&(d=o({traceorder:d})?"reversed+grouped":"grouped");var g=a.Lib.coerce(t,e,a.Plots.layoutAttributes,"showlegend",f>1);g!==!1&&(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),a.Lib.coerceFont(s,"font",e.font),s("traceorder",d),i(e.legend)&&s("tracegroupgap"),s("x"),s("xanchor"),s("y"),s("yanchor"),a.Lib.noneOrAll(c,h,["x","y"]))},u.lines=function(t){var e=t[0].trace,r=e.visible&&e.fill&&"none"!==e.fill,n=l.hasLines(e),i=s.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(a.Drawing.fillGroupStyle);var o=s.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(a.Drawing.lineGroupStyle)},u.points=function(t){function e(t,e,r){var n=a.Lib.nestedProperty(c,t).get(),i=Array.isArray(n)&&e?e(n):n;if(r){if(i<r[0])return r[0];if(i>r[1])return r[1]}return i}function r(t){return t[0]}var n,i,o=t[0],c=o.trace,u=l.hasMarkers(c),h=l.hasText(c),f=l.hasLines(c);if(u||h||f){var d={},p={};u&&(d.mc=e("marker.color",r),d.mo=e("marker.opacity",a.Lib.mean,[.2,1]),d.ms=e("marker.size",a.Lib.mean,[2,16]),d.mlc=e("marker.line.color",r),d.mlw=e("marker.line.width",a.Lib.mean,[0,5]),p.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),f&&(p.line={width:e("line.width",r,[0,10])}),h&&(d.tx="Aa",d.tp=e("textposition",r),d.ts=10,d.tc=e("textfont.color",r),d.tf=e("textfont.family",r)),n=[a.Lib.minExtend(o,d)],i=a.Lib.minExtend(c,p)}var g=s.select(this).select("g.legendpoints"),v=g.selectAll("path.scatterpts").data(u?n:[]);v.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),v.exit().remove(),v.call(a.Drawing.pointStyle,i),u&&(n[0].mrc=3);var m=g.selectAll("g.pointtext").data(h?n:[]);m.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),m.exit().remove(),m.selectAll("text").call(a.Drawing.textPointStyle,i)},u.bars=function(t){var e=t[0].trace,r=e.marker||{},n=r.line||{},i=s.select(this).select("g.legendpoints").selectAll("path.legendbar").data(a.Plots.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=s.select(this);i.style("stroke-width",e+"px").call(a.Color.fill,t.mc||r.color),e&&i.call(a.Color.stroke,t.mlc||n.color)})},u.boxes=function(t){var e=t[0].trace,r=s.select(this).select("g.legendpoints").selectAll("path.legendbox").data(a.Plots.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=s.select(this);n.style("stroke-width",r+"px").call(a.Color.fill,t.fc||e.fillcolor),r&&n.call(a.Color.stroke,t.lc||e.line.color)})},u.pie=function(t){var e=t[0].trace,r=s.select(this).select("g.legendpoints").selectAll("path.legendpie").data(a.Plots.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(c,t[0],e)},u.style=function(t){t.each(function(t){var e=s.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(u.bars).each(u.boxes).each(u.pie).each(u.lines).each(u.points)},u.texts=function(t,e,r,n,i){function o(t){a.util.convertToTspans(t,function(){e.firstRender&&u.repositionLegend(e,i)}),t.selectAll("tspan.line").attr({x:t.attr("x")})}var l=e._fullLayout,c=r[0].trace,h=a.Plots.traceIs(c,"pie"),f=c.index,d=h?r[0].label:c.name,p=s.select(t).selectAll("text.legendtext").data([0]);p.enter().append("text").classed("legendtext",!0),p.attr({x:40,y:0}).style("text-anchor","start").call(a.Drawing.font,l.legend.font).text(d).attr({"data-unformatted":d}),e._context.editable&&!h?p.call(a.util.makeEditable).call(o).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(o),this.text()||(t=" "),a.restyle(e,"name",t,f)}):p.call(o)},u.getLegendData=function(t,e){function r(t,r){if(""!==t&&i(e))-1===g.indexOf(t)?(g.push(t),v=!0,p[t]=[[r]]):p[t].push([r]);else{var n="~~i"+y;g.push(n),p[n]=[[r]],y++}}var s,l,c,u,h,f,d,p={},g=[],v=!1,m={},y=0;for(h=0;h<t.length;h++)if(s=t[h],l=s[0],c=l.trace,u=c.legendgroup,n(c)&&c.showlegend)if(a.Plots.traceIs(c,"pie"))for(m[u]||(m[u]={}),f=0;f<s.length;f++)d=s[f].label,m[u][d]||(r(u,{label:d,color:s[f].color,i:s[f].i,trace:c}),m[u][d]=!0);else r(u,l);if(!g.length)return[];var b,x,_=g.length;if(v&&i(e))for(x=new Array(_),h=0;_>h;h++)b=p[g[h]],x[h]=o(e)?b.reverse():b;else{for(x=[new Array(_)],h=0;_>h;h++)b=p[g[h]][0],x[0][o(e)?_-h-1:h]=b;_=1}return e._lgroupsLength=_,x},u.draw=function(t){var e=t._fullLayout;if(e._infolayer&&t.calcdata){var r=e.legend,n=e.showlegend&&u.getLegendData(t.calcdata,r),o=e.hiddenlabels||[];if(!e.showlegend||!n.length)return e._infolayer.selectAll(".legend").remove(),void a.Plots.autoMargin(t,"legend");"undefined"==typeof t.firstRender?t.firstRender=!0:t.firstRender&&(t.firstRender=!1);var l=e._infolayer.selectAll("svg.legend").data([0]);l.enter(0).append("svg").attr("class","legend");var c=l.selectAll("rect.bg").data([0]);c.enter(0).append("rect").attr("class","bg"),c.call(a.Color.stroke,r.bordercolor).call(a.Color.fill,r.bgcolor).style("stroke-width",r.borderwidth+"px");var h=l.selectAll("g.groups").data(n);h.enter().append("g").attr("class","groups"),h.exit().remove(),i(r)&&h.attr("transform",function(t,e){return"translate(0,"+e*r.tracegroupgap+")"});var f=h.selectAll("g.traces").data(a.Lib.identity);if(f.enter().append("g").attr("class","traces"),f.exit().remove(),f.call(u.style).style("opacity",function(t){var e=t[0].trace;return a.Plots.traceIs(e,"pie")?-1!==o.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(e,r){u.texts(this,t,e,r,f);var n=s.select(this).selectAll("rect").data([0]);n.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(a.Color.fill,"rgba(0,0,0,0)"),n.on("click",function(){if(!t._dragged){var r,n,i=t._fullData,s=e[0].trace,l=s.legendgroup,c=[];if(a.Plots.traceIs(s,"pie")){var u=e[0].label,h=o.slice(),f=h.indexOf(u);-1===f?h.push(u):h.splice(f,1),a.relayout(t,"hiddenlabels",h)}else{if(""===l)c=[s.index];else for(var d=0;d<i.length;d++)r=i[d],r.legendgroup===l&&c.push(r.index);n=s.visible===!0?"legendonly":!0,a.restyle(t,"visible",n,c)}}})}),u.repositionLegend(t,f),t._context.editable){var d,p,g,v,m,y;a.Fx.dragElement({element:l.node(),prepFn:function(){g=Number(l.attr("x")),v=Number(l.attr("y")),m=Number(l.attr("width")),y=Number(l.attr("height")),a.Fx.setCursor(l)},moveFn:function(e,n){var i=t._fullLayout._size;l.call(a.Drawing.setPosition,g+e,v+n),d=a.Fx.dragAlign(g+e,m,i.l,i.l+i.w,r.xanchor),p=a.Fx.dragAlign(v+n+y,-y,i.t+i.h,i.t,r.yanchor);var o=a.Fx.dragCursors(d,p,r.xanchor,r.yanchor);a.Fx.setCursor(l,o)},doneFn:function(e){a.Fx.setCursor(l),e&&void 0!==d&&void 0!==p&&a.relayout(t,{"legend.x":d,"legend.y":p})}})}}},u.repositionLegend=function(t,e){var r=t._fullLayout,n=r._size,o=r.legend,l=o.borderwidth,c=0,u=0;e.each(function(t){var e,r,n=t[0].trace,i=s.select(this),h=i.selectAll(".legendtoggle"),f=i.selectAll(".legendtext"),d=i.selectAll(".legendtext>tspan"),p=1.3*o.font.size,g=d[0].length||1,v=f.node()&&a.Drawing.bBox(f.node()).width,m=i.select("g[class*=math-group]");if(!n.showlegend)return void i.remove();
if(m.node()){var y=a.Drawing.bBox(m.node());p=y.height,v=y.width,m.attr("transform","translate(0,"+p/4+")")}else e=p*(.3+(1-g)/2),f.attr("y",e),d.attr("y",e);r=Math.max(p*g,16)+3,i.attr("transform","translate("+l+","+(5+l+u+r/2)+")"),h.attr({x:0,y:-r/2,height:r}),u+=r,c=Math.max(c,v||0)}),i(o)&&(u+=(o._lgroupsLength-1)*o.tracegroupgap),e.selectAll(".legendtoggle").attr("width",(t._context.editable?0:c)+40),c+=45+2*l,u+=10+2*l;var h=n.l+n.w*o.x,f=n.t+n.h*(1-o.y),d="left";"right"===o.xanchor||"auto"===o.xanchor&&o.x>=2/3?(h-=c,d="right"):("center"===o.xanchor||"auto"===o.xanchor&&o.x>1/3)&&(h-=c/2,d="center");var p="top";"bottom"===o.yanchor||"auto"===o.yanchor&&o.y<=1/3?(f-=u,p="bottom"):("middle"===o.yanchor||"auto"===o.yanchor&&o.y<2/3)&&(f-=u/2,p="middle"),c=Math.ceil(c),u=Math.ceil(u),h=Math.round(h),f=Math.round(f),r._infolayer.selectAll("svg.legend").call(a.Drawing.setRect,h,f,c,u),r._infolayer.selectAll("svg.legend .bg").call(a.Drawing.setRect,l/2,l/2,c-l,u-l),a.Plots.autoMargin(t,"legend",{x:o.x,y:o.y,l:c*({right:1,center:.5}[d]||0),r:c*({left:1,center:.5}[d]||0),b:u*({top:1,middle:.5}[p]||0),t:u*({bottom:1,middle:.5}[p]||0)})}},{"../../plotly":365,"../../traces/pie/style_one":491,"../../traces/scatter/subtypes":511,"./attributes":324,d3:70}],326:[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,c,u,h="in"===i?.5:2,f=(1+h)/2,p=(1-h)/2,g=l.Axes.list(t,null,!0),v=0;v<g.length;v++)s=g[v],s.fixedrange||(c=s._name,"auto"===i?a[c+".autorange"]=!0:"reset"===i?void 0===s._rangeInitial?a[c+".autorange"]=!0:a[c+".range"]=s._rangeInitial.slice():(u=s.range,a[c+".range"]=[f*u[0]+p*u[1],f*u[1]+p*u[0]]));else"hovermode"!==n||"x"!==i&&"y"!==i||(i=o._isHoriz?"y":"x",r.setAttribute("data-val",i)),a[n]=i;l.relayout(t,a).then(function(){"dragmode"===n&&(o._hasCartesian&&l.Fx.setCursor(o._paper.select(".nsewdrag"),d[i]),l.Fx.supplyLayoutDefaults(t.layout,o,t._fullData),l.Fx.init(t))})}function i(t,e){var r=e.currentTarget,n=r.getAttribute("data-attr"),i=r.getAttribute("data-val")||!0,o={};o[n]=i,l.relayout(t,o)}function o(t,e){for(var r=e.currentTarget,n=r.getAttribute("data-attr"),i=t.layout,o=t._fullLayout,a=l.Plots.getSubplotIds(o,"gl3d"),s=0;s<a.length;s++){var c=a[s],u=i[c],h=o[c],f=h._scene;if(u&&"resetDefault"!==n){if("resetLastSave"===n){var d=u.camera;d?f.setCamera(d):f.setCameraToDefault()}}else f.setCameraToDefault()}}function a(t,e){for(var r=e.currentTarget,n=r.getAttribute("data-attr"),i=r.getAttribute("data-val")||!0,o=t._fullLayout,a=l.Plots.getSubplotIds(o,"geo"),s=0;s<a.length;s++){var c=o[a[s]]._geo;if("zoom"===n){var u=c.projection.scale(),h="in"===i?2*u:.5*u;c.projection.scale(h),c.zoom.scale(h),c.render()}else"reset"===n?c.zoomReset():"hovermode"===n&&(c.showHover=!c.showHover)}}function s(t){var e=t._fullLayout.hovermode?!1:"closest";l.relayout(t,"hovermode",e)}var l=t("../../plotly"),c=t("../../lib"),u=t("../../snapshot"),h=t("../../../build/ploticon"),f=e.exports={};f.toImage={name:"toImage",title:"Download plot as a png",icon:h.camera,click:function(t){var e="png";if(c.isIE())return void c.notifier("Snapshotting is unavailable in Internet Explorer. Consider exporting your images using the Plotly Cloud","long");if(t._snapshotInProgress)return void c.notifier("Snapshotting is still in progress - please hold","long");t._snapshotInProgress=!0,c.notifier("Taking snapshot - this may take a few seconds","long");var r=u.toImage(t,{format:e}),n=t.fn||"newplot";n+="."+e,r.once("success",function(e){t._snapshotInProgress=!1;var i=document.createElement("a");i.href=e,i.download=n,document.body.appendChild(i),i.click(),document.body.removeChild(i),r.clean()}),r.once("error",function(n){t._snapshotInProgress=!1,c.notifier("Sorry there was a problem downloading your "+e,"long"),console.error(n),r.clean()})}},f.sendDataToCloud={name:"sendDataToCloud",title:"Save and edit plot in cloud",icon:h.disk,click:function(t){l.Plots.sendDataToCloud(t)}},f.zoom2d={name:"zoom2d",title:"Zoom",attr:"dragmode",val:"zoom",icon:h.zoombox,click:n},f.pan2d={name:"pan2d",title:"Pan",attr:"dragmode",val:"pan",icon:h.pan,click:n},f.select2d={name:"select2d",title:"Box Select",attr:"dragmode",val:"select",icon:h.selectbox,click:n},f.lasso2d={name:"lasso2d",title:"Lasso Select",attr:"dragmode",val:"lasso",icon:h.lasso,click:n},f.zoomIn2d={name:"zoomIn2d",title:"Zoom in",attr:"zoom",val:"in",icon:h.zoom_plus,click:n},f.zoomOut2d={name:"zoomOut2d",title:"Zoom out",attr:"zoom",val:"out",icon:h.zoom_minus,click:n},f.autoScale2d={name:"autoScale2d",title:"Autoscale",attr:"zoom",val:"auto",icon:h.autoscale,click:n},f.resetScale2d={name:"resetScale2d",title:"Reset axes",attr:"zoom",val:"reset",icon:h.home,click:n},f.hoverClosestCartesian={name:"hoverClosestCartesian",title:"Show closest data on hover",attr:"hovermode",val:"closest",icon:h.tooltip_basic,gravity:"ne",click:n},f.hoverCompareCartesian={name:"hoverCompareCartesian",title:"Compare data on hover",attr:"hovermode",val:function(t){return t._fullLayout._isHoriz?"y":"x"},icon:h.tooltip_compare,gravity:"ne",click:n};var d={pan:"move",zoom:"crosshair",select:"crosshair",lasso:"crosshair"};f.zoom3d={name:"zoom3d",title:"Zoom",attr:"dragmode",val:"zoom",icon:h.zoombox,click:i},f.pan3d={name:"pan3d",title:"Pan",attr:"dragmode",val:"pan",icon:h.pan,click:i},f.orbitRotation={name:"orbitRotation",title:"orbital rotation",attr:"dragmode",val:"orbit",icon:h["3d_rotate"],click:i},f.tableRotation={name:"tableRotation",title:"turntable rotation",attr:"dragmode",val:"turntable",icon:h["z-axis"],click:i},f.resetCameraDefault3d={name:"resetCameraDefault3d",title:"Reset camera to default",attr:"resetDefault",icon:h.home,click:o},f.resetCameraLastSave3d={name:"resetCameraLastSave3d",title:"Reset camera to last save",attr:"resetLastSave",icon:h.movie,click:o},f.hoverClosest3d={name:"hoverClosest3d",title:"Toggle show closest data on hover",attr:"hovermode",val:null,toggle:!0,icon:h.tooltip_basic,gravity:"ne",click:function(t,e){var r=e.currentTarget,n=JSON.parse(r.getAttribute("data-val"))||!1,i=t._fullLayout,o=l.Plots.getSubplotIds(i,"gl3d"),a=["xaxis","yaxis","zaxis"],s=["showspikes","spikesides","spikethickness","spikecolor"],c={},u={},h={};if(n)h=n,r.setAttribute("data-val",JSON.stringify(null));else{h={"allaxes.showspikes":!1};for(var f=0;f<o.length;f++)for(var d=o[f],p=i[d],g=c[d]={},v=0;3>v;v++){var m=a[v];u=g[m]={};for(var y=0;y<s.length;y++){var b=s[y];u[b]=p[m][b]}}r.setAttribute("data-val",JSON.stringify(c))}l.relayout(t,h)}},f.zoomInGeo={name:"zoomInGeo",title:"Zoom in",attr:"zoom",val:"in",icon:h.zoom_plus,click:a},f.zoomOutGeo={name:"zoomOutGeo",title:"Zoom in",attr:"zoom",val:"out",icon:h.zoom_minus,click:a},f.resetGeo={name:"resetGeo",title:"Reset",attr:"reset",val:null,icon:h.autoscale,click:a},f.hoverClosestGeo={name:"hoverClosestGeo",title:"Toggle show closest data on hover",attr:"hovermode",val:null,toggle:!0,icon:h.tooltip_basic,gravity:"ne",click:a},f.hoverClosestGl2d={name:"hoverClosestGl2d",title:"Toggle show closest data on hover",attr:"hovermode",val:null,toggle:!0,icon:h.tooltip_basic,gravity:"ne",click:s},f.hoverClosestPie={name:"hoverClosestPie",title:"Toggle show closest data on hover",attr:"hovermode",val:"closest",icon:h.tooltip_basic,gravity:"ne",click:s}},{"../../../build/ploticon":2,"../../lib":348,"../../plotly":365,"../../snapshot":411}],327:[function(t,e,r){"use strict";function n(t){this.container=t.container,this.element=document.createElement("div"),this.update(t.graphInfo,t.buttons),this.container.appendChild(this.element)}function i(t,e){var r=t._fullLayout,i=new n({graphInfo:t,container:r._paperdiv.node(),buttons:e});return r._privateplot&&a.select(i.element).append("span").classed("badge-private float--left",!0).text("PRIVATE"),i}var o=t("../../plotly"),a=t("d3"),s=t("../../../build/ploticon"),l=n.prototype;l.update=function(t,e){this.graphInfo=t;var r=this.graphInfo._context;"hover"===r.displayModeBar?this.element.className="modebar modebar--hover":this.element.className="modebar";var n=!this.hasButtons(e),i=this.hasLogo!==r.displaylogo;(n||i)&&(this.removeAllButtons(),this.updateButtons(e),r.displaylogo&&(this.element.appendChild(this.getLogo()),this.hasLogo=!0)),this.updateActiveButton()},l.updateButtons=function(t){var e=this;this.buttons=t,this.buttonElements=[],this.buttonsNames=[],this.buttons.forEach(function(t){var r=e.createGroup();t.forEach(function(t){var n=t.name;if(!n)throw new Error("must provide button 'name' in button config");if(-1!==e.buttonsNames.indexOf(n))throw new Error("button name '"+n+"' is taken");e.buttonsNames.push(n);var i=e.createButton(t);e.buttonElements.push(i),r.appendChild(i)}),e.element.appendChild(r)})},l.createGroup=function(){var t=document.createElement("div");return t.className="modebar-group",t},l.createButton=function(t){var e=this,r=document.createElement("a");r.setAttribute("rel","tooltip"),r.className="modebar-btn";var n=t.title;void 0===n&&(n=t.name),(n||0===n)&&r.setAttribute("data-title",n),void 0!==t.attr&&r.setAttribute("data-attr",t.attr);var i=t.val;void 0!==i&&("function"==typeof i&&(i=i(this.graphInfo)),r.setAttribute("data-val",i));var o=t.click;if("function"!=typeof o)throw new Error("must provide button 'click' function in button config");return r.addEventListener("click",function(r){t.click(e.graphInfo,r),e.updateActiveButton(r.currentTarget)}),r.setAttribute("data-toggle",t.toggle||!1),t.toggle&&r.classList.add("active"),r.appendChild(this.createIcon(t.icon||s.question)),r.setAttribute("data-gravity",t.gravity||"n"),r},l.createIcon=function(t){var e=t.ascent-t.descent,r="http://www.w3.org/2000/svg",n=document.createElementNS(r,"svg"),i=document.createElementNS(r,"path");return n.setAttribute("height","1em"),n.setAttribute("width",t.width/e+"em"),n.setAttribute("viewBox",[0,0,t.width,e].join(" ")),i.setAttribute("d",t.path),i.setAttribute("transform","matrix(1 0 0 -1 0 "+t.ascent+")"),n.appendChild(i),n},l.updateActiveButton=function(t){var e=this.graphInfo._fullLayout,r=void 0!==t?t.getAttribute("data-attr"):null;this.buttonElements.forEach(function(t){var n=t.getAttribute("data-val")||!0,i=t.getAttribute("data-attr"),o="true"===t.getAttribute("data-toggle"),s=a.select(t);o?i===r&&s.classed("active",!s.classed("active")):s.classed("active",e[i]===n)})},l.hasButtons=function(t){var e=this.buttons;if(!e)return!1;if(t.length!==e.length)return!1;for(var r=0;r<t.length;++r){if(t[r].length!==e[r].length)return!1;for(var n=0;n<t[r].length;n++)if(t[r][n].name!==e[r][n].name)return!1}return!0},l.getLogo=function(){var t=this.createGroup(),e=document.createElement("a");return e.href="https://plot.ly/",e.target="_blank",e.setAttribute("data-title","Produced with Plotly"),e.className="modebar-btn plotlyjsicon modebar-btn--logo",e.appendChild(this.createIcon(s.plotlylogo)),t.appendChild(e),t},l.removeAllButtons=function(){for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);this.hasLogo=!1},l.destroy=function(){o.Lib.removeElement(this.container.querySelector(".modebar"))},e.exports=i},{"../../../build/ploticon":2,"../../plotly":365,d3:70}],328:[function(t,e,r){"use strict";function n(t,e,r){function n(t){for(var r=[],n=0;n<t.length;n++){var i=t[n];-1===e.indexOf(i)&&r.push(c[i])}h.push(r)}var o,a,l=t._fullLayout,u=t._fullData,h=[];n(["toImage","sendDataToCloud"]),l._hasGL3D&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),l._hasGeo&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var f=l._hasCartesian,d=l._hasGL2D,p=i(l),g=[];if(!f&&!d||p||(g=["zoom2d","pan2d"]),f){var v=!1;for(o=0;o<u.length&&!v;o++)a=u[o],a._module&&a._module.selectPoints&&("scatter"===a.type?(s.hasMarkers(a)||s.hasText(a))&&(v=!0):v=!0);v&&(g.push("select2d"),g.push("lasso2d"))}if(g.length&&n(g),!f&&!d||p||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),f&&n(["hoverClosestCartesian","hoverCompareCartesian"]),d&&n(["hoverClosestGl2d"]),l._hasPie&&n(["hoverClosestPie"]),r.length)if(Array.isArray(r[0]))for(o=0;o<r.length;o++)h.push(r[o]);else h.push(r);return h}function i(t){for(var e=a.Axes.list({_fullLayout:t},null,!0),r=!0,n=0;n<e.length;n++)if(!e[n].fixedrange){r=!1;break}return r}function o(t){for(var e=0;e<t.length;e++)for(var r=t[e],n=0;n<r.length;n++){var i=r[n];if("string"==typeof i){if(void 0===c[i])throw new Error(["*modeBarButtons* configuration options","invalid button name"].join(" "));t[e][n]=c[i]}}return t}var a=t("../../plotly"),s=t("../../traces/scatter/subtypes"),l=t("./"),c=t("./buttons");e.exports=function(t){var e=t._fullLayout,r=t._context,i=e._modeBar;if(!r.displayModeBar)return void(i&&(i.destroy(),delete e._modeBar));if(!Array.isArray(r.modeBarButtonsToRemove))throw new Error(["*modeBarButtonsToRemove* configuration options","must be an array."].join(" "));if(!Array.isArray(r.modeBarButtonsToAdd))throw new Error(["*modeBarButtonsToAdd* configuration options","must be an array."].join(" "));var a,s=r.modeBarButtons;a=Array.isArray(s)&&s.length?o(s):n(t,r.modeBarButtonsToRemove,r.modeBarButtonsToAdd),i?i.update(t,a):e._modeBar=l(t,a)}},{"../../plotly":365,"../../traces/scatter/subtypes":511,"./":327,"./buttons":326}],329:[function(t,e,r){"use strict";var n=t("../annotations/attributes"),i=t("../../traces/scatter/attributes"),o=t("../../lib/extend").extendFlat,a=i.line;e.exports={_isLinkedToArray:!0,type:{valType:"enumerated",values:["circle","rect","path","line"],description:["Specifies the shape type to be drawn.","If *line*, a line is drawn from (`x0`,`y0`) to (`x1`,`y1`)","If *circle*, a circle is drawn from","((`x0`+`x1`)/2, (`y0`+`y1`)/2))","with radius","(|(`x0`+`x1`)/2 - `x0`|, |(`y0`+`y1`)/2 -`y0`)|)","If *rect*, a rectangle is drawn linking","(`x0`,`y0`), (`x1`,`y0`), (`x1`,`y1`), (`x0`,`y1`), (`x0`,`y0`)","If *path*, draw a custom SVG path using `path`."].join(" ")},xref:o({},n.xref,{description:["Sets the shape's x coordinate axis.","If set to an x axis id (e.g. *x* or *x2*), the `x` position","refers to an x coordinate","If set to *paper*, the `x` position refers to the distance from","the left side of the plotting area in normalized coordinates","where *0* (*1*) corresponds to the left (right) side."].join(" ")}),x0:{valType:"any",description:["Sets the shape's starting x position.","See `type` for more info."].join(" ")},x1:{valType:"any",description:["Sets the shape's end x position.","See `type` for more info."].join(" ")},yref:o({},n.yref,{description:["Sets the annotation's y coordinate axis.","If set to an y axis id (e.g. *y* or *y2*), the `y` position","refers to an y coordinate","If set to *paper*, the `y` position refers to the distance from","the bottom of the plotting area in normalized coordinates","where *0* (*1*) corresponds to the bottom (top)."].join(" ")}),y0:{valType:"any",description:["Sets the shape's starting y position.","See `type` for more info."].join(" ")},y1:{valType:"any",description:["Sets the shape's end y position.","See `type` for more info."].join(" ")},path:{valType:"string",description:["For `type` *path* - a valid SVG path but with the pixel values","replaced by data values. There are a few restrictions / quirks","only absolute instructions, not relative. So the allowed segments","are: M, L, H, V, Q, C, T, S, and Z","arcs (A) are not allowed because radius rx and ry are relative.","In the future we could consider supporting relative commands,","but we would have to decide on how to handle date and log axes.","Note that even as is, Q and C Bezier paths that are smooth on","linear axes may not be smooth on log, and vice versa.",'no chained "polybezier" commands - specify the segment type for',"each one.","On category axes, values are numbers scaled to the serial numbers","of categories because using the categories themselves there would","be no way to describe fractional positions","On data axes: because space and T are both normal components of path","strings, we can't use either to separate date from time parts.","Therefore we'll use underscore for this purpose:","2015-02-21_13:45:56.789"].join(" ")},opacity:{valType:"number",min:0,max:1,dflt:1},line:{color:a.color,width:a.width,dash:a.dash},fillcolor:{valType:"color",dflt:"rgba(0,0,0,0)",description:["Sets the color filling the shape's interior."].join(" ")}}},{"../../lib/extend":344,"../../traces/scatter/attributes":493,"../annotations/attributes":296}],330:[function(t,e,r){"use strict";function n(t,e){function r(e,r){return c.Lib.coerce(t,n,h.layoutAttributes,e,r)}var n={};r("opacity"),r("fillcolor"),r("line.color"),r("line.width"),r("line.dash");for(var i=t.path?"path":"rect",a=r("type",i),s=["x","y"],l=0;2>l;l++){var u=s[l],f={_fullLayout:e},d=c.Axes.coerceRef(t,n,f,u);if("path"!==a){var p=.25,g=.75;if("paper"!==d){var v=c.Axes.getFromId(f,d),m=o(v);p=m(v.range[0]+p*(v.range[1]-v.range[0])),g=m(v.range[0]+g*(v.range[1]-v.range[0]))}r(u+"0",p),r(u+"1",g)}}return"path"===a?r("path"):c.Lib.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){return function(e){return t(e.replace("_"," "))}}function s(t,e){var r,n,o,s,l=e.type,u=c.Axes.getFromId(t,e.xref),f=c.Axes.getFromId(t,e.yref),d=t._fullLayout._size;if(u?(r=i(u),n=function(t){return u._offset+u.l2p(r(t,!0))}):n=function(t){return d.l+d.w*t},f?(o=i(f),s=function(t){return f._offset+f.l2p(o(t,!0))}):s=function(t){return d.t+d.h*(1-t)},"path"===l)return u&&"date"===u.type&&(n=a(n)),f&&"date"===f.type&&(s=a(s)),h.convertPath(e.path,n,s);var p=n(e.x0),g=n(e.x1),v=s(e.y0),m=s(e.y1);if("line"===l)return"M"+p+","+v+"L"+g+","+m;if("rect"===l)return"M"+p+","+v+"H"+g+"V"+m+"H"+p+"Z";var y=(p+g)/2,b=(v+m)/2,x=Math.abs(y-p),_=Math.abs(b-v),w="A"+x+","+_,k=y+x+","+b,A=y+","+(b-_);return"M"+k+w+" 0 1,1 "+A+w+" 0 0,1 "+k+"Z"}function l(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 s,l,c,u,h,p=1/0,g=-(1/0),v=n.match(f);for("date"===t.type&&(o=a(o)),s=0;s<v.length;s++)l=v[s],c=i[l.charAt(0)].drawn,void 0!==c&&(u=v[s].substr(1).match(d),!u||u.length<c||(h=o(u[c]),p>h&&(p=h),h>g&&(g=h)));return g>=p?[p,g]:void 0}}var c=t("../../plotly"),u=t("fast-isnumeric"),h=e.exports={};h.layoutAttributes=t("./attributes"),h.supplyLayoutDefaults=function(t,e){for(var r=t.shapes||[],i=e.shapes=[],o=0;o<r.length;o++)i.push(n(r[o]||{},e))},h.drawAll=function(t){var e=t._fullLayout;e._shapelayer.selectAll("path").remove();for(var r=0;r<e.shapes.length;r++)h.draw(t,r)},h.add=function(t){var e=t._fullLayout.shapes.length;c.relayout(t,"shapes["+e+"]","add")},h.draw=function(t,e,r,a){var l,f=t.layout,d=t._fullLayout;if(!u(e)||-1===e){if(!e&&Array.isArray(a))return f.shapes=a,h.supplyLayoutDefaults(f,d),void h.drawAll(t);if("remove"===a)return delete f.shapes,d.shapes=[],void h.drawAll(t);if(r&&"add"!==a){for(l=0;l<d.shapes.length;l++)h.draw(t,l,r,a);return}e=d.shapes.length,d.shapes.push({})}if(!r&&a){if("remove"===a){for(d._shapelayer.selectAll('[data-index="'+e+'"]').remove(),d.shapes.splice(e,1),f.shapes.splice(e,1),l=e;l<d.shapes.length;l++)d._shapelayer.selectAll('[data-index="'+(l+1)+'"]').attr("data-index",String(l)),h.draw(t,l);return}if("add"===a||c.Lib.isPlainObject(a)){d.shapes.splice(e,0,{});var p=c.Lib.isPlainObject(a)?c.Lib.extendFlat({},a):{text:"New text"};for(f.shapes?f.shapes.splice(e,0,p):f.shapes=[p],l=d.shapes.length-1;l>e;l--)d._shapelayer.selectAll('[data-index="'+(l-1)+'"]').attr("data-index",String(l)),h.draw(t,l)}}d._shapelayer.selectAll('[data-index="'+e+'"]').remove();var g=f.shapes[e];if(g){var v={xref:g.xref,yref:g.yref},m={};"string"==typeof r&&r?m[r]=a:c.Lib.isPlainObject(r)&&(m=r);var y=Object.keys(m);for(l=0;l<m.length;l++){var b=y[l];c.Lib.nestedProperty(g,b).set(m[b])}var x=["x0","x1","y0","y1"];for(l=0;4>l;l++){var _=x[l];if(void 0===m[_]&&void 0!==g[_]){var w,k=_.charAt(0),A=c.Axes.getFromId(t,c.Axes.coerceRef(v,{},t,k)),M=c.Axes.getFromId(t,c.Axes.coerceRef(g,{},t,k)),T=g[_];void 0!==m[k+"ref"]&&(A?(w=i(A)(T),T=(w-A.range[0])/(A.range[1]-A.range[0])):T=(T-M.domain[0])/(M.domain[1]-M.domain[0]),M?(w=M.range[0]+T*(M.range[1]-M.range[0]),T=o(M)(w)):T=A.domain[0]+T*(A.domain[1]-A.domain[0])),g[_]=T}}var E=n(g,d);d.shapes[e]=E;var L={"data-index":String(e),"fill-rule":"evenodd",d:s(t,E)},S=(E.xref+E.yref).replace(/paper/g,""),C=E.line.width?E.line.color:"rgba(0,0,0,0)",z=d._shapelayer.append("path").attr(L).style("opacity",E.opacity).call(c.Color.stroke,C).call(c.Color.fill,E.fillcolor).call(c.Drawing.dashLine,E.line.dash,E.line.width);S&&z.call(c.Drawing.setClipUrl,"clip"+d._uid+S)}};var f=/[MLHVQCTSZ][^MLHVQCTSZ]*/g,d=/[^\s,]+/g,p={M:{0:!0,drawn:0},L:{0:!0,drawn:0},H:{0:!0,drawn:0},V:{},Q:{0:!0,2:!0,drawn:2},C:{0:!0,2:!0,4:!0,drawn:4},T:{0:!0,drawn:0},S:{0:!0,2:!0,drawn:2},Z:{}},g={M:{1:!0,drawn:1},L:{1:!0,drawn:1},H:{},V:{0:!0,drawn:0},Q:{1:!0,3:!0,drawn:3},C:{1:!0,3:!0,5:!0,drawn:5},T:{1:!0,drawn:1},S:{1:!0,3:!0,drawn:5},Z:{}},v={M:2,L:2,H:1,V:1,Q:4,C:6,T:2,S:4,Z:0};h.convertPath=function(t,e,r){return t.replace(f,function(t){var n=0,i=t.charAt(0),o=p[i],a=g[i],s=v[i],l=t.substr(1).replace(d,function(t){return o[n]?t=e(t):a[n]&&(t=r(t)),n++,n>s&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),console.log("ignoring extra params in segment "+t)),i+l})},h.calcAutorange=function(t){var e,r,n,i,o,a=t._fullLayout,s=a.shapes;if(s.length&&t._fullData.length)for(e=0;e<s.length;e++)r=s[e],n=r.line.width/2,"paper"!==r.xref&&(i=c.Axes.getFromId(t,r.xref),o=l(i,r.x0,r.x1,r.path,p),o&&c.Axes.expand(i,o,{ppad:n})),"paper"!==r.yref&&(i=c.Axes.getFromId(t,r.yref),o=l(i,r.y0,r.y1,r.path,g),o&&c.Axes.expand(i,o,{ppad:n}))}},{"../../plotly":365,"./attributes":329,"fast-isnumeric":74}],331:[function(t,e,r){"use strict";var n=t("../../plotly"),i=t("d3"),o=t("fast-isnumeric"),a=n.Plots,s=e.exports={};s.draw=function(t,e){function r(t){n.Lib.syncOrAsync([l,c],t)}function l(e){return e.attr("transform",S?"rotate("+[S.rotate,d.x,d.y]+") translate(0, "+S.offset+")":null),e.style({"font-family":T,"font-size":i.round(E,2)+"px",fill:n.Color.rgb(L),opacity:j*n.Color.opacity(L),"font-weight":a.fontWeight}).attr(d).call(n.util.convertToTspans).attr(d),e.selectAll("tspan.line").attr(d),a.previousPromises(t)}function c(t){var e=i.select(t.node().parentNode);if(C&&C.selection&&C.side&&I){e.attr("transform",null);var r=0,a={left:"right",right:"left",top:"bottom",bottom:"top"}[C.side],s=-1!==["left","top"].indexOf(C.side)?-1:1,l=o(C.pad)?C.pad:2,c=n.Drawing.bBox(e.node()),u={left:0,top:0,right:p.width,bottom:p.height},h=m?p.width:(u[C.side]-c[C.side])*("left"===C.side||"top"===C.side?-1:1);if(0>h?r=h:(c.left-=C.offsetLeft,c.right-=C.offsetLeft,c.top-=C.offsetTop,c.bottom-=C.offsetTop,C.selection.each(function(){var t=n.Drawing.bBox(this);n.Lib.bBoxIntersect(c,t,l)&&(r=Math.max(r,s*(t[C.side]-c[a])+l))}),r=Math.min(h,r)),r>0||0>h){var f={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[C.side];e.attr("transform","translate("+f+")")}}}function u(){j=0,P=!0,I=D,p._infolayer.select("."+e).attr({"data-unformatted":I}).text(I).on("mouseover.opacity",function(){i.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){i.select(this).transition().duration(1e3).style("opacity",0)})}if(!e)return n.Axes.listIds(t).forEach(function(e){s.draw(t,e+"title")}),void s.draw(t,"gtitle");var h,f,d,p=t._fullLayout,g=p._size,v=e.charAt(0),m="cb"===e.substr(1,2);if(m){var y=e.substr(3).replace("title","");t._fullData.some(function(e,r){return e.uid===y?(h=r,f=t.calcdata[r][0].t.cb.axis,!0):void 0})}else f=p[n.Axes.id2name(e.replace("title",""))]||p;var b,x,_,w,k,A=f===p?"title":f._name+".title",M=m?"colorscale":(f._id||v).toUpperCase()+" axis",T=f.titlefont.family,E=f.titlefont.size,L=f.titlefont.color,S="",C={selection:i.select(t).selectAll("g."+f._id+"tick"),side:f.side},z=m?0:1.5;m?(C.offsetLeft=g.l,C.offsetTop=g.t):C.selection.size()&&(k=i.select(C.selection.node().parentNode).attr("transform").match(/translate\(([-\.\d]+),([-\.\d]+)\)/),k&&(C.offsetLeft=+k[1],C.offsetTop=+k[2])),m&&f.titleside?(b=g.l+f.titlex*g.w,x=g.t+(1-f.titley)*g.h+("top"===f.titleside?3+.75*E:-3-.25*E),d={x:b,y:x,"text-anchor":"start"},C={},e="h"+e):"x"===v?(_=f,w="free"===_.anchor?{_offset:g.t+(1-(_.position||0))*g.h,_length:0}:n.Axes.getFromId(t,_.anchor),b=_._offset+_._length/2,x=w._offset+("top"===_.side?-10-E*(z+(_.showticklabels?1:0)):w._length+10+E*(z+(_.showticklabels?1.5:.5))),d={x:b,y:x,"text-anchor":"middle"},C.side||(C.side="bottom")):"y"===v?(w=f,_="free"===w.anchor?{_offset:g.l+(w.position||0)*g.w,_length:0}:n.Axes.getFromId(t,w.anchor),x=w._offset+w._length/2,b=_._offset+("right"===w.side?_._length+10+E*(z+(w.showticklabels?1:.5)):-10-E*(z+(w.showticklabels?.5:0))),d={x:b,y:x,"text-anchor":"middle"},S={rotate:"-90",offset:0},C.side||(C.side="left")):(M="Plot",E=p.titlefont.size,b=p.width/2,x=p._size.t/2,d={x:b,y:x,"text-anchor":"middle"},C={});var j=1,P=!1,I=f.title.trim();""===I&&(j=0),I.match(/Click to enter .+ title/)&&(j=.2,P=!0);var R;if(m){R=i.select(t).selectAll("."+f._id.substr(1)+" .cbtitle");var O="h"===e.charAt(0)?e.substr(1):"h"+e;R.selectAll("."+O+",."+O+"-math-group").remove()}else R=p._infolayer.selectAll(".g-"+e).data([0]),R.enter().append("g").classed("g-"+e,!0);var N=R.selectAll("text").data([0]);N.enter().append("text"),N.text(I).attr("class",e),N.attr({"data-unformatted":I}).call(r);var D="Click to enter "+M.replace(/\d+/,"")+" title";t._context.editable?(I||u(),N.call(n.util.makeEditable).on("edit",function(e){if(m){var r=t._fullData[h];a.traceIs(r,"markerColorscale")?n.restyle(t,"marker.colorbar.title",e,h):n.restyle(t,"colorbar.title",e,h)}else n.relayout(t,A,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(r)}).on("input",function(t){this.text(t||" ").attr(d).selectAll("tspan.line").attr(d)})):(!I||I.match(/Click to enter .+ title/))&&N.remove(),N.classed("js-placeholder",P)}},{"../../plotly":365,d3:70,"fast-isnumeric":74}],332:[function(t,e,r){"use strict";e.exports={DZA:"algeria",AGO:"angola",EGY:"egypt",BGD:"bangladesh|^(?=.*east).*paki?stan",NER:"\\bniger(?!ia)",LIE:"liechtenstein",NAM:"namibia",BGR:"bulgaria",BOL:"bolivia",GHA:"ghana|gold.?coast",CCK:"\\bcocos|keeling",PAK:"^(?!.*east).*paki?stan",CPV:"verde",JOR:"jordan",LBR:"liberia",LBY:"libya",MYS:"malaysia",IOT:"british.?indian.?ocean",PRI:"puerto.?rico",MYT:"mayotte",PRK:"^(?=.*democrat).*\\bkorea|^(?=.*people).*\\bkorea|^(?=.*north).*\\bkorea|\\bd\\.?p\\.?r\\.?k",PSE:"palestin|\\bgaza|west.?bank",TZA:"tanzania",BWA:"botswana|bechuana",KHM:"cambodia|kampuchea|khmer|^p\\.?r\\.?k\\.?$",UMI:"minor.?outlying.?is",TTO:"trinidad|tobago",PRY:"paraguay",HKG:"hong.?kong",SAU:"\\bsa\\w*.?arabia",LBN:"lebanon",SVN:"slovenia",BFA:"burkina|\\bfaso|upper.?volta",SVK:"^(?!.*cze).*slovak",MRT:"mauritania",HRV:"croatia",CHL:"\\bchile",CHN:"^(?!.*\\bmac)(?!.*\\bhong)(?!.*\\btai).*china|^p\\.?r\\.?c\\.?$",KNA:"kitts|\\bnevis",JAM:"jamaica",SMR:"san.?marino",GIB:"gibraltar",DJI:"djibouti",GIN:"^(?!.*eq)(?!.*span)(?!.*bissau)(?!.*portu)(?!.*new).*guinea",FIN:"finland",URY:"uruguay",VAT:"holy.?see|vatican|papal.?st",STP:"\\bs(a|\xe3)o.?tom(e|\xe9)",SYC:"seychell",NPL:"nepal",CXR:"christmas",LAO:"\\blaos?\\b",YEM:"^(?!.*arab)(?!.*north)(?!.*sana)(?!.*peo)(?!.*dem)(?!.*south)(?!.*aden)(?!.*\\bp\\.?d\\.?r).*yemen",BVT:"bouvet",ZAF:"\\bs\\w*.?africa",KIR:"kiribati",PHL:"philippines",SXM:"^(?!.*martin)(?!.*saba).*maarten",ROU:"r(o|u|ou)mania",VIR:"^(?=.*\\bu\\.?\\s?s).*virgin|^(?=.*states).*virgin",SYR:"syria",MAC:"maca(o|u)",NFK:"norfolk",NIC:"nicaragua",MLT:"\\bmalta",KAZ:"kazak",TCA:"turks",PYF:"french.?polynesia|tahiti",NIU:"niue",DMA:"dominica(?!n)",GBR:"united.?kingdom|britain|^u\\.?k\\.?$",BEN:"benin|dahome",GUF:"^(?=.*french).*guiana",BEL:"^(?!.*luxem).*belgium",MSR:"montserrat",TGO:"togo",DEU:"^(?!.*east).*germany|^(?=.*\\bfed.*\\brep).*german",GUM:"\\bguam",LKA:"sri.?lanka|ceylon",SSD:"\\bs\\w*.?sudan",FLK:"falkland|malvinas",PCN:"pitcairn",BES:"^(?=.*bonaire).*eustatius|^(?=.*carib).*netherlands|\\bbes.?islands",GUY:"guyana|british.?guiana",CRI:"costa.?rica",COK:"\\bcook",MAR:"morocco|\\bmaroc",MNP:"mariana",LSO:"lesotho|basuto",HUN:"^(?!.*austr).*hungary",TKM:"turkmen",SUR:"surinam|dutch.?guiana",NLD:"^(?!.*\\bant)(?!.*\\bcarib).*netherlands",BMU:"bermuda",HMD:"heard.*mcdonald",TCD:"\\bchad",GEO:"^(?!.*south).*georgia",MNE:"^(?!.*serbia).*montenegro",MNG:"mongolia",MHL:"marshall",MTQ:"martinique",CSK:"czechoslovakia",BLZ:"belize|^(?=.*british).*honduras",DDR:"german.?democratic.?republic|^(d|g)\\.?d\\.?r\\.?$|^(?=.*east).*germany",MMR:"myanmar|burma",AFG:"afghan",BDI:"burundi",VGB:"^(?=.*\\bu\\.?\\s?k).*virgin|^(?=.*brit).*virgin|^(?=.*kingdom).*virgin",BLR:"belarus|byelo",BLM:"barth(e|\xe9)lemy",GRD:"grenada",TKL:"tokelau",GRC:"greece|hellenic|hellas",GRL:"greenland",SHN:"helena",AND:"andorra",MOZ:"mozambique",TJK:"tajik",THA:"thailand|\\bsiam",HTI:"haiti",MEX:"\\bmexic",ANT:"^(?=.*\\bant).*(nether|dutch)",ZWE:"zimbabwe|^(?!.*northern).*rhodesia",LCA:"\\blucia",IND:"india(?!.*ocea)",LVA:"latvia",BTN:"bhutan",VCT:"vincent",VNM:"^(?!.*republic).*viet.?nam|^(?=.*socialist).*viet.?nam",NOR:"norway",CZE:"^(?=.*rep).*czech|czechia|bohemia",ATF:"french.?southern|\\bfr.*\\bso.*\\ban.*\\b\\bt",ATG:"antigua",FJI:"fiji",HND:"^(?!.*brit).*honduras",MUS:"mauritius",DOM:"dominican",LUX:"^(?!.*belg).*luxem",ISR:"israel",YUG:"yugoslavia",FSM:"micronesia",PER:"peru",REU:"r(e|\xe9)union",IDN:"indonesia",VUT:"vanuatu|new.?hebrides",MKD:"macedonia|^f\\.?y\\.?r\\.?o\\.?m\\.?$",COD:"\\bdem.*congo|congo.*\\bdem|congo.*\\bdr|\\bdr.*congo|\\bd\\.?r\\.?c|\\bd\\.?r\\.?o\\.?c|\\br\\.?d\\.?c|belgian.?congo|congo.?free.?state|kinshasa|zaire|l\\w{1,2}opoldville",COG:"^(?!.*\\bdem)(?!.*\\bdr)(?!.*kinshasa)(?!.*zaire)(?!.*belg)(?!.*l\\w{1,2}opoldville)(?!.*free).*\\bcongo",ISL:"iceland",GLP:"guadeloupe",ETH:"ethiopia|abyssinia",COM:"comoro",COL:"colombia",NGA:"nigeria",TLS:"^(?=.*leste).*timor|^(?=.*east).*timor",TWN:"taiwan|taipei|formosa",PRT:"portugal",MDA:"moldov|b(a|e)ssarabia",GGY:"guernsey",MDG:"madagascar|malagasy",ATA:"antarctica",ECU:"ecuador",SEN:"senegal",ESH:"sahara",MDV:"maldive",ASM:"^(?=.*americ).*samoa",SPM:"miquelon",CUW:"^(?!.*bonaire).*\\bcura(c|\xe7)ao",FRA:"^(?!.*\\bdep)(?!.*martinique).*france|french.?republic|\\bgaul",LTU:"lithuania",RWA:"rwanda",ZMB:"zambia|northern.?rhodesia",GMB:"gambia",WLF:"futuna|wallis",JEY:"jersey",FRO:"faroe|faeroe",GTM:"guatemala",DNK:"denmark",IMN:"^(?=.*isle).*\\bman",MAF:"^(?=.*collectivity).*martin|^(?=.*france).*martin(?!ique)|^(?=.*french).*martin(?!ique)",AUS:"australia",AUT:"^(?!.*hungary).*austria|\\baust.*\\bemp",SJM:"svalbard",VEN:"venezuela",PLW:"palau",KEN:"kenya|british.?east.?africa|east.?africa.?prot",TUR:"turkey",ALB:"albania",OMN:"\\boman|trucial",TUV:"tuvalu",ALA:"\\b(a|\xe5)land",BRN:"brunei",TUN:"tunisia",RUS:"\\brussia|soviet.?union|u\\.?s\\.?s\\.?r|socialist.?republics",BRB:"barbados",BRA:"brazil",CIV:"ivoire|ivory",SRB:"^(?!.*monte).*serbia",GNQ:"guine.*eq|eq.*guine|^(?=.*span).*guinea",USA:"^(?!.*islands).*united.?states|^u\\.?s\\.?a\\.?$|^u\\.?s\\.?$",QAT:"qatar",WSM:"^(?!.*amer).*samoa",AZE:"azerbaijan",GNB:"bissau|^(?=.*portu).*guinea",SWZ:"swaziland",TON:"tonga",CAN:"canada",UKR:"ukrain",KOR:"^(?!.*democrat)(?!.*people)(?!.*north).*\\bkorea|\\br\\.?o\\.?k\\b",AIA:"anguill?a",CAF:"\\bcen.*\\baf|^c\\.?a\\.?r\\.?$",CHE:"switz|swiss",CYP:"cyprus",BIH:"herzegovina|bosnia",SGP:"singapore",SGS:"south.?georgia|sandwich",SOM:"somali",UZB:"uzbek",CMR:"cameroon",POL:"poland",EAZ:"zanz",KWT:"kuwait",ERI:"eritrea",GAB:"gabon",CYM:"cayman",ARE:"emirates|^u\\.?a\\.?e\\.?$|united.?arab.?em",EST:"estonia",MWI:"malawi|nyasa",ESP:"spain",IRQ:"\\biraq|mesopotamia",SLV:"el.?salvador",MLI:"\\bmali\\b",YMD:"^(?=.*peo).*yemen|^(?!.*rep)(?=.*dem).*yemen|^(?=.*south).*yemen|^(?=.*aden).*yemen|^(?=.*\\bp\\.?d\\.?r).*yemen",IRL:"ireland",IRN:"\\biran|persia",
ABW:"^(?!.*bonaire).*\\baruba",SLE:"sierra",PAN:"panama",SDN:"^(?!.*\\bs(?!u)).*sudan",SLB:"solomon",NZL:"new.?zealand",MCO:"monaco",ITA:"italy",JPN:"japan",KGZ:"kyrgyz|kirghiz",UGA:"uganda",NCL:"new.?caledonia",PNG:"papua|\\bp.*\\bn.*\\bguin.*|^p\\.?n\\.?g\\.?$|new.?guinea",ARG:"argentin",SWE:"sweden",BHS:"bahamas",BHR:"bahrain",ARM:"armenia",NRU:"nauru",CUB:"\\bcuba"}},{}],333:[function(t,e,r){"use strict";var n=e.exports={};n.projNames={equirectangular:"equirectangular",mercator:"mercator",orthographic:"orthographic","natural earth":"naturalEarth",kavrayskiy7:"kavrayskiy7",miller:"miller",robinson:"robinson",eckert4:"eckert4","azimuthal equal area":"azimuthalEqualArea","azimuthal equidistant":"azimuthalEquidistant","conic equal area":"conicEqualArea","conic conformal":"conicConformal","conic equidistant":"conicEquidistant",gnomonic:"gnomonic",stereographic:"stereographic",mollweide:"mollweide",hammer:"hammer","transverse mercator":"transverseMercator","albers usa":"albersUsa"},n.axesNames=["lonaxis","lataxis"],n.lonaxisSpan={orthographic:180,"azimuthal equal area":360,"azimuthal equidistant":360,"conic conformal":180,gnomonic:160,stereographic:180,"transverse mercator":180,"*":360},n.lataxisSpan={"conic conformal":150,stereographic:179.5,"*":180},n.scopeDefaults={world:{lonaxisRange:[-180,180],lataxisRange:[-90,90],projType:"equirectangular",projRotate:[0,0,0]},usa:{lonaxisRange:[-180,-50],lataxisRange:[15,80],projType:"albers usa"},europe:{lonaxisRange:[-30,60],lataxisRange:[30,80],projType:"conic conformal",projRotate:[15,0,0],projParallels:[0,60]},asia:{lonaxisRange:[22,160],lataxisRange:[-15,55],projType:"mercator",projRotate:[0,0,0]},africa:{lonaxisRange:[-30,60],lataxisRange:[-40,40],projType:"mercator",projRotate:[0,0,0]},"north america":{lonaxisRange:[-180,-45],lataxisRange:[5,85],projType:"conic conformal",projRotate:[-100,0,0],projParallels:[29.5,45.5]},"south america":{lonaxisRange:[-100,-30],lataxisRange:[-60,15],projType:"mercator",projRotate:[0,0,0]}},n.clipPad=.001,n.precision=.1,n.landColor="#F0DC82",n.waterColor="#3399FF",n.locationmodeToLayer={"ISO-3":"countries","USA-states":"subunits","country names":"countries"},n.sphereSVG={type:"Sphere"},n.fillLayers=["ocean","land","lakes"],n.lineLayers=["subunits","countries","coastlines","rivers","frame"],n.baseLayers=["ocean","land","lakes","subunits","countries","coastlines","rivers","lataxis","lonaxis","frame"],n.layerNameToAdjective={ocean:"ocean",land:"land",lakes:"lake",subunits:"subunit",countries:"country",coastlines:"coastline",rivers:"river",frame:"frame"},n.baseLayersOverChoropleth=["rivers","lakes"]},{}],334:[function(t,e,r){"use strict";e.exports={solid:[1],dot:[1,1],dash:[4,1],longdash:[8,1],dashdot:[4,1,1,1],longdashdot:[8,1,1,1]}},{}],335:[function(t,e,r){"use strict";e.exports={solid:[[],0],dot:[[.5,1],200],dash:[[.5,1],50],longdash:[[.5,1],10],dashdot:[[.5,.625,.875,1],50],longdashdot:[[.5,.7,.8,1],10]}},{}],336:[function(t,e,r){"use strict";e.exports={circle:"\u25cf","circle-open":"\u25cb",square:"\u25a0","square-open":"\u25a1",diamond:"\u25c6","diamond-open":"\u25c7",cross:"+",x:"\u274c"}},{}],337:[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}},{}],338:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.5.0",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.setPlotConfig=t("./plot_api/set_plot_config"),r.register=n.register,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":364,"./plotly":365,d3:70}],339:[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},{}],340:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){Array.isArray(t)&&(e[r]=t[n])}},{}],341:[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"));r.valObjects={data_array:{description:["An {array} of data.","The value MUST be an {array}, or we ignore it."].join(" "),requiredOpts:[],otherOpts:["dflt"],coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{description:["Enumerated value type. The available values are listed","in `values`."].join(" "),requiredOpts:["values"],otherOpts:["dflt","coerceNumber","arrayOk"],coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),-1===n.values.indexOf(t)?e.set(r):e.set(t)}},"boolean":{requiredOpts:[],otherOpts:["dflt"],coerceFunction:function(t,e,r){t===!0||t===!1?e.set(t):e.set(r)}},number:{description:["A number or a numeric value","(e.g. a number inside a string).","When applicable, values greater (less) than `max` (`min`)","are coerced to the `dflt`."].join(" "),requiredOpts:[],otherOpts:["dflt","min","max","arrayOk"],coerceFunction:function(t,e,r,i){!n(t)||void 0!==i.min&&t<i.min||void 0!==i.max&&t>i.max?e.set(r):e.set(+t)}},integer:{description:["An integer or an integer inside a string.","When applicable, values greater (less) than `max` (`min`)","are coerced to the `dflt`."].join(" "),requiredOpts:[],otherOpts:["dflt","min","max"],coerceFunction:function(t,e,r,i){t%1||!n(t)||void 0!==i.min&&t<i.min||void 0!==i.max&&t>i.max?e.set(r):e.set(+t)}},string:{description:["A string value.","Numbers are converted to strings except for attributes with","`strict` set to true."].join(" "),requiredOpts:[],otherOpts:["dflt","noBlank","strict","arrayOk","values"],coerceFunction:function(t,e,r,n){if(n.strict===!0&&"string"!=typeof t)return void e.set(r);var i=String(t);void 0===t||n.noBlank===!0&&!i?e.set(r):e.set(i)}},color:{description:["A string describing color.","Supported formats:","- hex (e.g. '#d3d3d3')","- rgb (e.g. 'rgb(255, 0, 0)')","- rgba (e.g. 'rgb(255, 0, 0, 0.5)')","- hsl (e.g. 'hsl(0, 100%, 50%)')","- hsv (e.g. 'hsv(0, 100%, 100%)')","- named colors (full list: http://www.w3.org/TR/css3-color/#svg-color)"].join(" "),requiredOpts:[],otherOpts:["dflt","arrayOk"],coerceFunction:function(t,e,r){i(t).isValid()?e.set(t):e.set(r)}},colorscale:{description:["A Plotly colorscale either picked by a name:","(any of",s.join(", "),")","customized as an {array} of 2-element {arrays} where","the first element is the normalized color level value","(starting at *0* and ending at *1*),","and the second item is a valid color string."].join(" "),requiredOpts:[],otherOpts:["dflt"],coerceFunction:function(t,e,r){e.set(a(t,r))}},angle:{description:["A number (in degree) between -180 and 180."].join(" "),requiredOpts:[],otherOpts:["dflt"],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)}},axisid:{description:["An axis id string (e.g. 'x', 'x2', 'x3', ...)."].join(" "),requiredOpts:[],otherOpts:["dflt"],coerceFunction:function(t,e,r){if("string"==typeof t&&t.charAt(0)===r){var n=Number(t.substr(1));if(n%1===0&&n>1)return void e.set(t)}e.set(r)}},sceneid:{description:["A scene id string (e.g. 'scene', 'scene2', 'scene3', ...)."].join(" "),requiredOpts:[],otherOpts:["dflt"],coerceFunction:function(t,e,r){if("string"==typeof t&&t.substr(0,5)===r){var n=Number(t.substr(5));if(n%1===0&&n>1)return void e.set(t)}e.set(r)}},geoid:{description:["A geo id string (e.g. 'geo', 'geo2', 'geo3', ...)."].join(" "),requiredOpts:[],otherOpts:["dflt"],coerceFunction:function(t,e,r){if("string"==typeof t&&t.substr(0,3)===r){var n=Number(t.substr(3));if(n%1===0&&n>1)return void e.set(t)}e.set(r)}},flaglist:{description:["A string representing a combination of flags","(order does not matter here).","Combine any of the available `flags` with *+*.","(e.g. ('lines+markers')).","Values in `extras` cannot be combined."].join(" "),requiredOpts:["flags"],otherOpts:["dflt","extras"],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;o<i.length;){var a=i[o];-1===n.flags.indexOf(a)||i.indexOf(a)<o?i.splice(o,1):o++}i.length?e.set(i.join("+")):e.set(r)}},any:{requiredOpts:[],otherOpts:["dflt"],coerceFunction:function(t,e,r){void 0===t?e.set(r):e.set(t)}},info_array:{description:["An {array} of plot information."].join(" "),requiredOpts:["items"],otherOpts:["dflt"],coerceFunction:function(t,e,n,i){if(!Array.isArray(t))return void e.set(n);var o=i.items,a=[];n=Array.isArray(n)?n:[];for(var s=0;s<o.length;s++)r.coerce(t,a,o,"["+s+"]",n[s]);e.set(a)}}},r.coerce=function(t,e,n,i,a){var s=o(n,i).get(),l=o(t,i),c=o(e,i),u=l.get();return void 0===a&&(a=s.dflt),s.arrayOk&&Array.isArray(u)?(c.set(u),u):(r.valObjects[s.valType].coerceFunction(u,c,a,s),c.get())},r.coerce2=function(t,e,n,i,a){var s=o(t,i),l=r.coerce(t,e,n,i,a);return s.get()?l:!1},r.coerceFont=function(t,e,r){var n={};return r=r||{},n.family=t(e+".family",r.family),n.size=t(e+".size",r.size),n.color=t(e+".color",r.color),n}},{"../components/colorscale/get_scale":310,"../components/colorscale/scales":316,"./nested_property":351,"fast-isnumeric":74,tinycolor2:229}],342:[function(t,e,r){"use strict";function n(t,e){return String(t+Math.pow(10,e)).substr(1)}function i(t){var e;return e=y.test(t)?"Y":"y",e+=b.test(t)?"b":""}function o(t){var e;return e=_.test(t)?x.test(t)?"I":"H":"D"}var a=t("d3"),s=t("fast-isnumeric");r.dateTime2ms=function(t){try{if(t.getTime)return+t}catch(e){return!1}var r,n,i,o,a=String(t).split(" ");if(a.length>2)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 c=(new Date).getFullYear();r=((Number(l[0])-c+70)%100+200)%100+c-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 console.log("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 l={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"]},u=a.time.format.utc,h={Y:{H:["%Y~%m~%dT%H:%M:%S","%Y~%m~%dT%H:%M:%S~%L"].map(u),I:[],D:["%Y%m%d%H%M%S","%Y~%m","%m~%Y"].map(u)},Yb:{H:[],I:[],D:["%Y~%b","%b~%Y"].map(u)},y:{H:[],I:[],D:[]},yb:{H:[],I:[],D:[]}};["Y","Yb","y","yb"].forEach(function(t){c[t].forEach(function(e){h[t].D.push(u(e)),["H","I","D"].forEach(function(r){l[r].forEach(function(n){var i=h[t][r];i.push(u(e+"~"+n)),i.push(u(n+"~"+e))})})})});var f=/[a-z]*/g,d=function(t){return t.substr(0,3)},p=/(mon|tue|wed|thu|fri|sat|sun|the|of|st|nd|rd|th)/g,g=/[\s,\/\-\.\(\)]+/g,v=/~?([ap])~?m(~|$)/,m=function(t,e){return e+"m "},y=/\d\d\d\d/,b=/(^|~)[a-z]{3}/,x=/[ap]m/,_=/:/,w=/q([1-4])/,k=["31~mar","30~jun","30~sep","31~dec"],A=function(t,e){return k[e-1]},M=/ ?([+\-]\d\d:?\d\d|Z)$/;r.parseDate=function(t){if(t.getTime)return t;if("string"!=typeof t)return!1;t=t.toLowerCase().replace(f,d).replace(p,"").replace(g,"~").replace(v,m).replace(w,A).trim().replace(M,"");var e,r,n=null,a=i(t),s=o(t);e=h[a][s],r=e.length;for(var l=0;r>l&&!(n=e[l].parse(t));l++);if(!(n instanceof Date))return!1;var c=n.getTimezoneOffset();return n.setTime(n.getTime()+60*c*1e3),n}},{d3:70,"fast-isnumeric":74}],343:[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 $&&$(t).trigger(r,n),e.emit(r,n)},t},triggerHandler:function(t,e,r){var n,i;"undefined"!=typeof $&&(n=$(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;l<a.length;l++)a[l](r);return i=s(r),void 0!==n?n:i}};e.exports=i},{events:54}],344:[function(t,e,r){"use strict";function n(t,e,r){for(var a,s,l,c,u,h,f=t[0],d=t.length,p=1;d>p;p++){a=t[p];for(s in a)l=f[s],c=a[s],e&&c&&(i(c)||(u=o(c)))?(u?(u=!1,h=l&&o(l)?l:[]):h=l&&i(l)?l:{},f[s]=n([h,c],e,r)):("undefined"!=typeof c||r)&&(f[s]=c)}return f}var i=t("./is_plain_object.js"),o=Array.isArray;r.extendFlat=function(){return n(arguments,!1,!1)},r.extendDeep=function(){return n(arguments,!0,!1)},r.extendDeepAll=function(){return n(arguments,!0,!0)}},{"./is_plain_object.js":349}],345:[function(t,e,r){"use strict";function n(t,e){var r=c[t];return r(e)}function i(t){for(var e,r,n=0;n<l.length;n++)if(e=l[n],r=new RegExp(s[e]),r.test(t.toLowerCase()))return e;console.warn("unrecognized country name: "+t+".")}var o=e.exports={},a=t("../plotly"),s=t("../constants/country-name_to_iso3"),l=Object.keys(s),c={"ISO-3":a.Lib.identity,"USA-states":a.Lib.identity,"country names":i};o.locationToFeature=function(t,e,r){for(var i,o=n(t,e),a=0;a<r.length;a++)if(i=r[a],i.id===o)return i;console.warn(["location with id",o,"does not have a matching topojson feature at this resolution."].join(" "))}},{"../constants/country-name_to_iso3":332,"../plotly":365}],346:[function(t,e,r){"use strict";function n(t,e){var r=u(t);return r[3]*=e,r}function i(t){return l(t).isValid()?t:h}function o(t){return c(t)?t:f}function a(t,e,r){var a,l,c,u,d,p=t.color,g=Array.isArray(p),v=Array.isArray(e),m=[];if(a=void 0!==t.colorscale?s.Colorscale.makeScaleFunction(t.colorscale,t.cmin,t.cmax):i,l=g?function(t,e){return void 0===t[e]?h:a(t[e])}:i,c=v?function(t,e){return void 0===t[e]?f:o(t[e])}:o,g||v)for(var y=0;r>y;y++)u=l(p,y),d=c(e,y),m[y]=n(u,d);else m=n(p,e);return m}var s=t("../plotly"),l=t("tinycolor2"),c=t("fast-isnumeric"),u=t("./str2rgbarray"),h=t("../components/color/attributes").defaultLine,f=1;e.exports=a},{"../components/color/attributes":298,"../plotly":365,"./str2rgbarray":358,"fast-isnumeric":74,tinycolor2:229}],347:[function(t,e,r){"use strict";function n(t){for(var e=0;(e=t.indexOf("<sup>",e))>=0;){var r=t.indexOf("</sup>",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(/\<br\>/g,"\n")}function o(t){return t.replace(/\<.*\>/g,"")}function a(t){for(var e=0;(e=t.indexOf("&",e))>=0;){var r=t.indexOf(";",e);if(e>r)e+=1;else{var n=c[t.slice(e+1,r)];t=n?t.slice(0,e)+n+t.slice(r+1):t.slice(0,e)+t.slice(r+1)}}return t}function s(t){return""+a(o(n(i(t))))}var l=t("superscript-text"),c={mu:"\u03bc",amp:"&",lt:"<",gt:">"};e.exports=s},{"superscript-text":218}],348:[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;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 c=t("./matrix");i.init2dArray=c.init2dArray,i.transposeRagged=c.transposeRagged,i.dot=c.dot,i.translationMatrix=c.translationMatrix,i.rotationMatrix=c.rotationMatrix,i.rotationXYMatrix=c.rotationXYMatrix,i.apply2DTransform=c.apply2DTransform,i.apply2DTransform2=c.apply2DTransform2;var u=t("./extend");i.extendFlat=u.extendFlat,i.extendDeep=u.extendDeep,i.extendDeepAll=u.extendDeepAll,i.notifier=t("./notifier"),i.swapAttrs=function(t,e,r,n){r||(r="x"),n||(n="y");for(var o=0;o<e.length;o++){var a=e[o],s=i.nestedProperty(t,a.replace("?",r)),l=i.nestedProperty(t,a.replace("?",n)),c=s.get();s.set(l.get()),l.set(c)}},i.pauseEvent=function(t){return t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),t.cancelBubble=!0,!1},i.VERBOSE=!1,i.TIMER=(new Date).getTime(),i.log=function(){i.VERBOSE&&console.log.apply(console,arguments)},i.markTime=function(t){if(i.VERBOSE){var e=(new Date).getTime();console.log(t,e-i.TIMER,"(msec)"),"trace"===i.VERBOSE&&console.trace(),i.TIMER=e}},i.constrain=function(t,e,r){return e>r?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 h(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<Math.floor(a);n++)o=Math.floor(Math.random()*r).toString(r),s=o+s;l&&(i=Math.pow(r,l),o=Math.floor(Math.random()*i).toString(r),s=o+s);var c=parseInt(s,r);return t&&t.indexOf(s)>-1||c!==1/0&&c>=Math.pow(2,e)?h(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,c=new Array(l),u=new Array(a);for(r=0;l>r;r++)c[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]*c[n];u[r]=o}return u},i.promiseError=function(t){console.log(t,t.stack)},i.syncOrAsync=function(t,e,r){function n(){return i.markTime("async done "+a.name),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);i.markTime("sync done "+a.name)}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;n<r.length;n++)i=t[r[n]],void 0!==i&&null!==i?o=!0:a=!1;if(o&&!a)for(n=0;n<r.length;n++)t[r[n]]=e[r[n]]}},i.mergeArray=function(t,e,r){if(Array.isArray(t))for(var n=Math.min(t.length,e.length),i=0;n>i;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;n<l.length;n++)o=l[n],a=t[o],"_"!==o.charAt(0)&&"function"!=typeof a&&("module"===o?r[o]=a:Array.isArray(a)?r[o]=a.slice(0,s):a&&"object"==typeof a?r[o]=i.minExtend(t[o],e[o]):r[o]=a);for(l=Object.keys(e),n=0;n<l.length;n++)o=l[n],a=e[o],"object"==typeof a&&o in r&&"object"==typeof r[o]||(r[o]=a);return r},i.titleCase=function(t){return t.charAt(0).toUpperCase()+t.substr(1)},i.containsAny=function(t,e){for(var r=0;r<e.length;r++)if(-1!==t.indexOf(e[r]))return!0;return!1},i.getPlotDiv=function(t){for(;t&&t.removeAttribute;t=t.parentNode)if(i.isPlotDiv(t))return t},i.isPlotDiv=function(t){var e=n.select(t);return e.size()&&e.classed("js-plotly-plot")},i.removeElement=function(t){var e=t&&t.parentNode;e&&e.removeChild(t)},i.addStyleRule=function(t,e){if(!i.styleSheet){var r=document.createElement("style");r.appendChild(document.createTextNode("")),document.head.appendChild(r),i.styleSheet=r.sheet}var n=i.styleSheet;n.insertRule?n.insertRule(t+"{"+e+"}",0):n.addRule?n.addRule(t,e,0):console.warn("addStyleRule failed")},i.isIE=function(){return"undefined"!=typeof window.navigator.msSaveBlob}},{"./coerce":341,"./dates":342,"./extend":344,"./is_plain_object":349,"./matrix":350,"./nested_property":351,"./notifier":352,"./search":355,"./stats":357,d3:70}],349:[function(t,e,r){"use strict";e.exports=function(t){return"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],350:[function(t,e,r){"use strict";r.init2dArray=function(t,e){for(var r=new Array(t),n=0;t>n;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;i<a.length;i++)n[i]=r.dot(t,a[i])}else for(n=0,i=0;o>i;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)))}}},{}],351:[function(t,e,r){"use strict";function n(t,e){return function(){var r,i,o,a,s,l=t;for(a=0;a<e.length-1;a++){if(r=e[a],-1===r){for(i=!0,o=[],s=0;s<l.length;s++)o[s]=n(l[s],e.slice(a+1))(),o[s]!==o[0]&&(i=!1);return i?o[0]:o}if("number"==typeof r&&!Array.isArray(l))return;if(l=l[r],"object"!=typeof l||null===l)return}if("object"==typeof l&&null!==l&&(o=l[e[a]],null!==o))return o}}function i(t,e){var r=["annotations","shapes","range","domain"],n=-1===r.indexOf(e);return Array.isArray(t)&&n}function o(t,e){return function(r){var n,o,u=t,h=[t],f=c(r)&&!i(r,e[e.length-1]);for(o=0;o<e.length-1;o++){if(n=e[o],"number"==typeof n&&!Array.isArray(u))throw"array index but container is not an array";if(-1===n){if(f=!a(u,e.slice(o+1),r))break;return}if(!s(u,n,e[o+1],f))break;if(u=u[n],"object"!=typeof u||null===u)throw"container is not an object";h.push(u)}f?(o===e.length-1&&delete u[e[o]],l(h)):u[e[o]]=r}}function a(t,e,r){var n,i=Array.isArray(r),a=!0,l=r,u=i?!1:c(r),h=e[0];for(n=0;n<t.length;n++)i&&(l=r[n%r.length],u=c(l)),u&&(a=!1),s(t,n,h,u)&&o(t[n],e)(l);return a}function s(t,e,r,n){if(void 0===t[e]){if(n)return!1;"number"==typeof r?t[e]=[]:t[e]={}}return!0}function l(t){var e,r,n,o,a;for(e=t.length-1;e>=0;e--){if(n=t[e],a=!1,Array.isArray(n))for(r=n.length-1;r>=0;r--)c(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--)c(n[o[r]])&&!i(n[o[r]],o[r])?delete n[o[r]]:a=!0;if(a)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,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(".");s<l.length;){if(r=String(l[s]).match(/^([^\[\]]*)((\[\-?[0-9]*\])+)$/)){if(r[1])l[s]=r[1];else{if(0!==s)throw"bad property string";l.splice(0,1)}for(i=r[2].substr(1,r[2].length-2).split("]["),a=0;a<i.length;a++)s++,l.splice(s,0,Number(i[a]))}s++}return"object"!=typeof t?u(t,e,l):{set:o(t,l),get:n(t,l),astr:e,parts:l,obj:t}}},{"fast-isnumeric":74}],352:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),o=[];e.exports=function(t,e){function r(t){t.duration(700).style("opacity",0).each("end",function(t){var e=o.indexOf(t);-1!==e&&o.splice(e,1),n.select(this).remove()})}if(-1===o.indexOf(t)){o.push(t);var a=1e3;i(e)?a=e:"long"===e&&(a=3e3);var s=n.select("body").selectAll(".plotly-notifier").data([0]);s.enter().append("div").classed("plotly-notifier",!0);var l=s.selectAll(".notifier-note").data(o);l.enter().append("div").classed("notifier-note",!0).style("opacity",0).each(function(t){var e=n.select(this);e.append("button").classed("notifier-close",!0).html("&times;").on("click",function(){e.transition().call(r)}),e.append("p").html(t),e.transition().duration(700).style("opacity",1).transition().delay(a).call(r)})}}},{d3:70,"fast-isnumeric":74}],353:[function(t,e,r){"use strict";var n=t("./matrix").dot,i=e.exports={};i.tester=function(t){function e(t,e){var r=t[0],n=t[1];return i>r||r>o||a>n||n>s?!1:e&&c(t)?!1:!0}function r(t,e){var r=t[0],l=t[1];if(i>r||r>o||a>l||l>s)return!1;var c,u,h,f,d,p=n.length,g=n[0][0],v=n[0][1],m=0;for(c=1;p>c;c++)if(u=g,h=v,g=n[c][0],v=n[c][1],f=Math.min(u,g),!(f>r||r>Math.max(u,g)||l>Math.max(h,v)))if(l<Math.min(h,v))r!==f&&m++;else{if(d=g===u?l:h+(r-u)*(v-h)/(g-u),l===d)return 1===c&&e?!1:!0;d>=l&&r!==f&&m++}return m%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;l<n.length;l++)i=Math.min(i,n[l][0]),o=Math.max(o,n[l][0]),a=Math.min(a,n[l][1]),s=Math.max(s,n[l][1]);var c,u=!1;return 5===n.length&&(n[0][0]===n[1][0]?n[2][0]===n[3][0]&&n[0][1]===n[3][1]&&n[1][1]===n[2][1]&&(u=!0,c=function(t){return t[0]===n[0][0]}):n[0][1]===n[1][1]&&n[2][1]===n[3][1]&&n[0][0]===n[3][0]&&n[1][0]===n[2][0]&&(u=!0,c=function(t){return t[1]===n[0][1]})),{xmin:i,xmax:o,ymin:a,ymax:s,pts:n,contains:u?e:r,isRect:u}};var o=i.isSegmentBent=function(t,e,r,i){var o,a,s,l=t[e],c=[t[r][0]-l[0],t[r][1]-l[1]],u=n(c,c),h=Math.sqrt(u),f=[-c[1]/h,c[0]/h];for(o=e+1;r>o;o++)if(a=[t[o][0]-l[0],t[o][1]-l[1]],s=n(a,c),0>s||s>u||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 c=l+1;c<t.length;c++)(c===t.length-1||o(t,l,c+1,e))&&(n.push(t[c]),n.length<s-2&&(i=c,a=n.length-1),l=c)}var n=[t[0]],i=0,a=0;if(t.length>1){var s=t.pop();r(s)}return{addPt:r,raw:t,filtered:n}}},{"./matrix":350}],354:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],o=0;o<e.length;o++)r=e[o],r===t?n[o]=r:"object"==typeof r?n[o]=Array.isArray(r)?i.Lib.extendDeep([],r):i.Lib.extendDeepAll({},r):n[o]=r;return n}var i=t("../plotly"),o={};o.add=function(t,e,r,n,i){var o,a;return t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},a=t.undoQueue.index,t.autoplay?void(t.undoQueue.inSequence||(t.autoplay=!1)):(!t.undoQueue.sequence||t.undoQueue.beginSequence?(o={undo:{calls:[],args:[]},redo:{calls:[],args:[]}},t.undoQueue.queue.splice(a,t.undoQueue.queue.length-a,o),t.undoQueue.index+=1):o=t.undoQueue.queue[a-1],t.undoQueue.beginSequence=!1,o.undo.calls.unshift(e),o.undo.args.unshift(r),o.redo.calls.push(n),void o.redo.args.push(i))},o.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},o.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},o.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<e.undo.calls.length;r++)o.plotDo(t,e.undo.calls[r],e.undo.args[r]);t.undoQueue.inSequence=!1,t.autoplay=!1}},o.redo=function(t){var e,r;if(t.framework&&t.framework.isPolar)return void t.framework.redo();if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index>=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r<e.redo.calls.length;r++)o.plotDo(t,e.redo.calls[r],e.redo.args[r]);t.undoQueue.inSequence=!1,t.autoplay=!1,t.undoQueue.index++}},o.plotDo=function(t,e,r){t.autoplay=!0,r=n(t,r),e.apply(null,r)},e.exports=o},{"../plotly":365}],355:[function(t,e,r){"use strict";function n(t,e){return e>t}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");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 l,c,u=0,h=e.length,f=0;for(c=e[e.length-1]>=e[0]?r?n:i:r?a:o;h>u&&f++<100;)l=Math.floor((u+h)/2),c(e[l],t)?u=l+1:h=l;return f>90&&console.log("Long binary search..."),u-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,c=r?Math.ceil:Math.floor;o>i&&a++<100;)n=c((i+o)/2),e[n]<=t?i=n+s:o=n-l;return e[i]}},{"fast-isnumeric":74}],356:[function(t,e,r){"use strict";var n=t("../plotly"),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.Color.defaults[0],t.container.appendChild(r),t.container.style.background="#FFFFFF",t.container.onclick=function(){window.open("http://get.webgl.org")},!1}},{"../plotly":365}],357:[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":74}],358:[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:48,tinycolor2:229}],359:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(/(<|&lt;|&#60;)/g,"\\lt ").replace(/(>|&gt;|&#62;)/g,"\\gt ")}function o(t,e,r){var n="math-output-"+l.Lib.randstr([],64),o=c.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=c.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())console.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){for(var e=l.util.html_entity_decode(t),r=e.split(/(<[^<>]*>)/).map(function(t){var e=t.match(/<(\/?)([^ >]*)\s*(.*)>/i),r=e&&e[2].toLowerCase(),n=f[r];if(void 0!==n){var i=e[1],o=e[3],a=o.match(/^style\s*=\s*"([^"]+)"\s*/i);if("a"===r){if(i)return"</a>";if("href"!==o.substr(0,4).toLowerCase())return"<a>";
var s=document.createElement("a");return s.href=o.substr(4).replace(/["'=]/g,""),-1===d.indexOf(s.protocol)?"<a>":'<a xlink:show="new" xlink:href'+o.substr(4)+">"}if("br"===r)return"<br>";if(i)return"sup"===r?'</tspan><tspan dy="0.42em">&#x200b;</tspan>':"sub"===r?'</tspan><tspan dy="-0.21em">&#x200b;</tspan>':"</tspan>";var c="<tspan";return("sup"===r||"sub"===r)&&(c="&#x200b;"+c),a&&(a=a[1].replace(/(^|;)\s*color:/,"$1 fill:"),n=(n?n+";":"")+a),c+(n?' style="'+n+'"':"")+">"}return l.util.xml_entity_encode(t).replace(/</g,"&lt;")}),n=[],i=r.indexOf("<br>");i>0;i=r.indexOf("<br>",i+1))n.push(i);var o=0;n.forEach(function(t){for(var e=t+o,n=r.slice(0,e),i="",a=n.length-1;a>=0;a--){var s=n[a].match(/<(\/?).*>/i);if(s&&"<br>"!==n[a]){s[1]||(i=n[a]);break}}i&&(r.splice(e+1,0,i),r.splice(e,0,"</tspan>"),o+=2)});var a=r.join(""),s=a.split(/<br>/gi);return s.length>1&&(r=s.map(function(t,e){return'<tspan class="line" dy="'+1.3*e+'em">'+t+"</tspan>"})),r.join("")}function s(t,e,r){var n,i,o,a=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),c=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()-c.top+"px",left:o()-c.left+"px","z-index":1e3}),this}}var l=t("../plotly"),c=t("d3"),u=t("../constants/xmlns_namespaces"),h=e.exports={};c.selection.prototype.appendSVG=function(t){for(var e=['<svg xmlns="',u.svg,'" ','xmlns:xlink="',u.xlink,'">',t,"</svg>"].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")?(console.log(r.querySelector("parsererror div").textContent),null):c.select(this.node().lastChild)},h.html_entity_decode=function(t){var e=c.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"&lt;"===t?"&#60;":"&rt;"===t?"&#62;":e.html(t).text()});return e.remove(),r},h.xml_entity_encode=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&amp;")},h.convertToTspans=function(t,e){function r(){d.empty()||(p=u.attr("class")+"-math",d.select("svg."+p).remove()),t.text("").style({visibility:"visible","white-space":"pre"}),f=t.appendSVG(s),f||t.text(i),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(u)}var i=t.text(),s=a(i),u=t,h=!u.attr("data-notex")&&s.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),f=i,d=c.select(u.node().parentNode);if(!d.empty()){var p=u.attr("class")?u.attr("class").split(" ")[0]:"text";p+="-math",d.selectAll("svg."+p).remove(),d.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(h){var v=l.Lib.getPlotDiv(u.node());(v&&v._promises||[]).push(new Promise(function(t){u.style({visibility:"hidden"});var i={fontSize:parseInt(u.style("font-size"),10)};o(h[2],i,function(i,o,a){d.selectAll("svg."+p).remove(),d.selectAll("g."+p+"-group").remove();var s=i&&i.select("svg");if(!s||!s.node())return r(),void t();var l=d.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});l.node().appendChild(s.node()),o&&o.node()&&s.node().insertBefore(o.node().cloneNode(!0),s.node().firstChild),s.attr({"class":p,height:a.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var c=u.style("fill")||"black";s.select("g").attr({fill:c,stroke:c});var h=n(s,"width"),f=n(s,"height"),g=+u.attr("x")-h*{start:0,middle:.5,end:1}[u.attr("text-anchor")||"start"],v=parseInt(u.style("font-size"),10)||n(u,"height"),m=-v/4;"y"===p[0]?(l.attr({transform:"rotate("+[-90,+u.attr("x"),+u.attr("y")]+") translate("+[-h/2,m-f/2]+")"}),s.attr({x:+u.attr("x"),y:+u.attr("y")})):"l"===p[0]?s.attr({x:u.attr("x"),y:m-f/2}):"a"===p[0]?s.attr({x:0,y:m}):s.attr({x:g,y:+u.attr("y")+m-f/2}),e&&e.call(u,l),t(l)})}))}else r();return t}};var f={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"},d=["http:","https:","mailto:"],p=new RegExp("</?("+Object.keys(f).join("|")+")( [^>]*)?/?>","g");h.plainText=function(t){return(t||"").replace(p," ")},h.makeEditable=function(t,e,r){function n(){o(),a.style({opacity:0});var t,e=f.attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&c.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=c.select(l.Lib.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(s(a,e,r)).on("blur",function(){a.text(this.textContent).style({opacity:1});var t,e=c.select(this).attr("class");t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]",t&&c.select(a.node().parentNode).select(t).style({opacity:0});var r=this.textContent;c.select(this).transition().duration(0).remove(),c.select(document).on("mouseup",null),u.edit.call(a,r)}).on("focus",function(){var t=this;c.select(document).on("mouseup",function(){return c.event.target===t?!1:void(document.activeElement===n.node()&&n.node().blur())})}).on("keyup",function(){27===c.event.which?(a.style({opacity:1}),c.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),u.cancel.call(a,this.textContent)):(u.input.call(a,this.textContent),c.select(this).call(s(a,e,r)))}).on("keydown",function(){13===c.event.which&&this.blur()}).call(i)}r||(r={});var a=this,u=c.dispatch("edit","input","cancel"),h=c.select(this.node()).style({"pointer-events":"all"}),f=e||h;return e&&h.style({"pointer-events":"none"}),r.immediate?n():f.on("click",n),c.rebind(this,u,"on")}},{"../constants/xmlns_namespaces":337,"../plotly":365,d3:70}],360:[function(t,e,r){"use strict";var n=e.exports={},i=t("../constants/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}},{"../constants/geo_constants":333,topojson:230}],361:[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,e){t._fullLayout._paperdiv.style("background","white"),z.defaultConfig.setBackground(t,e)}function o(t,e){t._context||(t._context=j.extendFlat({},z.defaultConfig));var r=t._context;e&&(Object.keys(e).forEach(function(t){t in r&&("setBackground"===t&&"opaque"===e[t]?r[t]=i: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 a(t,e,r){var n=L.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),z.micropolar.manager.fillLayout(t),"initial"===t._fullLayout.autosize&&t._context.autosizable&&(w(t,{}),t._fullLayout.autosize=r.autosize=!0),i.style({width:t._fullLayout.width+"px",height:t._fullLayout.height+"px"}),t.framework=z.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",c=function(){this.call(z.util.convertToTspans)},u=o.select(".title-group text").call(c);if(t._context.editable){u.attr({"data-unformatted":s}),s&&s!==l||(a=.2,u.attr({"data-unformatted":l}).text(l).style({opacity:a}).on("mouseover.opacity",function(){L.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){L.select(this).transition().duration(1e3).style("opacity",0)}));var h=function(){this.call(z.util.makeEditable).on("edit",function(e){t.framework({layout:{title:e}}),this.attr({"data-unformatted":e}).text(e).call(c),this.call(h)}).on("cancel",function(){var t=this.attr("data-unformatted");this.text(t).call(c)})};u.call(h)}return t._context.setBackground(t,t._fullLayout.paper_bgcolor),R.addLinks(t),Promise.resolve()}function s(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=z.Axes.list({_fullLayout:t});for(e=0;e<n.length;e++){var i=n[e];i.anchor&&"free"!==i.anchor&&(i.anchor=z.Axes.cleanId(i.anchor)),i.overlaying&&(i.overlaying=z.Axes.cleanId(i.overlaying)),i.type||(i.isdate?i.type="date":i.islog?i.type="log":i.isdate===!1&&i.islog===!1&&(i.type="linear")),("withzero"===i.autorange||"tozero"===i.autorange)&&(i.autorange=!0,i.rangemode="tozero"),delete i.islog,delete i.isdate,delete i.categories,h(i,"domain")&&delete i.domain,void 0!==i.autotick&&(void 0===i.tickmode&&(i.tickmode=i.autotick?"auto":"linear"),delete i.autotick)}void 0===t.annotations||Array.isArray(t.annotations)||(console.log("annotations must be an array"),delete t.annotations);var o=(t.annotations||[]).length;for(e=0;o>e;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),l(a,"xref"),l(a,"yref")}void 0===t.shapes||Array.isArray(t.shapes)||(console.log("shapes must be an array"),delete t.shapes);var s=(t.shapes||[]).length;for(e=0;s>e;e++){var c=t.shapes[e];l(c,"xref"),l(c,"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,d,p,g,v,m,y,b=R.getSubplotIds(t,"gl3d");for(e=0;e<b.length;e++)if(f=t[b[e]],d=f.cameraposition,Array.isArray(d)&&4===d[0].length){for(p=d[0],v=d[1],g=d[2],m=S([],p),y=[],r=0;3>r;++r)y[r]=v[e]+g*m[2+4*r];f.camera={eye:{x:y[0],y:y[1],z:y[2]},center:{x:v[0],y:v[1],z:v[2]},up:{x:m[1],y:m[5],z:m[9]}},delete f.cameraposition}return j.markTime("finished rest of cleanLayout, starting color"),N.clean(t),j.markTime("finished cleanLayout color.clean"),t}function l(t,e){var r=t[e],n=e.charAt(0);r&&"paper"!==r&&(t[e]=z.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;i<t.length;i++){var o=t[i];if(!("uid"in o)||-1!==r.indexOf(o.uid)){var a,s;for(s=0;100>s&&(a=j.randstr(n),-1!==r.indexOf(a));s++);o.uid=j.randstr(n),n.push(o.uid)}if(r.push(o.uid),"histogramy"===o.type&&"xbins"in o&&!("ybins"in o)&&(o.ybins=o.xbins,delete o.xbins),o.error_y&&"opacity"in o.error_y){var l=N.defaults,c=o.error_y.color||(R.traceIs(o,"bar")?N.defaultLine:l[i%l.length]);o.error_y.color=N.addOpacity(N.rgb(c),N.opacity(c)*o.error_y.opacity),delete o.error_y.opacity}"bardir"in o&&("h"!==o.bardir||!R.traceIs(o,"bar")&&"histogram"!==o.type.substr(0,9)||(o.orientation="h",x(o)),delete o.bardir),"histogramy"===o.type&&x(o),("histogramx"===o.type||"histogramy"===o.type)&&(o.type="histogram"),"scl"in o&&(o.colorscale=o.scl,delete o.scl),"reversescl"in o&&(o.reversescale=o.reversescl,delete o.reversescl),o.xaxis&&(o.xaxis=z.Axes.cleanId(o.xaxis,"x")),o.yaxis&&(o.yaxis=z.Axes.cleanId(o.yaxis,"y")),R.traceIs(o,"gl3d")&&o.scene&&(o.scene=R.subplotsRegistry.gl3d.cleanId(o.scene)),R.traceIs(o,"pie")||(Array.isArray(o.textposition)?o.textposition=o.textposition.map(u):o.textposition&&(o.textposition=u(o.textposition))),h(o,"line")&&delete o.line,"marker"in o&&(h(o.marker,"line")&&delete o.marker.line,h(o,"marker")&&delete o.marker),j.markTime("finished rest of cleanData, starting color"),N.clean(o),j.markTime("finished cleanData color.clean")}}function u(t){var e="middle",r="center";return-1!==t.indexOf("top")?e="top":-1!==t.indexOf("bottom")&&(e="bottom"),-1!==t.indexOf("left")?r="left":-1!==t.indexOf("right")&&(r="right"),e+" "+r}function h(t,e){return e in t&&"object"==typeof t[e]&&0===Object.keys(t[e]).length}function f(t){var e,r,n,i,o=z.Axes.list(t),a=t._fullData,s=t._fullLayout,l=t.calcdata=new Array(a.length);for(t.firstscatter=!0,t.numboxes=0,t._hmpixcount=0,t._hmlumcount=0,s._piecolormap={},s._piedefaultcolorcount=0,e=0;e<o.length;e++)o[e]._categories=[];for(e=0;e<a.length;e++)r=a[e],n=r._module,i=[],n&&r.visible===!0&&n.calc&&(i=n.calc(t,r)),Array.isArray(i)&&i[0]||(i=[{x:!1,y:!1}]),i[0].t||(i[0].t={}),i[0].trace=r,j.markTime("done with calcdata for "+e),l[e]=i}function d(t,e){var r,n,i=e+1,o=[];for(r=0;r<t.length;r++)n=t[r],0>n?o.push(i+n):o.push(n);return o}function p(t,e,r){var n,i;for(n=0;n<e.length;n++){if(i=e[n],i!==parseInt(i,10))throw new Error("all values in "+r+" must be integers");if(i>=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]),p(t,e,"currentIndices"),"undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&p(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<e.length;n++)if(i=e[n],"object"!=typeof i||Array.isArray(i)||null===i)throw new Error("all values in traces array must be non-array objects");if("undefined"==typeof r||Array.isArray(r)||(r=[r]),"undefined"!=typeof r&&r.length!==e.length)throw new Error("if indices is specified, traces.length must equal indices.length")}function m(t,e,r,n){var i=j.isPlainObject(n);if(!Array.isArray(t.data))throw new Error("gd.data must be an array");if(!j.isPlainObject(e))throw new Error("update must be a key:value object");if("undefined"==typeof r)throw new Error("indices must be an integer or array of integers");p(t,r,"indices");for(var o in e){if(!Array.isArray(e[o])||e[o].length!==r.length)throw new Error("attribute "+o+" must be an array of length equal to indices array length");if(i&&(!(o in n)||!Array.isArray(n[o])||n[o].length!==e[o].length))throw new Error("when maxPoints is set as a key:value object it must contain a 1:1 corrispondence with the keys and number of traces in the update object")}}function y(t,e,r,n){var i,o,a,s,l,c=j.isPlainObject(n),u=[];Array.isArray(r)||(r=[r]),r=d(r,t.data.length-1);for(var h in e)for(var f=0;f<r.length;f++){if(i=t.data[r[f]],a=j.nestedProperty(i,h),o=a.get(),s=e[h][f],!Array.isArray(s))throw new Error("attribute: "+h+" index: "+f+" must be an array");if(!Array.isArray(o))throw new Error("cannot extend missing or non-array attribute: "+h);l=c?n[h][f]:n,C(l)||(l=-1),u.push({prop:a,target:o,insert:s,maxp:Math.floor(l)})}return u}function b(t,e,r,n,i,o){m(t,e,r,n);for(var a,s,l,c=y(t,e,r,n),u=[],h={},f={},d=0;d<c.length;d++)s=c[d].prop,l=c[d].maxp,a=i(c[d].target,c[d].insert),l>=0&&l<a.length&&(u=o(a,l)),l=c[d].target.length,s.set(a),Array.isArray(h[s.astr])||(h[s.astr]=[]),Array.isArray(f[s.astr])||(f[s.astr]=[]),h[s.astr].push(u),f[s.astr].push(l);return{update:h,maxPoints:f}}function x(t){var e;if(j.swapAttrs(t,["?","?0","d?","?bins","nbins?","autobin?","?src","error_?"]),Array.isArray(t.z)&&Array.isArray(t.z[0])&&(t.transpose?delete t.transpose:t.transpose=!0),t.error_x&&t.error_y){var r=t.error_y,n="copy_ystyle"in r?r.copy_ystyle:!(r.color||r.thickness||r.width);j.swapAttrs(t,["error_?.copy_ystyle"]),n&&j.swapAttrs(t,["error_?.color","error_?.thickness","error_?.width"])}if(t.hoverinfo){var i=t.hoverinfo.split("+");for(e=0;e<i.length;e++)"x"===i[e]?i[e]="y":"y"===i[e]&&(i[e]="x");t.hoverinfo=i.join("+")}}function _(t){var e,r={left:0,right:0,bottom:0,top:0};if(t)for(e in t)t.hasOwnProperty(e)&&(r.left+=t[e].left||0,r.right+=t[e].right||0,r.bottom+=t[e].bottom||0,r.top+=t[e].top||0);return r}function w(t,e){var r,n,i,o=t._fullLayout,a=t._context;if(t.emit("plotly_autosize"),t._context.fillFrame)i=window.innerWidth,n=window.innerHeight,document.body.style.overflow="hidden";else if(C(a.frameMargins)&&a.frameMargins>0){var s=_(t._boundingBoxMargins),l=s.left+s.right,c=s.bottom+s.top,u=o._container.node().getBoundingClientRect(),h=1-2*a.frameMargins;i=Math.round(h*(u.width-l)),n=Math.round(h*(u.height-c))}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),R.sanitizeMargins(o),e}function k(t){var e=L.select(t),r=t._fullLayout;if(r._hasGL3D&&R.subplotsRegistry.gl3d.initAxes(t),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&&(w(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=[];L.selectAll("defs").each(function(){this.id&&n.push(this.id.split("-")[1])}),r._uid=j.randstr(n)}r._paperdiv.selectAll(".main-svg").attr(H.svgAttrs),r._defs=r._paper.append("defs").attr("id","defs-"+r._uid),r._draggers=r._paper.append("g").classed("draglayer",!0);var i=z.Axes.getSubplots(t);i.join("")!==Object.keys(t._fullLayout._plots||{}).join("")&&A(t,i),r._hasCartesian&&M(t,i),r._shapelayer=r._paper.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._hoverlayer=r._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework");var o=j.syncOrAsync([T,function(){return z.Axes.doTicks(t,"redraw")},O.init],t);return o&&o.then&&t._promises.push(o),o}function A(t,e){function r(e,r){return function(){return z.Axes.getFromId(t,e,r)}}for(var n,i,o=t._fullLayout._plots={},a=0;a<e.length;a++)n=e[a],i=o[n]={},i.id=n,i.x=r(n,"x"),i.y=r(n,"y"),i.xaxis=i.x(),i.yaxis=i.y()}function M(t,e){function r(t){t.append("g").classed("maplayer",!0),t.append("g").classed("barlayer",!0),t.append("g").classed("errorlayer",!0),t.append("g").classed("boxlayer",!0),t.append("g").classed("scatterlayer",!0)}var n=t._fullLayout,i=[];n._paper.selectAll("g.subplot").data(e).enter().append("g").classed("subplot",!0).each(function(o){var a=n._plots[o],s=a.plotgroup=L.select(this).classed(o,!0),l=a.xaxis,c=a.yaxis;a.overlays=[];var u=z.Axes.getFromId(t,l.overlaying)||l;u!==l&&u.overlaying&&(u=l,l.overlaying=!1);var h=z.Axes.getFromId(t,c.overlaying)||c;h!==c&&h.overlaying&&(h=c,c.overlaying=!1);var f=u._id+h._id;f!==o&&-1!==e.indexOf(f)?(a.mainplot=f,i.push(a),l.domain=u.domain.slice(),c.domain=h.domain.slice()):(a.bg=s.append("rect").style("stroke-width",0),a.gridlayer=s.append("g"),a.overgrid=s.append("g"),a.zerolinelayer=s.append("g"),a.overzero=s.append("g"),a.plot=s.append("svg").call(r),a.overplot=s.append("g"),a.xlines=s.append("path"),a.ylines=s.append("path"),a.overlines=s.append("g"),a.xaxislayer=s.append("g"),a.yaxislayer=s.append("g"),a.overaxes=s.append("g")),a.draglayer=n._draggers.append("g")}),i.forEach(function(t){var e=n._plots[t.mainplot];e.overlays.push(t),t.gridlayer=e.overgrid.append("g"),t.zerolinelayer=e.overzero.append("g"),t.plot=e.overplot.append("svg").call(r),t.xlines=e.overlines.append("path"),t.ylines=e.overlines.append("path"),t.xaxislayer=e.overaxes.append("g"),t.yaxislayer=e.overaxes.append("g")}),e.forEach(function(t){var e=n._plots[t];e.plot.attr("preserveAspectRatio","none").style("fill","none"),e.xlines.style("fill","none").classed("crisp",!0),e.ylines.style("fill","none").classed("crisp",!0)})}function T(t){return j.syncOrAsync([R.doAutoMargin,E],t)}function E(t){var e,r=t._fullLayout,n=r._size,i=z.Axes.list(t);for(e=0;e<i.length;e++)i[e]._linepositions={};r._paperdiv.style({width:r.width+"px",height:r.height+"px"}).selectAll(".main-svg").call(D.setSize,r.width,r.height),t._context.setBackground(t,r.paper_bgcolor);var o=[];return r._paper.selectAll("g.subplot").each(function(e){var i=r._plots[e],a=z.Axes.getFromId(t,e,"x"),s=z.Axes.getFromId(t,e,"y");a.setScale(),s.setScale(),i.bg&&i.bg.call(D.setRect,a._offset-n.p,s._offset-n.p,a._length+2*n.p,s._length+2*n.p).call(N.fill,r.plot_bgcolor),i.plot.call(D.setRect,a._offset,s._offset,a._length,s._length);var l=D.crispRound(t,a.linewidth,1),c=D.crispRound(t,s.linewidth,1),u=n.p+c,h="M"+-u+",",f="h"+(a._length+2*u),d="free"===a.anchor&&-1===o.indexOf(a._id),p=n.h*(1-(a.position||0))+l/2%1,g=a.anchor===s._id&&(a.mirror||"top"!==a.side)||"all"===a.mirror||"allticks"===a.mirror||a.mirrors&&a.mirrors[s._id+"bottom"],v=s._length+n.p+l/2,m=a.anchor===s._id&&(a.mirror||"top"===a.side)||"all"===a.mirror||"allticks"===a.mirror||a.mirrors&&a.mirrors[s._id+"top"],y=-n.p-l/2,b=n.p,x=g?0:l,_=m?0:l,w=","+(-b-_)+"v"+(s._length+2*b+_+x),k="free"===s.anchor&&-1===o.indexOf(s._id),A=n.w*(s.position||0)+c/2%1,M=s.anchor===a._id&&(s.mirror||"right"!==s.side)||"all"===s.mirror||"allticks"===s.mirror||s.mirrors&&s.mirrors[a._id+"left"],T=-n.p-c/2,E=s.anchor===a._id&&(s.mirror||"right"===s.side)||"all"===s.mirror||"allticks"===s.mirror||s.mirrors&&s.mirrors[a._id+"right"],L=a._length+n.p+c/2;a._linepositions[e]=[g?v:void 0,m?y:void 0,d?p:void 0],a.anchor===s._id?a._linepositions[e][3]="top"===a.side?y:v:d&&(a._linepositions[e][3]=p),s._linepositions[e]=[M?T:void 0,E?L:void 0,k?A:void 0],s.anchor===a._id?s._linepositions[e][3]="right"===s.side?L:T:k&&(s._linepositions[e][3]=A);var S="translate("+a._offset+","+s._offset+")",C=S,j=S;d&&(C="translate("+a._offset+","+n.t+")",y+=s._offset-n.t,v+=s._offset-n.t),k&&(j="translate("+n.l+","+s._offset+")",T+=a._offset-n.l,L+=a._offset-n.l),i.xlines.attr("transform",C).attr("d",(g?h+v+f:"")+(m?h+y+f:"")+(d?h+p+f:"")||"M0,0").style("stroke-width",l+"px").call(N.stroke,a.showline?a.linecolor:"rgba(0,0,0,0)"),i.ylines.attr("transform",j).attr("d",(M?"M"+T+w:"")+(E?"M"+L+w:"")+(k?"M"+A+w:"")||"M0,0").attr("stroke-width",c+"px").call(N.stroke,s.showline?s.linecolor:"rgba(0,0,0,0)"),i.xaxislayer.attr("transform",C),i.yaxislayer.attr("transform",j),i.gridlayer.attr("transform",S),i.zerolinelayer.attr("transform",S),i.draglayer.attr("transform",S),d&&o.push(a._id),k&&o.push(s._id)}),z.Axes.makeClipPaths(t),V.draw(t,"gtitle"),q(t),t._promises.length&&Promise.all(t._promises)}var L=t("d3"),S=t("gl-mat4/fromQuat"),C=t("fast-isnumeric"),z=t("../plotly"),j=t("../lib"),P=t("../lib/events"),I=t("../lib/queue"),R=t("../plots/plots"),O=t("../plots/cartesian/graph_interact"),N=t("../components/color"),D=t("../components/drawing"),F=t("../components/errorbars"),B=t("../components/legend"),U=t("../components/shapes"),V=t("../components/titles"),q=t("../components/modebar/manage"),H=t("../constants/xmlns_namespaces");z.plot=function(t,e,r,i){function l(){var e,r,n,i=t.calcdata;for(B.draw(t),e=0;e<i.length;e++)r=i[e],n=r[0].trace,n.visible===!0&&n._module.colorbar?n._module.colorbar(t,r):R.autoMargin(t,"cb"+n.uid);return R.doAutoMargin(t),R.previousPromises(t)}function u(){var e=JSON.stringify(w._size)===E?[]:[l,T];return j.syncOrAsync(e.concat(O.init),t)}function h(){if(A){for(var e,r,n=R.getSubplotIds(w,"cartesian"),i=t._modules,o=0;o<n.length;o++){e=w._plots[n[o]];for(var a=0;a<i.length;a++)r=i[a],r.setPositions&&r.setPositions(t,e)}return j.markTime("done with bar/box adjustments"),F.calc(t),j.markTime("done ErrorBars.calc"),j.syncOrAsync([U.calcAutorange,z.Annotations.calcAutorange,d],t)}}function d(){for(var e=z.Axes.list(t,"",!0),r=0;r<e.length;r++)z.Axes.doAutoRange(e[r])}function p(){return z.Axes.doTicks(t,"redraw")}function g(){function e(t,e){var r,n,i,o=[];for(r=0;r<t.length;r++)n=t[r],i=n[0].trace,i.xaxis+i.yaxis===e&&o.push(n);return o}function r(t,e){for(var r=[],n=0;n<t.length;n++){var i=t[n],o=i[0].trace;o._module===e&&o.visible===!0&&r.push(i)}return r}var n,i,o,a,s,l,c,u,h,f,d,p=t.calcdata,g=R.getSubplotIds(w,"cartesian"),v=t._modules,m=R.subplotsRegistry;for(w._hasGL3D&&m.gl3d.plot(t),w._hasGeo&&m.geo.plot(t),w._hasGL2D&&m.gl2d.plot(t),n=0;n<p.length;n++)o=p[n],a=o[0].trace,a.visible===!0&&a._module.colorbar||(s=a.uid,w._paper.selectAll(".hm"+s+",.contour"+s+",.cb"+s+",#clip"+s).remove());for(n=0;n<g.length;n++){for(l=g[n],c=w._plots[l],u=e(p,l),h=[],c.plot&&c.plot.selectAll("g.trace").remove(),i=0;i<v.length;i++)d=v[i],(d.plot||"pie"!==d.name)&&(f=r(u,d),d.plot(t,c,f),j.markTime("done "+(f[0]&&f[0][0].trace.type)),f[0]&&f[0][0].trace&&R.traceIs(f[0][0].trace,"errorBarsOK")&&(h=h.concat(f)));w._hasCartesian&&(F.plot(t,c,h),j.markTime("done ErrorBars"))}if(w._hasPie){var y=R.getModule("pie"),b=r(p,y);b.length&&y.plot(t,b)}return R.style(t),j.markTime("done Plots.style"),U.drawAll(t),z.Annotations.drawAll(t),R.addLinks(t),R.previousPromises(t)}function v(){t._replotting=!1,j.markTime("done plot"),t.emit("plotly_afterplot")}j.markTime("in plot"),t=n(t),P.init(t);var m=P.triggerHandler(t,"plotly_beforeplot",[e,r,i]);if(m!==!1){e||r||j.isPlotDiv(t)||console.log("Warning: calling Plotly.plot as if redrawing but this container doesn't yet have a plot.",t),o(t,i),r||(r={}),L.select(t).classed("js-plotly-plot",!0),D.makeTester(t),t._promises=[];var y=0===(t.data||[]).length&&Array.isArray(e);if(Array.isArray(e)&&(c(e,t.data),y?t.data=e:t.data.push.apply(t.data,e),t.empty=!1),(!t.layout||y)&&(t.layout=s(r)),t._dragging)return void(t._replotPending=!0);if(t._replotPending=!1,R.supplyDefaults(t),e&&e[0]&&e[0].r)return a(t,e,r);t._replotting=!0;var b=t._fullData.length>0;if(b){var x=z.Axes.getSubplots(t).join(""),_=Object.keys(t._fullLayout._plots||{}).join("");(t.framework!==k||y||_!==x)&&(t.framework=k,k(t))}else y&&k(t);var w=t._fullLayout,A=!t.calcdata||t.calcdata.length!==(t.data||[]).length;A&&(f(t),(t._context.doubleClick!==!1||t._context.displayModeBar!==!1)&&z.Axes.saveRangeInitial(t));for(var M=0;M<t.calcdata.length;M++)t.calcdata[M][0].trace=t._fullData[M];var E=JSON.stringify(w._size),S=j.syncOrAsync([R.previousPromises,l,T,u,h,p,g],t,v);return S&&S.then?S:Promise.resolve(t)}},z.redraw=function(t){return t=n(t),j.isPlotDiv(t)?(t.calcdata=void 0,z.plot(t).then(function(){return t.emit("plotly_redraw"),t})):void console.log("This element is not a Plotly Plot",t)},z.newPlot=function(t,e,r,i){return t=n(t),R.purge(t),z.plot(t,e,r,i)},z.extendTraces=function G(t,e,r,i){t=n(t);var o=b(t,e,r,i,function(t,e){return t.concat(e)},function(t,e){return t.splice(0,t.length-e)}),a=z.redraw(t),s=[t,o.update,r,o.maxPoints];return I&&I.add(t,z.prependTraces,s,G,arguments),a},z.prependTraces=function Y(t,e,r,i){t=n(t);var o=b(t,e,r,i,function(t,e){return e.concat(t)},function(t,e){return t.splice(e,t.length)}),a=z.redraw(t),s=[t,o.update,r,o.maxPoints];return I&&I.add(t,z.extendTraces,s,Y,arguments),a},z.addTraces=function X(t,e,r){t=n(t);var i,o,a=[],s=z.deleteTraces,l=X,u=[t,a],h=[t,e];for(v(t,e,r),Array.isArray(e)||(e=[e]),c(e,t.data),i=0;i<e.length;i+=1)t.data.push(e[i]);for(i=0;i<e.length;i++)a.push(-e.length+i);if("undefined"==typeof r)return o=z.redraw(t),I&&I.add(t,s,u,l,h),o;Array.isArray(r)||(r=[r]);try{g(t,a,r)}catch(f){throw t.data.splice(t.data.length-e.length,e.length),f}return I&&I.startSequence(t),I&&I.add(t,s,u,l,h),o=z.moveTraces(t,a,r),I&&I.stopSequence(t),o},z.deleteTraces=function W(t,e){t=n(t);var r,i,o=[],a=z.addTraces,s=W,l=[t,o,e],c=[t,e];if("undefined"==typeof e)throw new Error("indices must be an integer or array of integers.");for(Array.isArray(e)||(e=[e]),p(t,e,"indices"),e=d(e,t.data.length-1),e.sort(j.sorterDes),r=0;r<e.length;r+=1)i=t.data.splice(e[r],1)[0],o.push(i);var u=z.redraw(t);return I&&I.add(t,a,l,s,c),u},z.moveTraces=function Z(t,e,r){t=n(t);var i,o=[],a=[],s=Z,l=Z,c=[t,r,e],u=[t,e,r];if(g(t,e,r),e=Array.isArray(e)?e:[e],"undefined"==typeof r)for(r=[],i=0;i<e.length;i++)r.push(-e.length+i);for(r=Array.isArray(r)?r:[r],e=d(e,t.data.length-1),r=d(r,t.data.length-1),i=0;i<t.data.length;i++)-1===e.indexOf(i)&&o.push(t.data[i]);for(i=0;i<e.length;i++)a.push({newIndex:r[i],trace:t.data[e[i]]});for(a.sort(function(t,e){return t.newIndex-e.newIndex}),i=0;i<a.length;i+=1)o.splice(a[i].newIndex,0,a[i].trace);t.data=o;var h=z.redraw(t);return I&&I.add(t,s,c,l,u),h},z.restyle=function Q(t,e,r,i){function o(){return i.map(function(){})}function a(t){var e=z.Axes.id2name(t);-1===p.indexOf(e)&&p.push(e)}function s(t){return"LAYOUT"+t+".autorange"}function l(t){return"LAYOUT"+t+".range"}function c(e,r,n){if(Array.isArray(e))return void e.forEach(function(t){c(t,r,n)});if(!(e in f)){var a;a="LAYOUT"===e.substr(0,6)?j.nestedProperty(t.layout,e.replace("LAYOUT","")):j.nestedProperty(t.data[i[n]],e),e in T||(T[e]=o()),void 0===T[e][n]&&(T[e][n]=a.get()),void 0!==r&&a.set(r)}}t=n(t);var u,h=t._fullLayout,f={};if("string"==typeof e)f[e]=r;else{if(!j.isPlainObject(e))return console.log("restyle fail",e,r,i),new Promise.reject;f=e,void 0===i&&(i=r)}Object.keys(f).length&&(t.changed=!0),C(i)?i=[i]:Array.isArray(i)&&i.length||(i=t._fullData.map(function(t,e){return e}));var d=["mode","visible","type","orientation","fill","histfunc","histnorm","text","x","y","z","xtype","x0","dx","ytype","y0","dy","xaxis","yaxis","line.width","connectgaps","transpose","zsmooth","showscale","marker.showscale","zauto","marker.cauto","autocolorscale","marker.autocolorscale","colorscale","marker.colorscale","reversescale","marker.reversescale","autobinx","nbinsx","xbins","xbins.start","xbins.end","xbins.size","autobiny","nbinsy","ybins","ybins.start","ybins.end","ybins.size","autocontour","ncontours","contours","contours.coloring","error_y","error_y.visible","error_y.value","error_y.type","error_y.traceref","error_y.array","error_y.symmetric","error_y.arrayminus","error_y.valueminus","error_y.tracerefminus","error_x","error_x.visible","error_x.value","error_x.type","error_x.traceref","error_x.array","error_x.symmetric","error_x.arrayminus","error_x.valueminus","error_x.tracerefminus","swapxy","swapxyaxes","orientationaxes","marker.colors","values","labels","label0","dlabel","sort","textinfo","textposition","textfont.size","textfont.family","textfont.color","insidetextfont.size","insidetextfont.family","insidetextfont.color","outsidetextfont.size","outsidetextfont.family","outsidetextfont.color","hole","scalegroup","domain","domain.x","domain.y","domain.x[0]","domain.x[1]","domain.y[0]","domain.y[1]","tilt","tiltaxis","depth","direction","rotation","pull"];
for(u=0;u<i.length;u++)if(R.traceIs(t._fullData[i[u]],"box")){d.push("name");break}var p,g=["marker","marker.size","textfont","boxpoints","jitter","pointpos","whiskerwidth","boxmean"],v=["zmin","zmax","zauto","marker.cmin","marker.cmax","marker.cauto","contours.start","contours.end","contours.size","contours.showlines","line","line.smoothing","line.shape","error_y.width","error_x.width","error_x.copy_ystyle","marker.maxdisplayed"],m=["type","x","y","x0","y0","orientation","xaxis","yaxis"],y=!1,b=!1,_=!1,w=!1,k=!1,A=!1,M={},T={},E={};(h._hasGL3D||h._hasGeo||h._hasGL2D)&&(_=!0);var L=["zmin","zmax"],S=["xbins.start","xbins.end","xbins.size"],P=["ybins.start","ybins.end","ybins.size"],O=["contours.start","contours.end","contours.size"];for(var N in f){var D,F,U,V,q,H=f[N];if(M[N]=H,"LAYOUT"!==N.substr(0,6)){for(T[N]=o(),u=0;u<i.length;u++){if(D=t.data[i[u]],F=t._fullData[i[u]],U=j.nestedProperty(D,N),V=U.get(),q=Array.isArray(H)?H[u%H.length]:H,-1!==L.indexOf(N))c("zauto",!1,u);else if("colorscale"===N)c("autocolorscale",!1,u);else if("autocolorscale"===N)c("colorscale",void 0,u);else if("marker.colorscale"===N)c("marker.autocolorscale",!1,u);else if("marker.autocolorscale"===N)c("marker.colorscale",void 0,u);else if("zauto"===N)c(L,void 0,u);else if(-1!==S.indexOf(N))c("autobinx",!1,u);else if("autobinx"===N)c(S,void 0,u);else if(-1!==P.indexOf(N))c("autobiny",!1,u);else if("autobiny"===N)c(P,void 0,u);else if(-1!==O.indexOf(N))c("autocontour",!1,u);else if("autocontour"===N)c(O,void 0,u);else if(-1!==["x0","dx"].indexOf(N)&&F.x&&"scaled"!==F.xtype)c("xtype","scaled",u);else if(-1!==["y0","dy"].indexOf(N)&&F.y&&"scaled"!==F.ytype)c("ytype","scaled",u);else if("colorbar.thicknessmode"===N&&U.get()!==q&&-1!==["fraction","pixels"].indexOf(q)&&F.colorbar){var G=-1!==["top","bottom"].indexOf(F.colorbar.orient)?h.height-h.margin.t-h.margin.b:h.width-h.margin.l-h.margin.r;c("colorbar.thickness",F.colorbar.thickness*("fraction"===q?1/G:G),u)}else if("colorbar.lenmode"===N&&U.get()!==q&&-1!==["fraction","pixels"].indexOf(q)&&F.colorbar){var Y=-1!==["top","bottom"].indexOf(F.colorbar.orient)?h.width-h.margin.l-h.margin.r:h.height-h.margin.t-h.margin.b;c("colorbar.len",F.colorbar.len*("fraction"===q?1/Y:Y),u)}else"colorbar.tick0"===N||"colorbar.dtick"===N?c("colorbar.tickmode","linear",u):"colorbar.tickmode"===N&&c(["colorbar.tick0","colorbar.dtick"],void 0,u);if("type"===N&&"pie"===q!=("pie"===V)){var X="x",W="y";"bar"!==q&&"bar"!==V||"h"!==D.orientation||(X="y",W="x"),j.swapAttrs(D,["?","?src"],"labels",X),j.swapAttrs(D,["d?","?0"],"label",X),j.swapAttrs(D,["?","?src"],"values",W),"pie"===V?(j.nestedProperty(D,"marker.color").set(j.nestedProperty(D,"marker.colors").get()),h._pielayer.selectAll("g.trace").remove()):R.traceIs(D,"cartesian")&&(j.nestedProperty(D,"marker.colors").set(j.nestedProperty(D,"marker.color").get()),E[D.xaxis||"x"]=!0,E[D.yaxis||"y"]=!0)}T[N][u]=V;var Z=["swapxy","swapxyaxes","orientation","orientationaxes"];if(-1!==Z.indexOf(N)){if("orientation"===N){if(U.set(q),U.get()===T[N][u])continue}else"orientationaxes"===N&&(D.orientation={v:"h",h:"v"}[F.orientation]);x(D)}else U.set(q)}if(-1!==["swapxyaxes","orientationaxes"].indexOf(N)&&z.Axes.swap(t,i),"orientationaxes"===N){var $=j.nestedProperty(t.layout,"hovermode");"x"===$.get()?$.set("y"):"y"===$.get()&&$.set("x")}if(-1!==i.indexOf(0)&&-1!==m.indexOf(N)&&(z.Axes.clearTypes(t,i),y=!0),(-1===["autobinx","autobiny","zauto"].indexOf(N)||q!==!1)&&(k=!0),(-1!==["colorbar","line"].indexOf(U.parts[0])||"marker"===U.parts[0]&&"colorbar"===U.parts[1])&&(A=!0),-1!==d.indexOf(N)){if(-1!==["orientation","type"].indexOf(N)){for(p=[],u=0;u<i.length;u++){var K=t.data[i[u]];R.traceIs(K,"cartesian")&&(a(K.xaxis||"x"),a(K.yaxis||"y"),"type"===e&&c(["autobinx","autobiny"],!0,u))}c(p.map(s),!0,0),c(p.map(l),[0,1],0)}y=!0}else-1!==v.indexOf(N)?_=!0:-1!==g.indexOf(N)&&(b=!0)}else U=j.nestedProperty(t.layout,N.replace("LAYOUT","")),T[N]=[U.get()],U.set(Array.isArray(H)?H[0]:H),y=!0}var J=Object.keys(E);t:for(u=0;u<J.length;u++){for(var tt=J[u],et=tt.charAt(0),rt=et+"axis",nt=0;nt<t.data.length;nt++)if(R.traceIs(t.data[nt],"cartesian")&&(t.data[nt][rt]||et)===tt)continue t;c("LAYOUT"+z.Axes.id2name(tt),null,0)}I&&I.add(t,Q,[t,T,i],Q,[t,M,i]);var it=!1;z.Axes.list(t).forEach(function(t){t.autorange&&(it=!0)}),(y||w||b&&it)&&(t.calcdata=void 0);var ot;w?ot=[function(){var e=t.layout;return t.layout=void 0,z.plot(t,"",e)}]:y||_||b?ot=[z.plot]:(R.supplyDefaults(t),ot=[R.previousPromises],k&&ot.push(function(){var e,r,n;for(e=0;e<t.calcdata.length;e++)r=t.calcdata[e],n=(((r[0]||{}).trace||{})._module||{}).arraysToCalcdata,n&&n(r);return R.style(t),B.draw(t),R.previousPromises(t)}),A&&ot.push(function(){return t.calcdata.forEach(function(t){if((t[0].t||{}).cb){var e=t[0].trace,r=t[0].t.cb;R.traceIs(e,"contour")&&r.line({width:e.contours.showlines!==!1?e.line.width:0,dash:e.line.dash,color:"line"===e.contours.coloring?r._opts.line.color:e.line.color}),R.traceIs(e,"markerColorscale")?r.options(e.marker.colorbar)():r.options(e.colorbar)()}}),R.previousPromises(t)}));var at=j.syncOrAsync(ot,t);return at&&at.then||(at=Promise.resolve()),at.then(function(){return t.emit("plotly_restyle",j.extendDeep([],[M,i])),t})},z.relayout=function $(t,e,r){function i(t,e){if(Array.isArray(t))return void t.forEach(function(t){i(t,e)});if(!(t in g)){var r=j.nestedProperty(d,t);t in M||(M[t]=r.get()),void 0!==e&&r.set(e)}}function o(t,e){var r=z.Axes.id2name(t[e+"ref"]||e);return(p[r]||{}).autorange}if(t=n(t),t.framework&&t.framework.isPolar)return new Promise.resolve(t);var a,s,l,c,u,h,f,d=t.layout,p=t._fullLayout,g={},v=!1,m=!1,y=!1,b=!1,x=!1,_=!1;if("string"==typeof e)g[e]=r;else{if(!j.isPlainObject(e))return console.log("relayout fail",e,r),new Promise.reject;g=e}for(Object.keys(g).length&&(t.changed=!0),l=Object.keys(g),s=z.Axes.list(t),f=0;f<l.length;f++){if(0===l[f].indexOf("allaxes")){for(var k=0;k<s.length;k++)u=s[k]._id.substr(1),h=-1!==u.indexOf("scene")?u+".":"",a=l[f].replace("allaxes",h+s[k]._name),g[a]||(g[a]=g[l[f]]);delete g[l[f]]}l[f].match(/^annotations\[[0-9-]+\].ref$/)&&(c=g[l[f]].split("y"),g[l[f].replace("ref","xref")]=c[0],g[l[f].replace("ref","yref")]=2===c.length?"y"+c[1]:"paper",delete g[l[f]])}var A={},M={},E=["height","width"];for(var L in g){var S=j.nestedProperty(d,L),C=g[L],P=S.parts.length,O="string"==typeof S.parts[P-1]?P-1:P-2,N=S.parts[O],D=S.parts[O-1]+"."+N,F=S.parts.slice(0,O).join("."),U=j.nestedProperty(t.layout,F).get(),H=j.nestedProperty(p,F).get();if(A[L]=C,M[L]="reverse"===N?C:S.get(),-1!==E.indexOf(L)?i("autosize",!1):"autosize"===L?i(E,void 0):D.match(/^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/)?i(F+".autorange",!1):D.match(/^[xyz]axis[0-9]*\.autorange$/)?i([F+".range[0]",F+".range[1]"],void 0):D.match(/^aspectratio\.[xyz]$/)?i(S.parts[0]+".aspectmode","manual"):D.match(/^aspectmode$/)?i([F+".x",F+".y",F+".z"],void 0):"tick0"===N||"dtick"===N?i(F+".tickmode","linear"):"tickmode"===N&&i([F+".tick0",F+".dtick"],void 0),"type"===N&&"log"===H.type!=("log"===C)){var G=U;if(G&&G.range)if(H.autorange)"log"===C&&(G.range=G.range[1]>G.range[0]?[1,2]:[2,1]);else{var Y=G.range[0],X=G.range[1];"log"===C?(0>=Y&&0>=X&&i(F+".autorange",!0),0>=Y?Y=X/1e6:0>=X&&(X=Y/1e6),i(F+".range[0]",Math.log(Y)/Math.LN10),i(F+".range[1]",Math.log(X)/Math.LN10)):(i(F+".range[0]",Math.pow(10,Y)),i(F+".range[1]",Math.pow(10,X)))}else i(F+".autorange",!0)}if("reverse"===N)U.range?U.range.reverse():(i(F+".autorange",!0),U.range=[1,0]),H.autorange?x=!0:b=!0;else if("annotations"===S.parts[0]||"shapes"===S.parts[0]){var W=S.parts[1],Z=S.parts[0],Q=d[Z]||[],K=z[j.titleCase(Z)],J=Q[W]||{};2===S.parts.length&&("add"===g[L]||j.isPlainObject(g[L])?M[L]="remove":"remove"===g[L]?-1===W?(M[Z]=Q,delete M[L]):M[L]=J:console.log("???",g)),!o(J,"x")&&!o(J,"y")||j.containsAny(L,["color","opacity","align","dash"])||(x=!0),K.draw(t,W,S.parts.slice(2).join("."),g[L]),delete g[L]}else 0===S.parts[0].indexOf("scene")?b=!0:0===S.parts[0].indexOf("geo")?b=!0:!p._hasGL2D||-1===L.indexOf("axis")&&"plot_bgcolor"!==S.parts[0]?"hiddenlabels"===L?x=!0:-1!==S.parts[0].indexOf("legend")?v=!0:-1!==L.indexOf("title")?m=!0:-1!==S.parts[0].indexOf("bgcolor")?y=!0:S.parts.length>1&&j.containsAny(S.parts[1],["tick","exponent","grid","zeroline"])?m=!0:-1!==L.indexOf(".linewidth")&&-1!==L.indexOf("axis")?m=y=!0:S.parts.length>1&&-1!==S.parts[1].indexOf("line")?y=!0:S.parts.length>1&&"mirror"===S.parts[1]?m=y=!0:"margin.pad"===L?m=y=!0:"margin"===S.parts[0]||"autorange"===S.parts[1]||"rangemode"===S.parts[1]||"type"===S.parts[1]||"domain"===S.parts[1]||L.match(/^(bar|box|font)/)?x=!0:-1!==["hovermode","dragmode"].indexOf(L)?_=!0:-1===["hovermode","dragmode","height","width","autosize"].indexOf(L)&&(b=!0):b=!0,S.set(C)}I&&I.add(t,$,[t,M],$,[t,A]),g.autosize&&(g=w(t,g)),(g.height||g.width||g.autosize)&&(x=!0);var tt=Object.keys(g),et=[R.previousPromises];if(b||x)et.push(function(){return t.layout=void 0,x&&(t.calcdata=void 0),z.plot(t,"",d)});else if(tt.length&&(R.supplyDefaults(t),p=t._fullLayout,v&&et.push(function(){return B.draw(t),R.previousPromises(t)}),y&&et.push(T),m&&et.push(function(){return z.Axes.doTicks(t,"redraw"),V.draw(t,"gtitle"),R.previousPromises(t)}),_)){q(t);var rt;for(rt=R.getSubplotIds(p,"gl3d"),f=0;f<rt.length;f++)u=p[rt[f]]._scene,u.handleDragmode(p.dragmode);for(rt=R.getSubplotIds(p,"gl2d"),f=0;f<rt.length;f++)u=p._plots[rt[f]]._scene2d,u.updateFx(p)}var nt=j.syncOrAsync(et,t);return nt&&nt.then||(nt=Promise.resolve(t)),nt.then(function(){return t.emit("plotly_relayout",j.extendDeep({},A)),t})}},{"../components/color":299,"../components/drawing":317,"../components/errorbars":323,"../components/legend":325,"../components/modebar/manage":328,"../components/shapes":330,"../components/titles":331,"../constants/xmlns_namespaces":337,"../lib":348,"../lib/events":343,"../lib/queue":354,"../plotly":365,"../plots/cartesian/graph_interact":370,"../plots/plots":404,d3:70,"fast-isnumeric":74,"gl-mat4/fromQuat":91}],362:[function(t,e,r){"use strict";function n(t,e){try{t._fullLayout._paper.style("background",e)}catch(r){console.log(r)}}e.exports={staticPlot:!1,editable:!1,autosizable:!1,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:n,topojsonURL:"https://cdn.plot.ly/"}},{}],363:[function(t,e,r){"use strict";function n(t){var e=v.attributes,r=l({type:t}),n=u(t),i=f(t),o={},h={};o.type=null,b(o,e),o=a(r.attributes,o,"attributes",t),void 0!==i.attributes&&b(o,i.attributes),o.type=t,o=c(o),s(o),E.traces[t]=y({},n,{attributes:o}),void 0!==r.layoutAttributes&&(h=a(r.layoutAttributes,h,"layoutAttributes",t),s(h),E.traces[t].layoutAttributes=h)}function i(){var t=v.layoutAttributes,e={};e=a(t,e,"layoutAttributes","*"),e=h(e),e=d(e),e=c(e),s(e),e=p(e),E.layout={layoutAttributes:e}}function o(){E.defs={valObjects:m.valObjects,metaKeys:T.concat(["description","role"])}}function a(t,e,r,n){var i,o,s,c,u;return Object.keys(t).forEach(function(h){return h===_?void Object.keys(t[h]).forEach(function(c){i=l({module:t[h][c]}),void 0!==i&&(o=i[r],s=a(o,{},r,n),m.nestedProperty(e,c).set(b({},s)))}):h===w?void Object.keys(t[h]).forEach(function(i){i===n&&(c=l({module:t[h][i]}),void 0!==c&&(u=c[r],u=a(u,{},r,n),x(e,u)))}):void(e[h]=m.isPlainObject(t[h])?x({},t[h]):t[h])}),e}function s(t){function e(t){return{valType:"string",description:["Sets the source reference on plot.ly for ",t,"."].join(" ")}}function r(t,r,n){C.isValObject(t)?"data_array"===t.valType?(t.role="data",n[r+"src"]=e(r)):t.arrayOk===!0&&(n[r+"src"]=e(r)):m.isPlainObject(t)&&(t.role="object")}C.crawl(t,r)}function l(t){if("type"in t)return"area"===t.type?{attributes:L}:v.getModule({type:t.type});var e=v.subplotsRegistry,r=t.module;return e[r]?e[r]:"module"in t?g[r]:void 0}function c(t){return Object.keys(t).forEach(function(e){"_"===e.charAt(0)&&-1===T.indexOf(e)&&delete t[e]}),t}function u(t){return"area"===t?{}:v.modules[t].meta||{}}function h(t){return y(t,{radialaxis:S.radialaxis,angularaxis:S.angularaxis}),y(t,S.layout),t}function f(t){if("area"===t)return{};var e=v.subplotsRegistry,r=Object.keys(e).filter(function(e){return v.traceIs({type:t},e)})[0];return void 0===r?{}:e[r]}function d(t){var e=v.subplotsRegistry;return Object.keys(t).forEach(function(r){Object.keys(e).forEach(function(n){var i,o=e[n];i="cartesian"===n||"gl2d"===n?o.attrRegex.x.test(r)||o.attrRegex.y.test(r):o.attrRegex.test(r),i&&(t[r][k]=!0)})}),t}function p(t){return Object.keys(t).forEach(function(e){var r=b({},t[e]);if(r[A]===!0){var n=e.substr(0,e.length-1);delete r[A],t[e]={items:{}},t[e].items[n]=r,t[e].role="object"}}),t}var g=t("../plotly"),v=t("../plots/plots"),m=t("../lib"),y=m.extendFlat,b=m.extendDeep,x=m.extendDeepAll,_="_nestedModules",w="_composedModules",k="_isSubplotObj",A="_isLinkedToArray",M="_deprecated",T=[k,A,M],E={traces:{},layout:{},defs:{}},L=t("../plots/polar/area_attributes"),S=t("../plots/polar/axis_attributes"),C=e.exports={};C.get=function(){return v.allTypes.concat("area").forEach(n),i(),o(),E},C.crawl=function(t,e){Object.keys(t).forEach(function(r){var n=t[r];-1===T.indexOf(r)&&(e(n,r,t),C.isValObject(n)||m.isPlainObject(n)&&C.crawl(n,e))})},C.isValObject=function(t){return t&&void 0!==t.valType}},{"../lib":348,"../plotly":365,"../plots/plots":404,"../plots/polar/area_attributes":405,"../plots/polar/axis_attributes":406}],364:[function(t,e,r){"use strict";var n=t("../plotly");e.exports=function(t){return n.Lib.extendFlat(n.defaultConfig,t)}},{"../plotly":365}],365:[function(t,e,r){"use strict";t("es6-promise").polyfill(),r.Lib=t("./lib"),r.util=t("./lib/svg_text_utils"),r.Queue=t("./lib/queue"),t("../build/plotcss"),r.MathJaxConfig=t("./fonts/mathjax_config"),r.defaultConfig=t("./plot_api/plot_config");var n=r.Plots=t("./plots/plots");r.Axes=t("./plots/cartesian/axes"),r.Fx=t("./plots/cartesian/graph_interact"),r.micropolar=t("./plots/polar/micropolar"),r.Color=t("./components/color"),r.Drawing=t("./components/drawing"),r.Colorscale=t("./components/colorscale"),r.Colorbar=t("./components/colorbar"),r.ErrorBars=t("./components/errorbars"),r.Annotations=t("./components/annotations"),r.Shapes=t("./components/shapes"),r.Titles=t("./components/titles"),r.Legend=t("./components/legend"),r.ModeBar=t("./components/modebar"),r.register=function(t){if(!t)throw new Error("No argument passed to Plotly.register.");t&&!Array.isArray(t)&&(t=[t]);for(var e=0;e<t.length;e++){var r=t[e];if(r&&"trace"!==r.moduleType)throw new Error("Invalid module was attempted to be registered!");n.register(r,r.name,r.categories,r.meta),n.subplotsRegistry[r.basePlotModule.name]||n.registerSubplot(r.basePlotModule)}},r.register(t("./traces/scatter")),t("./plot_api/plot_api"),r.PlotSchema=t("./plot_api/plot_schema"),r.Snapshot=t("./snapshot")},{"../build/plotcss":1,"./components/annotations":297,"./components/color":299,"./components/colorbar":304,"./components/colorscale":312,"./components/drawing":317,"./components/errorbars":323,"./components/legend":325,"./components/modebar":327,"./components/shapes":330,"./components/titles":331,"./fonts/mathjax_config":339,"./lib":348,"./lib/queue":354,"./lib/svg_text_utils":359,"./plot_api/plot_api":361,"./plot_api/plot_config":362,"./plot_api/plot_schema":363,"./plots/cartesian/axes":368,"./plots/cartesian/graph_interact":370,"./plots/plots":404,"./plots/polar/micropolar":407,"./snapshot":411,"./traces/scatter":502,"es6-promise":73}],366:[function(t,e,r){"use strict";e.exports={type:{valType:"enumerated",values:[],dflt:"scatter"},visible:{valType:"enumerated",values:[!0,!1,"legendonly"],dflt:!0,description:["Determines whether or not this trace is visible.","If *legendonly*, the trace is not drawn,","but can appear as a legend item","(provided that the legend itself is visible)."].join(" ")},showlegend:{valType:"boolean",dflt:!0,description:["Determines whether or not an item corresponding to this","trace is shown in the legend."].join(" ")},legendgroup:{valType:"string",dflt:"",description:["Sets the legend group for this trace.","Traces part of the same legend group hide/show at the same time","when toggling legend items."].join(" ")},opacity:{valType:"number",min:0,max:1,dflt:1},name:{valType:"string",description:["Sets the trace name.","The trace name appear as the legend item and on hover."].join(" ")},uid:{valType:"string",dflt:""},hoverinfo:{valType:"flaglist",flags:["x","y","z","text","name"],extras:["all","none"],dflt:"all"},stream:{token:{valType:"string",noBlank:!0,strict:!0,description:["The stream id number links a data trace on a plot with a stream.","See https://plot.ly/settings for more details."].join(" ")},maxpoints:{valType:"number",min:0,description:["Sets the maximum number of points to keep on the plots from an","incoming stream.","If `maxpoints` is set to *50*, only the newest 50 points will","be displayed on the plot."].join(" ")}}}},{}],367:[function(t,e,r){"use strict";e.exports={xaxis:{valType:"axisid",dflt:"x",description:["Sets a reference between this trace's x coordinates and","a 2D cartesian x axis.","If *x* (the default value), the x coordinates refer to","`layout.xaxis`.","If *x2*, the x coordinates refer to `layout.xaxis2`, and so on."].join(" ")},yaxis:{valType:"axisid",dflt:"y",description:["Sets a reference between this trace's y coordinates and","a 2D cartesian y axis.","If *y* (the default value), the y coordinates refer to","`layout.yaxis`.","If *y2*, the y coordinates refer to `layout.xaxis2`, and so on."].join(" ")}}},{}],368:[function(t,e,r){"use strict";function n(t,e){if("-"===t.type){var r=t._id,n=r.charAt(0);-1!==r.indexOf("scene")&&(r=n);var s=a(e,r,n);if(s){if("histogram"===s.type&&n==={v:"y",h:"x"}[s.orientation||"v"])return void(t.type="linear");if(o(s,n)){for(var l,c=i(s),u=[],h=0;h<e.length;h++)l=e[h],M.Plots.traceIs(l,"box")&&(l[n+"axis"]||n)===r&&(void 0!==l[c]?u.push(l[c][0]):void 0!==l.name?u.push(l.name):u.push("text"));t.type=L.autoType(u)}else t.type=L.autoType(s[n]||[s[n+"0"]])}}}function i(t){return{v:"x",h:"y"}[t.orientation||"v"]}function o(t,e){var r=i(t);return M.Plots.traceIs(t,"box")&&e===r&&void 0===t[r]&&void 0===t[r+"0"]}function a(t,e,r){for(var n,i=0;i<t.length;i++)if(n=t[i],(n[r+"axis"]||r)===e){if(o(n,r))return n;if((n[r]||[]).length||n[r+"0"])return n}}function s(t){if(!t)return!1;for(var e=0;e<t.length;e++)if(E(t[e]))return!0;return!1}function l(t){var e,r,n=t.tickvals,i=t.ticktext,o=new Array(n.length),a=1.0001*t.range[0]-1e-4*t.range[1],s=1.0001*t.range[1]-1e-4*t.range[0],l=Math.min(a,s),c=Math.max(a,s),u=0;for(Array.isArray(i)||(i=[]),r=0;r<n.length;r++)e=t.d2l(n[r]),e>l&&c>e&&(void 0===i[r]?o[u]=L.tickText(t,e):o[u]=f(t,e,String(i[r])),u++);return u<n.length&&o.splice(u,n.length-u),o}function c(t,e,r){return e*M.Lib.roundUp(t/e,r)}function u(t){var e,r=t.dtick;if(t._tickexponent=0,E(r)||"string"==typeof r||(r=1),"category"===t.type)t._tickround=null;else if(E(r)||"L"===r.charAt(0))if("date"===t.type)r>=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{E(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 h(t,e){var r=t.match(Y),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 T.time.format(t.replace(Y,o))(n)}return T.time.format(t)(n)}function f(t,e,r){var n=t.tickfont||t._td._fullLayout.font;return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function d(t,e,r,n){var i,o=e.x,a=t._tickround,s=new Date(o),l="";r&&t.hoverformat?i=h(t.hoverformat,o):t.tickformat?i=h(t.tickformat,o):(n&&(E(a)?a+=2:a={y:"m",m:"d",d:"H",H:"M",M:"S",S:2}[a]),"y"===a?i=B(s):"m"===a?i=U(s):(o!==t._tmin||r||(l="<br>"+B(s)),"d"===a?i=V(s):"H"===a?i=q(s):(o!==t._tmin||r||(l="<br>"+V(s)+", "+B(s)),i=H(s),"M"!==a&&(i+=G(s),"S"!==a&&(i+=m(A(o/1e3,1),t,"none",r).substr(1)))))),e.text=i+l}function p(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=m(Math.pow(10,a),t,i,n);else if(E(o)||"D"===o.charAt(0)&&A(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<sup>"+s+"</sup>":e.text="10<sup>\u2212"+-s+"</sup>",e.fontSize*=1.25}else e.text=m(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,A(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 g(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function v(t,e,r,n,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=m(e.x,t,i,n)}function m(t,e,r,n){var i=0>t,o=e._tickround,a=r||e.exponentformat||"B",s=e._tickexponent,l=e.tickformat;if(n){var c={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:E(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range:[0,t||1]};u(c),o=(Number(c._tickround)||0)+4,s=c._tickexponent,e.hoverformat&&(l=e.hoverformat)}if(l)return T.format(l)(t).replace(/-/g,"\u2212");var h=Math.pow(10,-o)/2;if("none"===a&&(s=0),t=Math.abs(t),h>t)t="0",i=!1;else{if(t+=h,s&&(t*=Math.pow(10,-s),o+=s),0===o)t=String(Math.floor(t));else if(0>o){t=String(Math.round(t)),t=t.substr(0,t.length+o);for(var f=o;0>f;f++)t+="0"}else{t=String(t);var d=t.indexOf(".")+1;d&&(t=t.substr(0,d+o).replace(/\.?0+$/,""))}t=y(t,e._td._fullLayout.separators)}if(s&&"hide"!==a){var p;p=0>s?"\u2212"+-s:"power"!==a?"+"+s:String(s),"e"===a||("SI"===a||"B"===a)&&(s>12||-15>s)?t+="e"+p:"E"===a?t+="E"+p:"power"===a?t+="&times;10<sup>"+p+"</sup>":"B"===a&&9===s?t+="B":("SI"===a||"B"===a)&&(t+=X[s/3+5])}return i?"\u2212"+t:t}function y(t,e){var r=e.charAt(0),n=e.charAt(1),i=t.split("."),o=i[0],a=i.length>1?r+i[1]:"";if(n&&(i.length>1||o.length>4))for(;W.test(o);)o=o.replace(W,"$1"+n+"$2");return o+a}function b(t,e,r){function n(t,r){for(var n=Object.keys(t),i=/^[xyz]axis[0-9]*/,o=[],a=0;a<n.length;a++){var s=n[a];e&&s.charAt(0)!==e||i.test(s)&&o.push(r+s)}return o.sort()}var i=t._fullLayout;if(!i)return[];var o=n(i,"");if(r)return o;for(var a=M.Plots.getSubplotIds(i,"gl3d")||[],s=0;s<a.length;s++){var l=a[s];o=o.concat(n(i[l],l+"."))}return o}function x(t,e){var r,n,i=[];for(r=0;r<e.length;r++){var o=[],a=t._fullData[e[r]].xaxis,s=t._fullData[e[r]].yaxis;if(a&&s){for(n=0;n<i.length;n++)(-1!==i[n].x.indexOf(a)||-1!==i[n].y.indexOf(s))&&o.push(n);if(o.length){var l,c=i[o[0]];if(o.length>1)for(n=1;n<o.length;n++)l=i[o[n]],_(c.x,l.x),_(c.y,l.y);_(c.x,[a]),_(c.y,[s])}else i.push({x:[a],y:[s]})}}return i}function _(t,e){for(var r=0;r<e.length;r++)-1===t.indexOf(e[r])&&t.push(e[r])}function w(t,e,r){var n,i,o=[],a=[],s=t.layout;for(n=0;n<e.length;n++)o.push(L.getFromId(t,e[n]));for(n=0;n<r.length;n++)a.push(L.getFromId(t,r[n]));var l=Object.keys(o[0]),c=["anchor","domain","overlaying","position","side","tickangle"],u=["linear","log"];for(n=0;n<l.length;n++){var h=l[n],f=o[0][h],d=a[0][h],p=!0,g=!1,v=!1;if("_"!==h.charAt(0)&&"function"!=typeof f&&-1===c.indexOf(h)){for(i=1;i<o.length&&p;i++){var m=o[i][h];"type"===h&&-1!==u.indexOf(f)&&-1!==u.indexOf(m)&&f!==m?g=!0:m!==f&&(p=!1)}for(i=1;i<a.length&&p;i++){var y=a[i][h];"type"===h&&-1!==u.indexOf(d)&&-1!==u.indexOf(y)&&d!==y?v=!0:a[i][h]!==d&&(p=!1)}p&&(g&&(s[o[0]._name].type="linear"),v&&(s[a[0]._name].type="linear"),k(s,h,o,a))}}for(n=0;n<t._fullLayout.annotations.length;n++){var b=t._fullLayout.annotations[n];-1!==e.indexOf(b.xref)&&-1!==r.indexOf(b.yref)&&M.Lib.swapAttrs(s.annotations[n],["?"])}}function k(t,e,r,n){var i,o=M.Lib.nestedProperty,a=o(t[r[0]._name],e).get(),s=o(t[n[0]._name],e).get();for("title"===e&&("Click to enter X axis title"===a&&(a="Click to enter Y axis title"),"Click to enter Y axis title"===s&&(s="Click to enter X axis title")),i=0;i<r.length;i++)o(t,r[i]._name+"."+e).set(s);for(i=0;i<n.length;i++)o(t,n[i]._name+"."+e).set(a)}function A(t,e){return(t%e+e)%e}var M=t("../../plotly"),T=t("d3"),E=t("fast-isnumeric"),L=e.exports={};L.layoutAttributes=t("./layout_attributes");var S=/^xaxis[0-9]*$/,C=/^yaxis[0-9]*$/;L.supplyLayoutDefaults=function(t,e,r){function n(t,e){var r=Number(t.substr(5)||1),n=Number(e.substr(5)||1);return r-n}var i,o=Object.keys(t),a=[],s=[],l={},c={};for(i=0;i<o.length;i++){var u=o[i];S.test(u)?a.push(u):C.test(u)&&s.push(u)}for(i=0;i<r.length;i++){var h=r[i],f=L.id2name(h.xaxis),d=L.id2name(h.yaxis);if(f&&-1===a.indexOf(f)&&a.push(f),d&&-1===s.indexOf(d)&&s.push(d),M.Plots.traceIs(h,"2dMap")&&(l[f]=!0,l[d]=!0),M.Plots.traceIs(h,"oriented")){var p="h"===h.orientation?d:f;c[p]=!0}}(e._hasCartesian||e._hasGL2D||!r.length)&&(a.length?a.sort(n):a=["xaxis"],s.length?s.sort(n):s=["yaxis"]),a.concat(s).forEach(function(n){function i(t,e){return M.Lib.coerce(u,h,L.layoutAttributes,t,e)}var o=n.charAt(0),u=t[n]||{},h={},f={letter:o,font:e.font,outerTicks:l[n],showGrid:!c[n],name:n,data:r},d={letter:o,counterAxes:{x:s,y:a}[o].map(L.name2id),overlayableAxes:{x:a,y:s}[o].filter(function(e){return e!==n&&!(t[e]||{}).overlaying}).map(L.name2id)};L.handleAxisDefaults(u,h,i,f),L.handleAxisPositioningDefaults(u,h,i,d),e[n]=h,t[n]||"-"===u.type||(t[n]={type:u.type})}),a.length&&s.length&&M.Lib.coerce(t,e,M.Plots.layoutAttributes,"plot_bgcolor")},L.handleAxisDefaults=function(t,e,r,i){var o=i.letter,a=i.font||{},s="Click to enter "+(i.title||o.toUpperCase()+" axis")+" title";i.name&&(e._name=i.name,e._id=L.name2id(i.name));var l=r("type");"-"===l&&(n(e,i.data),"-"===e.type?e.type="linear":l=t.type=e.type),L.setConvert(e),r("title",s),M.Lib.coerceFont(r,"titlefont",{family:a.family,size:Math.round(1.2*a.size),color:a.color});var c=2===(t.range||[]).length&&E(t.range[0])&&E(t.range[1]),u=r("autorange",!c);u&&r("rangemode");var h=r("range",[-1,"x"===o?6:4]);h[0]===h[1]&&(e.range=[h[0]-1,h[0]+1]),M.Lib.noneOrAll(t.range,e.range,[0,1]),r("fixedrange"),L.handleTickValueDefaults(t,e,r,l),L.handleTickDefaults(t,e,r,l,i);var f=M.Lib.coerce2(t,e,L.layoutAttributes,"linecolor"),d=M.Lib.coerce2(t,e,L.layoutAttributes,"linewidth"),p=r("showline",!!f||!!d);p||(delete e.linecolor,delete e.linewidth),(p||e.ticks)&&r("mirror");var g=M.Lib.coerce2(t,e,L.layoutAttributes,"gridcolor"),v=M.Lib.coerce2(t,e,L.layoutAttributes,"gridwidth"),m=r("showgrid",i.showGrid||!!g||!!v);m||(delete e.gridcolor,delete e.gridwidth);var y=M.Lib.coerce2(t,e,L.layoutAttributes,"zerolinecolor"),b=M.Lib.coerce2(t,e,L.layoutAttributes,"zerolinewidth"),x=r("zeroline",i.showGrid||!!y||!!b);return x||(delete e.zerolinecolor,delete e.zerolinewidth),e},L.handleTickDefaults=function(t,e,r,n,i){var o=M.Lib.coerce2(t,e,L.layoutAttributes,"ticklen"),a=M.Lib.coerce2(t,e,L.layoutAttributes,"tickwidth"),s=M.Lib.coerce2(t,e,L.layoutAttributes,"tickcolor"),l=r("ticks",i.outerTicks||o||a||s?"outside":"");l||(delete e.ticklen,delete e.tickwidth,delete e.tickcolor);var c=r("showticklabels");if(c){M.Lib.coerceFont(r,"tickfont",i.font||{}),r("tickangle");var u=L.getShowAttrDflt(t);if("category"!==n){var h=r("tickformat");i.noHover||r("hoverformat"),h||"date"===n||(r("showexponent",u),r("exponentformat"))}var f=r("tickprefix");f&&r("showtickprefix",u);var d=r("ticksuffix");d&&r("showticksuffix",u)}},L.handleTickValueDefaults=function(t,e,r,n){var i="auto";"array"!==t.tickmode||"log"!==n&&"date"!==n||(t.tickmode="auto"),Array.isArray(t.tickvals)?i="array":t.dtick&&E(t.dtick)&&(i="linear");var o=r("tickmode",i);if("auto"===o)r("nticks");else if("linear"===o)r("tick0"),r("dtick");else{var a=r("tickvals");void 0===a?e.tickmode="auto":r("ticktext")}},L.handleAxisPositioningDefaults=function(t,e,r,n){var i=n.counterAxes||[],o=n.overlayableAxes||[],a=n.letter,s=M.Lib.coerce(t,e,{anchor:{valType:"enumerated",values:["free"].concat(i),dflt:E(t.position)?"free":i[0]||"free"}},"anchor");"free"===s&&r("position"),M.Lib.coerce(t,e,{side:{valType:"enumerated",values:"x"===a?["bottom","top"]:["left","right"],dflt:"x"===a?"bottom":"left"}},"side");var l=!1;if(o.length&&(l=M.Lib.coerce(t,e,{overlaying:{valType:"enumerated",values:[!1].concat(o),dflt:!1}},"overlaying")),!l){var c=r("domain");c[0]>c[1]-.01&&(e.domain=[0,1]),M.Lib.noneOrAll(t.domain,e.domain,[0,1])}return e},L.coerceRef=function(t,e,r,n){var i=r._fullLayout._hasGL2D?[]:L.listIds(r,n),o=n+"ref",a={};return a[o]={valType:"enumerated",values:i.concat(["paper"]),dflt:i[0]||"paper"},M.Lib.coerce(t,e,a,o)},L.clearTypes=function(t,e){Array.isArray(e)&&e.length||(e=t._fullData.map(function(t,e){return e})),e.forEach(function(e){var r=t.data[e];delete(L.getFromId(t,r.xaxis)||{}).type,delete(L.getFromId(t,r.yaxis)||{}).type})};var z=/^[xyz][0-9]*$/,j=/^[xyz]axis[0-9]*$/;L.id2name=function(t){if("string"==typeof t&&t.match(z)){var e=t.substr(1);return"1"===e&&(e=""),t.charAt(0)+"axis"+e}},L.name2id=function(t){if(t.match(j)){var e=t.substr(5);return"1"===e&&(e=""),t.charAt(0)+e}},L.cleanId=function(t,e){if(t.match(z)&&(!e||t.charAt(0)===e)){var r=t.substr(1).replace(/^0+/,"");return"1"===r&&(r=""),t.charAt(0)+r}},L.cleanName=function(t,e){if(t.match(z)&&(!e||t.charAt(0)===e)){var r=t.substr(5).replace(/^0+/,"");return"1"===r&&(r=""),t.charAt(0)+"axis"+r}},L.counterLetter=function(t){return{x:"y",y:"x"}[t.charAt(0)]},L.autoType=function(t){return L.moreDates(t)?"date":L.category(t)?"category":s(t)?"linear":"-"},L.getShowAttrDflt=function(t){var e=["showexponent","showtickprefix","showticksuffix"],r=e.filter(function(e){return void 0!==t[e]}),n=function(e){return t[e]===t[r[0]]};return r.every(n)||1===r.length?t[r[0]]:void 0},L.moreDates=function(t){for(var e,r=0,n=0,i=Math.max(1,(t.length-1)/1e3),o=0;o<t.length;o+=i)e=t[Math.round(o)],M.Lib.isDateTime(e)&&(r+=1),E(e)&&(n+=1);return r>2*n},L.category=function(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,i=0,o=0;o<t.length;o+=r)e=L.cleanDatum(t[Math.round(o)]),E(e)?n++:"string"==typeof e&&""!==e&&"None"!==e&&i++;return i>2*n},L.cleanDatum=function(t){try{if("object"==typeof t&&null!==t&&t.getTime)return M.Lib.ms2DateTime(t);if("string"!=typeof t&&!E(t))return"";t=t.toString().replace(/['"%,$# ]/g,"")}catch(e){console.log(e,t)}return t},L.BADNUM=void 0,L.setConvert=function(t){function e(e,r){if(e>0)return Math.log(e)/Math.LN10;if(0>=e&&r&&t.range&&2===t.range.length){var n=t.range[0],o=t.range[1];return.5*(n+o-3*i*Math.abs(n-o))}return L.BADNUM}function r(t){return Math.pow(10,t)}function n(t){return E(t)?Number(t):L.BADNUM}var i=10;if(t.c2l="log"===t.type?e:n,t.l2c="log"===t.type?r:n,t.l2d=function(e){return t.c2d(t.l2c(e))},t.p2d=function(e){return t.l2d(t.p2l(e))},t.setScale=function(){var e,r=t._td._fullLayout._size;if(t._categories||(t._categories=[]),t.overlaying){var n=L.getFromId(t._td,t.overlaying);t.domain=n.domain}for(t.range&&2===t.range.length&&t.range[0]!==t.range[1]||(t.range=[-1,1]),e=0;2>e;e++)E(t.range[e])||(t.range[e]=E(t.range[1-e])?t.range[1-e]*(e?10:.1):e?1:-1),t.range[e]<-(Number.MAX_VALUE/2)?t.range[e]=-(Number.MAX_VALUE/2):t.range[e]>Number.MAX_VALUE/2&&(t.range[e]=Number.MAX_VALUE/2);if("y"===t._id.charAt(0)?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(t.range[0]-t.range[1]),t._b=-t._m*t.range[1]):(t._offset=r.l+t.domain[0]*r.w,t._length=r.w*(t.domain[1]-t.domain[0]),
t._m=t._length/(t.range[1]-t.range[0]),t._b=-t._m*t.range[0]),!isFinite(t._m)||!isFinite(t._b))throw M.Lib.notifier("Something went wrong with axis scaling","long"),t._td._replotting=!1,new Error("axis scaling")},t.l2p=function(e){return E(e)?T.round(M.Lib.constrain(t._b+t._m*e,-i*t._length,(1+i)*t._length),2):L.BADNUM},t.p2l=function(e){return(e-t._b)/t._m},t.c2p=function(e,r){return t.l2p(t.c2l(e,r))},t.p2c=function(e){return t.l2c(t.p2l(e))},-1!==["linear","log","-"].indexOf(t.type))t.c2d=n,t.d2c=function(t){return t=L.cleanDatum(t),E(t)?Number(t):L.BADNUM},t.d2l=function(e,r){return"log"===t.type?t.c2l(t.d2c(e),r):t.d2c(e)};else if("date"===t.type){if(t.c2d=function(t){return E(t)?M.Lib.ms2DateTime(t):L.BADNUM},t.d2c=function(t){return E(t)?Number(t):M.Lib.dateTime2ms(t)},t.d2l=t.d2c,t.range&&t.range.length>1)try{var o=t.range.map(M.Lib.dateTime2ms);!E(t.range[0])&&E(o[0])&&(t.range[0]=o[0]),!E(t.range[1])&&E(o[1])&&(t.range[1]=o[1])}catch(a){console.log(a,t.range)}}else"category"===t.type&&(t.c2d=function(e){return t._categories[Math.round(e)]},t.d2c=function(e){-1===t._categories.indexOf(e)&&t._categories.push(e);var r=t._categories.indexOf(e);return-1===r?L.BADNUM:r},t.d2l=t.d2c);t.makeCalcdata=function(e,r){var n,i,o;if(r in e)for(n=e[r],i=new Array(n.length),o=0;o<n.length;o++)i[o]=t.d2c(n[o]);else{var a=r+"0"in e?t.d2c(e[r+"0"]):0,s=e["d"+r]?Number(e["d"+r]):1;for(n=e[{x:"y",y:"x"}[r]],i=new Array(n.length),o=0;o<n.length;o++)i[o]=a+o*s}return i},t._min=[],t._max=[],t._minDtick=null,t._forceTick0=null},L.minDtick=function(t,e,r,n){-1===["log","category"].indexOf(t.type)&&n?null===t._minDtick?(t._minDtick=e,t._forceTick0=r):t._minDtick&&((t._minDtick/e+1e-6)%1<2e-6&&((r-t._forceTick0)/e%1+1.000001)%1<2e-6?(t._minDtick=e,t._forceTick0=r):((e/t._minDtick+1e-6)%1>2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},L.doAutoRange=function(t){if(t._length||t.setScale(),t.autorange&&t._min&&t._max&&t._min.length&&t._max.length){var e,r=t._min[0].val,n=t._max[0].val;for(e=1;e<t._min.length&&r===n;e++)r=Math.min(r,t._min[e].val);for(e=1;e<t._max.length&&r===n;e++)n=Math.max(n,t._max[e].val);var i,o,a,s,l,c,u,h=0,f=t.range&&t.range[1]<t.range[0];for("reversed"===t.autorange&&(f=!0,t.autorange=!0),e=0;e<t._min.length;e++)for(o=t._min[e],i=0;i<t._max.length;i++)a=t._max[i],u=a.val-o.val,c=t._length-o.pad-a.pad,u>0&&c>0&&u/c>h&&(s=o,l=a,h=u/c);r===n?t.range=f?[r+1,"normal"!==t.rangemode?0:r-1]:["normal"!==t.rangemode?0:r-1,r+1]:h&&(("linear"===t.type||"-"===t.type)&&("tozero"===t.rangemode&&s.val>=0?s={val:0,pad:0}:"nonnegative"===t.rangemode&&(s.val-h*s.pad<0&&(s={val:0,pad:0}),l.val<0&&(l={val:1,pad:0})),h=(l.val-s.val)/(t._length-s.pad-l.pad)),t.range=[s.val-h*s.pad,l.val+h*l.pad],t.range[0]===t.range[1]&&(t.range=[t.range[0]-1,t.range[0]+1]),f&&t.range.reverse());var d=t._td.layout[t._name];d||(t._td.layout[t._name]=d={}),d!==t&&(d.range=t.range.slice(),d.autorange=t.autorange)}},L.saveRangeInitial=function(t,e){for(var r,n,i,o=L.list(t,"",!0),a=!1,s=0;s<o.length;s++)r=o[s],n=void 0===r._rangeInitial,i=n||!(r.range[0]===r._rangeInitial[0]&&r.range[1]===r._rangeInitial[1]),(n&&r.autorange===!1||e&&i)&&(r._rangeInitial=r.range.slice(),a=!0);return a};var P=Number.MAX_VALUE/2;L.expand=function(t,e,r){function n(t){if(Array.isArray(t))return function(e){return Math.max(Number(t[e]||0),0)};var e=Math.max(Number(t||0),0);return function(){return e}}function i(r){function n(t){return E(t)&&Math.abs(t)<P}if(l=e[r],E(l)){if(h=b(r)+m,f=x(r)+m,p=l-w(r),g=l+_(r),"log"===t.type&&g/10>p&&(p=g/10),c=t.c2l(p),u=t.c2l(g),y&&(c=Math.min(0,c),u=Math.max(0,u)),n(c)){for(d=!0,a=0;a<t._min.length&&d;a++)s=t._min[a],s.val<=c&&s.pad>=f?d=!1:s.val>=c&&s.pad<=f&&(t._min.splice(a,1),a--);d&&t._min.push({val:c,pad:y&&0===c?0:f})}if(n(u)){for(d=!0,a=0;a<t._max.length&&d;a++)s=t._max[a],s.val>=u&&s.pad>=h?d=!1:s.val<=u&&s.pad<=h&&(t._max.splice(a,1),a--);d&&t._max.push({val:u,pad:y&&0===u?0:h})}}}if(t.autorange&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var o,a,s,l,c,u,h,f,d,p,g,v=e.length,m=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),x=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),_=n(r.vpadplus||r.vpad),w=n(r.vpadminus||r.vpad);for(o=0;6>o;o++)i(o);for(o=v-1;o>5;o--)i(o)}},L.autoBin=function(t,e,r,n){function i(t){return(1+100*(t-d)/h.dtick)%100<2}var o=M.Lib.aggNums(Math.min,null,t),a=M.Lib.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=M.Lib.distinctVals(t),c=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),u=c*M.Lib.roundUp(l.minDiff/c,[.9,1.9,4.9,9.9],!0);s=Math.max(u,2*M.Lib.stdev(t)/Math.pow(t.length,n?.25:.4))}var h={type:"log"===e.type?"linear":e.type,range:[o,a]};L.autoTicks(h,s);var f,d=L.tickIncrement(L.tickFirst(h),h.dtick,"reverse");if("number"==typeof h.dtick){for(var p=0,g=0,v=0,m=0,y=0;y<t.length;y++)t[y]%1===0?v++:E(t[y])||m++,i(t[y])&&p++,i(t[y]+h.dtick/2)&&g++;var b=t.length-m;if(v===b&&"date"!==e.type)h.dtick<1?d=o-.5*h.dtick:d-=.5;else if(.1*b>g&&(p>.3*b||i(o)||i(a))){var x=h.dtick/2;d+=o>d+x?x:-x}var _=1+Math.floor((a-d)/h.dtick);f=d+_*h.dtick}else for(f=d;a>=f;)f=L.tickIncrement(f,h.dtick);return{start:d,end:f,size:h.dtick}},L.calcTicks=function(t){if("array"===t.tickmode)return l(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=M.Lib.constrain(t._length/e,4,9)+1)),L.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),u(t),t._tmin=L.tickFirst(t);var n=t.range[1]<t.range[0],i=[],o=1.0001*t.range[1]-1e-4*t.range[0];"category"===t.type&&(o=n?Math.max(-.5,o):Math.min(t._categories.length-.5,o));for(var a=t._tmin;(n?a>=o:o>=a)&&(i.push(a),!(i.length>1e3));a=L.tickIncrement(a,t.dtick,n));t._tmax=i[i.length-1];for(var s=new Array(i.length),c=0;c<i.length;c++)s[c]=L.tickText(t,i[c]);return s};var I=[2,5,10],R=[1,2,3,6,12],O=[1,2,5,10,15,30],N=[1,2,3,7,14],D=[-.046,0,.301,.477,.602,.699,.778,.845,.903,.954,1],F=[-.301,0,.301,.699,1];L.autoTicks=function(t,e){var r;if("date"===t.type)t.tick0=new Date(2e3,0,1).getTime(),e>157788e5?(e/=315576e5,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*c(e,r,I)):e>12096e5?(e/=26298e5,t.dtick="M"+c(e,1,R)):e>432e5?(t.dtick=c(e,864e5,N),t.tick0=new Date(2e3,0,2).getTime()):e>18e5?t.dtick=c(e,36e5,R):e>3e4?t.dtick=c(e,6e4,O):e>500?t.dtick=c(e,1e3,O):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=c(e,r,I));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"+c(e,r,I)}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=c(e,r,I));if(0===t.dtick&&(t.dtick=1),!E(t.dtick)&&"string"!=typeof t.dtick){var i=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(i)}},L.tickIncrement=function(t,e,r){var n=r?-1:1;if(E(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?F:D,l=t+.01*n,c=M.Lib.roundUp(A(l,1),s,r);return Math.floor(l)+Math.log(T.round(Math.pow(10,c),1))/Math.LN10}throw"unrecognized dtick "+String(e)},L.tickFirst=function(t){var e=t.range[1]<t.range[0],r=e?Math.floor:Math.ceil,n=1.0001*t.range[0]-1e-4*t.range[1],i=t.dtick,o=t.tick0;if(E(i)){var a=r((n-o)/i)*i+o;return"category"===t.type&&(a=M.Lib.constrain(a,0,t._categories.length-1)),a}var s,l,c,u=i.charAt(0),h=Number(i.substr(1));if("M"===u){for(s=new Date(o),n=new Date(n),l=12*(n.getFullYear()-s.getFullYear())+n.getMonth()-s.getMonth(),c=s.setMonth(s.getMonth()+(Math.round(l/h)+(e?1:-1))*h);e?c>n:n>c;)c=L.tickIncrement(c,i,e);return c}if("L"===u)return Math.log(r((Math.pow(10,n)-o)/h)*h+o)/Math.LN10;if("D"===u){var f="D2"===i?F:D,d=M.Lib.roundUp(A(n,1),f,e);return Math.floor(n)+Math.log(T.round(Math.pow(10,d),1))/Math.LN10}throw"unrecognized dtick "+String(i)};var B=T.time.format("%Y"),U=T.time.format("%b %Y"),V=T.time.format("%b %-d"),q=T.time.format("%b %-d %Hh"),H=T.time.format("%H:%M"),G=T.time.format(":%S"),Y=/%(\d?)f/g;L.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=f(t,e),s="array"===t.tickmode,l=r||s;if(s&&Array.isArray(t.ticktext)){var c=Math.abs(t.range[1]-t.range[0])/1e4;for(o=0;o<t.ticktext.length&&!(Math.abs(e-t.d2l(t.tickvals[o]))<c);o++);if(o<t.ticktext.length)return a.text=String(t.ticktext[o]),a}return i="none"!==t.exponentformat&&n(t.showexponent)?"hide":"","date"===t.type?d(t,a,r,l):"log"===t.type?p(t,a,r,l,i):"category"===t.type?g(t,a):v(t,a,r,l,i),t.tickprefix&&!n(t.showtickprefix)&&(a.text=t.tickprefix+a.text),t.ticksuffix&&!n(t.showticksuffix)&&(a.text+=t.ticksuffix),a};var X=["f","p","n","&mu;","m","","k","M","G","T"],W=/(\d+)(\d{3})/;L.list=function(t,e,r){return b(t,e,r).map(function(e){return M.Lib.nestedProperty(t._fullLayout,e).get()})},L.listIds=function(t,e){return b(t,e,!0).map(L.name2id)},L.getFromId=function(t,e,r){var n=t._fullLayout;return"x"===r?e=e.replace(/y[0-9]*/,""):"y"===r&&(e=e.replace(/x[0-9]*/,"")),n[L.id2name(e)]},L.getFromTrace=function(t,e,r){var n=t._fullLayout,i=null;if(M.Plots.traceIs(e,"gl3d")){var o=e.scene;"scene"===o.substr(0,5)&&(i=n[o][r+"axis"])}else i=L.getFromId(t,e[r+"axis"]||r);return i},L.subplotMatch=/^x([0-9]*)y([0-9]*)$/,L.getSubplots=function(t,e){function r(t,e){return-1!==t.indexOf(e._id)}var n,i,o,a=[],s=t.data||[];for(n=0;n<s.length;n++){var l=s[n];if(l.visible!==!1&&"legendonly"!==l.visible&&(M.Plots.traceIs(l,"cartesian")||M.Plots.traceIs(l,"gl2d"))){var c=l.xaxis||"x",u=l.yaxis||"y";o=c+u,-1===a.indexOf(o)&&a.push(o)}}var h=L.list(t,"",!0);for(n=0;n<h.length;n++){var f=h[n],d=f._id.charAt(0),p="free"===f.anchor?"x"===d?"y":"x":f.anchor,g=L.getFromId(t,p),v=!1;for(i=0;i<a.length;i++)if(r(a[i],f)){v=!0;break}if("free"!==f.anchor||!v){if(!g)return void console.log(["Warning: couldnt find anchor",p,"for axis",f._id].join(" "));o="x"===d?f._id+g._id:g._id+f._id,-1===a.indexOf(o)&&a.push(o)}}var m=L.subplotMatch,y=[];for(n=0;n<a.length;n++)o=a[n],m.test(o)&&y.push(o);return y.sort(function(t,e){var r=t.match(m),n=e.match(m);return r[1]===n[1]?+(r[2]||1)-(n[2]||1):+(r[1]||0)-(n[1]||0)}),e?L.findSubplotsWithAxis(y,e):y},L.findSubplotsWithAxis=function(t,e){for(var r=new RegExp("x"===e._id.charAt(0)?"^"+e._id+"y":e._id+"$"),n=[],i=0;i<t.length;i++){var o=t[i];r.test(o)&&n.push(o)}return n},L.makeClipPaths=function(t){var e,r,n=t._fullLayout,i=n._defs,o={_offset:0,_length:n.width,_id:""},a={_offset:0,_length:n.height,_id:""},s=L.list(t,"x",!0),l=L.list(t,"y",!0),c=[];for(e=0;e<s.length;e++)for(c.push({x:s[e],y:a}),r=0;r<l.length;r++)0===e&&c.push({x:o,y:l[r]}),c.push({x:s[e],y:l[r]});var u=i.selectAll("g.clips").data([0]);u.enter().append("g").classed("clips",!0);var h=u.selectAll(".axesclip").data(c,function(t){return t.x._id+t.y._id});h.enter().append("clipPath").classed("axesclip",!0).attr("id",function(t){return"clip"+n._uid+t.x._id+t.y._id}).append("rect"),h.exit().remove(),h.each(function(t){T.select(this).select("rect").attr({x:t.x._offset||0,y:t.y._offset||0,width:t.x._length||1,height:t.y._length||1})})},L.doTicks=function(t,e,r){function n(t){var e=l.l2p(t.x);return e>1&&e<l._length-1}function i(t,e){var r=t.selectAll("path."+x).data("inside"===l.ticks?I:y,b);e&&l.ticks?(r.enter().append("path").classed(x,1).classed("ticks",1).classed("crisp",1).call(M.Color.stroke,l.tickcolor).style("stroke-width",z+"px").attr("d",e),r.attr("transform",f),r.exit().remove()):r.remove()}function o(n,i){function o(t,e){t.each(function(t){var r=d(e),n=T.select(this),i=n.select(".text-math-group"),o=f(t)+(E(e)&&0!==+e?" rotate("+e+","+u(t)+","+(h(t)-t.fontSize/2)+")":"");if(i.empty()){var a=n.select("text").attr({transform:o,"text-anchor":r});a.empty()||a.selectAll("tspan.line").attr({x:a.attr("x"),y:a.attr("y")})}else{var s=M.Drawing.bBox(i.node()).width*{end:-.5,start:.5}[r];i.attr("transform",o+(s?"translate("+s+",0)":""))}})}function a(){return L.length&&Promise.all(L)}function s(){if(o(c,l.tickangle),"x"===v&&!E(l.tickangle)&&("log"!==l.type||"D"!==String(l.dtick).charAt(0))){var n=[];for(c.each(function(t){var e=T.select(this),r=e.select(".text-math-group"),i=l.l2p(t.x);r.empty()&&(r=e.select("text"));var o=M.Drawing.bBox(r.node());n.push({top:0,bottom:10,height:10,left:i-o.width/2,right:i+o.width/2+2,width:o.width+2})}),g=0;g<n.length-1;g++)if(M.Lib.bBoxIntersect(n[g],n[g+1])){w=30;break}if(w){var i=Math.abs((y[y.length-1].x-y[0].x)*l._m)/(y.length-1);2.5*_>i&&(w=90),o(c,w)}l._lastangle=w}return r||M.Titles.draw(t,e+"title"),e+" done"}var c=n.selectAll("g."+x).data(y,b);if(!l.showticklabels||!E(i))return c.remove(),void M.Titles.draw(t,e+"title");var u,h,d,p;if("x"===v){var m="bottom"===j?1:-1;u=function(t){return t.dx},p=i+(A+k)*m,h=function(t){return t.dy+p+t.fontSize*("bottom"===j?1:-.5)},d=function(t){return E(t)&&0!==t&&180!==t?0>t*m?"end":"start":"middle"}}else h=function(t){return t.dy+t.fontSize/2},u=function(t){return t.dx+i+(A+k+(90===Math.abs(l.tickangle)?t.fontSize/2:0))*("right"===j?1:-1)},d=function(t){return E(t)&&90===Math.abs(t)?"middle":"right"===j?"start":"end"};var _=0,w=0,L=[];c.enter().append("g").classed(x,1).append("text").attr("text-anchor","middle").each(function(e){var r=T.select(this),n=t._promises.length;r.call(M.Drawing.setPosition,u(e),h(e)).call(M.Drawing.font,e.font,e.fontSize,e.fontColor).text(e.text).call(M.util.convertToTspans),n=t._promises[n],n?L.push(t._promises.pop().then(function(){o(r,l.tickangle)})):o(r,l.tickangle)}),c.exit().remove(),c.each(function(t){_=Math.max(_,t.fontSize)}),o(c,l._lastangle||l.tickangle);var S=M.Lib.syncOrAsync([a,s]);return S&&S.then&&t._promises.push(S),S}function a(t,e){return t.visible!==!0||t.xaxis+t.yaxis!==e?!1:M.Plots.traceIs(t,"bar")&&t.orientation==={x:"h",y:"v"}[v]?!0:t.fill&&t.fill.charAt(t.fill.length-1)===v}function s(e,r,i){var o=e.gridlayer,s=e.zerolinelayer,c=e["hidegrid"+v]?[]:I,u="M0,0"+("x"===v?"v":"h")+r._length,h=o.selectAll("path."+_).data(l.showgrid===!1?[]:c,b);h.enter().append("path").classed(_,1).classed("crisp",1).attr("d",u).each(function(t){l.zeroline&&("linear"===l.type||"-"===l.type)&&Math.abs(t.x)<l.dtick/100&&T.select(this).remove()}),h.attr("transform",f).call(M.Color.stroke,l.gridcolor||"#ddd").style("stroke-width",S+"px"),h.exit().remove();for(var d=!1,p=0;p<t._fullData.length;p++)if(a(t._fullData[p],i)){d=!0;break}var g=l.range[0]*l.range[1]<=0&&l.zeroline&&("linear"===l.type||"-"===l.type)&&c.length&&(d||n({x:0})||!l.showline),m=s.selectAll("path."+w).data(g?[{x:0}]:[]);m.enter().append("path").classed(w,1).classed("zl",1).classed("crisp",1).attr("d",u),m.attr("transform",f).call(M.Color.stroke,l.zerolinecolor||M.Color.defaultLine).style("stroke-width",C+"px"),m.exit().remove()}var l,c=t._fullLayout,u=!1;if("object"==typeof e)l=e,e=l._id,u=!0;else if(l=L.getFromId(t,e),"redraw"===e&&c._paper.selectAll("g.subplot").each(function(t){var e=c._plots[t],r=e.x(),n=e.y();e.plot.attr("viewBox","0 0 "+r._length+" "+n._length),e.xaxislayer.selectAll("."+r._id+"tick").remove(),e.yaxislayer.selectAll("."+n._id+"tick").remove(),e.gridlayer.selectAll("path").remove(),e.zerolinelayer.selectAll("path").remove()}),!e||"redraw"===e)return M.Lib.syncOrAsync(L.list(t,"",!0).map(function(r){return function(){if(r._id){var n=L.doTicks(t,r._id);return"redraw"===e&&(r._r=r.range.slice()),n}}}));l.tickformat||(-1===["none","e","E","power","SI","B"].indexOf(l.exponentformat)&&(l.exponentformat="e"),-1===["all","first","last","none"].indexOf(l.showexponent)&&(l.showexponent="all")),l.range=[+l.range[0],+l.range[1]],l.setScale();var h,f,d,p,g,v=e.charAt(0),m=L.counterLetter(e),y=L.calcTicks(l),b=function(t){return t.text+t.x+l.mirror},x=e+"tick",_=e+"grid",w=e+"zl",k=(l.linewidth||1)/2,A=("outside"===l.ticks?l.ticklen:1)+(l.linewidth||0),S=M.Drawing.crispRound(t,l.gridwidth,1),C=M.Drawing.crispRound(t,l.zerolinewidth,S),z=M.Drawing.crispRound(t,l.tickwidth,1);if("x"===v)h=["bottom","top"],f=function(t){return"translate("+l.l2p(t.x)+",0)"},d="M0,",p="v";else{if("y"!==v)return void console.log("unrecognized doTicks axis",e);h=["left","right"],f=function(t){return"translate(0,"+l.l2p(t.x)+")"},d="M",p=",0h"}var j=l.side||h[0],P=[-1,1,j===h[1]?1:-1];"inside"!==l.ticks==("x"===v)&&(P=P.map(function(t){return-t}));var I=y.filter(n);if(u)return i(l._axislayer,d+(l._pos+k*P[2])+p+P[2]*l.ticklen),o(l._axislayer,l._pos);var R=L.getSubplots(t,l).map(function(t){var e=c._plots[t];if(c._hasCartesian){var r=e[v+"axislayer"],n=l._linepositions[t]||[],a=e[m](),u=a._id===l.anchor,f=[!1,!1,!1],y="";if("allticks"===l.mirror?f=[!0,!0,!1]:u&&("ticks"===l.mirror?f=[!0,!0,!1]:f[h.indexOf(j)]=!0),l.mirrors)for(g=0;2>g;g++){var b=l.mirrors[a._id+h[g]];("ticks"===b||"labels"===b)&&(f[g]=!0)}return void 0!==n[2]&&(f[2]=!0),f.forEach(function(t,e){var r=n[e],i=P[e];t&&E(r)&&(y+=d+(r+k*i)+p+i*l.ticklen)}),i(r,y),s(e,a,t),o(r,n[3])}}).filter(function(t){return t&&t.then});return R.length?Promise.all(R):0},L.swap=function(t,e){for(var r=x(t,e),n=0;n<r.length;n++)w(t,r[n].x,r[n].y)}},{"../../plotly":365,"./layout_attributes":372,d3:70,"fast-isnumeric":74}],369:[function(t,e,r){"use strict";e.exports={DBLCLICKDELAY:600,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:100,BENDPX:1.5}},{}],370:[function(t,e,r){"use strict";function n(t,e){for(var r=[],n=t.length;n>0;n--)r.push(e);return r}function i(t,e){for(var r=[],n=0;n<t.length;n++)r.push(t[n].p2c(e));return r}function o(t,e){return function(r){var n=t(r),i=e(r);return Math.sqrt(n*n+i*i)}}function a(t,e,r){if("pie"===r)return void t.emit("plotly_hover",{points:[e]});r||(r="xy");var o=t._fullLayout,a=o._plots[r],d=[r].concat(a.overlays.map(function(t){return t.id})),p=d.map(function(e){return k.Axes.getFromId(t,e,"x")}),g=d.map(function(e){return k.Axes.getFromId(t,e,"y")}),v=e.hovermode||o.hovermode;if(-1===["x","y","closest"].indexOf(v)||!t.calcdata||t.querySelector(".zoombox")||t._dragging)return f(t,e);var m,y,b,x,_,M,E,L,S,C,z,j,P=[],I=[];if(Array.isArray(e))for(v="array",b=0;b<e.length;b++)_=t.calcdata[e[b].curveNumber||0],"none"!==_[0].trace.hoverinfo&&I.push(_);else{for(x=0;x<t.calcdata.length;x++)_=t.calcdata[x],M=_[0].trace,"none"!==M.hoverinfo&&-1!==d.indexOf(M.xaxis+M.yaxis)&&I.push(_);var R,O;if(e.target&&"clientX"in e&&"clientY"in e){if(A.triggerHandler(t,"plotly_beforehover",e)===!1)return;var N=e.target.getBoundingClientRect();if(R=e.clientX-N.left,O=e.clientY-N.top,0>R||R>N.width||0>O||O>N.height)return f(t,e)}else R="xpx"in e?e.xpx:p[0]._length/2,O="ypx"in e?e.ypx:g[0]._length/2;if(m="xval"in e?n(d,e.xval):i(p,R),y="yval"in e?n(d,e.yval):i(g,O),!w(m[0])||!w(y[0]))return console.log("Plotly.Fx.hover failed",e,t),f(t,e)}var D=1/0;for(x=0;x<I.length;x++)if(_=I[x],_&&_[0]&&_[0].trace&&_[0].trace.visible===!0){if(M=_[0].trace,E=d.indexOf(M.xaxis+M.yaxis),L=v,z={cd:_,trace:M,xa:p[E],ya:g[E],name:t.data.length>1||-1!==M.hoverinfo.indexOf("name")?M.name:void 0,index:!1,distance:Math.min(D,T.MAXDIST),color:k.Color.defaultLine,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},j=P.length,"array"===L){var F=e[x];"pointNumber"in F?(z.index=F.pointNumber,L="closest"):(L="","xval"in F&&(S=F.xval,L="x"),"yval"in F&&(C=F.yval,L=L?"closest":"y"))}else S=m[E],C=y[E];if(M._module&&M._module.hoverPoints){var B=M._module.hoverPoints(z,S,C,L);if(B)for(var U,V=0;V<B.length;V++)U=B[V],w(U.x0)&&w(U.y0)&&P.push(s(U,v))}else console.log("unrecognized trace type in hover",M);"closest"===v&&P.length>j&&(P.splice(0,j),D=P[0].distance)}if(0===P.length)return f(t,e);var q="y"===v&&I.length>1;P.sort(function(t,e){return t.distance-e.distance});var H={hovermode:v,rotateLabels:q,bgColor:k.Color.combine(o.plot_bgcolor,o.paper_bgcolor),container:o._hoverlayer,outerContainer:o._paperdiv},G=l(P,H);c(P,q?p[0]:g[0]),u(G,q);var Y=t._hoverdata,X=[];for(b=0;b<P.length;b++){var W=P[b],Z={data:W.trace._input,fullData:W.trace,curveNumber:W.trace.index,pointNumber:W.index,x:W.xVal,y:W.yVal,xaxis:W.xa,yaxis:W.ya};void 0!==W.zLabelVal&&(Z.z=W.zLabelVal),X.push(Z)}t._hoverdata=X,h(t,e,Y)&&(Y&&t.emit("plotly_unhover",{points:Y}),t.emit("plotly_hover",{points:t._hoverdata,xaxes:p,yaxes:g,xvals:m,yvals:y}))}function s(t,e){t.posref="y"===e?(t.x0+t.x1)/2:(t.y0+t.y1)/2,t.x0=k.Lib.constrain(t.x0,0,t.xa._length),t.x1=k.Lib.constrain(t.x1,0,t.xa._length),t.y0=k.Lib.constrain(t.y0,0,t.ya._length),t.y1=k.Lib.constrain(t.y1,0,t.ya._length);var r;if(void 0!==t.xLabelVal){r="log"===t.xa.type&&t.xLabelVal<=0;var n=k.Axes.tickText(t.xa,t.xa.c2l(r?-t.xLabelVal:t.xLabelVal),"hover");r?0===t.xLabelVal?t.xLabel="0":t.xLabel="-"+n.text:t.xLabel=n.text,t.xVal=t.xa.c2d(t.xLabelVal)}if(void 0!==t.yLabelVal){r="log"===t.ya.type&&t.yLabelVal<=0;var i=k.Axes.tickText(t.ya,t.ya.c2l(r?-t.yLabelVal:t.yLabelVal),"hover");r?0===t.yLabelVal?t.yLabel="0":t.yLabel="-"+i.text:t.yLabel=i.text,t.yVal=t.ya.c2d(t.yLabelVal)}if(void 0!==t.zLabelVal&&(t.zLabel=String(t.zLabelVal)),void 0!==t.xerr){var o=k.Axes.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+o+" / -"+k.Axes.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" &plusmn; "+o,"x"===e&&(t.distance+=1)}if(void 0!==t.yerr){var a=k.Axes.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+a+" / -"+k.Axes.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" &plusmn; "+a,"y"===e&&(t.distance+=1)}var s=t.trace.hoverinfo;return"all"!==s&&(s=s.split("+"),-1===s.indexOf("x")&&(t.xLabel=void 0),-1===s.indexOf("y")&&(t.yLabel=void 0),-1===s.indexOf("z")&&(t.zLabel=void 0),-1===s.indexOf("text")&&(t.text=void 0),-1===s.indexOf("name")&&(t.name=void 0)),t}function l(t,e){var r,n,i=e.hovermode,o=e.rotateLabels,a=e.bgColor,s=e.container,l=e.outerContainer,c=t[0],u=c.xa,h=c.ya,f="y"===i?"yLabel":"xLabel",d=c[f],p=(String(d)||"").split(" ")[0],g=l.node().getBoundingClientRect(),v=g.top,m=g.width,y=g.height,b=c.distance<=T.MAXDIST&&("x"===i||"y"===i);for(r=0;r<t.length;r++){n=t[r].trace.hoverinfo;var w=n.split("+");if(-1===w.indexOf("all")&&-1===w.indexOf(i)){b=!1;break}}var A=s.selectAll("g.axistext").data(b?[0]:[]);A.enter().append("g").classed("axistext",!0),A.exit().remove(),A.each(function(){var e=x.select(this),r=e.selectAll("path").data([0]),n=e.selectAll("text").data([0]);r.enter().append("path").style({fill:k.Color.defaultLine,"stroke-width":"1px",stroke:k.Color.background}),n.enter().append("text").call(k.Drawing.font,O,R,k.Color.background).attr("data-notex",1),n.text(d).call(k.util.convertToTspans).call(k.Drawing.setPosition,0,0).selectAll("tspan.line").call(k.Drawing.setPosition,0,0),e.attr("transform","");var o=n.node().getBoundingClientRect();if("x"===i){n.attr("text-anchor","middle").call(k.Drawing.setPosition,0,"top"===u.side?v-o.bottom-P-I:v-o.top+P+I).selectAll("tspan.line").attr({x:n.attr("x"),y:n.attr("y")});var a="top"===u.side?"-":"";r.attr("d","M0,0L"+P+","+a+P+"H"+(I+o.width/2)+"v"+a+(2*I+o.height)+"H-"+(I+o.width/2)+"V"+a+P+"H-"+P+"Z"),e.attr("transform","translate("+(u._offset+(c.x0+c.x1)/2)+","+(h._offset+("top"===u.side?0:h._length))+")")}else{n.attr("text-anchor","right"===h.side?"start":"end").call(k.Drawing.setPosition,("right"===h.side?1:-1)*(I+P),v-o.top-o.height/2).selectAll("tspan.line").attr({x:n.attr("x"),y:n.attr("y")});var s="right"===h.side?"":"-";r.attr("d","M0,0L"+s+P+","+P+"V"+(I+o.height/2)+"h"+s+(2*I+o.width)+"V-"+(I+o.height/2)+"H"+s+P+"V-"+P+"Z"),e.attr("transform","translate("+(u._offset+("right"===h.side?u._length:0))+","+(h._offset+(c.y0+c.y1)/2)+")")}t=t.filter(function(t){return void 0!==t.zLabelVal||(t[f]||"").split(" ")[0]===p})});var M=s.selectAll("g.hovertext").data(t,function(t){return[t.trace.index,t.index,t.x0,t.y0,t.name,t.attr||""].join(",")});return M.enter().append("g").classed("hovertext",!0).each(function(){var t=x.select(this);t.append("rect").call(k.Color.fill,k.Color.addOpacity(a,.8)),t.append("text").classed("name",!0).call(k.Drawing.font,O,R),t.append("path").style("stroke-width","1px"),t.append("text").classed("nums",!0).call(k.Drawing.font,O,R)}),M.exit().remove(),M.each(function(t){var e=x.select(this).attr("transform",""),r="",n="",s=k.Color.opacity(t.color)?t.color:k.Color.defaultLine,l=k.Color.combine(s,a),c=_(l).getBrightness()>128?"#000":k.Color.background;if(t.name&&void 0===t.zLabelVal){var f=document.createElement("p");f.innerHTML=t.name,r=f.textContent||"",r.length>15&&(r=r.substr(0,12)+"...")}void 0!==t.zLabel?(void 0!==t.xLabel&&(n+="x: "+t.xLabel+"<br>"),void 0!==t.yLabel&&(n+="y: "+t.yLabel+"<br>"),n+=(n?"z: ":"")+t.zLabel):b&&t[i+"Label"]===d?n=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(n=t.yLabel):n=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&(n+=(n?"<br>":"")+t.text),""===n&&(""===r&&e.remove(),n=r);var p=e.select("text.nums").style("fill",c).call(k.Drawing.setPosition,0,0).text(n).attr("data-notex",1).call(k.util.convertToTspans);p.selectAll("tspan.line").call(k.Drawing.setPosition,0,0);var g=e.select("text.name"),w=0;r&&r!==n?(g.style("fill",l).text(r).call(k.Drawing.setPosition,0,0).attr("data-notex",1).call(k.util.convertToTspans),g.selectAll("tspan.line").call(k.Drawing.setPosition,0,0),w=g.node().getBoundingClientRect().width+2*I):(g.remove(),e.select("rect").remove()),e.select("path").style({fill:l,stroke:c});var A,M,T=p.node().getBoundingClientRect(),E=u._offset+(t.x0+t.x1)/2,S=h._offset+(t.y0+t.y1)/2,C=Math.abs(t.x1-t.x0),z=Math.abs(t.y1-t.y0),j=T.width+P+I+w;t.ty0=v-T.top,t.bx=T.width+2*I,t.by=T.height+2*I,t.anchor="start",t.txwidth=T.width,t.tx2width=w,t.offset=0,o?(t.pos=E,A=y>=S+z/2+j,M=S-z/2-j>=0,"top"!==t.idealAlign&&A||!M?A?(S+=z/2,t.anchor="start"):t.anchor="middle":(S-=z/2,t.anchor="end")):(t.pos=S,A=m>=E+C/2+j,M=E-C/2-j>=0,"left"!==t.idealAlign&&A||!M?A?(E+=C/2,t.anchor="start"):t.anchor="middle":(E-=C/2,t.anchor="end")),p.attr("text-anchor",t.anchor),w&&g.attr("text-anchor",t.anchor),e.attr("transform","translate("+E+","+S+")"+(o?"rotate("+L+")":""))}),M}function c(t,e){function r(t){var e=t[0],r=t[t.length-1];if(i=h-e.pos-e.dp+e.size,o=r.pos+r.dp+r.size-f,i>.01){for(s=t.length-1;s>=0;s--)t[s].dp+=i;n=!1}if(!(.01>o)){if(-.01>i){for(s=t.length-1;s>=0;s--)t[s].dp-=o;n=!1}if(n){var c=0;for(a=0;a<t.length;a++)l=t[a],l.pos+l.dp+l.size>f&&c++;for(a=t.length-1;a>=0&&!(0>=c);a--)l=t[a],l.pos>f-1&&(l.del=!0,c--);for(a=0;a<t.length&&!(0>=c);a++)if(l=t[a],l.pos<h+1)for(l.del=!0,c--,o=2*l.size,s=t.length-1;s>=0;s--)t[s].dp-=o;for(a=t.length-1;a>=0&&!(0>=c);a--)l=t[a],l.pos+l.dp+l.size>f&&(l.del=!0,c--)}}}for(var n,i,o,a,s,l,c,u=0,h=e._offset,f=e._offset+e._length,d=t.map(function(t,r){return[{i:r,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===e._id.charAt(0)?C:1)/2}]}).sort(function(t,e){return t[0].posref-e[0].posref});!n&&u<=t.length;){for(u++,n=!0,a=0;a<d.length-1;){var p=d[a],g=d[a+1],v=p[p.length-1],m=g[0];if(i=v.pos+v.dp+v.size-m.pos-m.dp+m.size,i>.01){for(s=g.length-1;s>=0;s--)g[s].dp+=i;for(p.push.apply(p,g),d.splice(a+1,1),c=0,s=p.length-1;s>=0;s--)c+=p[s].dp;for(o=c/p.length,s=p.length-1;s>=0;s--)p[s].dp-=o;n=!1}else a++}d.forEach(r)}for(a=d.length-1;a>=0;a--){var y=d[a];for(s=y.length-1;s>=0;s--){var b=y[s],x=t[b.i];x.offset=b.dp,x.del=b.del}}}function u(t,e){t.each(function(t){var r=x.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,i=r.select("text.nums"),o={start:1,end:-1,middle:0}[t.anchor],a=o*(P+I),s=a+o*(t.txwidth+I),l=0,c=t.offset;"middle"===t.anchor&&(a-=t.tx2width/2,s-=t.tx2width/2),e&&(c*=-j,l=t.offset*z),r.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(n*P+l)+","+(P+c)+"v"+(t.by/2-P)+"h"+n*t.bx+"v-"+t.by+"H"+(n*P+l)+"V"+(c-P)+"Z"),i.call(k.Drawing.setPosition,a+l,c+t.ty0-t.by/2+I).selectAll("tspan.line").attr({x:i.attr("x"),y:i.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(k.Drawing.setPosition,s+o*I+l,c+t.ty0-t.by/2+I),r.select("rect").call(k.Drawing.setRect,s+(o-1)*t.tx2width/2+l,c-t.by/2-1,t.tx2width,t.by+2))})}function h(t,e,r){if(!e.target)return!1;if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var i=r[n],o=t._hoverdata[n];if(i.curveNumber!==o.curveNumber||String(i.pointNumber)!==String(o.pointNumber))return!0}return!1}function f(t,e){var r=t._fullLayout;e||(e={}),e.target&&A.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)}function d(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function p(t,e,r,n,i,o,a,s){function l(t,e){for(z=0;z<t.length;z++)if(!t[z].fixedrange)return e;return""}function c(t){t[0]=Number(t[0]),t[1]=Number(t[1])}function u(r,n,i){var o=Z.getBoundingClientRect();for($=n-o.left,K=i-o.top,J={l:$,r:$,w:0,t:K,b:K,h:0},tt=t._hmpixcount?t._hmlumcount/t._hmpixcount:_(t._fullLayout.plot_bgcolor).getLuminance(),et=et="M0,0H"+F+"V"+B+"H0V0",rt=!1,nt="xy",it=e.plot.append("path").attr("class","zoombox").style({fill:tt>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("d",et+"Z"),ot=e.plot.append("path").attr("class","zoombox-corners").style({fill:k.Color.background,stroke:k.Color.defaultLine,"stroke-width":1,opacity:0}).attr("d","M0,0Z"),h(),z=0;z<q.length;z++)c(q[z].range)}function h(){e.plot.selectAll(".select-outline").remove()}function f(t,e){var r=Math.max(0,Math.min(F,t+$)),n=Math.max(0,Math.min(B,e+K)),i=Math.abs(r-$),o=Math.abs(n-K),a=Math.floor(Math.min(o,i,V)/2);J.l=Math.min($,r),J.r=Math.max($,r),J.t=Math.min(K,n),J.b=Math.max(K,n),!G||o<Math.min(Math.max(.6*i,U),V)?U>i?(nt="",J.r=J.l,J.t=J.b,ot.attr("d","M0,0Z")):(J.t=0,J.b=B,nt="x",ot.attr("d","M"+(J.l-.5)+","+(K-V-.5)+"h-3v"+(2*V+1)+"h3ZM"+(J.r+.5)+","+(K-V-.5)+"h3v"+(2*V+1)+"h-3Z")):!H||i<Math.min(.6*o,V)?(J.l=0,J.r=F,nt="y",ot.attr("d","M"+($-V-.5)+","+(J.t-.5)+"v-3h"+(2*V+1)+"v3ZM"+($-V-.5)+","+(J.b+.5)+"v3h"+(2*V+1)+"v-3Z")):(nt="xy",ot.attr("d","M"+(J.l-3.5)+","+(J.t-.5+a)+"h3v"+-a+"h"+a+"v-3h-"+(a+3)+"ZM"+(J.r+3.5)+","+(J.t-.5+a)+"h-3v"+-a+"h"+-a+"v-3h"+(a+3)+"ZM"+(J.r+3.5)+","+(J.b+.5-a)+"h-3v"+a+"h"+-a+"v3h"+(a+3)+"ZM"+(J.l-3.5)+","+(J.b+.5-a)+"h3v"+a+"h"+a+"v3h-"+(a+3)+"Z")),J.w=J.r-J.l,J.h=J.b-J.t,it.attr("d",et+"M"+J.l+","+J.t+"v"+J.h+"h"+J.w+"v-"+J.h+"h-"+J.w+"Z"),rt||(it.transition().style("fill",tt>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),ot.transition().style("opacity",1).duration(200),rt=!0)}function p(t,e,r){var n,i,o;for(n=0;n<t.length;n++)i=t[n],i.fixedrange||(o=i.range,i.range=[o[0]+(o[1]-o[0])*e,o[0]+(o[1]-o[0])*r])}function m(e,r){return Math.min(J.h,J.w)<2*U?(2===r?L():v(t),y(t)):(("xy"===nt||"x"===nt)&&p(O,J.l/F,J.r/F),("xy"===nt||"y"===nt)&&p(D,(B-J.b)/B,(B-J.t)/B),y(t),S(nt),void(N&&t.data&&t._context.showTips&&(k.Lib.notifier("Double-click to<br>zoom back out","long"),N=!1)))}function b(e,r){var n=1===(a+s).length;if(e)S();else if(2!==r||n)if(1===r&&n){var i=a?D[0]:O[0],o="s"===a||"w"===s?0:1,l=i._name+".range["+o+"]",c=g(i,o),u="left",h="middle";if(i.fixedrange)return;a?(h="n"===a?"top":"bottom","right"===i.side&&(u="right")):"e"===s&&(u="right"),W.call(k.util.makeEditable,null,{immediate:!0,background:I.paper_bgcolor,text:String(c),fill:i.tickfont?i.tickfont.color:"#444",
horizontalAlign:u,verticalAlign:h}).on("edit",function(e){var r="category"===i.type?i.c2l(e):i.d2l(e);void 0!==r&&k.relayout(t,l,r)})}else v(t);else L()}function x(e){function r(t,e,r){if(!t.fixedrange){c(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||I._enablescrollzoom){var n=t.querySelector(".plotly");if(!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(st);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void console.log("did not find wheel motion attributes",e);var o,l=Math.exp(-Math.min(Math.max(i,-20),20)/100),u=ct.draglayer.select(".nsewdrag").node().getBoundingClientRect(),h=(e.clientX-u.left)/u.width,f=at[0]+at[2]*h,d=(u.bottom-e.clientY)/u.height,p=at[1]+at[3]*(1-d);if(s){for(o=0;o<O.length;o++)r(O[o],h,l);at[2]*=l,at[0]=f-at[2]*h}if(a){for(o=0;o<D.length;o++)r(D[o],d,l);at[3]*=l,at[1]=p-at[3]*(1-d)}return C(at),A(a,s),st=setTimeout(function(){at=[0,0,F,B],S()},lt),k.Lib.pauseEvent(e)}}}function w(t,e){function r(t,e){for(var r=0;r<t.length;r++){var n=t[r];n.fixedrange||(n.range=[n._r[0]-e/n._m,n._r[1]-e/n._m])}}function n(t){return 1-(t>=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;a<t.length;a++){var s=t[a];s.fixedrange||(o=a,s.range[e]=s._r[i]+(s._r[e]-s._r[i])/n(r/s._length))}return t[o]._length*(t[o]._r[e]-t[o].range[e])/(t[o]._r[e]-t[o]._r[i])}return"ew"===H||"ns"===G?(H&&r(O,t),G&&r(D,e),C([H?-t:0,G?-e:0,F,B]),void A(G,H)):("w"===H?t=i(O,0,t):"e"===H?t=i(O,1,-t):H||(t=0),"n"===G?e=i(D,1,e):"s"===G?e=i(D,0,-e):G||(e=0),C(["w"===H?t:0,"n"===G?e:0,F-t,B-e]),void A(G,H))}function A(e,r){function n(t){for(o=0;o<t.length;o++)t[o].fixedrange||a.push(t[o]._id)}function i(n,i){var s;for(o=0;o<n.length;o++)s=n[o],(r&&-1!==a.indexOf(s.xref)||e&&-1!==a.indexOf(s.yref))&&i.draw(t,o)}var o,a=[];for(r&&n(O),e&&n(D),o=0;o<a.length;o++)k.Axes.doTicks(t,a[o],!0);i(I.annotations||[],k.Annotations),i(I.shapes||[],k.Shapes)}function L(){var e,r,n=t._context.doubleClick,i=(H?O:[]).concat(G?D:[]),o={};if("autosize"===n)for(r=0;r<i.length;r++)e=i[r],e.fixedrange||(o[e._name+".autorange"]=!0);else if("reset"===n)for(r=0;r<i.length;r++)e=i[r],o[e._name+".range"]=e._rangeInitial.slice();else if("reset+autosize"===n)for(r=0;r<i.length;r++)e=i[r],e.fixedrange||(void 0===e._rangeInitial||e.range[0]===e._rangeInitial[0]&&e.range[1]===e._rangeInitial[1]?o[e._name+".autorange"]=!0:o[e._name+".range"]=e._rangeInitial.slice());k.relayout(t,o)}function S(e){for(var r={},n=0;n<q.length;n++){var i=q[n];e&&-1===e.indexOf(i._id.charAt(0))||(i._r[0]!==i.range[0]&&(r[i._name+".range[0]"]=i.range[0]),i._r[1]!==i.range[1]&&(r[i._name+".range[1]"]=i.range[1]),i.range=i._r.slice())}C([0,0,F,B]),k.relayout(t,r)}function C(t){var e,r,n,i,o,l,c=I._plots,u=Object.keys(c);for(e=0;e<u.length;e++)if(r=c[u[e]],n=r.x(),i=r.y(),o=s&&-1!==O.indexOf(n)&&!n.fixedrange,l=a&&-1!==D.indexOf(i)&&!i.fixedrange,o||l){var h=[0,0,n._length,i._length];o&&(h[0]=t[0],h[2]=t[2]),l&&(h[1]=t[1],h[3]=t[3]),r.plot.attr("viewBox",h.join(" "))}}var z,j,P,I=t._fullLayout,R=[e].concat(a&&s?e.overlays:[]),O=[e.x()],D=[e.y()],F=O[0]._length,B=D[0]._length,U=T.MINDRAG,V=T.MINZOOM;for(z=1;z<R.length;z++)j=R[z].x(),P=R[z].y(),-1===O.indexOf(j)&&O.push(j),-1===D.indexOf(P)&&D.push(P);var q=O.concat(D),H=l(O,s),G=l(D,a),Y=d(G+H,I.dragmode),X=a+s+"drag",W=e.draglayer.selectAll("."+X).data([0]);W.enter().append("rect").classed("drag",!0).classed(X,!0).style({fill:"transparent","stroke-width":0}).attr("data-subplot",e.id),W.call(k.Drawing.setRect,r,n,i,o).call(E.setCursor,Y);var Z=W.node();if(!G&&!H)return Z.onmousedown=null,Z.style.pointerEvents=a+s==="nsew"?"all":"none",Z;var Q={element:Z,gd:t,plotinfo:e,xaxes:O,yaxes:D,doubleclick:L,prepFn:function(e,r,n){var i=t._fullLayout.dragmode;a+s==="nsew"?e.shiftKey&&(i="pan"===i?"zoom":"pan"):i="pan","lasso"===i?Q.minDrag=1:Q.minDrag=void 0,"zoom"===i?(Q.moveFn=f,Q.doneFn=m,u(e,r,n)):"pan"===i?(Q.moveFn=w,Q.doneFn=b,h()):("select"===i||"lasso"===i)&&M(e,r,n,Q,i)}};E.dragElement(Q);var $,K,J,tt,et,rt,nt,it,ot,at=[0,0,F,B],st=null,lt=300,ct=e.mainplot?I._plots[e.mainplot]:e;return a.length*s.length!==1&&(void 0!==Z.onwheel?Z.onwheel=x:void 0!==Z.onmousewheel&&(Z.onmousewheel=x)),Z}function g(t,e){var r,n=t.range[e],i=Math.abs(n-t.range[1-e]);return"date"===t.type?k.Lib.ms2DateTime(n,i):"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,x.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,x.format("."+String(r)+"g")(n))}function v(t){t._dragging=!0;var e=t._replotPending;t._replotPending=!1,setTimeout(function(){t._replotPending=e,m(t)},T.DBLCLICKDELAY)}function m(t){t._dragging=!1,t._replotPending&&k.plot(t)}function y(t){x.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function b(){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}var x=t("d3"),_=t("tinycolor2"),w=t("fast-isnumeric"),k=t("../../plotly"),A=t("../../lib/events"),M=t("./select"),T=t("./constants"),E=e.exports={};E.layoutAttributes={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],description:["Determines the mode of drag interactions.","*select* and *lasso* apply only to scatter traces with","markers or text. *orbit* and *turntable* apply only to","3D scenes."].join(" ")},hovermode:{valType:"enumerated",values:["x","y","closest",!1]}},E.supplyLayoutDefaults=function(t,e,r){function n(r,n){return k.Lib.coerce(t,e,E.layoutAttributes,r,n)}var i,o;n("dragmode",e._hasGL3D?"turntable":"zoom"),e._hasCartesian?(i=e._isHoriz=E.isHoriz(r),o=i?"y":"x"):o="closest",n("hovermode",o)},E.isHoriz=function(t){var e,r,n=!0;for(e=0;e<t.length;e++)if(r=t[e],"h"!==r.orientation){n=!1;break}return n},E.init=function(t){var e=t._fullLayout;if(!(e._hasGL3D||e._hasGeo||t._context.staticPlot)){var r=Object.keys(e._plots||{}).sort(function(t,r){if((e._plots[t].mainplot&&!0)===(e._plots[r].mainplot&&!0)){var n=t.split("y"),i=r.split("y");return n[0]===i[0]?Number(n[1]||1)-Number(i[1]||1):Number(n[0]||1)-Number(i[0]||1)}return e._plots[t].mainplot?1:-1});r.forEach(function(r){var n=e._plots[r];if(e._hasCartesian){var i=n.x(),o=n.y(),a=(i._linepositions[r]||[])[3],s=(o._linepositions[r]||[])[3],l=T.DRAGGERSIZE;if(w(a)&&"top"===i.side&&(a-=l),w(s)&&"right"!==o.side&&(s-=l),!n.mainplot){var c=p(t,n,0,0,i._length,o._length,"ns","ew");c.onmousemove=function(n){E.hover(t,n,r),e._lasthover=c,e._hoversubplot=r},c.onmouseout=function(e){t._dragging||E.unhover(t,e)},c.onclick=function(e){E.click(t,e)},p(t,n,-l,-l,l,l,"n","w"),p(t,n,i._length,-l,l,l,"n","e"),p(t,n,-l,o._length,l,l,"s","w"),p(t,n,i._length,o._length,l,l,"s","e")}w(a)&&("free"===i.anchor&&(a-=e._size.h*(1-o.domain[1])),p(t,n,.1*i._length,a,.8*i._length,l,"","ew"),p(t,n,0,a,.1*i._length,l,"","w"),p(t,n,.9*i._length,a,.1*i._length,l,"","e")),w(s)&&("free"===o.anchor&&(s-=e._size.w*i.domain[0]),p(t,n,s,.1*o._length,l,.8*o._length,"ns",""),p(t,n,s,.9*o._length,l,.1*o._length,"s",""),p(t,n,s,0,l,.1*o._length,"n",""))}});var n=e._hoverlayer.node();n.onmousemove=function(r){r.target=e._lasthover,E.hover(t,r,e._hoversubplot)},n.onclick=function(r){r.target=e._lasthover,E.click(t,r)},n.onmousedown=function(t){e._lasthover.onmousedown(t)}}};var L=T.YANGLE,S=Math.PI*L/180,C=1/Math.sin(S),z=Math.cos(S),j=Math.sin(S),P=T.HOVERARROWSIZE,I=T.HOVERTEXTPAD,R=T.HOVERFONTSIZE,O=T.HOVERFONT;E.hover=function(t,e,r){return"string"==typeof t&&(t=document.getElementById(t)),void 0===t._lastHoverTime&&(t._lastHoverTime=0),void 0!==t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),Date.now()>t._lastHoverTime+T.HOVERMINTIME?(a(t,e,r),void(t._lastHoverTime=Date.now())):void(t._hoverTimer=setTimeout(function(){a(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},T.HOVERMINTIME))},E.unhover=function(t,e,r){"string"==typeof t&&(t=document.getElementById(t)),t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),f(t,e,r)},E.getDistanceFunction=function(t,e,r,n){return"closest"===t?n||o(e,r):"x"===t?e:r},E.getClosest=function(t,e,r){if(r.index!==!1)r.index>=0&&r.index<t.length?r.distance=0:r.index=!1;else for(var n=0;n<t.length;n++){var i=e(t[n]);i<r.distance&&(r.index=n,r.distance=i)}return r},E.loneHover=function(t,e){var r={color:t.color||k.Color.defaultLine,x0:t.x0||t.x||0,x1:t.x1||t.x||0,y0:t.y0||t.y||0,y1:t.y1||t.y||0,xLabel:t.xLabel,yLabel:t.yLabel,zLabel:t.zLabel,text:t.text,name:t.name,idealAlign:t.idealAlign,trace:{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0},n=x.select(e.container),i=e.outerContainer?x.select(e.outerContainer):n,o={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||k.Color.background,container:n,outerContainer:i},a=l([r],o);return u(a,o.rotateLabels),a.node()},E.loneUnhover=function(t){var e=t instanceof x.selection?t:x.select(t);e.selectAll("g.hovertext").remove()},E.click=function(t,e){t._hoverdata&&e&&e.target&&(t.emit("plotly_click",{points:t._hoverdata}),e.stopImmediatePropagation&&e.stopImmediatePropagation())};var N=!0;E.dragAlign=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};var D=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];E.dragCursors=function(t,e,r,n){return t="left"===r?0:"center"===r?1:"right"===r?2:k.Lib.constrain(Math.floor(3*t),0,2),e="bottom"===n?0:"middle"===n?1:"top"===n?2:k.Lib.constrain(Math.floor(3*e),0,2),D[e][t]},E.dragElement=function(t){function e(e){var f=document.querySelector(".plugin-editable");return f&&x.select(f).on("blur").call(f),c._dragged=!1,c._dragging=!0,i=e.clientX,o=e.clientY,l=e.target,a=(new Date).getTime(),a-c._mouseDownTime<h?u+=1:(u=1,c._mouseDownTime=a),t.prepFn&&t.prepFn(e,i,o),s=b(),s.onmousemove=r,s.onmouseup=n,s.onmouseout=n,s.style.cursor=window.getComputedStyle(t.element).cursor,k.Lib.pauseEvent(e)}function r(e){var r=e.clientX-i,n=e.clientY-o,a=t.minDrag||T.MINDRAG;return Math.abs(r)<a&&(r=0),Math.abs(n)<a&&(n=0),(r||n)&&(c._dragged=!0,E.unhover(c)),t.moveFn&&t.moveFn(r,n,c._dragged),k.Lib.pauseEvent(e)}function n(e){if(s.onmousemove=null,s.onmouseup=null,s.onmouseout=null,k.Lib.removeElement(s),!c._dragging)return void(c._dragged=!1);if(c._dragging=!1,(new Date).getTime()-c._mouseDownTime>h&&(u=Math.max(u-1,1)),t.doneFn&&t.doneFn(c._dragged,u),!c._dragged){var r=document.createEvent("MouseEvents");r.initEvent("click",!0,!0),l.dispatchEvent(r)}return m(c),c._dragged=!1,k.Lib.pauseEvent(e)}var i,o,a,s,l,c=k.Lib.getPlotDiv(t.element)||{},u=1,h=T.DBLCLICKDELAY;c._mouseDownTime||(c._mouseDownTime=0),t.element.onmousedown=e,t.element.style.pointerEvents="all"},E.setCursor=function(t,e){(t.attr("class")||"").split(" ").forEach(function(e){0===e.indexOf("cursor-")&&t.classed(e,!1)}),e&&t.classed("cursor-"+e,!0)},E.inbox=function(t,e){return 0>t*e||0===t?T.MAXDIST*(.6-.3/Math.max(3,Math.abs(t-e))):1/0}},{"../../lib/events":343,"../../plotly":365,"./constants":369,"./select":373,d3:70,"fast-isnumeric":74,tinycolor2:229}],371:[function(t,e,r){"use strict";r.name="cartesian",r.attr=["xaxis","yaxis"],r.idRoot=["x","y"],r.attributes=t("./attributes"),r.idRegex={x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},r.attrRegex={x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/}},{"./attributes":367}],372:[function(t,e,r){"use strict";var n=t("./index"),i=t("../font_attributes"),o=t("../../components/color/attributes"),a=t("../../lib/extend").extendFlat;e.exports={title:{valType:"string"},titlefont:a({},i,{description:["Sets this axis' title font."].join(" ")}),type:{valType:"enumerated",values:["-","linear","log","date","category"],dflt:"-",description:["Sets the axis type.","By default, plotly attempts to determined the axis type","by looking into the data of the traces that referenced","the axis in question."].join(" ")},autorange:{valType:"enumerated",values:[!0,!1,"reversed"],dflt:!0,description:["Determines whether or not the range of this axis is","computed in relation to the input data.","See `rangemode` for more info.","If `range` is provided, then `autorange` is set to *false*."].join(" ")},rangemode:{valType:"enumerated",values:["normal","tozero","nonnegative"],dflt:"normal",description:["If *normal*, the range is computed in relation to the extrema","of the input data.","If *tozero*`, the range extends to 0,","regardless of the input data","If *nonnegative*, the range is non-negative,","regardless of the input data."].join(" ")},range:{valType:"info_array",items:[{valType:"number"},{valType:"number"}],description:["Sets the range of this axis.","If the axis `type` is *log*, then you must take the log of your desired range","(e.g. to set the range from 1 to 100, set the range from 0 to 2).","If the axis `type` is *date*, then you must convert the date to unix time in milliseconds","(the number of milliseconds since January 1st, 1970). For example, to set the date range from","January 1st 1970 to November 4th, 2013, set the range from 0 to 1380844800000.0"].join(" ")},fixedrange:{valType:"boolean",dflt:!1,description:["Determines whether or not this axis is zoom-able.","If true, then zoom is disabled."].join(" ")},tickmode:{valType:"enumerated",values:["auto","linear","array"],description:["Sets the tick mode for this axis.","If *auto*, the number of ticks is set via `nticks`.","If *linear*, the placement of the ticks is determined by","a starting position `tick0` and a tick step `dtick`","(*linear* is the default value if `tick0` and `dtick` are provided).","If *array*, the placement of the ticks is set via `tickvals`","and the tick text is `ticktext`.","(*array* is the default value if `tickvals` is provided)."].join(" ")},nticks:{valType:"integer",min:0,dflt:0,description:["Sets the number of ticks.","Has an effect only if `tickmode` is set to *auto*."].join(" ")},tick0:{valType:"number",dflt:0,description:["Sets the placement of the first tick on this axis.","Use with `dtick`.","If the axis `type` is *log*, then you must take the log of your starting tick","(e.g. to set the starting tick to 100, set the `tick0` to 2).","If the axis `type` is *date*, then you must convert the date to unix time in milliseconds","(the number of milliseconds since January 1st, 1970).","For example, to set the starting tick to","November 4th, 2013, set the range to 1380844800000.0."].join(" ")},dtick:{valType:"any",dflt:1,description:["Sets the step in-between ticks on this axis","Use with `tick0`.","If the axis `type` is *log*, then ticks are set every 10^(n*dtick) where n","is the tick number. For example,","to set a tick mark at 1, 10, 100, 1000, ... set dtick to 1.","To set tick marks at 1, 100, 10000, ... set dtick to 2.","To set tick marks at 1, 5, 25, 125, 625, 3125, ... set dtick to log_10(5), or 0.69897000433.","If the axis `type` is *date*, then you must convert the time to milliseconds.","For example, to set the interval between ticks to one day,","set `dtick` to 86400000.0."].join(" ")},tickvals:{valType:"data_array",description:["Sets the values at which ticks on this axis appear.","Only has an effect if `tickmode` is set to *array*.","Used with `ticktext`."].join(" ")},ticktext:{valType:"data_array",description:["Sets the text displayed at the ticks position via `tickvals`.","Only has an effect if `tickmode` is set to *array*.","Used with `ticktext`."].join(" ")},ticks:{valType:"enumerated",values:["outside","inside",""],description:["Determines whether ticks are drawn or not.","If **, this axis' ticks are not drawn.","If *outside* (*inside*), this axis' are drawn outside (inside)","the axis lines."].join(" ")},mirror:{valType:"enumerated",values:[!0,"ticks",!1,"all","allticks"],dflt:!1,description:["Determines if the axis lines or/and ticks are mirrored to","the opposite side of the plotting area.","If *true*, the axis lines are mirrored.","If *ticks*, the axis lines and ticks are mirrored.","If *false*, mirroring is disable.","If *all*, axis lines are mirrored on all shared-axes subplots.","If *allticks*, axis lines and ticks are mirrored","on all shared-axes subplots."].join(" ")},ticklen:{valType:"number",min:0,dflt:5},tickwidth:{valType:"number",min:0,dflt:1},tickcolor:{valType:"color",dflt:o.defaultLine},showticklabels:{valType:"boolean",dflt:!0},tickfont:a({},i,{}),tickangle:{valType:"angle",dflt:"auto",description:["Sets the angle of the tick labels with respect to the horizontal.","For example, a `tickangle` of -90 draws the tick labels","vertically."].join(" ")},tickprefix:{valType:"string",dflt:""},showtickprefix:{valType:"enumerated",values:["all","first","last","none"],dflt:"all",description:["If *all*, all tick labels are displayed with a prefix.","If *first*, only the first tick is displayed with a prefix.","If *last*, only the last tick is displayed with a suffix.","If *none*, tick prefixes are hidden."].join(" ")},ticksuffix:{valType:"string",dflt:""},showticksuffix:{valType:"enumerated",values:["all","first","last","none"],dflt:"all"},showexponent:{valType:"enumerated",values:["all","first","last","none"],dflt:"all",description:["If *all*, all exponents are shown besides their significands.","If *first*, only the exponent of the first tick is shown.","If *last*, only the exponent of the last tick is shown.","If *none*, no exponents appear."].join(" ")},exponentformat:{valType:"enumerated",values:["none","e","E","power","SI","B"],dflt:"B",description:["Determines a formatting rule for the tick exponents.","For example, consider the number 1,000,000,000.","If *none*, it appears as 1,000,000,000.","If *e*, 1e+9.","If *E*, 1E+9.","If *power*, 1x10^9 (with 9 in a super script).","If *SI*, 1G.","If *B*, 1B."].join(" ")},tickformat:{valType:"string",dflt:"",description:["Sets the tick label formatting rule using the","python/d3 number formatting language.","See https://github.com/mbostock/d3/wiki/Formatting#numbers","or https://docs.python.org/release/3.1.3/library/string.html#formatspec","for more info."].join(" ")},hoverformat:{valType:"string",dflt:"",description:["Sets the hover text formatting rule for data values on this axis,","using the python/d3 number formatting language.","See https://github.com/mbostock/d3/wiki/Formatting#numbers","or https://docs.python.org/release/3.1.3/library/string.html#formatspec","for more info."].join(" ")},showline:{valType:"boolean",dflt:!1,description:["Determines whether or not a line bounding this axis is drawn."].join(" ")},linecolor:{valType:"color",dflt:o.defaultLine},linewidth:{valType:"number",min:0,dflt:1},showgrid:{valType:"boolean",description:["Determines whether or not grid lines are drawn.","If *true*, the grid lines are drawn at every tick mark."].join(" ")},gridcolor:{valType:"color",dflt:o.lightLine},gridwidth:{valType:"number",min:0,dflt:1},zeroline:{valType:"boolean",description:["Determines whether or not a line is drawn at along the 0 value","of this axis.","If *true*, the zero line is drawn on top of the grid lines."].join(" ")},zerolinecolor:{valType:"color",dflt:o.defaultLine},zerolinewidth:{valType:"number",dflt:1},anchor:{valType:"enumerated",values:["free",n.idRegex.x.toString(),n.idRegex.y.toString()],description:["If set to an opposite-letter axis id (e.g. `xaxis2`, `yaxis`), this axis is bound to","the corresponding opposite-letter axis.","If set to *free*, this axis' position is determined by `position`."].join(" ")},side:{valType:"enumerated",values:["top","bottom","left","right"],description:["Determines whether a x (y) axis is positioned","at the *bottom* (*left*) or *top* (*right*)","of the plotting area."].join(" ")},overlaying:{valType:"enumerated",values:["free",n.idRegex.x.toString(),n.idRegex.y.toString()],description:["If set a same-letter axis id, this axis is overlaid on top of","the corresponding same-letter axis.","If *false*, this axis does not overlay any same-letter axes."].join(" ")},domain:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1],description:["Sets the domain of this axis (in plot fraction)."].join(" ")},position:{valType:"number",min:0,max:1,dflt:0,description:["Sets the position of this axis in the plotting space","(in normalized coordinates).","Only has an effect if `anchor` is set to *free*."].join(" ")},_deprecated:{autotick:{valType:"boolean",description:["Obsolete.","Set `tickmode` to *auto* for old `autotick` *true* behavior.","Set `tickmode` to *linear* for `autotick` *false*."].join(" ")}}}},{"../../components/color/attributes":298,"../../lib/extend":344,"../font_attributes":374,"./index":371}],373:[function(t,e,r){"use strict";function n(t){return t._id}var i=t("../../lib/polygon"),o=t("../../components/color"),a=t("./axes"),s=t("./constants"),l=i.filter,c=i.tester,u=s.MINSELECT;e.exports=function(t,e,r,i,h){function f(t){var e="y"===t._id.charAt(0)?1:0;return function(r){return t.p2d(r[e])}}function d(t,e){return t-e}var p,g=i.plotinfo.plot,v=i.element.getBoundingClientRect(),m=e-v.left,y=r-v.top,b=m,x=y,_="M"+m+","+y,w=i.xaxes[0]._length,k=i.yaxes[0]._length,A=i.xaxes.map(n),M=i.yaxes.map(n),T=i.xaxes.concat(i.yaxes);"lasso"===h&&(p=l([[m,y]],s.BENDPX));var E=g.selectAll("path.select-outline").data([1,2]);E.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("d",_+"Z");var L,S,C,z,j,P=g.append("path").attr("class","zoombox-corners").style({fill:o.background,stroke:o.defaultLine,"stroke-width":1}).attr("d","M0,0Z"),I=[],R=i.gd,O=[];for(L=0;L<R.calcdata.length;L++)S=R.calcdata[L],C=S[0].trace,C._module&&C._module.selectPoints&&-1!==A.indexOf(C.xaxis)&&-1!==M.indexOf(C.yaxis)&&I.push({selectPoints:C._module.selectPoints,cd:S,xaxis:a.getFromId(R,C.xaxis),yaxis:a.getFromId(R,C.yaxis)});i.moveFn=function(t,e){var r,n;b=Math.max(0,Math.min(w,t+m)),x=Math.max(0,Math.min(k,e+y));var o=Math.abs(b-m),a=Math.abs(x-y);for("select"===h?(a<Math.min(.6*o,u)?(r=c([[m,0],[m,k],[b,k],[b,0]]),P.attr("d","M"+r.xmin+","+(y-u)+"h-4v"+2*u+"h4ZM"+(r.xmax-1)+","+(y-u)+"h4v"+2*u+"h-4Z")):o<Math.min(.6*a,u)?(r=c([[0,y],[0,x],[w,x],[w,y]]),P.attr("d","M"+(m-u)+","+r.ymin+"v-4h"+2*u+"v4ZM"+(m-u)+","+(r.ymax-1)+"v4h"+2*u+"v-4Z")):(r=c([[m,y],[m,x],[b,x],[b,y]]),P.attr("d","M0,0Z")),E.attr("d","M"+r.xmin+","+r.ymin+"H"+(r.xmax-1)+"V"+(r.ymax-1)+"H"+r.xmin+"Z")):"lasso"===h&&(p.addPt([b,x]),r=c(p.filtered),E.attr("d","M"+p.filtered.join("L")+"Z")),O=[],L=0;L<I.length;L++)z=I[L],[].push.apply(O,z.selectPoints(z,r));if(j={points:O},"select"===h){var s,l=j.range={};for(L=0;L<T.length;L++)n=T[L],s=n._id.charAt(0),l[n._id]=[n.p2d(r[s+"min"]),n.p2d(r[s+"max"])].sort(d)}else{var g=j.lassoPoints={};for(L=0;L<T.length;L++)n=T[L],g[n._id]=p.filtered.map(f(n))}i.gd.emit("plotly_selecting",j)},i.doneFn=function(t,e){if(t||2!==e)i.gd.emit("plotly_selected",j);else for(E.remove(),L=0;L<I.length;L++)z=I[L],z.selectPoints(z,!1);P.remove()}}},{"../../components/color":299,"../../lib/polygon":353,"./axes":368,"./constants":369}],374:[function(t,e,r){"use strict";e.exports={family:{valType:"string",noBlank:!0,strict:!0,description:["HTML font family - the typeface that will be applied by the web browser.","The web browser will only be able to apply a font if it is available on the system","which it operates. Provide multiple font families, separated by commas, to indicate","the preference in which to apply fonts if they aren't available on the system.","The plotly service (at https://plot.ly or on-premise) generates images on a server,","where only a select number of","fonts are installed and supported.","These include *Arial*, *Balto*, *Courier New*, *Droid Sans*,, *Droid Serif*,","*Droid Sans Mono*, *Gravitas One*, *Old Standard TT*, *Open Sans*, *Overpass*,","*PT Sans Narrow*, *Raleway*, *Times New Roman*."].join(" ")},size:{valType:"number",min:1},color:{valType:"color"}}},{}],375:[function(t,e,r){"use strict";function n(t,e){this.id=t.id,this.container=t.container,this.topojsonURL=t.topojsonURL,p(),this.showHover="closest"===e.hovermode,this.hoverContainer=null,this.topojsonName=null,this.topojson=null,this.projectionType=null,this.projection=null,this.clipAngle=null,this.setScale=null,this.path=null,this.zoom=null,this.zoomReset=null,this.makeFramework()}function i(t,e,r){return c.geo.graticule().extent([[t[0],e[0]],[t[1],e[1]]]).step(r)}function o(t,e,r){var n=b.layerNameToAdjective[e];t.select("."+e).selectAll("path").attr("stroke","none").call(u.fill,r[n+"color"])}function a(t,e,r){var n=b.layerNameToAdjective[e];t.select("."+e).selectAll("path").attr("fill","none").call(u.stroke,r[n+"color"]).call(h.dashLine,"",r[n+"width"])}function s(t,e,r){t.select("."+e+"graticule").selectAll("path").attr("fill","none").call(u.stroke,r[e].gridcolor).call(h.dashLine,"",r[e].gridwidth)}function l(t){var e={type:"linear",showexponent:"all",exponentformat:d.layoutAttributes.exponentformat.dflt,_td:{_fullLayout:t}};return d.setConvert(e),e}var c=t("d3"),u=t("../../components/color"),h=t("../../components/drawing"),f=t("../../plots/plots"),d=t("../../plots/cartesian/axes"),p=t("./projections"),g=t("./set_scale"),v=t("./zoom"),m=t("./zoom_reset"),y=t("../../constants/xmlns_namespaces"),b=t("../../constants/geo_constants"),x=t("../../lib/topojson_utils"),_=t("topojson").feature;e.exports=n;var w=n.prototype;w.plot=function(t,e,r){var n,i,o=this,a=e[o.id],s=e._size;o.projection=null,o.setScale=g(a,s),o.makeProjection(a),o.makePath(),o.adjustLayout(a,s),o.zoom=v(o,a),o.zoomReset=m(o,a),o.mockAxis=l(e),o.framework.call(o.zoom).on("dblclick.zoom",o.zoomReset),n=x.getTopojsonName(a),null===o.topojson||n!==o.topojsonName?(o.topojsonName=n,void 0!==PlotlyGeoAssets.topojson[o.topojsonName]?(o.topojson=PlotlyGeoAssets.topojson[o.topojsonName],o.onceTopojsonIsLoaded(t,a)):(i=x.getTopojsonPath(o.topojsonURL,o.topojsonName),r.push(new Promise(function(e,r){c.json(i,function(n,s){return n?void r(404===n.status?new Error(["plotly.js could not find topojson file at",i,".","Make sure the *topojsonURL* plot config option","is set properly."].join(" ")):new Error(["unexpected error while fetching topojson file at",i].join(" "))):(o.topojson=s,PlotlyGeoAssets.topojson[o.topojsonName]=s,o.onceTopojsonIsLoaded(t,a),void e())})})))):o.onceTopojsonIsLoaded(t,a)},w.onceTopojsonIsLoaded=function(t,e){var r={};this.drawLayout(e);for(var n=0;n<t.length;n++){var i=t[n];r[i.type]=r[i.type]||[],r[i.type].push(i)}for(var o=Object.keys(r),a=0;a<o.length;a++){var s=o[a];f.getModule(s).plot(this,r[s],e)}this.render()},w.makeProjection=function(t){var e,r=t.projection,n=r.type,i=null===this.projection||n!==this.projectionType;i?(this.projectionType=n,e=this.projection=c.geo[b.projNames[n]]()):e=this.projection,e.translate(r._translate0).precision(b.precision),t._isAlbersUsa||e.rotate(r._rotate).center(r._center),t._clipAngle?(this.clipAngle=t._clipAngle,e.clipAngle(t._clipAngle-b.clipPad)):this.clipAngle=null,r.parallels&&e.parallels(r.parallels),i&&this.setScale(e),e.translate(r._translate).scale(r._scale)},w.makePath=function(){this.path=c.geo.path().projection(this.projection)},w.makeFramework=function(){var t=this.geoDiv=c.select(this.container).append("div");t.attr("id",this.id).style("position","absolute");var e=this.hoverContainer=t.append("svg");e.attr(y.svgAttrs).style({position:"absolute","z-index":20,"pointer-events":"none"});var r=this.framework=t.append("svg");r.attr(y.svgAttrs).attr({position:"absolute",preserveAspectRatio:"none"}),r.append("g").attr("class","bglayer").append("rect"),r.append("g").attr("class","baselayer"),r.append("g").attr("class","choroplethlayer"),r.append("g").attr("class","baselayeroverchoropleth"),r.append("g").attr("class","scattergeolayer"),r.on("dblclick.zoom",null)},w.adjustLayout=function(t,e){var r=t.domain;this.geoDiv.style({left:e.l+e.w*r.x[0]+t._marginX+"px",top:e.t+e.h*(1-r.y[1])+t._marginY+"px",width:t._width+"px",height:t._height+"px"}),this.hoverContainer.attr({width:t._width,height:t._height}),this.framework.attr({width:t._width,height:t._height}),this.framework.select(".bglayer").select("rect").attr({width:t._width,height:t._height}).style({fill:t.bgcolor,"stroke-width":0})},w.drawTopo=function(t,e,r){if(r["show"+e]===!0){var n=this.topojson,i="frame"===e?b.sphereSVG:_(n,n.objects[e]);t.append("g").datum(i).attr("class",e).append("path").attr("class","basepath")}},w.drawGraticule=function(t,e,r){var n=r[e];if(n.showgrid===!0){var o=b.scopeDefaults[r.scope],a=o.lonaxisRange,s=o.lataxisRange,l="lonaxis"===e?[n.dtick]:[0,n.dtick],c=i(a,s,l);t.append("g").datum(c).attr("class",e+"graticule").append("path").attr("class","graticulepath")}},w.drawLayout=function(t){var e,r=this.framework.select("g.baselayer"),n=b.baseLayers,i=b.axesNames;r.selectAll("*").remove();for(var o=0;o<n.length;o++)e=n[o],-1!==i.indexOf(e)?this.drawGraticule(r,e,t):this.drawTopo(r,e,t);this.styleLayout(t)},w.styleLayer=function(t,e,r){var n=b.fillLayers,i=b.lineLayers;-1!==n.indexOf(e)?o(t,e,r):-1!==i.indexOf(e)&&a(t,e,r)},w.styleLayout=function(t){for(var e,r=this.framework.select("g.baselayer"),n=b.baseLayers,i=b.axesNames,o=0;o<n.length;o++)e=n[o],-1!==i.indexOf(e)?s(r,e,t):this.styleLayer(r,e,t)},w.render=function(){function t(t){var e=o([t.lon,t.lat]);return e?"translate("+e[0]+","+e[1]+")":null}function e(t){var e=o.rotate(),r=c.geo.distance([t.lon,t.lat],[-e[0],-e[1]]),n=s*Math.PI/180;return r>n?"0":"1.0"}var r=this.framework,n=r.select("g.choroplethlayer"),i=r.select("g.scattergeolayer"),o=this.projection,a=this.path,s=this.clipAngle;r.selectAll("path.basepath").attr("d",a),r.selectAll("path.graticulepath").attr("d",a),n.selectAll("path.choroplethlocation").attr("d",a),n.selectAll("path.basepath").attr("d",a),i.selectAll("path.js-line").attr("d",a),null!==s?(i.selectAll("path.point").style("opacity",e).attr("transform",t),i.selectAll("text").style("opacity",e).attr("transform",t)):(i.selectAll("path.point").attr("transform",t),i.selectAll("text").attr("transform",t))}},{"../../components/color":299,"../../components/drawing":317,"../../constants/geo_constants":333,"../../constants/xmlns_namespaces":337,"../../lib/topojson_utils":360,"../../plots/cartesian/axes":368,"../../plots/plots":404,"./projections":382,"./set_scale":383,"./zoom":384,"./zoom_reset":385,d3:70,topojson:230}],376:[function(t,e,r){"use strict";var n=t("./geo"),i=t("../../plots/plots");r.name="geo",r.attr="geo",r.idRoot="geo",r.idRegex=/^geo([2-9]|[1-9][0-9]+)?$/,r.attrRegex=/^geo([2-9]|[1-9][0-9]+)?$/,r.attributes=t("./layout/attributes"),r.layoutAttributes=t("./layout/layout_attributes"),r.supplyLayoutDefaults=t("./layout/defaults"),r.plot=function(t){var e=t._fullLayout,r=t._fullData,o=i.getSubplotIds(e,"geo");void 0===window.PlotlyGeoAssets&&(window.PlotlyGeoAssets={topojson:{}});for(var a=0;a<o.length;a++){var s=o[a],l=i.getSubplotData(r,"geo",s),c=e[s]._geo;void 0===c&&(c=new n({id:s,container:e._geocontainer.node(),topojsonURL:t._context.topojsonURL},e),e[s]._geo=c),c.plot(l,e,t._promises)}}},{"../../plots/plots":404,"./geo":375,"./layout/attributes":377,"./layout/defaults":380,"./layout/layout_attributes":381}],377:[function(t,e,r){"use strict";e.exports={geo:{valType:"geoid",dflt:"geo",description:["Sets a reference between this trace's geospatial coordinates and","a geographic map.","If *geo* (the default value), the geospatial coordinates refer to","`layout.geo`.","If *geo2*, the geospatial coordinates refer to `layout.geo2`,","and so on."].join(" ")}}},{}],378:[function(t,e,r){"use strict";var n=t("../../../components/color/attributes");e.exports={range:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},showgrid:{valType:"boolean",dflt:!1},tick0:{valType:"number",description:["Sets the graticule's starting tick longitude/latitude."].join(" ")
},dtick:{valType:"number",description:["Sets the graticule's longitude/latitude tick step."].join(" ")},gridcolor:{valType:"color",dflt:n.lightLine,description:["Sets the graticule's stroke color."].join(" ")},gridwidth:{valType:"number",min:0,dflt:1,description:["Sets the graticule's stroke width (in px)."].join(" ")}}},{"../../../components/color/attributes":298}],379:[function(t,e,r){"use strict";var n=t("../../../lib"),i=t("../../../constants/geo_constants"),o=t("./axis_attributes");e.exports=function(t,e){function r(t,e){return n.coerce(s,l,o,t,e)}function a(t){var r,n,o,a,s,l,c=e.scope;return"world"===c?(r=e.projection,n=r.type,o=r.rotation,s=i[t+"Span"],l=void 0!==s[n]?s[n]/2:s["*"]/2,a="lonaxis"===t?o.lon:o.lat,[a-l,a+l]):i.scopeDefaults[c][t+"Range"]}for(var s,l,c=i.axesNames,u=0;u<c.length;u++){var h=c[u];s=t[h]||{},l={};var f=a(h),d=r("range",f);n.noneOrAll(s.range,l.range,[0,1]),r("tick0",d[0]),r("dtick","lonaxis"===h?30:10);var p=r("showgrid");p&&(r("gridcolor"),r("gridwidth")),e[h]=l,e[h]._fullRange=f}}},{"../../../constants/geo_constants":333,"../../../lib":348,"./axis_attributes":378}],380:[function(t,e,r){"use strict";function n(t,e,r){var n,i=r("scope"),o="world"!==i,s=a.scopeDefaults[i],c=r("resolution"),u=r("projection.type",s.projType),h="albers usa"===u,f=-1!==u.indexOf("conic");if(f){var d=s.projParallels||[0,60];r("projection.parallels",d)}if(h)e.scope="usa";else{var p=s.projRotate||[0,0,0];r("projection.rotation.lon",p[0]),r("projection.rotation.lat",p[1]),r("projection.rotation.roll",p[2]),n=r("showcoastlines",!o),n&&(r("coastlinecolor"),r("coastlinewidth")),n=r("showocean"),n&&r("oceancolor")}r("projection.scale"),n=r("showland"),n&&r("landcolor"),n=r("showlakes"),n&&r("lakecolor"),n=r("showrivers"),n&&(r("rivercolor"),r("riverwidth")),n=r("showcountries",o),n&&(r("countrycolor"),r("countrywidth")),("usa"===i||"north america"===i&&50===c)&&(r("showsubunits",!0),r("subunitcolor"),r("subunitwidth")),o||(n=r("showframe",!0),n&&(r("framecolor"),r("framewidth"))),r("bgcolor"),l(t,e),e._isHighRes=50===c,e._clipAngle=a.lonaxisSpan[u]/2,e._isAlbersUsa=h,e._isConic=f,e._isScoped=o;var g=e.projection.rotation||{};e.projection._rotate=[-g.lon||0,-g.lat||0,g.roll||0]}var i=t("../../../lib"),o=t("../../plots"),a=t("../../../constants/geo_constants"),s=t("./layout_attributes"),l=t("./axis_defaults");e.exports=function(t,e,r){function a(t,e){return i.coerce(l,c,s,t,e)}for(var l,c,u=o.getSubplotIdsInData(r,"geo"),h=u.length,f=0;h>f;f++){var d=u[f];l=t[d]||{},c={},a("domain.x"),a("domain.y",[f/h,(f+1)/h]),n(l,c,a),e[d]=c}}},{"../../../constants/geo_constants":333,"../../../lib":348,"../../plots":404,"./axis_defaults":379,"./layout_attributes":381}],381:[function(t,e,r){"use strict";var n=t("../../../components/color/attributes"),i=t("../../../constants/geo_constants"),o=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],description:["Sets the horizontal domain of this map","(in plot fraction)."].join(" ")},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1],description:["Sets the vertical domain of this map","(in plot fraction)."].join(" ")}},resolution:{valType:"enumerated",values:[110,50],dflt:110,coerceNumber:!0,description:["Sets the resolution of the base layers.","The values have units of km/mm","e.g. 110 corresponds to a scale ratio of 1:110,000,000."].join(" ")},scope:{valType:"enumerated",values:Object.keys(i.scopeDefaults),dflt:"world"},projection:{type:{valType:"enumerated",values:Object.keys(i.projNames)},rotation:{lon:{valType:"number",description:["Rotates the map along parallels","(in degrees East)."].join(" ")},lat:{valType:"number",description:["Rotates the map along meridians","(in degrees North)."].join(" ")},roll:{valType:"number",description:["Roll the map (in degrees)","For example, a roll of *180* makes the map appear upside down."].join(" ")}},parallels:{valType:"info_array",items:[{valType:"number"},{valType:"number"}],description:["For conic projection types only.","Sets the parallels (tangent, secant)","where the cone intersects the sphere."].join(" ")},scale:{valType:"number",min:0,max:10,dflt:1}},showcoastlines:{valType:"boolean"},coastlinecolor:{valType:"color",dflt:n.defaultLine},coastlinewidth:{valType:"number",min:0,dflt:1},showland:{valType:"boolean",dflt:!1},landcolor:{valType:"color",dflt:i.landColor},showocean:{valType:"boolean",dflt:!1},oceancolor:{valType:"color",dflt:i.waterColor},showlakes:{valType:"boolean",dflt:!1},lakecolor:{valType:"color",dflt:i.waterColor},showrivers:{valType:"boolean",dflt:!1},rivercolor:{valType:"color",dflt:i.waterColor},riverwidth:{valType:"number",min:0,dflt:1},showcountries:{valType:"boolean"},countrycolor:{valType:"color",dflt:n.defaultLine},countrywidth:{valType:"number",min:0,dflt:1},showsubunits:{valType:"boolean",description:["Sets whether or not boundaries of subunits within countries","(e.g. states, provinces) are drawn."].join(" ")},subunitcolor:{valType:"color",dflt:n.defaultLine},subunitwidth:{valType:"number",min:0,dflt:1},showframe:{valType:"boolean"},framecolor:{valType:"color",dflt:n.defaultLine},framewidth:{valType:"number",min:0,dflt:1},bgcolor:{valType:"color",dflt:n.background},lonaxis:o,lataxis:o}},{"../../../components/color/attributes":298,"../../../constants/geo_constants":333,"./axis_attributes":378}],382:[function(t,e,r){function n(){function t(t,r){return{type:"Feature",id:t.id,properties:t.properties,geometry:e(t.geometry,r)}}function e(t,r){if(!t)return null;if("GeometryCollection"===t.type)return{type:"GeometryCollection",geometries:object.geometries.map(function(t){return e(t,r)})};if(!A.hasOwnProperty(t.type))return null;var n=A[t.type];return i.geo.stream(t,r(n)),n.result()}function r(){}function n(t){if((e=t.length)<4)return!1;for(var e,r=0,n=t[e-1][1]*t[0][0]-t[e-1][0]*t[0][1];++r<e;)n+=t[r-1][1]*t[r][0]-t[r-1][0]*t[r][1];return 0>=n}function o(t,e){for(var r=e[0],n=e[1],i=!1,o=0,a=t.length,s=a-1;a>o;s=o++){var l=t[o],c=l[0],u=l[1],h=t[s],f=h[0],d=h[1];u>n^d>n&&(f-c)*(n-u)/(d-u)+c>r&&(i=!i)}return i}function a(t){return t>1?L:-1>t?-L:Math.asin(t)}function s(t,e){var r=(2+L)*Math.sin(e);e/=2;for(var n=0,i=1/0;10>n&&Math.abs(i)>M;n++){var o=Math.cos(e);e-=i=(e+Math.sin(e)*(o+2)-r)/(2*o*(1+o))}return[2/Math.sqrt(E*(4+E))*t*(1+Math.cos(e)),2*Math.sqrt(E/(4+E))*Math.sin(e)]}function l(t,e){function r(r,n){var i=P(r/e,n);return i[0]*=t,i}return arguments.length<2&&(e=t),1===e?P:e===1/0?u:(r.invert=function(r,n){var i=P.invert(r/t,n);return i[0]*=e,i},r)}function c(){var t=2,e=j(l),r=e(t);return r.coefficient=function(r){return arguments.length?e(t=+r):t},r}function u(t,e){return[t*Math.cos(e)/Math.cos(e/=2),2*Math.sin(e)]}function h(t,e){return[3*t/(2*E)*Math.sqrt(E*E/3-e*e),e]}function f(t,e){return[t,1.25*Math.log(Math.tan(E/4+.4*e))]}function d(t){return function(e){var r,n=t*Math.sin(e),i=30;do e-=r=(e+Math.sin(e)-n)/(1+Math.cos(e));while(Math.abs(r)>M&&--i>0);return e/2}}function p(t,e,r){function n(r,n){return[t*r*Math.cos(n=i(n)),e*Math.sin(n)]}var i=d(r);return n.invert=function(n,i){var o=a(i/e);return[n/(t*Math.cos(o)),a((2*o+Math.sin(2*o))/r)]},n}function g(t,e){var r=e*e,n=r*r;return[t*(.8707-.131979*r+n*(-.013791+n*(.003971*r-.001529*n))),e*(1.007226+r*(.015085+n*(-.044475+.028874*r-.005916*n)))]}function v(t,e){var r,n=Math.min(18,36*Math.abs(e)/E),i=Math.floor(n),o=n-i,a=(r=R[i])[0],s=r[1],l=(r=R[++i])[0],c=r[1],u=(r=R[Math.min(19,++i)])[0],h=r[1];return[t*(l+o*(u-a)/2+o*o*(u-2*l+a)/2),(e>0?L:-L)*(c+o*(h-s)/2+o*o*(h-2*c+s)/2)]}function m(t,e){return[t*Math.cos(e),e]}i.geo.project=function(t,r){var n=r.stream;if(!n)throw new Error("not yet supported");return(t&&y.hasOwnProperty(t.type)?y[t.type]:e)(t,n)};var y={Feature:t,FeatureCollection:function(e,r){return{type:"FeatureCollection",features:e.features.map(function(e){return t(e,r)})}}},b=[],x=[],_={point:function(t,e){b.push([t,e])},result:function(){var t=b.length?b.length<2?{type:"Point",coordinates:b[0]}:{type:"MultiPoint",coordinates:b}:null;return b=[],t}},w={lineStart:r,point:function(t,e){b.push([t,e])},lineEnd:function(){b.length&&(x.push(b),b=[])},result:function(){var t=x.length?x.length<2?{type:"LineString",coordinates:x[0]}:{type:"MultiLineString",coordinates:x}:null;return x=[],t}},k={polygonStart:r,lineStart:r,point:function(t,e){b.push([t,e])},lineEnd:function(){var t=b.length;if(t){do b.push(b[0].slice());while(++t<4);x.push(b),b=[]}},polygonEnd:r,result:function(){if(!x.length)return null;var t=[],e=[];return x.forEach(function(r){n(r)?t.push([r]):e.push(r)}),e.forEach(function(e){var r=e[0];t.some(function(t){return o(t[0],r)?(t.push(e),!0):void 0})||t.push([e])}),x=[],t.length?t.length>1?{type:"MultiPolygon",coordinates:t}:{type:"Polygon",coordinates:t[0]}:null}},A={Point:_,MultiPoint:_,LineString:w,MultiLineString:w,Polygon:k,MultiPolygon:k,Sphere:k},M=1e-6,T=M*M,E=Math.PI,L=E/2,S=(Math.sqrt(E),E/180),C=180/E,z=i.geo.projection,j=i.geo.projectionMutator;i.geo.interrupt=function(t){function e(e,r){for(var n=0>r?-1:1,i=l[+(0>r)],o=0,a=i.length-1;a>o&&e>i[o][2][0];++o);var s=t(e-i[o][1][0],r);return s[0]+=t(i[o][1][0],n*r>n*i[o][0][1]?i[o][0][1]:r)[0],s}function r(){s=l.map(function(e){return e.map(function(e){var r,n=t(e[0][0],e[0][1])[0],i=t(e[2][0],e[2][1])[0],o=t(e[1][0],e[0][1])[1],a=t(e[1][0],e[1][1])[1];return o>a&&(r=o,o=a,a=r),[[n,o],[i,a]]})})}function n(){for(var t=1e-6,e=[],r=0,n=l[0].length;n>r;++r){var a=l[0][r],s=180*a[0][0]/E,c=180*a[0][1]/E,u=180*a[1][1]/E,h=180*a[2][0]/E,f=180*a[2][1]/E;e.push(o([[s+t,c+t],[s+t,u-t],[h-t,u-t],[h-t,f+t]],30))}for(var r=l[1].length-1;r>=0;--r){var a=l[1][r],s=180*a[0][0]/E,c=180*a[0][1]/E,u=180*a[1][1]/E,h=180*a[2][0]/E,f=180*a[2][1]/E;e.push(o([[h-t,f-t],[h-t,u+t],[s+t,u+t],[s+t,c-t]],30))}return{type:"Polygon",coordinates:[i.merge(e)]}}function o(t,e){for(var r,n,i,o=-1,a=t.length,s=t[0],l=[];++o<a;){r=t[o],n=(r[0]-s[0])/e,i=(r[1]-s[1])/e;for(var c=0;e>c;++c)l.push([s[0]+c*n,s[1]+c*i]);s=r}return l.push(r),l}function a(t,e){return Math.abs(t[0]-e[0])<M&&Math.abs(t[1]-e[1])<M}var s,l=[[[[-E,0],[0,L],[E,0]]],[[[-E,0],[0,-L],[E,0]]]];t.invert&&(e.invert=function(r,n){for(var i=s[+(0>n)],o=l[+(0>n)],c=0,u=i.length;u>c;++c){var h=i[c];if(h[0][0]<=r&&r<h[1][0]&&h[0][1]<=n&&n<h[1][1]){var f=t.invert(r-t(o[c][1][0],0)[0],n);return f[0]+=o[c][1][0],a(e(f[0],f[1]),[r,n])?f:null}}});var c=i.geo.projection(e),u=c.stream;return c.stream=function(t){var e=c.rotate(),r=u(t),o=(c.rotate([0,0]),u(t));return c.rotate(e),r.sphere=function(){i.geo.stream(n(),o)},r},c.lobes=function(t){return arguments.length?(l=t.map(function(t){return t.map(function(t){return[[t[0][0]*E/180,t[0][1]*E/180],[t[1][0]*E/180,t[1][1]*E/180],[t[2][0]*E/180,t[2][1]*E/180]]})}),r(),c):l.map(function(t){return t.map(function(t){return[[180*t[0][0]/E,180*t[0][1]/E],[180*t[1][0]/E,180*t[1][1]/E],[180*t[2][0]/E,180*t[2][1]/E]]})})},c},s.invert=function(t,e){var r=.5*e*Math.sqrt((4+E)/E),n=a(r),i=Math.cos(n);return[t/(2/Math.sqrt(E*(4+E))*(1+i)),a((n+r*(i+2))/(2+L))]},(i.geo.eckert4=function(){return z(s)}).raw=s;var P=i.geo.azimuthalEqualArea.raw;u.invert=function(t,e){var r=2*a(e/2);return[t*Math.cos(r/2)/Math.cos(r),r]},(i.geo.hammer=c).raw=l,h.invert=function(t,e){return[2/3*E*t/Math.sqrt(E*E/3-e*e),e]},(i.geo.kavrayskiy7=function(){return z(h)}).raw=h,f.invert=function(t,e){return[t,2.5*Math.atan(Math.exp(.8*e))-.625*E]},(i.geo.miller=function(){return z(f)}).raw=f;var I=(d(E),p(Math.SQRT2/L,Math.SQRT2,E));(i.geo.mollweide=function(){return z(I)}).raw=I,g.invert=function(t,e){var r,n=e,i=25;do{var o=n*n,a=o*o;n-=r=(n*(1.007226+o*(.015085+a*(-.044475+.028874*o-.005916*a)))-e)/(1.007226+o*(.045255+a*(-0.311325+.259866*o-.005916*11*a)))}while(Math.abs(r)>M&&--i>0);return[t/(.8707+(o=n*n)*(-.131979+o*(-.013791+o*o*o*(.003971-.001529*o)))),n]},(i.geo.naturalEarth=function(){return z(g)}).raw=g;var R=[[.9986,-.062],[1,0],[.9986,.062],[.9954,.124],[.99,.186],[.9822,.248],[.973,.31],[.96,.372],[.9427,.434],[.9216,.4958],[.8962,.5571],[.8679,.6176],[.835,.6769],[.7986,.7346],[.7597,.7903],[.7186,.8435],[.6732,.8936],[.6213,.9394],[.5722,.9761],[.5322,1]];R.forEach(function(t){t[1]*=1.0144}),v.invert=function(t,e){var r=e/L,n=90*r,i=Math.min(18,Math.abs(n/5)),o=Math.max(0,Math.floor(i));do{var a=R[o][1],s=R[o+1][1],l=R[Math.min(19,o+2)][1],c=l-a,u=l-2*s+a,h=2*(Math.abs(r)-s)/c,f=u/c,d=h*(1-f*h*(1-2*f*h));if(d>=0||1===o){n=(e>=0?5:-5)*(d+i);var p,g=50;do i=Math.min(18,Math.abs(n)/5),o=Math.floor(i),d=i-o,a=R[o][1],s=R[o+1][1],l=R[Math.min(19,o+2)][1],n-=(p=(e>=0?L:-L)*(s+d*(l-a)/2+d*d*(l-2*s+a)/2)-e)*C;while(Math.abs(p)>T&&--g>0);break}}while(--o>=0);var v=R[o][0],m=R[o+1][0],y=R[Math.min(19,o+2)][0];return[t/(m+d*(y-v)/2+d*d*(y-2*m+v)/2),n*S]},(i.geo.robinson=function(){return z(v)}).raw=v,m.invert=function(t,e){return[t/Math.cos(e),e]},(i.geo.sinusoidal=function(){return z(m)}).raw=m}var i=t("d3");e.exports=n},{d3:70}],383:[function(t,e,r){"use strict";function n(t,e){var r=t.projection,n=t.lonaxis,a=t.lataxis,l=t.domain,c=t.framewidth||0,u=e.w*(l.x[1]-l.x[0]),h=e.h*(l.y[1]-l.y[0]),f=n.range[0]+s,d=n.range[1]-s,p=a.range[0]+s,g=a.range[1]-s,v=n._fullRange[0]+s,m=n._fullRange[1]-s,y=a._fullRange[0]+s,b=a._fullRange[1]-s;r._translate0=[e.l+u/2,e.t+h/2];var x=d-f,_=g-p,w=[f+x/2,p+_/2],k=r._rotate;r._center=[w[0]+k[0],w[1]+k[1]];var A=function(e){function n(t){return Math.min(_*u/(t[1][0]-t[0][0]),_*h/(t[1][1]-t[0][1]))}var a,s,l,x,_=e.scale(),w=r._translate0,k=i(f,p,d,g),A=i(v,y,m,b);l=o(e,k),a=n(l),x=o(e,A),r._fullScale=n(x),e.scale(a),l=o(e,k),s=[w[0]-l[0][0]+c,w[1]-l[0][1]+c],r._translate=s,e.translate(s),l=o(e,k),t._isAlbersUsa||e.clipExtent(l),a=r.scale*a,r._scale=a,t._width=Math.round(l[1][0])+c,t._height=Math.round(l[1][1])+c,t._marginX=(u-Math.round(l[1][0]))/2,t._marginY=(h-Math.round(l[1][1]))/2};return A}function i(t,e,r,n){var i=(r-t)/4;return{type:"Polygon",coordinates:[[[t,e],[t,n],[t+i,n],[t+2*i,n],[t+3*i,n],[r,n],[r,e],[r-i,e],[r-2*i,e],[r-3*i,e],[t,e]]]}}function o(t,e){return a.geo.path().projection(t).bounds(e)}var a=t("d3"),s=t("../../constants/geo_constants").clipPad;e.exports=n},{"../../constants/geo_constants":333,d3:70}],384:[function(t,e,r){"use strict";function n(t,e){var r;return(r=e._isScoped?o:e._clipAngle?s:a)(t,e.projection)}function i(t,e){var r=e._fullScale;return _.behavior.zoom().translate(t.translate()).scale(t.scale()).scaleExtent([.5*r,100*r])}function o(t,e){function r(){_.select(this).style(A)}function n(){a.scale(_.event.scale).translate(_.event.translate),t.render()}function o(){_.select(this).style(M)}var a=t.projection,s=i(a,e);return s.on("zoomstart",r).on("zoom",n).on("zoomend",o),s}function a(t,e){function r(t){return v.invert(t)}function n(t){var e=v(r(t));return Math.abs(e[0]-t[0])>y||Math.abs(e[1]-t[1])>y}function o(){_.select(this).style(A),l=_.mouse(this),c=v.rotate(),u=v.translate(),h=c,f=r(l)}function a(){return d=_.mouse(this),n(l)?(m.scale(v.scale()),void m.translate(v.translate())):(v.scale(_.event.scale),v.translate([u[0],_.event.translate[1]]),f?r(d)&&(g=r(d),p=[h[0]+(g[0]-f[0]),c[1],c[2]],v.rotate(p),h=p):(l=d,f=r(l)),void t.render())}function s(){_.select(this).style(M)}var l,c,u,h,f,d,p,g,v=t.projection,m=i(v,e),y=2;return m.on("zoomstart",o).on("zoom",a).on("zoomend",s),m}function s(t,e){function r(t){m++||t({type:"zoomstart"})}function n(t){t({type:"zoom"})}function o(t){--m||t({type:"zoomend"})}var a,s=t.projection,d={r:s.rotate(),k:s.scale()},p=i(s,e),g=x(p,"zoomstart","zoom","zoomend"),m=0,y=p.on;return p.on("zoomstart",function(){_.select(this).style(A);var t=_.mouse(this),e=s.rotate(),i=e,o=s.translate(),m=c(e);a=l(s,t),y.call(p,"zoom",function(){var r=_.mouse(this);if(s.scale(d.k=_.event.scale),a){if(l(s,r)){s.rotate(e).translate(o);var c=l(s,r),p=h(a,c),y=v(u(m,p)),b=d.r=f(y,a,i);isFinite(b[0])&&isFinite(b[1])&&isFinite(b[2])||(b=i),s.rotate(b),i=b}}else t=r,a=l(s,t);n(g.of(this,arguments))}),r(g.of(this,arguments))}).on("zoomend",function(){_.select(this).style(M),y.call(p,"zoom",null),o(g.of(this,arguments))}).on("zoom.redraw",function(){t.render()}),_.rebind(p,g,"on")}function l(t,e){var r=t.invert(e);return r&&isFinite(r[0])&&isFinite(r[1])&&m(r)}function c(t){var e=.5*t[0]*w,r=.5*t[1]*w,n=.5*t[2]*w,i=Math.sin(e),o=Math.cos(e),a=Math.sin(r),s=Math.cos(r),l=Math.sin(n),c=Math.cos(n);return[o*s*c+i*a*l,i*s*c-o*a*l,o*a*c+i*s*l,o*s*l-i*a*c]}function u(t,e){var r=t[0],n=t[1],i=t[2],o=t[3],a=e[0],s=e[1],l=e[2],c=e[3];return[r*a-n*s-i*l-o*c,r*s+n*a+i*c-o*l,r*l-n*c+i*a+o*s,r*c+n*l-i*s+o*a]}function h(t,e){if(t&&e){var r=b(t,e),n=Math.sqrt(y(r,r)),i=.5*Math.acos(Math.max(-1,Math.min(1,y(t,e)))),o=Math.sin(i)/n;return n&&[Math.cos(i),r[2]*o,-r[1]*o,r[0]*o]}}function f(t,e,r){var n=g(e,2,t[0]);n=g(n,1,t[1]),n=g(n,0,t[2]-r[2]);var i,o,a=e[0],s=e[1],l=e[2],c=n[0],u=n[1],h=n[2],f=Math.atan2(s,a)*k,p=Math.sqrt(a*a+s*s);Math.abs(u)>p?(o=(u>0?90:-90)-f,i=0):(o=Math.asin(u/p)*k-f,i=Math.sqrt(p*p-u*u));var v=180-o-2*f,m=(Math.atan2(h,c)-Math.atan2(l,i))*k,y=(Math.atan2(h,c)-Math.atan2(l,-i))*k,b=d(r[0],r[1],o,m),x=d(r[0],r[1],v,y);return x>=b?[o,m,r[2]]:[v,y,r[2]]}function d(t,e,r,n){var i=p(r-t),o=p(n-e);return Math.sqrt(i*i+o*o)}function p(t){return(t%360+540)%360-180}function g(t,e,r){var n=r*w,i=t.slice(),o=0===e?1:0,a=2===e?1:2,s=Math.cos(n),l=Math.sin(n);return i[o]=t[o]*s-t[a]*l,i[a]=t[a]*s+t[o]*l,i}function v(t){return[Math.atan2(2*(t[0]*t[1]+t[2]*t[3]),1-2*(t[1]*t[1]+t[2]*t[2]))*k,Math.asin(Math.max(-1,Math.min(1,2*(t[0]*t[2]-t[3]*t[1]))))*k,Math.atan2(2*(t[0]*t[3]+t[1]*t[2]),1-2*(t[2]*t[2]+t[3]*t[3]))*k]}function m(t){var e=t[0]*w,r=t[1]*w,n=Math.cos(r);return[n*Math.cos(e),n*Math.sin(e),Math.sin(r)]}function y(t,e){for(var r=0,n=0,i=t.length;i>n;++n)r+=t[n]*e[n];return r}function b(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function x(t){for(var e=0,r=arguments.length,n=[];++e<r;)n.push(arguments[e]);var i=_.dispatch.apply(null,n);return i.of=function(e,r){return function(n){var o;try{o=n.sourceEvent=_.event,n.target=t,_.event=n,i[n.type].apply(e,r)}finally{_.event=o}}},i}var _=t("d3"),w=Math.PI/180,k=180/Math.PI,A={cursor:"pointer"},M={cursor:"auto"};e.exports=n},{d3:70}],385:[function(t,e,r){"use strict";function n(t,e){var r=t.projection,n=t.zoom,o=function(){t.makeProjection(e),t.makePath(),n.scale(r.scale()),n.translate(r.translate()),i.loneUnhover(t.hoverContainer),t.render()};return o}var i=t("../cartesian/graph_interact");e.exports=n},{"../cartesian/graph_interact":370}],386:[function(t,e,r){"use strict";function n(t,e){this.element=t,this.plot=e,this.mouseListener=null,this.wheelListener=null,this.lastInputTime=Date.now(),this.lastPos=[0,0],this.boxEnabled=!1,this.boxStart=[0,0],this.boxEnd=[0,0]}function i(t){var e=t.mouseContainer,r=t.glplot,i=new n(e,r);return i.mouseListener=o(e,function(e,n,o){function a(e,r,n){var o=Math.min(r,n),a=Math.max(r,n);o!==a?(e[0]=o,e[1]=a,i.dataBox=e):(t.selectBox.selectBox=[0,0,1,1],t.glplot.setDirty())}var s=t.xaxis.range,l=t.yaxis.range,c=r.viewBox,u=i.lastPos[0],h=i.lastPos[1];switch(n*=r.pixelRatio,o*=r.pixelRatio,o=c[3]-c[1]-o,t.fullLayout.dragmode){case"zoom":if(e){var f=n/(c[2]-c[0])*(s[1]-s[0])+s[0],d=o/(c[3]-c[1])*(l[1]-l[0])+l[0];i.boxEnabled||(i.boxStart[0]=f,i.boxStart[1]=d),i.boxEnd[0]=f,i.boxEnd[1]=d,i.boxEnabled=!0}else i.boxEnabled&&(a(s,i.boxStart[0],i.boxEnd[0]),a(l,i.boxStart[1],i.boxEnd[1]),i.boxEnabled=!1);break;case"pan":if(i.boxEnabled=!1,e){var p=(u-n)*(s[1]-s[0])/(r.viewBox[2]-r.viewBox[0]),g=(h-o)*(l[1]-l[0])/(r.viewBox[3]-r.viewBox[1]);s[0]+=p,s[1]+=p,l[0]+=g,l[1]+=g,i.lastInputTime=Date.now(),t.cameraChanged()}}i.lastPos[0]=n,i.lastPos[1]=o}),i.wheelListener=a(e,function(e,n){var o=t.xaxis.range,a=t.yaxis.range,s=r.viewBox,l=i.lastPos[0],c=i.lastPos[1];switch(t.fullLayout.dragmode){case"zoom":break;case"pan":var u=Math.exp(.1*n/(s[3]-s[1])),h=l/(s[2]-s[0])*(o[1]-o[0])+o[0],f=c/(s[3]-s[1])*(a[1]-a[0])+a[0];o[0]=(o[0]-h)*u+h,o[1]=(o[1]-h)*u+h,a[0]=(a[0]-f)*u+f,a[1]=(a[1]-f)*u+f,i.lastInputTime=Date.now(),t.cameraChanged()}return!0}),i}var o=t("mouse-change"),a=t("mouse-wheel");e.exports=i},{"mouse-change":196,"mouse-wheel":200}],387:[function(t,e,r){"use strict";function n(t){this.scene=t,this.gl=t.gl,this.pixelRatio=t.pixelRatio,this.screenBox=[0,0,1,1],this.viewBox=[0,0,1,1],this.dataBox=[-1,-1,1,1],this.borderLineEnable=[!1,!1,!1,!1],this.borderLineWidth=[1,1,1,1],this.borderLineColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.ticks=[[],[]],this.tickEnable=[!0,!0,!1,!1],this.tickPad=[15,15,15,15],this.tickAngle=[0,0,0,0],this.tickColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.tickMarkLength=[0,0,0,0],this.tickMarkWidth=[0,0,0,0],this.tickMarkColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.labels=["x","y"],this.labelEnable=[!0,!0,!1,!1],this.labelAngle=[0,Math.PI/2,0,3*Math.PI/2],this.labelPad=[15,15,15,15],this.labelSize=[12,12],this.labelFont=["sans-serif","sans-serif"],this.labelColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.title="",this.titleEnable=!0,this.titleCenter=[0,0,0,0],this.titleAngle=0,this.titleColor=[0,0,0,1],this.titleFont="sans-serif",this.titleSize=18,this.gridLineEnable=[!0,!0],this.gridLineColor=[[0,0,0,.5],[0,0,0,.5]],this.gridLineWidth=[1,1],this.zeroLineEnable=[!0,!0],this.zeroLineWidth=[1,1],this.zeroLineColor=[[0,0,0,1],[0,0,0,1]],this.borderColor=[0,0,0,0],this.backgroundColor=[0,0,0,0]}function i(t){return new n(t)}var o=t("../../plotly"),a=t("../../lib/html2unicode"),s=t("../../lib/str2rgbarray"),l=n.prototype,c=["xaxis","yaxis"];l.merge=function(t){this.titleEnable=!1,this.backgroundColor=s(t.plot_bgcolor);var e,r,n,i,o,l,u,h,f,d,p;for(d=0;2>d;++d){for(e=c[d],r=t[this.scene[e]._name],n=/Click to enter .+ title/.test(r.title)?"":r.title,p=0;2>=p;p+=2)this.labelEnable[d+p]=!1,this.labels[d+p]=a(n),this.labelColor[d+p]=s(r.titlefont.color),this.labelFont[d+p]=r.titlefont.family,this.labelSize[d+p]=r.titlefont.size,this.labelPad[d+p]=this.getLabelPad(e,r),this.tickEnable[d+p]=!1,this.tickColor[d+p]=s((r.tickfont||{}).color),this.tickAngle[d+p]="auto"===r.tickangle?0:Math.PI*-r.tickangle/180,this.tickPad[d+p]=this.getTickPad(r),this.tickMarkLength[d+p]=0,this.tickMarkWidth[d+p]=r.tickwidth||0,this.tickMarkColor[d+p]=s(r.tickcolor),this.borderLineEnable[d+p]=!1,this.borderLineColor[d+p]=s(r.linecolor),this.borderLineWidth[d+p]=r.linewidth||0;u=this.hasSharedAxis(r),o=this.hasAxisInDfltPos(e,r)&&!u,l=this.hasAxisInAltrPos(e,r)&&!u,i=r.mirror||!1,h=u?-1!==String(i).indexOf("all"):!!i,f=u?"allticks"===i:-1!==String(i).indexOf("ticks"),o?this.labelEnable[d]=!0:l&&(this.labelEnable[d+2]=!0),o?this.tickEnable[d]=r.showticklabels:l&&(this.tickEnable[d+2]=r.showticklabels),(o||h)&&(this.borderLineEnable[d]=r.showline),(l||h)&&(this.borderLineEnable[d+2]=r.showline),(o||f)&&(this.tickMarkLength[d]=this.getTickMarkLength(r)),(l||f)&&(this.tickMarkLength[d+2]=this.getTickMarkLength(r)),this.gridLineEnable[d]=r.showgrid,this.gridLineColor[d]=s(r.gridcolor),this.gridLineWidth[d]=r.gridwidth,this.zeroLineEnable[d]=r.zeroline,this.zeroLineColor[d]=s(r.zerolinecolor),this.zeroLineWidth[d]=r.zerolinewidth}},l.hasSharedAxis=function(t){var e=this.scene,r=o.Plots.getSubplotIds(e.fullLayout,"gl2d"),n=o.Axes.findSubplotsWithAxis(r,t);return 0!==n.indexOf(e.id)},l.hasAxisInDfltPos=function(t,e){var r=e.side;return"xaxis"===t?"bottom"===r:"yaxis"===t?"left"===r:void 0},l.hasAxisInAltrPos=function(t,e){var r=e.side;return"xaxis"===t?"top"===r:"yaxis"===t?"right"===r:void 0},l.getLabelPad=function(t,e){var r=1.5,n=e.titlefont.size,i=e.showticklabels;return"xaxis"===t?"top"===e.side?-10+n*(r+(i?1:0)):-10+n*(r+(i?.5:0)):"yaxis"===t?"right"===e.side?10+n*(r+(i?1:.5)):10+n*(r+(i?.5:0)):void 0},l.getTickPad=function(t){return"outside"===t.ticks?10+t.ticklen:15},l.getTickMarkLength=function(t){if(!t.ticks)return 0;var e=t.ticklen;return"inside"===t.ticks?-e:e},e.exports=i},{"../../lib/html2unicode":347,"../../lib/str2rgbarray":358,"../../plotly":365}],388:[function(t,e,r){"use strict";var n=t("../../plotly"),i=t("./scene2d"),o=n.Plots;r.name="gl2d",r.attr=["xaxis","yaxis"],r.idRoot=["x","y"],r.idRegex={x:/^x([2-9]|[1-9][0-9]+)?$/,y:/^y([2-9]|[1-9][0-9]+)?$/},r.attrRegex={x:/^xaxis([2-9]|[1-9][0-9]+)?$/,y:/^yaxis([2-9]|[1-9][0-9]+)?$/},r.attributes=t("../cartesian/attributes"),r.plot=function(t){for(var e=t._fullLayout,r=t._fullData,n=o.getSubplotIds(e,"gl2d"),a=0;a<n.length;a++){var s=n[a],l=e._plots[s],c=o.getSubplotData(r,"gl2d",s),u=l._scene2d;void 0===u&&(u=new i({container:t.querySelector(".gl-container"),id:s,staticPlot:t._context.staticPlot,plotGlPixelRatio:t._context.plotGlPixelRatio},e),l._scene2d=u),u.plot(c,e,t.layout)}}},{"../../plotly":365,"../cartesian/attributes":367,"./scene2d":389}],389:[function(t,e,r){"use strict";function n(t,e){this.container=t.container,this.pixelRatio=t.plotGlPixelRatio||window.devicePixelRatio,this.id=t.id,this.staticPlot=!!t.staticPlot,this.fullLayout=e,this.updateAxes(e),this.makeFramework(),this.glplotOptions=d(this),this.glplotOptions.merge(e),this.glplot=u(this.glplotOptions),this.camera=p(this),this.traces={},this.spikes=h(this.glplot),this.selectBox=f(this.glplot,{innerFill:!1,outerFill:!0}),this.pickResult=null,this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.stopped=!1,this.redraw=this.draw.bind(this),this.redraw()}function i(t,e){for(var r=0;2>r;++r){var n=t[r],i=e[r];if(n.length!==i.length)return!0;for(var o=0;o<n.length;++o)if(n[o].x!==i[o].x)return!0}return!1}var o,a,s=t("../../plots/plots"),l=t("../../plots/cartesian/axes"),c=t("../../plots/cartesian/graph_interact"),u=t("gl-plot2d"),h=t("gl-spikes2d"),f=t("gl-select-box"),d=t("./convert"),p=t("./camera"),g=t("../../lib/html2unicode"),v=t("../../lib/show_no_webgl_msg"),m=["xaxis","yaxis"];e.exports=n;var y=n.prototype;y.makeFramework=function(){if(this.staticPlot){if(!a){o=document.createElement("canvas");try{a=o.getContext("webgl",{preserveDrawingBuffer:!0,premultipliedAlpha:!0,antialias:!0})}catch(t){throw new Error(["Error creating static canvas/context for image server"].join(" "))}}this.canvas=o,this.gl=a}else{var e,r=document.createElement("canvas"),n={premultipliedAlpha:!0};try{e=r.getContext("webgl",n)}catch(t){}if(!e)try{e=r.getContext("experimental-webgl",n)}catch(t){}e||v(this),this.canvas=r,this.gl=e}var i=this.canvas,s=this.pixelRatio,l=this.fullLayout;i.width=0|Math.ceil(s*l.width),i.height=0|Math.ceil(s*l.height),i.style.width="100%",i.style.height="100%",i.style.position="absolute",i.style.top="0px",i.style.left="0px",i.style["pointer-events"]="none";var c=this.svgContainer=document.createElementNS("http://www.w3.org/2000/svg","svg");c.style.position="absolute",c.style.top=c.style.left="0px",c.style.width=c.style.height="100%",c.style["z-index"]=20,c.style["pointer-events"]="none";var u=this.mouseContainer=document.createElement("div");u.style.position="absolute";var h=this.container;h.appendChild(i),h.appendChild(c),h.appendChild(u)},y.toImage=function(t){t||(t="png"),this.stopped=!0,this.staticPlot&&this.container.appendChild(o),this.glplot.setDirty(!0),this.glplot.draw();var e=this.glplot.gl,r=e.drawingBufferWidth,n=e.drawingBufferHeight;e.bindFramebuffer(e.FRAMEBUFFER,null);var i=new Uint8Array(r*n*4);e.readPixels(0,0,r,n,e.RGBA,e.UNSIGNED_BYTE,i);for(var a=0,s=n-1;s>a;++a,--s)for(var l=0;r>l;++l)for(var c=0;4>c;++c){var u=i[4*(r*a+l)+c];i[4*(r*a+l)+c]=i[4*(r*s+l)+c],i[4*(r*s+l)+c]=u}var h=document.createElement("canvas");h.width=r,h.height=n;var f=h.getContext("2d"),d=f.createImageData(r,n);d.data.set(i),f.putImageData(d,0,0);var p;switch(t){case"jpeg":p=h.toDataURL("image/jpeg");break;case"webp":p=h.toDataURL("image/webp");break;default:p=h.toDataURL("image/png")}return this.staticPlot&&this.container.removeChild(o),p},y.computeTickMarks=function(){this.xaxis._length=this.glplot.viewBox[2]-this.glplot.viewBox[0],this.yaxis._length=this.glplot.viewBox[3]-this.glplot.viewBox[1];for(var t=[l.calcTicks(this.xaxis),l.calcTicks(this.yaxis)],e=0;2>e;++e)for(var r=0;r<t[e].length;++r)t[e][r].text=g(t[e][r].text+"").replace(/\n/g," ");return t},y.updateAxes=function(t){var e=l.subplotMatch,r="xaxis"+this.id.match(e)[1],n="yaxis"+this.id.match(e)[2];this.xaxis=t[r],this.yaxis=t[n]},y.updateFx=function(t){var e=this.fullLayout;e.dragmode=t.dragmode,e.hovermode=t.hovermode},y.cameraChanged=function(){var t=this.camera,e=this.xaxis.range,r=this.yaxis.range;this.glplot.setDataBox([e[0],r[0],e[1],r[1]]);var n=this.computeTickMarks(),o=this.glplotOptions.ticks;i(n,o)&&(this.glplotOptions.ticks=n,this.glplotOptions.dataBox=t.dataBox,this.glplot.update(this.glplotOptions))},y.destroy=function(){this.glplot.dispose()},y.plot=function(t,e){var r,n,i=this.glplot,o=this.pixelRatio;this.fullLayout=e,this.updateAxes(e);var a=e.width,c=e.height,u=0|Math.ceil(o*a),h=0|Math.ceil(o*c),f=this.canvas;(f.width!==u||f.height!==h)&&(f.width=u,f.height=h),t?Array.isArray(t)||(t=[t]):t=[];var d,p;for(r=0;r<t.length;++r){if(d=t[r],p=this.traces[d.uid])p.update(d);else{var g=s.getModule(d.type);p=g.plot(this,d)}this.traces[d.uid]=p}var v=Object.keys(this.traces);t:for(r=0;r<v.length;++r){for(n=0;n<t.length;++n)if(t[n].uid===v[r])continue t;p=this.traces[v[r]],p.dispose(),delete this.traces[v[r]]}var y=this.glplotOptions;y.merge(e),y.screenBox=[0,0,a,c];var b=e._size,x=this.xaxis.domain,_=this.yaxis.domain;y.viewBox=[b.l+x[0]*b.w,b.b+_[0]*b.h,a-b.r-(1-x[1])*b.w,c-b.t-(1-_[1])*b.h],this.mouseContainer.style.width=b.w*(x[1]-x[0])+"px",this.mouseContainer.style.height=b.h*(_[1]-_[0])+"px",this.mouseContainer.height=b.h*(_[1]-_[0]),this.mouseContainer.style.left=b.l+x[0]*b.w+"px",this.mouseContainer.style.top=b.t+(1-_[1])*b.h+"px";var w=this.bounds;for(w[0]=w[1]=1/0,w[2]=w[3]=-(1/0),v=Object.keys(this.traces),r=0;r<v.length;++r){p=this.traces[v[r]];for(var k=0;2>k;++k)w[k]=Math.min(w[k],p.bounds[k]),w[k+2]=Math.max(w[k+2],p.bounds[k+2])}var A;for(r=0;2>r;++r)w[r]>w[r+2]&&(w[r]=-1,w[r+2]=1),A=this[m[r]],A._length=y.viewBox[r+2]-y.viewBox[r],l.doAutoRange(A);y.ticks=this.computeTickMarks();var M=this.xaxis.range,T=this.yaxis.range;y.dataBox=[M[0],T[0],M[1],T[1]],y.merge(e),i.update(y)},y.draw=function(){if(!this.stopped){requestAnimationFrame(this.redraw);var t=this.glplot,e=this.camera,r=e.mouseListener,n=this.fullLayout;this.cameraChanged();var i=r.x*t.pixelRatio,o=this.canvas.height-t.pixelRatio*r.y;if(e.boxEnabled&&"zoom"===n.dragmode)this.selectBox.enabled=!0,this.selectBox.selectBox=[Math.min(e.boxStart[0],e.boxEnd[0]),Math.min(e.boxStart[1],e.boxEnd[1]),Math.max(e.boxStart[0],e.boxEnd[0]),Math.max(e.boxStart[1],e.boxEnd[1])],t.setDirty();else{this.selectBox.enabled=!1;var a=n._size,s=this.xaxis.domain,l=this.yaxis.domain,u=t.pick(i/t.pixelRatio+a.l+s[0]*a.w,o/t.pixelRatio-(a.t+(1-l[1])*a.h));if(u&&n.hovermode){var h=u.object._trace.handlePick(u);if(h&&(!this.lastPickResult||this.lastPickResult.trace!==h.trace||this.lastPickResult.dataCoord[0]!==h.dataCoord[0]||this.lastPickResult.dataCoord[1]!==h.dataCoord[1])){var f=this.lastPickResult=h;this.spikes.update({center:u.dataCoord}),f.screenCoord=[((t.viewBox[2]-t.viewBox[0])*(u.dataCoord[0]-t.dataBox[0])/(t.dataBox[2]-t.dataBox[0])+t.viewBox[0])/t.pixelRatio,(this.canvas.height-(t.viewBox[3]-t.viewBox[1])*(u.dataCoord[1]-t.dataBox[1])/(t.dataBox[3]-t.dataBox[1])-t.viewBox[1])/t.pixelRatio];var d=f.hoverinfo;if("all"!==d){var p=d.split("+");-1===p.indexOf("x")&&(f.traceCoord[0]=void 0),-1===p.indexOf("y")&&(f.traceCoord[1]=void 0),-1===p.indexOf("text")&&(f.textLabel=void 0),-1===p.indexOf("name")&&(f.name=void 0)}c.loneHover({x:f.screenCoord[0],y:f.screenCoord[1],xLabel:this.hoverFormatter("xaxis",f.traceCoord[0]),yLabel:this.hoverFormatter("yaxis",f.traceCoord[1]),text:f.textLabel,name:f.name,color:f.color},{container:this.svgContainer}),this.lastPickResult={dataCoord:u.dataCoord}}}else!u&&this.lastPickResult&&(this.spikes.update({}),this.lastPickResult=null,c.loneUnhover(this.svgContainer))}t.draw()}},y.hoverFormatter=function(t,e){if(void 0!==e){
var r=this[t];return l.tickText(r,r.c2l(e),"hover").text}}},{"../../lib/html2unicode":347,"../../lib/show_no_webgl_msg":356,"../../plots/cartesian/axes":368,"../../plots/cartesian/graph_interact":370,"../../plots/plots":404,"./camera":386,"./convert":387,"gl-plot2d":122,"gl-select-box":152,"gl-spikes2d":178}],390:[function(t,e,r){"use strict";function n(t,e){t=t||document.body,e=e||{};var r=[.01,1/0];"distanceLimits"in e&&(r[0]=e.distanceLimits[0],r[1]=e.distanceLimits[1]),"zoomMin"in e&&(r[0]=e.zoomMin),"zoomMax"in e&&(r[1]=e.zoomMax);var n=o({center:e.center||[0,0,0],up:e.up||[0,1,0],eye:e.eye||[0,0,10],mode:e.mode||"orbit",distanceLimits:r}),l=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],c=0,u=t.clientWidth,h=t.clientHeight,f={keyBindingMode:"rotate",view:n,element:t,delay:e.delay||16,rotateSpeed:e.rotateSpeed||1,zoomSpeed:e.zoomSpeed||1,translateSpeed:e.translateSpeed||1,flipX:!!e.flipX,flipY:!!e.flipY,modes:n.modes,tick:function(){var e=i(),r=this.delay,o=e-2*r;n.idle(e-r),n.recalcMatrix(o),n.flush(e-(100+2*r));for(var a=!0,s=n.computedMatrix,f=0;16>f;++f)a=a&&l[f]===s[f],l[f]=s[f];var d=t.clientWidth===u&&t.clientHeight===h;return u=t.clientWidth,h=t.clientHeight,a?!d:(c=Math.exp(n.computedRadius[0]),!0)},lookAt:function(t,e,r){n.lookAt(n.lastT(),t,e,r)},rotate:function(t,e,r){n.rotate(n.lastT(),t,e,r)},pan:function(t,e,r){n.pan(n.lastT(),t,e,r)},translate:function(t,e,r){n.translate(n.lastT(),t,e,r)}};Object.defineProperties(f,{matrix:{get:function(){return n.computedMatrix},set:function(t){return n.setMatrix(n.lastT(),t),n.computedMatrix},enumerable:!0},mode:{get:function(){return n.getMode()},set:function(t){var e=n.computedUp.slice(),r=n.computedEye.slice(),o=n.computedCenter.slice();if(n.setMode(t),"turntable"===t){var a=i();n._active.lookAt(a,r,o,e),n._active.lookAt(a+500,r,o,[0,0,1]),n._active.flush(a)}return n.getMode()},enumerable:!0},center:{get:function(){return n.computedCenter},set:function(t){return n.lookAt(n.lastT(),null,t),n.computedCenter},enumerable:!0},eye:{get:function(){return n.computedEye},set:function(t){return n.lookAt(n.lastT(),t),n.computedEye},enumerable:!0},up:{get:function(){return n.computedUp},set:function(t){return n.lookAt(n.lastT(),null,null,t),n.computedUp},enumerable:!0},distance:{get:function(){return c},set:function(t){return n.setDistance(n.lastT(),t),t},enumerable:!0},distanceLimits:{get:function(){return n.getDistanceLimits(r)},set:function(t){return n.setDistanceLimits(t),t},enumerable:!0}}),t.addEventListener("contextmenu",function(t){return t.preventDefault(),!1});var d=0,p=0;return a(t,function(e,r,o,a){var s="rotate"===f.keyBindingMode,l="pan"===f.keyBindingMode,u="zoom"===f.keyBindingMode,h=!!a.control,g=!!a.alt,v=!!a.shift,m=!!(1&e),y=!!(2&e),b=!!(4&e),x=1/t.clientHeight,_=x*(r-d),w=x*(o-p),k=f.flipX?1:-1,A=f.flipY?1:-1,M=i(),T=Math.PI*f.rotateSpeed;if((s&&m&&!h&&!g&&!v||m&&!h&&!g&&v)&&n.rotate(M,k*T*_,-A*T*w,0),(l&&m&&!h&&!g&&!v||y||m&&h&&!g&&!v)&&n.pan(M,-f.translateSpeed*_*c,f.translateSpeed*w*c,0),u&&m&&!h&&!g&&!v||b||m&&!h&&g&&!v){var E=-f.zoomSpeed*w/window.innerHeight*(M-n.lastT())*100;n.pan(M,0,0,c*(Math.exp(E)-1))}return d=r,p=o,!0}),s(t,function(t,e){var r=f.flipX?1:-1,o=f.flipY?1:-1,a=i();if(Math.abs(t)>Math.abs(e))n.rotate(a,0,0,-t*r*Math.PI*f.rotateSpeed/window.innerWidth);else{var s=-f.zoomSpeed*o*e/window.innerHeight*(a-n.lastT())/100;n.pan(a,0,0,c*(Math.exp(s)-1))}},!0),f}e.exports=n;var i=t("right-now"),o=t("3d-view"),a=t("mouse-change"),s=t("mouse-wheel")},{"3d-view":38,"mouse-change":196,"mouse-wheel":200,"right-now":210}],391:[function(t,e,r){"use strict";var n=t("./scene"),i=t("../plots"),o=["xaxis","yaxis","zaxis"];r.name="gl3d",r.attr="scene",r.idRoot="scene",r.idRegex=/^scene([2-9]|[1-9][0-9]+)?$/,r.attrRegex=/^scene([2-9]|[1-9][0-9]+)?$/,r.attributes=t("./layout/attributes"),r.layoutAttributes=t("./layout/layout_attributes"),r.supplyLayoutDefaults=t("./layout/defaults"),r.plot=function(t){var e=t._fullLayout,r=t._fullData,o=i.getSubplotIds(e,"gl3d");e._paperdiv.style({width:e.width+"px",height:e.height+"px"}),t._context.setBackground(t,e.paper_bgcolor);for(var a=0;a<o.length;a++){var s=o[a],l=i.getSubplotData(r,"gl3d",s),c=e[s]._scene;void 0===c&&(c=new n({container:t.querySelector(".gl-container"),id:s,staticPlot:t._context.staticPlot,plotGlPixelRatio:t._context.plotGlPixelRatio},e),e[s]._scene=c),c.plot(l,e,t.layout)}},r.cleanId=function(t){if(t.match(/^scene[0-9]*$/)){var e=t.substr(5);return"1"===e&&(e=""),"scene"+e}},r.setConvert=t("./set_convert"),r.initAxes=function(t){var e=t._fullLayout;delete e.xaxis,delete e.yaxis;for(var r=i.getSubplotIds(e,"gl3d"),n=0;n<r.length;++n)for(var a=r[n],s=e[a],l=0;3>l;++l){var c=o[l],u=s[c];u._td=t}}},{"../plots":404,"./layout/attributes":392,"./layout/defaults":396,"./layout/layout_attributes":397,"./scene":401,"./set_convert":402}],392:[function(t,e,r){"use strict";e.exports={scene:{valType:"sceneid",dflt:"scene",description:["Sets a reference between this trace's 3D coordinate system and","a 3D scene.","If *scene* (the default value), the (x,y,z) coordinates refer to","`layout.scene`.","If *scene2*, the (x,y,z) coordinates refer to `layout.scene2`,","and so on."].join(" ")}}},{}],393:[function(t,e,r){"use strict";var n=t("../../cartesian/layout_attributes"),i=t("../../../lib/extend").extendFlat;e.exports={showspikes:{valType:"boolean",dflt:!0,description:["Sets whether or not spikes starting from","data points to this axis' wall are shown on hover."].join(" ")},spikesides:{valType:"boolean",dflt:!0,description:["Sets whether or not spikes extending from the","projection data points to this axis' wall boundaries","are shown on hover."].join(" ")},spikethickness:{valType:"number",min:0,dflt:2},spikecolor:{valType:"color",dflt:"rgb(0,0,0)"},showbackground:{valType:"boolean",dflt:!1,description:["Sets whether or not this axis' wall","has a background color."].join(" ")},backgroundcolor:{valType:"color",dflt:"rgba(204, 204, 204, 0.5)"},showaxeslabels:{valType:"boolean",dflt:!0},title:n.title,titlefont:n.titlefont,type:n.type,autorange:n.autorange,rangemode:n.rangemode,range:n.range,fixedrange:n.fixedrange,tickmode:n.tickmode,nticks:n.nticks,tick0:n.tick0,dtick:n.dtick,tickvals:n.tickvals,ticktext:n.ticktext,ticks:n.ticks,mirror:n.mirror,ticklen:n.ticklen,tickwidth:n.tickwidth,tickcolor:n.tickcolor,showticklabels:n.showticklabels,tickfont:n.tickfont,tickangle:n.tickangle,tickprefix:n.tickprefix,showtickprefix:n.showtickprefix,ticksuffix:n.ticksuffix,showticksuffix:n.showticksuffix,showexponent:n.showexponent,exponentformat:n.exponentformat,tickformat:n.tickformat,hoverformat:n.hoverformat,showline:n.showline,linecolor:n.linecolor,linewidth:n.linewidth,showgrid:n.showgrid,gridcolor:i({},n.gridcolor,{dflt:"rgb(204, 204, 204)"}),gridwidth:n.gridwidth,zeroline:n.zeroline,zerolinecolor:n.zerolinecolor,zerolinewidth:n.zerolinewidth}},{"../../../lib/extend":344,"../../cartesian/layout_attributes":372}],394:[function(t,e,r){"use strict";var n=t("../../../plotly"),i=t("./axis_attributes"),o=["xaxis","yaxis","zaxis"],a=function(){};e.exports=function(t,e,r){function s(t,e){return n.Lib.coerce(l,c,i,t,e)}for(var l,c,u=n.Axes,h=0;h<o.length;h++){var f=o[h];l=t[f]||{},c={_id:f[0]+r.scene,_name:f},e[f]=c=u.handleAxisDefaults(l,c,s,{font:r.font,letter:f[0],data:r.data,showGrid:!0}),s("gridcolor"),s("title",f[0]),c.setScale=a,s("showspikes")&&(s("spikesides"),s("spikethickness"),s("spikecolor")),s("showbackground")&&s("backgroundcolor"),s("showaxeslabels")}}},{"../../../plotly":365,"./axis_attributes":393}],395:[function(t,e,r){"use strict";function n(){this.bounds=[[-10,-10,-10],[10,10,10]],this.ticks=[[],[],[]],this.tickEnable=[!0,!0,!0],this.tickFont=["sans-serif","sans-serif","sans-serif"],this.tickSize=[12,12,12],this.tickAngle=[0,0,0],this.tickColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.tickPad=[18,18,18],this.labels=["x","y","z"],this.labelEnable=[!0,!0,!0],this.labelFont=["Open Sans","Open Sans","Open Sans"],this.labelSize=[20,20,20],this.labelAngle=[0,0,0],this.labelColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.labelPad=[30,30,30],this.lineEnable=[!0,!0,!0],this.lineMirror=[!1,!1,!1],this.lineWidth=[1,1,1],this.lineColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.lineTickEnable=[!0,!0,!0],this.lineTickMirror=[!1,!1,!1],this.lineTickLength=[10,10,10],this.lineTickWidth=[1,1,1],this.lineTickColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.gridEnable=[!0,!0,!0],this.gridWidth=[1,1,1],this.gridColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.zeroEnable=[!0,!0,!0],this.zeroLineColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.zeroLineWidth=[2,2,2],this.backgroundEnable=[!0,!0,!0],this.backgroundColor=[[.8,.8,.8,.5],[.8,.8,.8,.5],[.8,.8,.8,.5]],this._defaultTickPad=l(this.tickPad),this._defaultLabelPad=l(this.labelPad),this._defaultLineTickLength=l(this.lineTickLength)}function i(t){var e=new n;return e.merge(t),e}var o=t("arraytools"),a=t("../../../lib/html2unicode"),s=t("../../../lib/str2rgbarray"),l=o.copy1D,c=["xaxis","yaxis","zaxis"],u=n.prototype;u.merge=function(t){for(var e=this,r=0;3>r;++r){var n=t[c[r]];e.labels[r]=a(n.title),"titlefont"in n&&(n.titlefont.color&&(e.labelColor[r]=s(n.titlefont.color)),n.titlefont.family&&(e.labelFont[r]=n.titlefont.family),n.titlefont.size&&(e.labelSize[r]=n.titlefont.size)),"showline"in n&&(e.lineEnable[r]=n.showline),"linecolor"in n&&(e.lineColor[r]=s(n.linecolor)),"linewidth"in n&&(e.lineWidth[r]=n.linewidth),"showgrid"in n&&(e.gridEnable[r]=n.showgrid),"gridcolor"in n&&(e.gridColor[r]=s(n.gridcolor)),"gridwidth"in n&&(e.gridWidth[r]=n.gridwidth),"log"===n.type?e.zeroEnable[r]=!1:"zeroline"in n&&(e.zeroEnable[r]=n.zeroline),"zerolinecolor"in n&&(e.zeroLineColor[r]=s(n.zerolinecolor)),"zerolinewidth"in n&&(e.zeroLineWidth[r]=n.zerolinewidth),"ticks"in n&&n.ticks?e.lineTickEnable[r]=!0:e.lineTickEnable[r]=!1,"ticklen"in n&&(e.lineTickLength[r]=e._defaultLineTickLength[r]=n.ticklen),"tickcolor"in n&&(e.lineTickColor[r]=s(n.tickcolor)),"tickwidth"in n&&(e.lineTickWidth[r]=n.tickwidth),"tickangle"in n&&(e.tickAngle[r]="auto"===n.tickangle?0:Math.PI*-n.tickangle/180),"showticklabels"in n&&(e.tickEnable[r]=n.showticklabels),"tickfont"in n&&(n.tickfont.color&&(e.tickColor[r]=s(n.tickfont.color)),n.tickfont.family&&(e.tickFont[r]=n.tickfont.family),n.tickfont.size&&(e.tickSize[r]=n.tickfont.size)),"mirror"in n?-1!==["ticks","all","allticks"].indexOf(n.mirror)?(e.lineTickMirror[r]=!0,e.lineMirror[r]=!0):n.mirror===!0?(e.lineTickMirror[r]=!1,e.lineMirror[r]=!0):(e.lineTickMirror[r]=!1,e.lineMirror[r]=!1):e.lineMirror[r]=!1,"showbackground"in n&&n.showbackground!==!1?(e.backgroundEnable[r]=!0,e.backgroundColor[r]=s(n.backgroundcolor)):e.backgroundEnable[r]=!1}},e.exports=i},{"../../../lib/html2unicode":347,"../../../lib/str2rgbarray":358,arraytools:48}],396:[function(t,e,r){"use strict";var n=t("../../../plotly"),i=t("./layout_attributes"),o=t("./axis_defaults");e.exports=function(t,e,r){function a(t,e){return n.Lib.coerce(c,u,i,t,e)}if(e._hasGL3D){var s,l=n.Plots.getSubplotIdsInData(r,"gl3d");delete e.xaxis,delete e.yaxis;var c,u,h=l.length;for(s=0;h>s;++s){var f=l[s];void 0!==t[f]?c=t[f]:t[f]=c={},u=e[f]||{},a("bgcolor");for(var d=Object.keys(i.camera),p=0;p<d.length;p++)a("camera."+d[p]+".x"),a("camera."+d[p]+".y"),a("camera."+d[p]+".z");a("domain.x",[s/h,(s+1)/h]),a("domain.y");var g=!!a("aspectratio.x")&&!!a("aspectratio.y")&&!!a("aspectratio.z"),v=g?"manual":"auto",m=a("aspectmode",v);g||(c.aspectratio=u.aspectratio={x:1,y:1,z:1},"manual"===m&&(u.aspectmode="auto")),o(c,u,{font:e.font,scene:f,data:r}),e[f]=u}}}},{"../../../plotly":365,"./axis_defaults":394,"./layout_attributes":397}],397:[function(t,e,r){"use strict";function n(t,e,r){return{x:{valType:"number",dflt:t},y:{valType:"number",dflt:e},z:{valType:"number",dflt:r}}}var i=t("./axis_attributes"),o=t("../../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},camera:{up:o(n(0,0,1),{description:["Sets the (x,y,z) components of the 'up' camera vector.","This vector determines the up direction of this scene","with respect to the page.","The default is *{x: 0, y: 0, z: 1}* which means that","the z axis points up."].join(" ")}),center:o(n(0,0,0),{description:["Sets the (x,y,z) components of the 'center' camera vector","This vector determines the translation (x,y,z) space","about the center of this scene.","By default, there is no such translation."].join(" ")}),eye:o(n(1.25,1.25,1.25),{description:["Sets the (x,y,z) components of the 'eye' camera vector.","This vector determines the view point about the origin","of this scene."].join(" ")})},domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1],description:["Sets the horizontal domain of this scene","(in plot fraction)."].join(" ")},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1],description:["Sets the vertical domain of this scene","(in plot fraction)."].join(" ")}},aspectmode:{valType:"enumerated",values:["auto","cube","data","manual"],dflt:"auto",description:["If *cube*, this scene's axes are drawn as a cube,","regardless of the axes' ranges.","If *data*, this scene's axes are drawn","in proportion with the axes' ranges.","If *manual*, this scene's axes are drawn","in proportion with the input of *aspectratio*","(the default behavior if *aspectratio* is provided).","If *auto*, this scene's axes are drawn","using the results of *data* except when one axis","is more than four times the size of the two others,","where in that case the results of *cube* are used."].join(" ")},aspectratio:{x:{valType:"number",min:0},y:{valType:"number",min:0},z:{valType:"number",min:0},description:["Sets this scene's axis aspectratio."].join(" ")},xaxis:i,yaxis:i,zaxis:i,_deprecated:{cameraposition:{valType:"info_array"}}}},{"../../../lib/extend":344,"./axis_attributes":393}],398:[function(t,e,r){"use strict";function n(){this.enabled=[!0,!0,!0],this.colors=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.drawSides=[!0,!0,!0],this.lineWidth=[1,1,1]}function i(t){var e=new n;return e.merge(t),e}var o=t("../../../lib/str2rgbarray"),a=["xaxis","yaxis","zaxis"],s=n.prototype;s.merge=function(t){for(var e=0;3>e;++e){var r=t[a[e]];this.enabled[e]=r.showspikes,this.colors[e]=o(r.spikecolor),this.drawSides[e]=r.spikesides,this.lineWidth[e]=r.spikethickness}},e.exports=i},{"../../../lib/str2rgbarray":358}],399:[function(t,e,r){"use strict";function n(t){for(var e=new Array(3),r=0;3>r;++r){for(var n=t[r],i=new Array(n.length),o=0;o<n.length;++o)i[o]=n[o].x;e[r]=i}return e}function i(t){for(var e=t.axesOptions,r=t.glplot.axesPixels,i=t.fullSceneLayout,c=[[],[],[]],u=0;3>u;++u){var h=i[s[u]];if(h._length=(r[u].hi-r[u].lo)*r[u].pixelsPerDataUnit/t.dataScale[u],Math.abs(h._length)===1/0)c[u]=[];else{h.range[0]=r[u].lo/t.dataScale[u],h.range[1]=r[u].hi/t.dataScale[u],h._m=1/(t.dataScale[u]*r[u].pixelsPerDataUnit),h.range[0]===h.range[1]&&(h.range[0]-=1,h.range[1]+=1);var f=h.tickmode;if("auto"===h.tickmode){h.tickmode="linear";var d=h.nticks||o.Lib.constrain(h._length/40,4,9);o.Axes.autoTicks(h,Math.abs(h.range[1]-h.range[0])/d)}for(var p=o.Axes.calcTicks(h),g=0;g<p.length;++g)p[g].x=p[g].x*t.dataScale[u],p[g].text=a(p[g].text);c[u]=p,h.tickmode=f}}e.ticks=c;for(var u=0;3>u;++u){l[u]=.5*(t.glplot.bounds[0][u]+t.glplot.bounds[1][u]);for(var g=0;2>g;++g)e.bounds[g][u]=t.glplot.bounds[g][u]}t.contourLevels=n(c)}e.exports=i;var o=t("../../../plotly"),a=t("../../../lib/html2unicode"),s=["xaxis","yaxis","zaxis"],l=[0,0,0]},{"../../../lib/html2unicode":347,"../../../plotly":365}],400:[function(t,e,r){"use strict";function n(t,e){var r,n,i=[0,0,0,0];for(r=0;4>r;++r)for(n=0;4>n;++n)i[n]+=t[4*r+n]*e[r];return i}function i(t,e){var r=n(t.projection,n(t.view,n(t.model,[e[0],e[1],e[2],1])));return r}e.exports=i},{}],401:[function(t,e,r){"use strict";function n(t){function e(e,r){if(void 0!==r){if("string"==typeof r)return r;var n=t.fullSceneLayout[e];return d.tickText(n,n.c2l(r),"hover").text}}var r=t.svgContainer,n=t.container.getBoundingClientRect(),i=n.width,o=n.height;r.setAttributeNS(null,"viewBox","0 0 "+i+" "+o),r.setAttributeNS(null,"width",i),r.setAttributeNS(null,"height",o),w(t),t.glplot.axes.update(t.axesOptions);for(var a=Object.keys(t.traces),s=null,l=t.glplot.selection,c=0;c<a.length;++c){var u=t.traces[a[c]];u.handlePick(l)&&(s=u),u.setContourLevels&&u.setContourLevels()}if(null!==s){var h=y(t.glplot.cameraParams,l.dataCoordinate),f=s.data.hoverinfo;if("all"!==f){var g=f.split("+");-1===g.indexOf("x")&&(l.traceCoordinate[0]=void 0),-1===g.indexOf("y")&&(l.traceCoordinate[1]=void 0),-1===g.indexOf("z")&&(l.traceCoordinate[2]=void 0),-1===g.indexOf("text")&&(l.textLabel=void 0),-1===g.indexOf("name")&&(s.name=void 0)}p.loneHover({x:(.5+.5*h[0]/h[3])*i,y:(.5-.5*h[1]/h[3])*o,xLabel:e("xaxis",l.traceCoordinate[0]),yLabel:e("yaxis",l.traceCoordinate[1]),zLabel:e("zaxis",l.traceCoordinate[2]),text:l.textLabel,name:s.name,color:s.color},{container:r})}else p.loneUnhover(r)}function i(t,e,r,i){var o={canvas:r,gl:i,container:t.container,axes:t.axesOptions,spikes:t.spikeOptions,pickRadius:10,snapToData:!0,autoScale:!0,autoBounds:!1};if(t.staticMode){if(!c){l=document.createElement("canvas");try{c=l.getContext("webgl",{preserveDrawingBuffer:!0,premultipliedAlpha:!0})}catch(a){throw new Error("error creating static canvas/context for image server")}}o.pixelRatio=t.pixelRatio,o.gl=c,o.canvas=l}try{t.glplot=u(o)}catch(a){v(t)}if(t.staticMode||t.glplot.canvas.addEventListener("webglcontextlost",function(t){console.log("lost context"),t.preventDefault()}),!t.camera){var s=e.scene.camera;t.camera=m(t.container,{center:[s.center.x,s.center.y,s.center.z],eye:[s.eye.x,s.eye.y,s.eye.z],up:[s.up.x,s.up.y,s.up.z],zoomMin:.1,zoomMax:100,mode:"orbit"})}return t.glplot.mouseListener.enabled=!1,t.glplot.camera=t.camera,t.glplot.oncontextloss=function(){t.recoverContext()},t.glplot.onrender=n.bind(null,t),t.traces={},!0}function o(t,e){var r=document.createElement("div"),n=t.container,o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.style.position="absolute",o.style.top=o.style.left="0px",o.style.width=o.style.height="100%",o.style["z-index"]=20,o.style["pointer-events"]="none",r.appendChild(o),this.svgContainer=o,r.id=t.id,r.style.position="absolute",r.style.top=r.style.left="0px",r.style.width=r.style.height="100%",n.appendChild(r),this.fullLayout=e,this.id=t.id||"scene",this.plotArgs=[[],{},{}],this.axesOptions=x(e[this.id]),this.spikeOptions=_(e[this.id]),this.container=r,this.staticMode=!!t.staticPlot,this.pixelRatio=t.plotGlPixelRatio||2,this.dataScale=[1,1,1],this.contourLevels=[[],[],[]],!i(this,e)}function a(t,e,r,n){for(var i=0;i<e.length;++i)if(Array.isArray(e[i]))for(var o=0;o<e[i].length;++o){var a=t.d2l(e[i][o]);!isNaN(a)&&isFinite(a)&&(n[0][r]=Math.min(n[0][r],a),n[1][r]=Math.max(n[1][r],a))}else{var a=t.d2l(e[i]);!isNaN(a)&&isFinite(a)&&(n[0][r]=Math.min(n[0][r],a),n[1][r]=Math.max(n[1][r],a))}}function s(t,e,r){var n=t.fullSceneLayout;a(n.xaxis,e.x,0,r),a(n.yaxis,e.y,1,r),a(n.zaxis,e.z,2,r)}var l,c,u=t("gl-plot3d"),h=t("../../lib"),f=t("../../plots/plots"),d=t("../../plots/cartesian/axes"),p=t("../../plots/cartesian/graph_interact"),g=t("../../lib/str2rgbarray"),v=t("../../lib/show_no_webgl_msg"),m=t("./camera"),y=t("./project"),b=t("./set_convert"),x=t("./layout/convert"),_=t("./layout/spikes"),w=t("./layout/tick_marks"),k=o.prototype;k.recoverContext=function(){function t(){return r.isContextLost()?void requestAnimationFrame(t):i(e,e.fullLayout,n,r)?void e.plot.apply(e,e.plotArgs):void console.error("catastrophic/unrecoverable webgl error. context lost.")}var e=this,r=this.glplot.gl,n=this.glplot.canvas;this.glplot.dispose(),requestAnimationFrame(t)};var A=["xaxis","yaxis","zaxis"];k.plot=function(t,e,r){if(this.plotArgs=[t,e,r],!this.glplot.contextLost){var n,i,o,a,l=e[this.id],c=r[this.id];for(l.bgcolor?this.glplot.clearColor=g(l.bgcolor):this.glplot.clearColor=[0,0,0,0],this.glplot.snapToData=!0,this.fullSceneLayout=l,this.glplotLayout=l,this.axesOptions.merge(l),this.spikeOptions.merge(l),this.handleDragmode(e.dragmode),this.glplot.update({}),o=0;3>o;++o){var u=l[A[o]];b(u)}t?Array.isArray(t)||(t=[t]):t=[];for(var h=[[1/0,1/0,1/0],[-(1/0),-(1/0),-(1/0)]],o=0;o<t.length;++o){var n=t[o];n.visible===!0&&s(this,n,h)}for(var d=[1,1,1],a=0;3>a;++a)h[0][a]>h[1][a]?d[a]=1:h[1][a]===h[0][a]?d[a]=1:d[a]=1/(h[1][a]-h[0][a]);this.dataScale=d;for(var o=0;o<t.length;++o)if(n=t[o],n.visible===!0){if(i=this.traces[n.uid])i.update(n);else{var p=f.getModule(n.type);i=p.plot(this,n),this.traces[n.uid]=i}i.name=n.name}var v=Object.keys(this.traces);t:for(o=0;o<v.length;++o){for(a=0;a<t.length;++a)if(t[a].uid===v[o]&&t[a].visible===!0)continue t;i=this.traces[v[o]],i.dispose(),delete this.traces[v[o]]}var m=[[0,0,0],[0,0,0]],y=[],x={};for(o=0;3>o;++o){var u=l[A[o]],_=u.type;if(_ in x?(x[_].acc*=d[o],x[_].count+=1):x[_]={acc:d[o],count:1},u.autorange){for(m[0][o]=1/0,m[1][o]=-(1/0),a=0;a<this.glplot.objects.length;++a){var w=this.glplot.objects[a].bounds;m[0][o]=Math.min(m[0][o],w[0][o]/d[o]),m[1][o]=Math.max(m[1][o],w[1][o]/d[o])}if("rangemode"in u&&"tozero"===u.rangemode&&(m[0][o]=Math.min(m[0][o],0),m[1][o]=Math.max(m[1][o],0)),m[0][o]>m[1][o])m[0][o]=-1,m[1][o]=1;else{var k=m[1][o]-m[0][o];m[0][o]-=k/32,m[1][o]+=k/32}}else{var M=l[A[o]].range;m[0][o]=M[0],m[1][o]=M[1]}m[0][o]===m[1][o]&&(m[0][o]-=1,m[1][o]+=1),y[o]=m[1][o]-m[0][o],this.glplot.bounds[0][o]=m[0][o]*d[o],this.glplot.bounds[1][o]=m[1][o]*d[o]}for(var T=[1,1,1],o=0;3>o;++o){var u=l[A[o]],_=u.type,E=x[_];T[o]=Math.pow(E.acc,1/E.count)/d[o]}var L,S=4;if("auto"===l.aspectmode)L=Math.max.apply(null,T)/Math.min.apply(null,T)<=S?T:[1,1,1];else if("cube"===l.aspectmode)L=[1,1,1];else if("data"===l.aspectmode)L=T;else{if("manual"!==l.aspectmode)throw new Error("scene.js aspectRatio was not one of the enumerated types");var C=l.aspectratio;L=[C.x,C.y,C.z]}l.aspectratio.x=c.aspectratio.x=L[0],l.aspectratio.y=c.aspectratio.y=L[1],l.aspectratio.z=c.aspectratio.z=L[2],this.glplot.aspect=L;var z=l.domain||null,j=e._size||null;if(z&&j){var P=this.container.style;P.position="absolute",P.left=j.l+z.x[0]*j.w+"px",P.top=j.t+(1-z.y[1])*j.h+"px",P.width=j.w*(z.x[1]-z.x[0])+"px",P.height=j.h*(z.y[1]-z.y[0])+"px"}}},k.destroy=function(){this.glplot.dispose(),this.container.parentNode.removeChild(this.container),this.glplot=null},k.setCameraToDefault=function(){this.glplot.camera.lookAt([1.25,1.25,1.25],[0,0,0],[0,0,1])},k.getCamera=function(){this.glplot.camera.view.recalcMatrix(this.camera.view.lastT());var t=this.glplot.camera.up,e=this.glplot.camera.center,r=this.glplot.camera.eye;return{up:{x:t[0],y:t[1],z:t[2]},center:{x:e[0],y:e[1],z:e[2]},eye:{x:r[0],y:r[1],z:r[2]}}},k.setCamera=function(t){var e=t.up,r=t.center,n=t.eye;this.glplot.camera.lookAt([n.x,n.y,n.z],[r.x,r.y,r.z],[e.x,e.y,e.z])},k.saveCamera=function(t){function e(t,e,r,n){var i=["up","center","eye"],o=["x","y","z"];return t[i[r]][o[n]]===e[i[r]][o[n]]}var r=this.getCamera(),n=h.nestedProperty(t,this.id+".camera"),i=n.get(),o=!1;if(void 0===i)o=!0;else for(var a=0;3>a;a++)for(var s=0;3>s;s++)if(!e(r,i,a,s)){o=!0;break}return o&&n.set(r),o},k.handleDragmode=function(t){var e=this.camera;e&&("orbit"===t?(e.mode="orbit",e.keyBindingMode="rotate"):"turntable"===t?(e.up=[0,0,1],e.mode="turntable",e.keyBindingMode="rotate"):e.keyBindingMode=t)},k.toImage=function(t){t||(t="png"),this.staticMode&&this.container.appendChild(l),this.glplot.redraw();var e=this.glplot.gl,r=e.drawingBufferWidth,n=e.drawingBufferHeight;e.bindFramebuffer(e.FRAMEBUFFER,null);var i=new Uint8Array(r*n*4);e.readPixels(0,0,r,n,e.RGBA,e.UNSIGNED_BYTE,i);for(var o=0,a=n-1;a>o;++o,--a)for(var s=0;r>s;++s)for(var c=0;4>c;++c){var u=i[4*(r*o+s)+c];i[4*(r*o+s)+c]=i[4*(r*a+s)+c],i[4*(r*a+s)+c]=u}var h=document.createElement("canvas");h.width=r,h.height=n;var f=h.getContext("2d"),d=f.createImageData(r,n);d.data.set(i),f.putImageData(d,0,0);var p;switch(t){case"jpeg":p=h.toDataURL("image/jpeg");break;case"webp":p=h.toDataURL("image/webp");break;default:p=h.toDataURL("image/png")}return this.staticMode&&this.container.removeChild(l),p},e.exports=o},{"../../lib":348,"../../lib/show_no_webgl_msg":356,"../../lib/str2rgbarray":358,"../../plots/cartesian/axes":368,"../../plots/cartesian/graph_interact":370,"../../plots/plots":404,"./camera":390,"./layout/convert":395,"./layout/spikes":398,"./layout/tick_marks":399,"./project":400,"./set_convert":402,"gl-plot3d":140}],402:[function(t,e,r){"use strict";var n=t("../../plotly"),i=function(){};e.exports=function(t){n.Axes.setConvert(t),t.setScale=i}},{"../../plotly":365}],403:[function(t,e,r){"use strict";var n=t("../plotly"),i=t("./font_attributes"),o=t("../components/color/attributes"),a=n.Lib.extendFlat;e.exports={font:{family:a({},i.family,{dflt:'"Open Sans", verdana, arial, sans-serif'}),size:a({},i.size,{dflt:12}),color:a({},i.color,{dflt:o.defaultLine}),description:["Sets the global font.","Note that fonts used in traces and other","layout components inherit from the global font."].join(" ")},title:{valType:"string",dflt:"Click to enter Plot title",description:["Sets the plot's title."].join(" ")},titlefont:a({},i,{}),autosize:{valType:"enumerated",values:[!0,!1,"initial"],description:["Determines whether or not the dimensions of the figure are","computed as a function of the display size."].join(" ")},width:{valType:"number",min:10,dflt:700,description:["Sets the plot's width (in px)."].join(" ")},height:{valType:"number",min:10,dflt:450,description:["Sets the plot's height (in px)."].join(" ")},margin:{l:{valType:"number",min:0,dflt:80},r:{valType:"number",min:0,dflt:80},t:{valType:"number",min:0,dflt:100},b:{valType:"number",min:0,dflt:80},pad:{valType:"number",min:0,dflt:0,description:["Sets the amount of padding (in px)","between the plotting area and the axis lines"].join(" ")},autoexpand:{valType:"boolean",dflt:!0}},paper_bgcolor:{valType:"color",dflt:o.background},plot_bgcolor:{valType:"color",dflt:o.background,description:["Sets the color of plotting area in-between x and y axes."].join(" ")},separators:{valType:"string",dflt:".,",description:["Sets the decimal and thousand separators.","For example, *. * puts a '.' before decimals and","a space between thousands."].join(" ")},hidesources:{valType:"boolean",dflt:!1,description:["Determines whether or not a text link citing the data source is","placed at the bottom-right cored of the figure.","Has only an effect only on graphs that have been generated via","forked graphs from the plotly service (at https://plot.ly or on-premise)."].join(" ")},smith:{valType:"enumerated",values:[!1],dflt:!1},showlegend:{valType:"boolean"},_hasCartesian:{valType:"boolean",dflt:!1},_hasGL3D:{valType:"boolean",dflt:!1},_hasGeo:{valType:"boolean",dflt:!1},_hasPie:{valType:"boolean",dflt:!1},_hasGL2D:{valType:"boolean",dflt:!1},_composedModules:{"*":"Fx"},_nestedModules:{xaxis:"Axes",yaxis:"Axes",scene:"gl3d",geo:"geo",legend:"Legend",annotations:"Annotations",shapes:"Shapes"}}},{"../components/color/attributes":298,"../plotly":365,"./font_attributes":374}],404:[function(t,e,r){"use strict";function n(t){return"object"==typeof t&&(t=t.type),t}function i(t,e){e.text("");var r=e.append("a").attr({"xlink:xlink:href":"#","class":"link--impt link--embedview","font-weight":"bold"}).text(t._context.linkText+" "+String.fromCharCode(187));if(t._context.sendData)r.on("click",function(){h.sendDataToCloud(t)});else{var n=window.location.pathname.split("/"),i=window.location.search;r.attr({"xlink:xlink:show":"new","xlink:xlink:href":"/"+n[2].split(".")[0]+"/"+n[1]+i})}}function o(t,e){for(var r,n=h.getSubplotIds(e,"gl3d"),i=0;i<n.length;i++)r=n[i],!t[r]&&e[r]._scene&&e[r]._scene.destroy()}function a(t,e){for(var r,n=Object.keys(e),i=0;i<n.length;++i){var o=n[i];if("_"===o.charAt(0)||"function"==typeof e[o]){if(o in t)continue;t[o]=e[o]}else if(Array.isArray(e[o])&&Array.isArray(t[o])&&e[o].length&&u.isPlainObject(e[o][0])){if(e[o].length!==t[o].length)throw new Error("relinkPrivateKeys needs equal length arrays");for(r=0;r<e[o].length;r++)a(t[o][r],e[o][r])}else u.isPlainObject(e[o])&&u.isPlainObject(t[o])&&(a(t[o],e[o]),Object.keys(t[o]).length||delete t[o])}}var s=t("../plotly"),l=t("d3"),c=t("fast-isnumeric"),u=t("../lib"),h=e.exports={},f=h.modules={},d=h.allTypes=[],p=h.allCategories={},g=h.subplotsRegistry={};h.attributes=t("./attributes"),h.attributes.type.values=d,h.fontAttrs=t("./font_attributes"),h.layoutAttributes=t("./layout_attributes"),h.fontWeight="normal",h.register=function(t,e,r,n){if(f[e])return void console.log("type "+e+" already registered");for(var i={},o=0;o<r.length;o++)i[r[o]]=!0,p[r[o]]=!0;f[e]={_module:t,categories:i},n&&Object.keys(n).length&&(f[e].meta=n),d.push(e)},h.getModule=function(t){if(void 0!==t.r)return console.log("Oops, tried to put a polar trace on an incompatible graph of cartesian data. Ignoring this dataset.",t),!1;var e=f[n(t)];return e?e._module:!1},h.traceIs=function(t,e){if(t=n(t),"various"===t)return!1;var r=f[t];return r||(void 0!==t&&console.warn("unrecognized trace type "+t),r=f[h.attributes.type.dflt]),!!r.categories[e]},h.registerSubplot=function(t){var e=t.name;return g[e]?void console.log("plot type "+e+" already registered"):void(g[e]=t)},h.getSubplotIds=function(t,e){if(void 0===h.subplotsRegistry[e])return[];if("cartesian"===e&&!t._hasCartesian)return[];if("gl2d"===e&&!t._hasGL2D)return[];if("cartesian"===e||"gl2d"===e)return Object.keys(t._plots);for(var r,n=h.subplotsRegistry[e].idRegex,i=Object.keys(t),o=[],a=0;a<i.length;a++)r=i[a],n.test(r)&&o.push(r);return o},h.getSubplotIdsInData=function(t,e){if(void 0===h.subplotsRegistry[e])return[];for(var r,n=h.subplotsRegistry[e].attr,i=[],o=0;o<t.length;o++)r=t[o],s.Plots.traceIs(r,e)&&-1===i.indexOf(r[n])&&i.push(r[n]);return i},h.getSubplotData=function(t,e,r){if(void 0===h.subplotsRegistry[e])return[];for(var n,i=h.subplotsRegistry[e].attr,o=[],a=0;a<t.length;a++)if(n=t[a],"gl2d"===e&&h.traceIs(n,"gl2d")){var l=s.Axes.subplotMatch,c="x"+r.match(l)[1],u="y"+r.match(l)[2];n[i[0]]===c&&n[i[1]]===u&&o.push(n)}else n[i]===r&&o.push(n);return o},h.redrawText=function(t){return t._fullLayout._hasGL3D||t.data&&t.data[0]&&t.data[0].r?void 0:new Promise(function(e){setTimeout(function(){s.Annotations.drawAll(t),s.Legend.draw(t),(t.calcdata||[]).forEach(function(t){t[0]&&t[0].t&&t[0].t.cb&&t[0].t.cb()}),e(h.previousPromises(t))},300)})},h.resize=function(t){t&&"none"!==l.select(t).style("display")&&(t._redrawTimer&&clearTimeout(t._redrawTimer),t._redrawTimer=setTimeout(function(){if((t._fullLayout||{}).autosize){var e=t.changed;t.autoplay=!0,s.relayout(t,{autosize:!0}),t.changed=e}},100))},h.previousPromises=function(t){return(t._promises||[]).length?Promise.all(t._promises).then(function(){t._promises=[]}):void 0},h.addLinks=function(t){var e=t._fullLayout,r=e._paper.selectAll("text.js-plot-link-container").data([0]);r.enter().append("text").classed("js-plot-link-container",!0).style({"font-family":'"Open Sans", Arial, sans-serif',"font-size":"12px",fill:s.Color.defaultLine,"pointer-events":"all"}).each(function(){var t=l.select(this);t.append("tspan").classed("js-link-to-tool",!0),t.append("tspan").classed("js-link-spacer",!0),t.append("tspan").classed("js-sourcelinks",!0)});var n=r.node(),o={y:e._paper.attr("height")-9};n&&n.offsetParent&&n.getComputedTextLength()>=e.width-20?(o["text-anchor"]="start",o.x=5):(o["text-anchor"]="end",o.x=e._paper.attr("width")-7),r.attr(o);var a=r.select(".js-link-to-tool"),c=r.select(".js-link-spacer"),u=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&i(t,a),c.text(a.text()&&u.text()?" - ":"")},h.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",r=l.select(t).append("div").attr("id","hiddenform").style("display","none"),n=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"
}),i=n.append("input").attr({type:"text",name:"data"});return i.node().value=h.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},h.supplyDefaults=function(t){var e,r,n,i,l,c,u=t._fullLayout||{},f=t._fullLayout={},d=t.layout||{},p=t._fullData||[],g=t._fullData=[],v=t.data||[],m=t._modules=[];for(h.supplyLayoutGlobalDefaults(d,f),f._dataLength=v.length,e=0;e<v.length;e++)r=v[e],n=h.supplyDataDefaults(r,e,f),g.push(n),h.traceIs(n,"cartesian")?f._hasCartesian=!0:h.traceIs(n,"gl3d")?f._hasGL3D=!0:h.traceIs(n,"geo")?f._hasGeo=!0:h.traceIs(n,"pie")?f._hasPie=!0:h.traceIs(n,"gl2d")?f._hasGL2D=!0:"r"in n&&(f._hasPolar=!0),i=n._module,i&&-1===m.indexOf(i)&&m.push(i);for(e=0;e<m.length;e++)i=m[e],i.cleanData&&i.cleanData(g);if(p.length===v.length)for(e=0;e<g.length;e++)a(g[e],p[e]);for(h.supplyLayoutModuleDefaults(d,f,g),o(f,u),a(f,u),h.doAutoMargin(t),l=s.Axes.list(t),e=0;e<l.length;e++)c=l[e],c._td=t,c.setScale();if((t.calcdata||[]).length===g.length)for(e=0;e<g.length;e++)r=g[e],(t.calcdata[e][0]||{}).trace=r},h.supplyDataDefaults=function(t,e,r){function n(e,r){return u.coerce(t,o,h.attributes,e,r)}function i(e,r){return h.traceIs(o,e)?u.coerce(t,o,h.subplotsRegistry[e].attributes,r):void 0}var o={},a=s.Color.defaults[e%s.Color.defaults.length];o.index=e;var l,c,f=n("visible");return n("type"),n("uid"),i("gl3d","scene"),i("geo","geo"),(f||l)&&(c=h.getModule(o),o._module=c),f&&n("hoverinfo",1===r._dataLength?"x+y+z+text":void 0),c&&f&&c.supplyDefaults(t,o,a,r),f&&(n("name","trace "+e),h.traceIs(o,"noOpacity")||n("opacity"),i("cartesian","xaxis"),i("cartesian","yaxis"),i("gl2d","xaxis"),i("gl2d","yaxis"),h.traceIs(o,"showLegend")&&(n("showlegend"),n("legendgroup"))),o._input=t,o},h.supplyLayoutGlobalDefaults=function(t,e){function r(r,n){return u.coerce(t,e,h.layoutAttributes,r,n)}var n=u.coerceFont(r,"font");r("title"),u.coerceFont(r,"titlefont",{family:n.family,size:Math.round(1.4*n.size),color:n.color});var i=r("autosize",t.width&&t.height?!1:"initial");r("width"),r("height"),r("margin.l"),r("margin.r"),r("margin.t"),r("margin.b"),r("margin.pad"),r("margin.autoexpand"),"initial"!==i&&h.sanitizeMargins(e),r("paper_bgcolor"),r("separators"),r("hidesources"),r("smith"),r("_hasCartesian"),r("_hasGL3D"),r("_hasGeo"),r("_hasPie"),r("_hasGL2D")},h.supplyLayoutModuleDefaults=function(t,e,r){var n,i;s.Axes.supplyLayoutDefaults(t,e,r);var o=Object.keys(g);for(n=0;n<o.length;n++)i=g[o[n]],i.supplyLayoutDefaults&&i.supplyLayoutDefaults(t,e,r);var a=Object.keys(f);for(n=0;n<a.length;n++)i=f[d[n]]._module,i.supplyLayoutDefaults&&i.supplyLayoutDefaults(t,e,r);var l=["Fx","Annotations","Shapes","Legend"];for(n=0;n<l.length;n++)i=l[n],s[i]&&s[i].supplyLayoutDefaults(t,e,r)},h.purge=function(t){var e=t._fullLayout||{};void 0!==e._glcontainer&&e._glcontainer.remove(),void 0!==e._geocontainer&&e._geocontainer.remove(),e._modeBar&&e._modeBar.destroy(),delete t.data,delete t.layout,delete t._fullData,delete t._fullLayout,delete t.calcdata,delete t.framework,delete t.empty,delete t.fid,delete t.undoqueue,delete t.undonum,delete t.autoplay,delete t.changed,delete t._modules,delete t._tester,delete t._testref,delete t._promises,delete t._redrawTimer,delete t._replotting,delete t.firstscatter,delete t.hmlumcount,delete t.hmpixcount,delete t.numboxes,delete t._hoverTimer,delete t._lastHoverTime,t.removeAllListeners&&t.removeAllListeners()},h.style=function(t){for(var e=t._modules.concat(s.ErrorBars),r=0;r<e.length;r++){var n=e[r];n.style&&n.style(t)}},h.sanitizeMargins=function(t){if(t&&t.margin){var e,r=t.width,n=t.height,i=t.margin,o=r-(i.l+i.r),a=n-(i.t+i.b);0>o&&(e=(r-1)/(i.l+i.r),i.l=Math.floor(e*i.l),i.r=Math.floor(e*i.r)),0>a&&(e=(n-1)/(i.t+i.b),i.t=Math.floor(e*i.t),i.b=Math.floor(e*i.b))}},h.autoMargin=function(t,e,r){var n=t._fullLayout;if(n._pushmargin||(n._pushmargin={}),n.margin.autoexpand!==!1){if(r){var i=r.pad||12;r.l+r.r>.5*n.width&&(r.l=r.r=0),r.b+r.t>.5*n.height&&(r.b=r.t=0),n._pushmargin[e]={l:{val:r.x,size:r.l+i},r:{val:r.x,size:r.r+i},b:{val:r.y,size:r.b+i},t:{val:r.y,size:r.t+i}}}else delete n._pushmargin[e];t._replotting||h.doAutoMargin(t)}},h.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var r=e._size,n=JSON.stringify(r),i=Math.max(e.margin.l||0,0),o=Math.max(e.margin.r||0,0),a=Math.max(e.margin.t||0,0),l=Math.max(e.margin.b||0,0),u=e._pushmargin;return e.margin.autoexpand!==!1&&(u.base={l:{val:0,size:i},r:{val:1,size:o},t:{val:1,size:a},b:{val:0,size:l}},Object.keys(u).forEach(function(t){var r=u[t].l||{},n=u[t].b||{},s=r.val,h=r.size,f=n.val,d=n.size;Object.keys(u).forEach(function(t){if(c(h)&&u[t].r){var r=u[t].r.val,n=u[t].r.size;if(r>s){var p=(h*r+(n-e.width)*s)/(r-s),g=(n*(1-s)+(h-e.width)*(1-r))/(r-s);p>=0&&g>=0&&p+g>i+o&&(i=p,o=g)}}if(c(d)&&u[t].t){var v=u[t].t.val,m=u[t].t.size;if(v>f){var y=(d*v+(m-e.height)*f)/(v-f),b=(m*(1-f)+(d-e.height)*(1-v))/(v-f);y>=0&&b>=0&&y+b>l+a&&(l=y,a=b)}}})})),r.l=Math.round(i),r.r=Math.round(o),r.t=Math.round(a),r.b=Math.round(l),r.p=Math.round(e.margin.pad),r.w=Math.round(e.width)-r.l-r.r,r.h=Math.round(e.height)-r.t-r.b,t._replotting||"{}"===n||n===JSON.stringify(e._size)?void 0:s.plot(t)},h.graphJson=function(t,e,r,n,i){function o(t){if("function"==typeof t)return null;if(u.isPlainObject(t)){var e,n,i={};for(e in t)if("function"!=typeof t[e]&&-1===["_","["].indexOf(e.charAt(0))){if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0&&!u.isPlainObject(t.stream))continue}else if("keepall"!==r&&(n=t[e+"src"],"string"==typeof n&&n.indexOf(":")>0))continue;i[e]=o(t[e])}return i}return Array.isArray(t)?t.map(o):t&&t.getTime?u.ms2DateTime(t):t}(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&h.supplyDefaults(t);var a=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l={data:(a||[]).map(function(t){var r=o(t);return e&&delete r.fit,r})};return e||(l.layout=o(s)),t.framework&&t.framework.isPolar&&(l=t.framework.getConfig()),"object"===n?l:JSON.stringify(l)}},{"../lib":348,"../plotly":365,"./attributes":366,"./font_attributes":374,"./layout_attributes":403,d3:70,"fast-isnumeric":74}],405:[function(t,e,r){"use strict";var n=t("../../traces/scatter/attributes"),i=n.marker;e.exports={r:n.r,t:n.t,marker:{color:i.color,size:i.size,symbol:i.symbol,opacity:i.opacity}}},{"../../traces/scatter/attributes":493}],406:[function(t,e,r){"use strict";function n(t,e){var r={showline:{valType:"boolean",description:["Determines whether or not the line bounding this",t,"axis","will be shown on the figure."].join(" ")},showticklabels:{valType:"boolean",description:["Determines whether or not the",t,"axis ticks","will feature tick labels."].join(" ")},tickorientation:{valType:"enumerated",values:["horizontal","vertical"],description:["Sets the orientation (from the paper perspective)","of the",t,"axis tick labels."].join(" ")},ticklen:{valType:"number",min:0,description:["Sets the length of the tick lines on this",t,"axis."].join(" ")},tickcolor:{valType:"color",description:["Sets the color of the tick lines on this",t,"axis."].join(" ")},ticksuffix:{valType:"string",description:["Sets the length of the tick lines on this",t,"axis."].join(" ")},endpadding:{valType:"number"},visible:{valType:"boolean",description:["Determines whether or not this axis will be visible."].join(" ")}};return o({},e,r)}var i=t("../cartesian/layout_attributes"),o=t("../../lib/extend").extendFlat,a=o({},i.domain,{description:["Polar chart subplots are not supported yet.","This key has currently no effect."].join(" ")});e.exports={radialaxis:n("radial",{range:{valType:"info_array",items:[{valType:"number"},{valType:"number"}],description:["Defines the start and end point of this radial axis."].join(" ")},domain:a,orientation:{valType:"number",description:["Sets the orientation (an angle with respect to the origin)","of the radial axis."].join(" ")}}),angularaxis:n("angular",{range:{valType:"info_array",items:[{valType:"number",dflt:0},{valType:"number",dflt:360}],description:["Defines the start and end point of this angular axis."].join(" ")},domain:a}),layout:{direction:{valType:"enumerated",values:["clockwise","counterclockwise"],description:["For polar plots only.","Sets the direction corresponding to positive angles."].join(" ")},orientation:{valType:"angle",description:["For polar plots only.","Rotates the entire polar by the given angle."].join(" ")}}}},{"../../lib/extend":344,"../cartesian/layout_attributes":372}],407:[function(t,e,r){var n=t("../../plotly"),i=t("d3"),o=e.exports={version:"0.2.2",manager:t("./micropolar_manager")},a=n.Lib.extendDeepAll;o.Axis=function(){function t(t){r=t||r;var c=l.data,h=l.layout;return("string"==typeof r||r.nodeName)&&(r=i.select(r)),r.datum(c).each(function(t,r){function l(t,e){return s(t)%360+h.orientation}var c=t.slice();u={data:o.util.cloneJson(c),layout:o.util.cloneJson(h)};var f=0;c.forEach(function(t,e){t.color||(t.color=h.defaultColorRange[f],f=(f+1)%h.defaultColorRange.length),t.strokeColor||(t.strokeColor="LinePlot"===t.geometry?t.color:i.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 d=c.filter(function(t,e){var r=t.visible;return"undefined"==typeof r||r===!0}),p=!1,g=d.map(function(t,e){return p=p||"undefined"!=typeof t.groupId,t});if(p){var v=i.nest().key(function(t,e){return"undefined"!=typeof t.groupId?t.groupId:"unstacked"}).entries(g),m=[],y=v.map(function(t,e){if("unstacked"===t.key)return t.values;var r=t.values[0].r.map(function(t,e){return 0});return t.values.forEach(function(t,e,n){t.yStack=[r],m.push(r),r=o.util.sumArrays(t.r,r)}),t.values});d=i.merge(y)}d.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 b=Math.min(h.width-h.margin.left-h.margin.right,h.height-h.margin.top-h.margin.bottom)/2;b=Math.max(10,b);var x,_=[h.margin.left+b,h.margin.top+b];if(p){var w=i.max(o.util.sumArrays(o.util.arrayLast(d).r[0],o.util.arrayLast(m)));x=[0,w]}else x=i.extent(o.util.flattenArray(d.map(function(t,e){return t.r})));h.radialAxis.domain!=o.DATAEXTENT&&(x[0]=0),n=i.scale.linear().domain(h.radialAxis.domain!=o.DATAEXTENT&&h.radialAxis.domain?h.radialAxis.domain:x).range([0,b]),u.layout.radialAxis.domain=n.domain();var k,A=o.util.flattenArray(d.map(function(t,e){return t.t})),M="string"==typeof A[0];M&&(A=o.util.deduplicate(A),k=A.slice(),A=i.range(A.length),d=d.map(function(t,e){var r=t;return t.t=[A],p&&(r.yStack=t.yStack),r}));var T=d.filter(function(t,e){return"LinePlot"===t.geometry||"DotPlot"===t.geometry}).length===d.length,E=null===h.needsEndSpacing?M||!T:h.needsEndSpacing,L=h.angularAxis.domain&&h.angularAxis.domain!=o.DATAEXTENT&&!M&&h.angularAxis.domain[0]>=0,S=L?h.angularAxis.domain:i.extent(A),C=Math.abs(A[1]-A[0]);T&&!M&&(C=0);var z=S.slice();E&&M&&(z[1]+=C);var j=h.angularAxis.ticksCount||4;j>8&&(j=j/(j/8)+j%8),h.angularAxis.ticksStep&&(j=(z[1]-z[0])/j);var P=h.angularAxis.ticksStep||(z[1]-z[0])/(j*(h.minorTicks+1));k&&(P=Math.max(Math.round(P),1)),z[2]||(z[2]=P);var I=i.range.apply(this,z);if(I=I.map(function(t,e){return parseFloat(t.toPrecision(12))}),s=i.scale.linear().domain(z.slice(0,2)).range("clockwise"===h.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=s.domain(),u.layout.angularAxis.endPadding=E?C:0,e=i.select(this).select("svg.chart-root"),"undefined"==typeof e||e.empty()){var R="<svg xmlns='http://www.w3.org/2000/svg' class='chart-root'>' + '<g class='outer-group'>' + '<g class='chart-group'>' + '<circle class='background-circle'></circle>' + '<g class='geometry-group'></g>' + '<g class='radial axis-group'>' + '<circle class='outside-circle'></circle>' + '</g>' + '<g class='angular axis-group'></g>' + '<g class='guides-group'><line></line><circle r='0'></circle></g>' + '</g>' + '<g class='legend-group'></g>' + '<g class='tooltips-group'></g>' + '<g class='title-group'><text></text></g>' + '</g>' + '</svg>",O=(new DOMParser).parseFromString(R,"application/xml"),N=this.appendChild(this.ownerDocument.importNode(O.documentElement,!0));e=i.select(N)}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 D,F=e.select(".chart-group"),B={fill:"none",stroke:h.tickColor},U={"font-size":h.font.size,"font-family":h.font.family,fill:h.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+h.font.outlineColor}).join(",")};if(h.showLegend){D=e.select(".legend-group").attr({transform:"translate("+[b,h.margin.top]+")"}).style({display:"block"});var V=d.map(function(t,e){var r=o.util.cloneJson(t);return r.symbol="DotPlot"===t.geometry?t.dotType||"circle":"LinePlot"!=t.geometry?"square":"line",r.visibleInLegend="undefined"==typeof t.visibleInLegend||t.visibleInLegend,r.color="LinePlot"===t.geometry?t.strokeColor:t.color,r});o.Legend().config({data:d.map(function(t,e){return t.name||"Element"+e}),legendConfig:a({},o.Legend.defaultConfig().legendConfig,{container:D,elements:V,reverseOrder:h.legend.reverseOrder})})();var q=D.node().getBBox();b=Math.min(h.width-q.width-h.margin.left-h.margin.right,h.height-h.margin.top-h.margin.bottom)/2,b=Math.max(10,b),_=[h.margin.left+b,h.margin.top+b],n.range([0,b]),u.layout.radialAxis.domain=n.domain(),D.attr("transform","translate("+[_[0]+b,_[1]-b]+")")}else D=e.select(".legend-group").style({display:"none"});e.attr({width:h.width,height:h.height}).style({opacity:h.opacity}),F.attr("transform","translate("+_+")").style({cursor:"crosshair"});var H=[(h.width-(h.margin.left+h.margin.right+2*b+(q?q.width:0)))/2,(h.height-(h.margin.top+h.margin.bottom+2*b))/2];if(H[0]=Math.max(0,H[0]),H[1]=Math.max(0,H[1]),e.select(".outer-group").attr("transform","translate("+H+")"),h.title){var G=e.select("g.title-group text").style(U).text(h.title),Y=G.node().getBBox();G.attr({x:_[0]-Y.width/2,y:_[1]-b-20})}var X=e.select(".radial.axis-group");if(h.radialAxis.gridLinesVisible){var W=X.selectAll("circle.grid-circle").data(n.ticks(5));W.enter().append("circle").attr({"class":"grid-circle"}).style(B),W.attr("r",n),W.exit().remove()}X.select("circle.outside-circle").attr({r:b}).style(B);var Z=e.select("circle.background-circle").attr({r:b}).style({fill:h.backgroundColor,stroke:h.stroke});if(h.radialAxis.visible){var Q=i.svg.axis().scale(n).ticks(5).tickSize(5);X.call(Q).attr({transform:"rotate("+h.radialAxis.orientation+")"}),X.selectAll(".domain").style(B),X.selectAll("g>text").text(function(t,e){return this.textContent+h.radialAxis.ticksSuffix}).style(U).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===h.radialAxis.tickOrientation?"rotate("+-h.radialAxis.orientation+") translate("+[0,U["font-size"]]+")":"translate("+[0,U["font-size"]]+")"}}),X.selectAll("g>line").style({stroke:"black"})}var $=e.select(".angular.axis-group").selectAll("g.angular-tick").data(I),K=$.enter().append("g").classed("angular-tick",!0);$.attr({transform:function(t,e){return"rotate("+l(t,e)+")"}}).style({display:h.angularAxis.visible?"block":"none"}),$.exit().remove(),K.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(h.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(h.minorTicks+1)==0)}).style(B),K.selectAll(".minor").style({stroke:h.minorTickColor}),$.select("line.grid-line").attr({x1:h.tickLength?b-h.tickLength:0,x2:b}).style({display:h.angularAxis.gridLinesVisible?"block":"none"}),K.append("text").classed("axis-text",!0).style(U);var J=$.select("text.axis-text").attr({x:b+h.labelOffset,dy:".35em",transform:function(t,e){var r=l(t,e),n=b+h.labelOffset,i=h.angularAxis.tickOrientation;return"horizontal"==i?"rotate("+-r+" "+n+" 0)":"radial"==i?270>r&&r>90?"rotate(180 "+n+" 0)":null:"rotate("+(180>=r&&r>0?-90:90)+" "+n+" 0)"}}).style({"text-anchor":"middle",display:h.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(h.minorTicks+1)!=0?"":k?k[t]+h.angularAxis.ticksSuffix:t+h.angularAxis.ticksSuffix}).style(U);h.angularAxis.rewriteTicks&&J.text(function(t,e){return e%(h.minorTicks+1)!=0?"":h.angularAxis.rewriteTicks(this.textContent,e)});var tt=i.max(F.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));D.attr({transform:"translate("+[b+tt,h.margin.top]+")"});var et=e.select("g.geometry-group").selectAll("g").size()>0,rt=e.select("g.geometry-group").selectAll("g.geometry").data(d);if(rt.enter().append("g").attr({"class":function(t,e){return"geometry geometry"+e}}),rt.exit().remove(),d[0]||et){var nt=[];d.forEach(function(t,e){var r={};r.radialScale=n,r.angularScale=s,r.container=rt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=h.orientation,r.direction=h.direction,r.index=e,nt.push({data:t,geometryConfig:r})});var it=i.nest().key(function(t,e){return"undefined"!=typeof t.data.groupId||"unstacked"}).entries(nt),ot=[];it.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 r;r=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var n=t.map(function(t,e){return a(o[r].defaultConfig(),t)});o[r]().config(n)()})}var at,st,lt=e.select(".guides-group"),ct=e.select(".tooltips-group"),ut=o.tooltipPanel().config({container:ct,fontSize:8})(),ht=o.tooltipPanel().config({container:ct,fontSize:8})(),ft=o.tooltipPanel().config({container:ct,hasTick:!0})();if(!M){var dt=lt.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});F.on("mousemove.angular-guide",function(t,e){var r=o.util.getMousePos(Z).angle;dt.attr({x2:-b,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-h.orientation)%360;at=s.invert(n);var i=o.util.convertToCartesian(b+12,r+180);ut.text(o.util.round(at)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){lt.select("line").style({opacity:0})})}var pt=lt.select("circle").style({stroke:"grey",fill:"none"});F.on("mousemove.radial-guide",function(t,e){var r=o.util.getMousePos(Z).radius;pt.attr({r:r}).style({opacity:.5}),st=n.invert(o.util.getMousePos(Z).radius);var i=o.util.convertToCartesian(r,h.radialAxis.orientation);ht.text(o.util.round(st)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){pt.style({opacity:0}),ft.hide(),ut.hide(),ht.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,r){var n=i.select(this),a=n.style("fill"),s="black",l=n.style("opacity")||1;if(n.attr({"data-opacity":l}),"none"!=a){n.attr({"data-fill":a}),s=i.hsl(a).darker().toString(),n.style({fill:s,opacity:1});var c={t:o.util.round(t[0]),r:o.util.round(t[1])};M&&(c.t=k[t[0]]);var u="t: "+c.t+", r: "+c.r,h=this.getBoundingClientRect(),f=e.node().getBoundingClientRect(),d=[h.left+h.width/2-H[0]-f.left,h.top+h.height/2-H[1]-f.top];ft.config({color:s}).text(u),ft.move(d)}else a=n.style("stroke"),n.attr({"data-stroke":a}),s=i.hsl(a).darker().toString(),n.style({stroke:s,opacity:1})}).on("mousemove.tooltip",function(t,e){return 0!=i.event.which?!1:void(i.select(this).attr("data-fill")&&ft.show())}).on("mouseout.tooltip",function(t,e){ft.hide();var r=i.select(this),n=r.attr("data-fill");n?r.style({fill:n,opacity:r.attr("data-opacity")}):r.style({stroke:r.attr("data-stroke"),opacity:r.attr("data-opacity")})})}),f}var e,r,n,s,l={data:[],layout:{}},c={},u={},h=i.dispatch("hover"),f={};return f.render=function(e){return t(e),this},f.config=function(t){if(!arguments.length)return l;var e=o.util.cloneJson(t);return e.data.forEach(function(t,e){l.data[e]||(l.data[e]={}),a(l.data[e],o.Axis.defaultConfig().data[0]),a(l.data[e],t)}),a(l.layout,o.Axis.defaultConfig().layout),a(l.layout,e.layout),this},f.getLiveConfig=function(){return u},f.getinputConfig=function(){return c},f.radialScale=function(t){return n},f.angularScale=function(t){return s},f.svg=function(){return e},i.rebind(f,h,"on"),f},o.Axis.defaultConfig=function(t,e){var r={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:i.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 r},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 r in t)r in e&&(e[r]=t[r])},o.util._extend=function(t,e){for(var r in t)e[r]=t[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var r=e||6,n=i.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180,i=t(n);return[e,i]});return n},o.util.dataFromEquation=function(t,e,r){var n=e||6,o=[],a=[];i.range(0,360+n,n).forEach(function(e,r){var n=e*Math.PI/180,i=t(n);o.push(e),a.push(i)});var s={t:o,r:a};return r&&(s.name=r),s},o.util.ensureArray=function(t,e){if("undefined"==typeof t)return null;var r=[].concat(t);return i.range(e).map(function(t,e){return r[e]||r[0]})},o.util.fillArrays=function(t,e,r){return e.forEach(function(e,n){t[e]=o.util.ensureArray(t[e],r)}),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 r=e.shift();return t[r]&&(!e.length||objHasKeys(t[r],e))},o.util.sumArrays=function(t,e){return i.zip(t,e).map(function(t,e){return i.sum(t)})},o.util.arrayLast=function(t){return t[t.length-1]},o.util.arrayEqual=function(t,e){for(var r=Math.max(t.length,e.length,1);r-- >=0&&t[r]===e[r];);return-2===r},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,r){return r.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var r=e*Math.PI/180,n=t*Math.cos(r),i=t*Math.sin(r);return[n,i]},o.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},o.util.getMousePos=function(t){var e=i.mouse(t.node()),r=e[0],n=e[1],o={};return o.x=r,o.y=n,o.pos=e,o.angle=180*(Math.atan2(n,r)+Math.PI)/Math.PI,o.radius=Math.sqrt(r*r+n*n),o},o.util.duplicatesCount=function(t){for(var e,r={},n={},i=0,o=t.length;o>i;i++)e=t[i],e in r?(r[e]++,n[e]=r[e]):r[e]=1;return n},o.util.duplicates=function(t){return Object.keys(o.util.duplicatesCount(t))},o.util.translator=function(t,e,r,n){if(n){var i=r.slice();r=e,e=i}var o=e.reduce(function(t,e){return"undefined"!=typeof t?t[e]:void 0},t);"undefined"!=typeof o&&(e.reduce(function(t,r,n){return"undefined"!=typeof t?(n===e.length-1&&delete t[r],t[r]):void 0},t),r.reduce(function(t,e,n){return"undefined"==typeof t[e]&&(t[e]={}),n===r.length-1&&(t[e]=o),t[e]},t))},o.PolyChart=function(){function t(){var t=r[0].geometryConfig,e=t.container;"string"==typeof e&&(e=i.select(e)),e.datum(r).each(function(e,r){function n(e,r){var n=t.radialScale(e[1]),i=(t.angularScale(e[0])+t.orientation)*Math.PI/180;return{r:n,t:i}}function o(t){var e=t.r*Math.cos(t.t),r=t.r*Math.sin(t.t);return{x:e,y:r}}var a=!!e[0].data.yStack,l=e.map(function(t,e){return a?i.zip(t.data.t[0],t.data.r[0],t.data.yStack[0]):i.zip(t.data.t[0],t.data.r[0])}),c=t.angularScale,u=t.radialScale.domain()[0],h={};h.bar=function(r,n,o){var a=e[o].data,s=t.radialScale(r[1])-t.radialScale(0),l=t.radialScale(r[2]||0),u=a.barWidth;i.select(this).attr({"class":"mark bar",d:"M"+[[s+l,-u/2],[s+l,u/2],[l,u/2],[l,-u/2]].join("L")+"Z",transform:function(e,r){return"rotate("+(t.orientation+c(e[0]))+")"}})},h.dot=function(t,r,a){var s=t[2]?[t[0],t[1]+t[2]]:t,l=i.svg.symbol().size(e[a].data.dotSize).type(e[a].data.dotType)(t,r);i.select(this).attr({"class":"mark dot",d:l,transform:function(t,e){var r=o(n(s));return"translate("+[r.x,r.y]+")"}})};var f=i.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});h.line=function(r,n,o){var a=r[2]?l[o].map(function(t,e){return[t[0],t[1]+t[2]]}):l[o];if(i.select(this).each(h.dot).style({opacity:function(t,r){return+e[o].data.dotVisible},fill:v.stroke(r,n,o)}).attr({"class":"mark dot"}),!(n>0)){var s=i.select(this.parentNode).selectAll("path.line").data([0]);s.enter().insert("path"),s.attr({"class":"line",d:f(a),transform:function(e,r){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return v.fill(r,n,o)},"fill-opacity":0,stroke:function(t,e){return v.stroke(r,n,o)},"stroke-width":function(t,e){return v["stroke-width"](r,n,o)},"stroke-dasharray":function(t,e){return v["stroke-dasharray"](r,n,o)},opacity:function(t,e){return v.opacity(r,n,o)},display:function(t,e){return v.display(r,n,o)}})}};var d=t.angularScale.range(),p=Math.abs(d[1]-d[0])/l[0].length*Math.PI/180,g=i.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])});h.arc=function(e,r,n){i.select(this).attr({"class":"mark arc",d:g,transform:function(e,r){return"rotate("+(t.orientation+c(e[0])+90)+")"}})};var v={fill:function(t,r,n){return e[n].data.color},stroke:function(t,r,n){return e[n].data.strokeColor},"stroke-width":function(t,r,n){return e[n].data.strokeSize+"px"},"stroke-dasharray":function(t,r,n){return s[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return"undefined"==typeof e[n].data.visible||e[n].data.visible?"block":"none"}},m=i.select(this).selectAll("g.layer").data(l);m.enter().append("g").attr({"class":"layer"});var y=m.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({"class":"mark"}),y.style(v).each(h[t.geometryType]),y.exit().remove(),m.exit().remove()})}var e,r=[o.PolyChart.defaultConfig()],n=i.dispatch("hover"),s={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,e){r[e]||(r[e]={}),a(r[e],o.PolyChart.defaultConfig()),a(r[e],t)}),this):r},t.getColorScale=function(){return e},i.rebind(t,n,"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:i.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 r=e.legendConfig,n=e.data.map(function(t,e){return[].concat(t).map(function(t,n){var i=a({},r.elements[e]);return i.name=t,i.color=[].concat(r.elements[e].color)[n],i})}),o=i.merge(n);o=o.filter(function(t,e){return r.elements[e]&&(r.elements[e].visibleInLegend||"undefined"==typeof r.elements[e].visibleInLegend)}),r.reverseOrder&&(o=o.reverse());var s=r.container;("string"==typeof s||s.nodeName)&&(s=i.select(s));var l=o.map(function(t,e){return t.color}),c=r.fontSize,u=null==r.isContinuous?"number"==typeof o[0]:r.isContinuous,h=u?r.height:c*o.length,f=s.classed("legend-group",!0),d=f.selectAll("svg").data([0]),p=d.enter().append("svg").attr({width:300,height:h+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=i.range(o.length),v=i.scale[u?"linear":"ordinal"]().domain(g).range(l),m=i.scale[u?"linear":"ordinal"]().domain(g)[u?"range":"rangePoints"]([0,h]),y=function(t,e){var r=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":-1!=i.svg.symbolTypes.indexOf(t)?i.svg.symbol().type(t).size(r)():i.svg.symbol().type("square").size(r)()};if(u){var b=d.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(l);b.enter().append("stop"),b.attr({offset:function(t,e){return e/(l.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),d.append("rect").classed("legend-mark",!0).attr({height:r.height,width:r.colorBandWidth,fill:"url(#grad1)"})}else{var x=d.select(".legend-marks").selectAll("path.legend-mark").data(o);x.enter().append("path").classed("legend-mark",!0),x.attr({transform:function(t,e){return"translate("+[c/2,m(e)+c/2]+")"},d:function(t,e){var r=t.symbol;return y(r,c)},fill:function(t,e){return v(e)}}),x.exit().remove()}var _=i.svg.axis().scale(m).orient("right"),w=d.select("g.legend-axis").attr({transform:"translate("+[u?r.colorBandWidth:c,c/2]+")"}).call(_);return w.selectAll(".domain").style({fill:"none",stroke:"none"}),w.selectAll("line").style({fill:"none",stroke:u?r.textColor:"none"}),w.selectAll("text").style({fill:r.textColor,"font-size":r.fontSize}).text(function(t,e){return o[e].name}),t}var e=o.Legend.defaultConfig(),r=i.dispatch("hover");return t.config=function(t){return arguments.length?(a(e,t),this):e},i.rebind(t,r,"on"),t},o.Legend.defaultConfig=function(t,e){var r={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 r},o.tooltipPanel=function(){var t,e,r,n={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=10,c=function(){t=n.container.selectAll("g."+s).data([0]);var i=t.enter().append("g").classed(s,!0).style({"pointer-events":"none",display:"none"});return r=i.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),e=i.append("text").attr({dx:n.padding+l,dy:.3*+n.fontSize}),c};return c.text=function(o){var a=i.hsl(n.color).l,s=a>=.5?"#aaa":"white",u=a>=.5?"black":"white",h=o||"";e.style({fill:u,"font-size":n.fontSize+"px"}).text(h);var f=n.padding,d=e.node().getBBox(),p={fill:n.color,stroke:s,"stroke-width":"2px"},g=d.width+2*f+l,v=d.height+2*f;return r.attr({d:"M"+[[l,-v/2],[l,-v/4],[n.hasTick?0:l,0],[l,v/4],[l,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[l,-v/2+2*f]+")"}),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 a(n,t),c},c},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var t={};return t.convert=function(t,e){var r={};if(t.data&&(r.data=t.data.map(function(t,r){
var n=a({},t),i=[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]];return i.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",n.dotVisible===!0?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n}),!e&&t.layout&&"stack"===t.layout.barmode)){var n=o.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var i=n.indexOf(t.geometry);-1!=i&&(r.data[e].groupId=i)})}if(t.layout){var s=a({},t.layout),l=[[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]];if(l.forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e?("undefined"!=typeof s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&"undefined"!=typeof s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&"undefined"!=typeof s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&"undefined"!=typeof s.margin.t){var c=["t","r","b","l","pad"],u=["top","right","bottom","left","pad"],h={};i.entries(s.margin).forEach(function(t,e){h[u[c.indexOf(t.key)]]=t.value}),s.margin=h}e&&(delete s.needsEndSpacing,delete s.minorTickColor,delete s.minorTicks,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksCount,delete s.angularaxis.ticksStep,delete s.angularaxis.rewriteTicks,delete s.angularaxis.nticks,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksCount,delete s.radialaxis.ticksStep,delete s.radialaxis.rewriteTicks,delete s.radialaxis.nticks),r.layout=s}return r},t}},{"../../plotly":365,"./micropolar_manager":408,d3:70}],408:[function(t,e,r){"use strict";var n=t("../../plotly"),i=t("d3"),o=t("./undo_manager"),a=e.exports={},s=n.Lib.extendDeepAll;a.framework=function(t){function e(e,o){return o&&(h=o),i.select(i.select(h).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),r=r?s(r,e):e,c||(c=n.micropolar.Axis()),u=n.micropolar.adapter.plotly().convert(r),c.config(u).render(h),t.data=r.data,t.layout=r.layout,a.fillLayout(t),r}var r,l,c,u,h,f=new o;return e.isPolar=!0,e.svg=function(){return c.svg()},e.getConfig=function(){return r},e.getLiveConfig=function(){return n.micropolar.adapter.plotly().convert(c.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:c.angularScale(),r:c.radialScale()}},e.setUndoPoint=function(){var t=this,e=n.micropolar.util.cloneJson(r);!function(e,r){f.add({undo:function(){r&&t(r)},redo:function(){t(e)}})}(e,l),l=n.micropolar.util.cloneJson(e)},e.undo=function(){f.undo()},e.redo=function(){f.redo()},e},a.fillLayout=function(t){var e=i.select(t).selectAll(".plot-container"),r=e.selectAll(".svg-container"),o=t.framework&&t.framework.svg&&t.framework.svg(),a={width:800,height:600,paper_bgcolor:n.Color.background,_container:e,_paperdiv:r,_paper:o};t._fullLayout=s(a,t.layout)}},{"../../plotly":365,"./undo_manager":409,d3:70}],409:[function(t,e,r){"use strict";e.exports=function(){function t(t,e){return t?(i=!0,t[e](),i=!1,this):this}var e,r=[],n=-1,i=!1;return{add:function(t){return i?this:(r.splice(n+1,r.length-n),r.push(t),n=r.length-1,this)},setCallback:function(t){e=t},undo:function(){var i=r[n];return i?(t(i,"undo"),n-=1,e&&e(i.undo),this):this},redo:function(){var i=r[n+1];return i?(t(i,"redo"),n+=1,e&&e(i.redo),this):this},clear:function(){r=[],n=-1},hasUndo:function(){return-1!==n},hasRedo:function(){return n<r.length-1},getCommands:function(){return r},getPreviousCommand:function(){return r[n-1]},getIndex:function(){return n}}}},{}],410:[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,c=t.layout,u=s([],l),h=s({},c,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;r<f.length;r++)i(f[r])&&(h[f[r]].title="");for(r=0;r<u.length;r++){var d=u[r];d.showscale=!1,d.marker&&(d.marker.showscale=!1),"pie"===d.type&&(d.textposition="none")}}if(Array.isArray(e.annotations))for(r=0;r<e.annotations.length;r++)h.annotations.push(e.annotations[r]);var p=o.Plots.getSubplotIds(h,"gl3d");if(p.length){var g={};for("thumbnail"===e.tileClass&&(g={title:"",showaxeslabels:!1,showticklabels:!1,linetickenable:!1}),r=0;r<p.length;r++){var v=p[r];a(h[v].xaxis,g),a(h[v].yaxis,g),a(h[v].zaxis,g),h[v]._scene=null}}var m=document.createElement("div");e.tileClass&&(m.className=e.tileClass);var y={td:m,layout:h,data:u,config:{staticPlot:void 0===e.staticPlot?!0:e.staticPlot,plotGlPixelRatio:void 0===e.plotGlPixelRatio?2:e.plotGlPixelRatio,displaylogo:e.displaylogo||!1,showLink:e.showLink||!1,showTips:e.showTips||!1}};return"transparent"!==e.setBackground&&(y.config.setBackground=e.setBackground||"opaque"),y.td.defaultLayout=n(e.tileClass),y}},{"../plotly":365}],411:[function(t,e,r){"use strict";function n(t){return t._hasGL3D||t._hasGL2D?500:0}function i(t){return function(){var e=t._fullLayout;e._hasGL3D||e._hasGL2D||t.data&&t.data[0]&&t.data[0].r||(o.Annotations.drawAll(t),o.Legend.draw(t,e.showlegend),(t.calcdata||[]).forEach(function(t){t[0]&&t[0].t&&t[0].t.cb&&t[0].t.cb()}))}}var o=t("../plotly"),a={getDelay:n,getRedrawFunc:i,clone:t("./cloneplot"),toSVG:t("./tosvg"),svgToImg:t("./svgtoimg"),toImage:t("./toimage")};e.exports=a},{"../plotly":365,"./cloneplot":410,"./svgtoimg":412,"./toimage":413,"./tosvg":414}],412:[function(t,e,r){"use strict";function n(t){var e=t.emitter?t.emitter:new i,r=window.Image,n=window.Blob,o=t.svg,a=t.format||"png",s=t.canvas,l=s.getContext("2d"),c=new r,u=window.URL||window.webkitURL,h=new n([o],{type:"image/svg+xml;charset=utf-8"}),f=u.createObjectURL(h);return s.height=t.height||150,s.width=t.width||300,c.onload=function(){var t;switch(u.revokeObjectURL(f),l.drawImage(c,0,0),a){case"jpeg":t=s.toDataURL("image/jpeg");break;case"png":t=s.toDataURL("image/png");break;case"webp":t=s.toDataURL("image/webp");break;case"svg":t=o;break;default:return e.emit("error","Image format is not jpeg, png or svg")}e.emit("success",t)},c.onerror=function(t){return u.revokeObjectURL(f),e.emit("error",t)},c.src=f,e}var i=t("events").EventEmitter;e.exports=n},{events:54}],413:[function(t,e,r){"use strict";function n(t,e){function r(){var t=n.getDelay(l._fullLayout);setTimeout(function(){var t=o.Snapshot.toSVG(l),r=window.document.createElement("div"),n=window.document.createElement("canvas");r.appendChild(n),r.id=o.Lib.randstr(),n.id=o.Lib.randstr(),a=o.Snapshot.svgToImg({format:e.format,width:l._fullLayout.width,height:l._fullLayout.height,canvas:n,emitter:a,svg:t}),a.clean=function(){l&&l.remove()}},t)}var n=o.Snapshot,a=new i,s=n.clone(t,{format:"png"}),l=s.td;l.style.position="absolute",l.style.left="-5000px",document.body.appendChild(l);var c=n.getRedrawFunc(l);return o.plot(l,s.data,s.layout,s.config).then(c).then(r).catch(function(t){a.emit("error",t)}),a}var i=t("events").EventEmitter,o=t("../plotly");e.exports=n},{"../plotly":365,events:54}],414:[function(t,e,r){"use strict";function n(t,e,r){var n=e.toImage("png");t._glimages.append("svg:image").attr({xmlns:a.svg,"xlink:href":n,x:r.x,y:r.y,width:r.width,height:r.height,preserveAspectRatio:"none"}),e.destroy()}var i=t("../plotly"),o=t("d3"),a=t("../constants/xmlns_namespaces");e.exports=function(t,e){var r,s,l=t._fullLayout,c=l._paper,u=l._size;c.insert("rect",":first-child").call(i.Drawing.setRect,0,0,l.width,l.height).call(i.Color.fill,l.paper_bgcolor);var h,f=i.Plots.getSubplotIds(l,"gl3d");for(s=0;s<f.length;s++)h=l[f[s]],r=h.domain,n(l,h._scene,{x:u.l+u.w*r.x[0],y:u.t+u.h*(1-r.y[1]),width:u.w*(r.x[1]-r.x[0]),height:u.h*(r.y[1]-r.y[0])});var d,p=i.Plots.getSubplotIds(l,"gl2d");for(s=0;s<p.length;s++)d=l._plots[p[s]],n(l,d._scene2d,{x:u.l,y:u.t,width:u.w,height:u.h});var g,v,m=i.Plots.getSubplotIds(l,"geo");for(s=0;s<m.length;s++)g=l[m[s]],r=g.domain,v=g._geo.framework,v.attr("style",null),v.attr({x:u.l+u.w*r.x[0]+g._marginX,y:u.t+u.h*(1-r.y[1])+g._marginY,width:g._width,height:g._height}),l._geoimages.node().appendChild(v.node());if(l._toppaper){var y,b=l._toppaper.node().childNodes;for(s=0;s<b.length;s++)y=b[s],y.childNodes.length&&c.node().appendChild(y)}c.node().style.background="",c.selectAll("text").attr({"data-unformatted":null}).each(function(){var t=o.select(this);if("hidden"===t.style("visibility"))return void t.remove();var e=t.style("font-family");e&&-1!==e.indexOf('"')&&t.style("font-family",e.replace(/"/g,"\\'"))}),("pdf"===e||"eps"===e)&&c.selectAll("#MathJax_SVG_glyphs path").attr("stroke-width",0),c.node().setAttributeNS(a.xmlns,"xmlns",a.svg),c.node().setAttributeNS(a.xmlns,"xmlns:xlink",a.xlink);var x=(new window.XMLSerializer).serializeToString(c.node());return x=i.util.html_entity_decode(x),x=i.util.xml_entity_encode(x)}},{"../constants/xmlns_namespaces":337,"../plotly":365,d3:70}],415:[function(t,e,r){"use strict";var n=t("../../lib").mergeArray;e.exports=function(t){var e=t[0].trace,r=e.marker,i=r.line;n(e.text,t,"tx"),n(r.opacity,t,"mo"),n(r.color,t,"mc"),n(i.color,t,"mlc"),n(i.width,t,"mlw")}},{"../../lib":348}],416:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=n.marker,o=i.line;e.exports={x:n.x,x0:n.x0,dx:n.dx,y:n.y,y0:n.y0,dy:n.dy,text:n.text,orientation:{valType:"enumerated",values:["v","h"],description:["Sets the orientation of the bars.","With *v* (*h*), the value of the each bar spans","along the vertical (horizontal)."].join(" ")},marker:{color:i.color,colorscale:i.colorscale,cauto:i.cauto,cmax:i.cmax,cmin:i.cmin,autocolorscale:i.autocolorscale,reversescale:i.reversescale,showscale:i.showscale,line:{color:o.color,colorscale:o.colorscale,cauto:o.cauto,cmax:o.cmax,cmin:o.cmin,width:o.width,autocolorscale:o.autocolorscale,reversescale:o.reversescale}},r:n.r,t:n.t,_nestedModules:{error_y:"ErrorBars",error_x:"ErrorBars","marker.colorbar":"Colorbar"},_deprecated:{bardir:{valType:"enumerated",values:["v","h"]}}}},{"../scatter/attributes":493}],417:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plotly"),o=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/calc");e.exports=function(t,e){var r,s,l,c=i.Axes.getFromId(t,e.xaxis||"x"),u=i.Axes.getFromId(t,e.yaxis||"y"),h=e.orientation||(e.x&&!e.y?"h":"v");"h"===h?(s=c.makeCalcdata(e,"x"),r=u.makeCalcdata(e,"y")):(s=u.makeCalcdata(e,"y"),r=c.makeCalcdata(e,"x"));var f=Math.min(r.length,s.length),d=[];for(l=0;f>l;l++)n(r[l])&&n(s[l])&&d.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"),d}},{"../../components/colorscale/calc":306,"../../components/colorscale/has_colorscale":311,"../../plotly":365,"fast-isnumeric":74}],418:[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,c){function u(r,i){return n.coerce(t,e,l,r,i)}var h=o(t,e,u);return h?(u("orientation",e.x&&!e.y?"h":"v"),u("text"),a(t,e,u,r,c),s(t,e,i.defaultLine,{axis:"y"}),void s(t,e,i.defaultLine,{axis:"x",inherit:"y"})):void(e.visible=!1)}},{"../../components/color":299,"../../components/errorbars/defaults":322,"../../lib":348,"../bar/style_defaults":426,"../scatter/xy_defaults":513,"./attributes":416}],419:[function(t,e,r){"use strict";var n=t("../../plotly"),i=t("../../components/color");e.exports=function(t,e,r,o){var a,s=t.cd,l=s[0].trace,c=s[0].t,u=t.xa,h=t.ya,f="closest"===o?c.barwidth/2:c.dbar*(1-u._td._fullLayout.bargap)/2;a="closest"!==o?function(t){return t.p}:"h"===l.orientation?function(t){return t.y}:function(t){return t.x};var d,p;"h"===l.orientation?(d=function(t){return n.Fx.inbox(t.b-e,t.x-e)+(t.x-e)/(t.x-t.b)},p=function(t){var e=a(t)-r;return n.Fx.inbox(e-f,e+f)}):(p=function(t){return n.Fx.inbox(t.b-r,t.y-r)+(t.y-r)/(t.y-t.b)},d=function(t){var r=a(t)-e;return n.Fx.inbox(r-f,r+f)});var g=n.Fx.getDistanceFunction(o,d,p);if(n.Fx.getClosest(s,g,t),t.index!==!1){var v=s[t.index],m=v.mcc||l.marker.color,y=v.mlcc||l.marker.line.color,b=v.mlw||l.marker.line.width;return i.opacity(m)?t.color=m:i.opacity(y)&&b&&(t.color=y),"h"===l.orientation?(t.x0=t.x1=u.c2p(v.x,!0),t.xLabelVal=v.s,t.y0=h.c2p(a(v)-f,!0),t.y1=h.c2p(a(v)+f,!0),t.yLabelVal=v.p):(t.y0=t.y1=h.c2p(v.y,!0),t.yLabelVal=v.s,t.x0=u.c2p(a(v)-f,!0),t.x1=u.c2p(a(v)+f,!0),t.xLabelVal=v.p),v.tx&&(t.text=v.tx),n.ErrorBars.hoverInfo(v,l,t),[t]}}},{"../../components/color":299,"../../plotly":365}],420:[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={description:["The data visualized by the span of the bars is set in `y`","if `orientation` is set th *v* (the default)","and the labels are set in `x`.","By setting `orientation` to *h*, the roles are interchanged."].join(" ")},e.exports=n},{"../../plots/cartesian":371,"../scatter/colorbar":496,"./arrays_to_calcdata":415,"./attributes":416,"./calc":417,"./defaults":418,"./hover":419,"./layout_attributes":421,"./layout_defaults":422,"./plot":423,"./set_positions":424,"./style":425}],421:[function(t,e,r){"use strict";e.exports={barmode:{valType:"enumerated",values:["stack","group","overlay"],dflt:"group",description:["Determines how bars at the same location coordinate","are displayed on the graph.","With *stack*, the bars are stacked on top of one another","With *group*, the bars are plotted next to one another","centered around the shared location.","With *overlay*, the bars are plotted over one another,","you might need to an *opacity* to see multiple bars."].join(" ")},barnorm:{valType:"enumerated",values:["","fraction","percent"],dflt:"",description:["Sets the normalization for bar traces on the graph.","With *fraction*, the value of each bar is divide by the sum of the","values at the location coordinate.","With *percent*, the results form *fraction* are presented in percents."].join(" ")},bargap:{valType:"number",min:0,max:1,description:["Sets the gap (in plot fraction) between bars of","adjacent location coordinates."].join(" ")},bargroupgap:{valType:"number",min:0,max:1,dflt:0,description:["Sets the gap (in plot fraction) between bars of","the same location coordinate."].join(" ")}}},{}],422:[function(t,e,r){"use strict";var n=t("../../plotly"),i=t("../../lib"),o=t("./layout_attributes");e.exports=function(t,e,r){function a(r,n){return i.coerce(t,e,o,r,n)}var s,l,c,u=!1,h=!1,f=!1,d={};for(s=0;s<r.length;s++)if(l=r[s],n.Plots.traceIs(l,"bar")&&(u=!0,"overlay"!==t.barmode&&"stack"!==t.barmode&&(c=l.xaxis+l.yaxis,d[c]&&(f=!0),d[c]=!0),l.visible&&"histogram"===l.type)){var p=n.Axes.getFromId({_fullLayout:e},l["v"===l.orientation?"xaxis":"yaxis"]);"category"!==p.type&&(h=!0)}if(u){var g=a("barmode");"overlay"!==g&&a("barnorm"),a("bargap",h&&!f?0:.2),a("bargroupgap")}}},{"../../lib":348,"../../plotly":365,"./layout_attributes":421}],423:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),o=t("../../lib"),a=t("../../components/color"),s=t("./arrays_to_calcdata");e.exports=function(t,e,r){var l=e.x(),c=e.y(),u=t._fullLayout,h=e.plot.select(".barlayer").selectAll("g.trace.bars").data(r).enter().append("g").attr("class","trace bars");h.append("g").attr("class","points").each(function(e){var r=e[0].t,h=e[0].trace;s(e),n.select(this).selectAll("path").data(o.identity).enter().append("path").each(function(e){function o(t){return 0===u.bargap&&0===u.bargroupgap?n.round(Math.round(t)-m,2):t}function s(t,e){return Math.abs(t-e)>=2?o(t):t>e?Math.ceil(t):Math.floor(t)}var f,d,p,g;if("h"===h.orientation?(p=c.c2p(r.poffset+e.p,!0),g=c.c2p(r.poffset+e.p+r.barwidth,!0),f=l.c2p(e.b,!0),d=l.c2p(e.s+e.b,!0)):(f=l.c2p(r.poffset+e.p,!0),d=l.c2p(r.poffset+e.p+r.barwidth,!0),g=c.c2p(e.s+e.b,!0),p=c.c2p(e.b,!0)),!(i(f)&&i(d)&&i(p)&&i(g)&&f!==d&&p!==g))return void n.select(this).remove();var v=(e.mlw+1||h.marker.line.width+1||(e.trace?e.trace.marker.line.width:0)+1)-1,m=n.round(v/2%1,2);if(!t._context.staticPlot){var y=a.opacity(e.mc||h.marker.color),b=1>y||v>.01?o:s;f=b(f,d),d=b(d,f),p=b(p,g),g=b(g,p)}n.select(this).attr("d","M"+f+","+p+"V"+g+"H"+d+"V"+p+"Z")})})}},{"../../components/color":299,"../../lib":348,"./arrays_to_calcdata":415,d3:70,"fast-isnumeric":74}],424:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plotly"),o=t("../../lib");e.exports=function(t,e){var r,a,s=t._fullLayout,l=e.x(),c=e.y();["v","h"].forEach(function(u){function h(e){function r(t){t[d]=t.p+p}var n=[];e.forEach(function(e){t.calcdata[e].forEach(function(t){n.push(t.p)})});var a=o.distinctVals(n),l=a.vals,c=a.minDiff,u=!1,h=[];"group"===s.barmode&&e.forEach(function(e){u||(t.calcdata[e].forEach(function(t){u||h.forEach(function(e){Math.abs(t.p-e)<c&&(u=!0)})}),u||t.calcdata[e].forEach(function(t){h.push(t.p)}))}),i.Axes.minDtick(g,c,l[0],u),i.Axes.expand(g,l,{vpad:c/2}),c*=1-s.bargap,u&&(c/=f.length);for(var p,v=0;v<e.length;v++){var m=t.calcdata[e[v]][0].t;m.barwidth=c*(1-s.bargroupgap),m.poffset=((u?(2*v+1-e.length)*c:0)-m.barwidth)/2,m.dbar=a.minDiff,p=m.poffset+m.barwidth/2,t.calcdata[e[v]].forEach(r)}}var f=[],d={v:"x",h:"y"}[u],p={v:"y",h:"x"}[u],g=e[d](),v=e[p]();if(t._fullData.forEach(function(t,e){t.visible===!0&&i.Plots.traceIs(t,"bar")&&t.orientation===u&&t.xaxis===l._id&&t.yaxis===c._id&&f.push(e)}),f.length){"overlay"===s.barmode?f.forEach(function(t){h([t])}):h(f);var m="stack"===s.barmode,y=s.barnorm;if(m||y){var b,x,_,w=v.l2c(v.c2l(0)),k=w,A={},M=t.calcdata[f[0]][0].t.barwidth/100,T=0,E=!0;for(r=0;r<f.length;r++)for(x=t.calcdata[f[r]],a=0;a<x.length;a++){T=Math.round(x[a].p/M);var L=A[T]||0;m&&(x[a].b=L),b=x[a].b+x[a].s,A[T]=L+x[a].s,m&&(x[a][p]=b,!y&&n(v.c2l(b))&&(w=Math.max(w,b),k=Math.min(k,b)))}if(y){E=!1;var S="fraction"===y?1:100,C=S/1e9;for(k=0,w=m?S:0,r=0;r<f.length;r++)for(x=t.calcdata[f[r]],a=0;a<x.length;a++)_=S/A[Math.round(x[a].p/M)],x[a].b*=_,x[a].s*=_,b=x[a].b+x[a].s,x[a][p]=b,n(v.c2l(b))&&(k-C>b&&(E=!0,k=b),b>w+C&&(E=!0,w=b))}i.Axes.expand(v,[k,w],{tozero:!0,padded:E})}else{var z=function(t){return t[p]=t.s,t.s};for(r=0;r<f.length;r++)i.Axes.expand(v,t.calcdata[f[r]].map(z),{tozero:!0,padded:!0})}}})}},{"../../lib":348,"../../plotly":365,"fast-isnumeric":74}],425:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../plotly"),o=t("../../components/color");e.exports=function(t){var e=n.select(t).selectAll("g.trace.bars"),r=e.size(),a=t._fullLayout;e.style("opacity",function(t){return t[0].trace.opacity}).each(function(t){("stack"===a.barmode&&r>1||0===a.bargap&&0===a.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=i.Drawing.tryColorscale(r,s,""),c=i.Drawing.tryColorscale(r,s,"line.");n.select(this).selectAll("path").each(function(t){var e,i,s=(t.mlw+1||a.width+1)-1,u=n.select(this);e="mc"in t?t.mcc=l(t.mc):Array.isArray(r.color)?o.defaultLine:r.color,u.style("stroke-width",s+"px").call(o.fill,e),s&&(i="mlc"in t?t.mlcc=c(t.mlc):Array.isArray(a.color)?o.defaultLine:a.color,u.call(o.stroke,i))})})}},{"../../components/color":299,"../../plotly":365,d3:70}],426:[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":299,"../../components/colorscale/defaults":308,"../../components/colorscale/has_colorscale":311}],427:[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",description:["Sets the y sample data or coordinates.","See overview for more info."].join(" ")},x:{valType:"data_array",description:["Sets the x sample data or coordinates.","See overview for more info."].join(" ")},x0:{valType:"any",description:["Sets the x coordinate of the box.","See overview for more info."].join(" ")},y0:{valType:"any",description:["Sets the y coordinate of the box.","See overview for more info."].join(" ")},whiskerwidth:{valType:"number",min:0,max:1,dflt:.5,description:["Sets the width of the whiskers relative to","the box' width.","For example, with 1, the whiskers are as wide as the box(es)."].join(" ")},boxpoints:{valType:"enumerated",values:["all","outliers","suspectedoutliers",!1],dflt:"outliers",description:["If *outliers*, only the sample points lying outside the whiskers","are shown","If *suspectedoutliers*, the outlier points are shown and","points either less than 4*Q1-3*Q3 or greater than 4*Q3-3*Q1","are highlighted (see `outliercolor`)","If *all*, all sample points are shown","If *false*, only the box(es) are shown with no sample points"].join(" ")},boxmean:{valType:"enumerated",values:[!0,"sd",!1],dflt:!1,description:["If *true*, the mean of the box(es)' underlying distribution is","drawn as a dashed line inside the box(es).","If *sd* the standard deviation is also drawn."].join(" ")},jitter:{valType:"number",min:0,max:1,description:["Sets the amount of jitter in the sample points drawn.","If *0*, the sample points align along the distribution axis.","If *1*, the sample points are drawn in a random jitter of width","equal to the width of the box(es)."].join(" ")},pointpos:{valType:"number",min:-2,max:2,description:["Sets the position of the sample points in relation to the box(es).","If *0*, the sample points are places over the center of the box(es).","Positive (negative) values correspond to positions to the","right (left) for vertical boxes and above (below) for horizontal boxes"].join(" ")},orientation:{valType:"enumerated",values:["v","h"],description:["Sets the orientation of the box(es).","If *v* (*h*), the distribution is visualized along","the vertical (horizontal)."].join(" ")},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",description:["Sets the border line color of the outlier sample points.","Defaults to marker.color"].join(" ")},outlierwidth:{valType:"number",min:0,dflt:1,description:["Sets the border line width (in px) of the outlier sample points."].join(" ")}}},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2}},fillcolor:n.fillcolor}},{"../../components/color/attributes":298,"../../lib/extend":344,"../scatter/attributes":493}],428:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plotly"),o=t("../../lib");e.exports=function(t,e){function r(t,e,r,i,a){var s;return r in e?p=i.makeCalcdata(e,r):(s=r+"0"in e?e[r+"0"]:"name"in e&&("category"===i.type||n(e.name)&&-1!==["linear","log"].indexOf(i.type)||o.isDateTime(e.name)&&"date"===i.type)?e.name:t.numboxes,s=i.d2c(s),p=a.map(function(){return s})),p}function a(t,e,r,i,a){var s,l,c,u,h=i.length,f=e.length,d=[],p=[];for(s=0;h>s;++s)l=i[s],t[s]={pos:l},p[s]=l-a,d[s]=[];for(p.push(i[h-1]+a),s=0;f>s;++s)u=e[s],n(u)&&(c=o.findBin(r[s],p),c>=0&&f>c&&d[c].push(u));return d}function s(t,e){var r,n,i,a;for(a=0;a<e.length;++a)r=e[a].sort(o.sorterAsc),n=r.length,i=t[a],i.val=r,i.min=r[0],i.max=r[n-1],i.mean=o.mean(r,n),i.sd=o.stdev(r,n,i.mean),i.q1=o.interp(r,.25),i.med=o.interp(r,.5),i.q3=o.interp(r,.75),i.lf=Math.min(i.q1,r[Math.min(o.findBin(2.5*i.q1-1.5*i.q3,r,!0)+1,n-1)]),i.uf=Math.max(i.q3,r[Math.max(o.findBin(2.5*i.q3-1.5*i.q1,r),0)]),i.lo=4*i.q1-3*i.q3,i.uo=4*i.q3-3*i.q1}var l,c,u,h,f,d,p,g,v,m=i.Axes.getFromId(t,e.xaxis||"x"),y=i.Axes.getFromId(t,e.yaxis||"y"),b=e.orientation,x=[];"h"===b?(l=m,c="x",f=y,d="y"):(l=y,c="y",f=m,d="x"),u=l.makeCalcdata(e,c),i.Axes.expand(l,u,{padded:!0}),p=r(t,e,d,f,u);var _=o.distinctVals(p);return g=_.vals,v=_.minDiff/2,h=a(x,u,p,g,v),s(x,h),x=x.filter(function(t){return t.val&&t.val.length}),x.length?(x[0].t={boxnum:t.numboxes,dPos:v},t.numboxes++,x):[{t:{emptybox:!0}}]}},{"../../lib":348,"../../plotly":365,"fast-isnumeric":74}],429:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/color"),o=t("./attributes");e.exports=function(t,e,r){function a(r,i){return n.coerce(t,e,o,r,i)}var s,l=a("y"),c=a("x");if(l&&l.length)s="v",c||a("x0");else{if(!c||!c.length)return void(e.visible=!1);s="h",a("y0")}a("orientation",s),a("line.color",(t.marker||{}).color||r),a("line.width",2),a("fillcolor",i.addOpacity(e.line.color,.5)),a("whiskerwidth"),a("boxmean");var u=n.coerce2(t,e,o,"marker.outliercolor"),h=a("marker.line.outliercolor"),f=u||h?a("boxpoints","suspectedoutliers"):a("boxpoints");f&&(a("jitter","all"===f?.3:0),a("pointpos","all"===f?-1.5:0),a("marker.symbol"),a("marker.opacity"),a("marker.size"),a("marker.color",e.line.color),a("marker.line.color"),a("marker.line.width"),"suspectedoutliers"===f&&(a("marker.line.outliercolor",e.marker.color),a("marker.line.outlierwidth")))}},{"../../components/color":299,"../../lib":348,"./attributes":427}],430:[function(t,e,r){"use strict";var n=t("../../plotly"),i=t("../../components/color");e.exports=function(t,e,r,o){var a,s,l,c,u,h,f,d,p,g=t.cd,v=g[0].trace,m=g[0].t,y=t.xa,b=t.ya,x=[];if(c="closest"===o?2.5*m.bdPos:m.bdPos,"h"===v.orientation?(a=function(t){return n.Fx.inbox(t.min-e,t.max-e)},s=function(t){var e=t.pos+m.bPos-r;return n.Fx.inbox(e-c,e+c)},u="y",h=b,d="x",p=y):(a=function(t){var r=t.pos+m.bPos-e;return n.Fx.inbox(r-c,r+c)},s=function(t){return n.Fx.inbox(t.min-r,t.max-r)},u="x",h=y,d="y",p=b),l=n.Fx.getDistanceFunction(o,a,s),n.Fx.getClosest(g,l,t),t.index!==!1){var _=g[t.index],w=v.line.color,k=(v.marker||{}).color;i.opacity(w)&&v.line.width?t.color=w:i.opacity(k)&&v.boxpoints?t.color=k:t.color=v.fillcolor,t[u+"0"]=h.c2p(_.pos+m.bPos-m.bdPos,!0),t[u+"1"]=h.c2p(_.pos+m.bPos+m.bdPos,!0),n.Axes.tickText(h,h.c2l(_.pos),"hover").text,t[u+"LabelVal"]=_.pos;var A,M,T={},E=["med","min","q1","q3","max"];v.boxmean&&E.push("mean"),v.boxpoints&&[].push.apply(E,["lf","uf"]);for(var L=0;L<E.length;L++)A=E[L],A in _&&!(_[A]in T)&&(T[_[A]]=!0,f=p.c2p(_[A],!0),M=n.Lib.extendFlat({},t),M[d+"0"]=M[d+"1"]=f,M[d+"LabelVal"]=_[A],M.attr=A,"mean"===A&&"sd"in _&&"sd"===v.boxmean&&(M[d+"err"]=_.sd),t.name="",x.push(M));return x}}},{"../../components/color":299,"../../plotly":365}],431:[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.plot=t("./plot"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.moduleType="trace",n.name="box",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","symbols","oriented","box","showLegend"],n.meta={description:["In vertical (horizontal) box plots,","statistics are computed using `y` (`x`) values.","By supplying an `x` (`y`) array, one box per distinct x (y) value","is drawn","If no `x` (`y`) {array} is provided, a single box is drawn.","That box position is then positioned with","with `name` or with `x0` (`y0`) if provided.","Each box spans from quartile 1 (Q1) to quartile 3 (Q3).","The second quartile (Q2) is marked by a line inside the box.","By default, the whiskers correspond to the box' edges","+/- 1.5 times the interquartile range (IQR = Q3-Q1),","see *boxpoints* for other options."].join(" ")},e.exports=n},{"../../plots/cartesian":371,"./attributes":427,"./calc":428,"./defaults":429,"./hover":430,"./layout_attributes":432,"./layout_defaults":433,"./plot":434,"./set_positions":435,"./style":436}],432:[function(t,e,r){"use strict";e.exports={boxmode:{valType:"enumerated",values:["group","overlay"],dflt:"overlay",description:["Determines how boxes at the same location coordinate","are displayed on the graph.","If *group*, the boxes are plotted next to one another","centered around the shared location.","If *overlay*, the boxes are plotted over one another,","you might need to set *opacity* to see them multiple boxes."].join(" ")},boxgap:{valType:"number",min:0,max:1,dflt:.3,description:["Sets the gap (in plot fraction) between boxes of","adjacent location coordinates."].join(" ")},boxgroupgap:{valType:"number",min:0,max:1,dflt:.3,description:["Sets the gap (in plot fraction) between boxes of","the same location coordinate."].join(" ")}}},{}],433:[function(t,e,r){
"use strict";var n=t("../../plots/plots"),i=t("../../lib"),o=t("./layout_attributes");e.exports=function(t,e,r){function a(r,n){return i.coerce(t,e,o,r,n)}for(var s,l=0;l<r.length;l++)if(n.traceIs(r[l],"box")){s=!0;break}s&&(a("boxmode"),a("boxgap"),a("boxgroupgap"))}},{"../../lib":348,"../../plots/plots":404,"./layout_attributes":432}],434:[function(t,e,r){"use strict";function n(){l=2e9}function i(){var t=l;return l=(69069*l+1)%4294967296,Math.abs(l-t)<429496729?i():l/4294967296}var o=t("d3"),a=t("../../plotly"),s=t("../../lib"),l=2e9,c=5,u=.01;e.exports=function(t,e,r){var l,h,f=t._fullLayout,d=e.x(),p=e.y(),g=e.plot.select(".boxlayer").selectAll("g.trace.boxes").data(r).enter().append("g").attr("class","trace boxes");g.each(function(e){var r=e[0].t,g=e[0].trace,v="group"===f.boxmode&&t.numboxes>1,m=r.dPos*(1-f.boxgap)*(1-f.boxgroupgap)/(v?t.numboxes:1),y=v?2*r.dPos*(-.5+(r.boxnum+.5)/t.numboxes)*(1-f.boxgap):0,b=m*g.whiskerwidth;return g.visible!==!0||r.emptybox?void o.select(this).remove():("h"===g.orientation?(l=p,h=d):(l=d,h=p),r.bPos=y,r.bdPos=m,n(),o.select(this).selectAll("path.box").data(s.identity).enter().append("path").attr("class","box").each(function(t){var e=l.c2p(t.pos+y,!0),r=l.c2p(t.pos+y-m,!0),n=l.c2p(t.pos+y+m,!0),i=l.c2p(t.pos+y-b,!0),a=l.c2p(t.pos+y+b,!0),c=h.c2p(t.q1,!0),u=h.c2p(t.q3,!0),f=s.constrain(h.c2p(t.med,!0),Math.min(c,u)+1,Math.max(c,u)-1),d=h.c2p(g.boxpoints===!1?t.min:t.lf,!0),p=h.c2p(g.boxpoints===!1?t.max:t.uf,!0);"h"===g.orientation?o.select(this).attr("d","M"+f+","+r+"V"+n+"M"+c+","+r+"V"+n+"H"+u+"V"+r+"ZM"+c+","+e+"H"+d+"M"+u+","+e+"H"+p+(0===g.whiskerwidth?"":"M"+d+","+i+"V"+a+"M"+p+","+i+"V"+a)):o.select(this).attr("d","M"+r+","+f+"H"+n+"M"+r+","+c+"H"+n+"V"+u+"H"+r+"ZM"+e+","+c+"V"+d+"M"+e+","+u+"V"+p+(0===g.whiskerwidth?"":"M"+i+","+d+"H"+a+"M"+i+","+p+"H"+a))}),g.boxpoints&&o.select(this).selectAll("g.points").data(function(t){return t.forEach(function(t){t.t=r,t.trace=g}),t}).enter().append("g").attr("class","points").selectAll("path").data(function(t){var e,r,n,o,a,l,h,f="all"===g.boxpoints?t.val:t.val.filter(function(e){return e<t.lf||e>t.uf}),d=(t.q3-t.q1)*u,p=[],v=0;if(g.jitter){for(e=0;e<f.length;e++)r=Math.max(0,e-c),o=f[r],n=Math.min(f.length-1,e+c),a=f[n],"all"!==g.boxpoints&&(f[e]<t.lf?a=Math.min(a,t.lf):o=Math.max(o,t.uf)),l=Math.sqrt(d*(n-r)/(a-o))||0,l=s.constrain(Math.abs(l),0,1),p.push(l),v=Math.max(l,v);h=2*g.jitter/v}return f.map(function(e,r){var n,o=g.pointpos;return g.jitter&&(o+=h*p[r]*(i()-.5)),n="h"===g.orientation?{y:t.pos+o*m+y,x:e}:{x:t.pos+o*m+y,y:e},"suspectedoutliers"===g.boxpoints&&e<t.uo&&e>t.lo&&(n.so=!0),n})}).enter().append("path").call(a.Drawing.translatePoints,d,p),void(g.boxmean&&o.select(this).selectAll("path.mean").data(s.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-m,!0),n=l.c2p(t.pos+y+m,!0),i=h.c2p(t.mean,!0),a=h.c2p(t.mean-t.sd,!0),s=h.c2p(t.mean+t.sd,!0);"h"===g.orientation?o.select(this).attr("d","M"+i+","+r+"V"+n+("sd"!==g.boxmean?"":"m0,0L"+a+","+e+"L"+i+","+r+"L"+s+","+e+"Z")):o.select(this).attr("d","M"+r+","+i+"H"+n+("sd"!==g.boxmean?"":"m0,0L"+e+","+a+"L"+r+","+i+"L"+e+","+s+"Z"))})))})}},{"../../lib":348,"../../plotly":365,d3:70}],435:[function(t,e,r){"use strict";var n=t("../../plotly"),i=t("../../plots/plots"),o=t("../../lib");e.exports=function(t,e){var r,a,s,l,c=t._fullLayout,u=e.x(),h=e.y(),f=["v","h"];for(a=0;a<f.length;++a){var d,p,g,v=f[a],m=[],y=[],b=0,x=0;for(r="h"===v?h:u,s=0;s<t.calcdata.length;++s)d=t.calcdata[s],p=d[0].t,g=d[0].trace,g.visible===!0&&i.traceIs(g,"box")&&!p.emptybox&&g.orientation===v&&g.xaxis===u._id&&g.yaxis===h._id&&(m.push(s),g.boxpoints!==!1&&(b=Math.max(b,g.jitter-g.pointpos-1),x=Math.max(x,g.jitter+g.pointpos-1)));for(s=0;s<m.length;s++)for(d=t.calcdata[m[s]],l=0;l<d.length;l++)y.push(d[l].pos);if(y.length){var _=o.distinctVals(y),w=_.minDiff/2;for(y.length===_.vals.length&&(t.numboxes=1),n.Axes.minDtick(r,_.minDiff,_.vals[0],!0),a=0;a<m.length;++a)t.calcdata[a][0].t.dPos=w;var k=(1-c.boxgap)*(1-c.boxgroupgap)*w/t.numboxes;n.Axes.expand(r,_.vals,{vpadminus:w+b*k,vpadplus:w+x*k})}}}},{"../../lib":348,"../../plotly":365,"../../plots/plots":404}],436:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../plotly"),o=t("../../components/color");e.exports=function(t){var e=n.select(t).selectAll("g.trace.boxes");e.style("opacity",function(t){return t[0].trace.opacity}).each(function(t){var e=t[0].trace,r=e.line.width;n.select(this).selectAll("path.box").style("stroke-width",r+"px").call(o.stroke,e.line.color).call(o.fill,e.fillcolor),n.select(this).selectAll("path.mean").style({"stroke-width":r,"stroke-dasharray":2*r+"px,"+r+"px"}).call(o.stroke,e.line.color),n.select(this).selectAll("g.points path").call(i.Drawing.pointStyle,e)})}},{"../../components/color":299,"../../plotly":365,d3:70}],437:[function(t,e,r){"use strict";var n=t("../scattergeo/attributes"),i=t("../../components/colorscale/attributes"),o=t("../../plots/attributes"),a=t("../../lib/extend").extendFlat,s=n.marker.line;e.exports={locations:{valType:"data_array",description:["Sets the coordinates via location IDs or names.","See `locationmode` for more info."].join(" ")},locationmode:n.locationmode,z:{valType:"data_array"},text:{valType:"data_array"},marker:{line:{color:s.color,width:s.width}},zauto:i.zauto,zmin:i.zmin,zmax:i.zmax,colorscale:i.colorscale,autocolorscale:i.autocolorscale,reversescale:i.reversescale,showscale:i.showscale,hoverinfo:a({},o.hoverinfo,{flags:["location","z","text","name"]}),_nestedModules:{colorbar:"Colorbar"}}},{"../../components/colorscale/attributes":305,"../../lib/extend":344,"../../plots/attributes":366,"../scattergeo/attributes":520}],438:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/colorscale/defaults"),o=t("./attributes");e.exports=function(t,e,r,a){function s(r,i){return n.coerce(t,e,o,r,i)}var l,c=s("locations");if(c&&(l=c.length),!c||!l)return void(e.visible=!1);var u=s("z");return Array.isArray(u)?(u.length>l&&(e.z=u.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":308,"../../lib":348,"./attributes":437}],439:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../heatmap/colorbar"),n.calc=t("../surface/calc"),n.plot=t("./plot").plot,n.moduleType="trace",n.name="choropleth",n.basePlotModule=t("../../plots/geo"),n.categories=["geo","noOpacity"],n.meta={description:["The data that describes the choropleth value-to-color mapping","is set in `z`.","The geographic locations corresponding to each value in `z`","are set in `locations`."].join(" ")},e.exports=n},{"../../plots/geo":376,"../heatmap/colorbar":452,"../surface/calc":530,"./attributes":437,"./defaults":438,"./plot":440}],440:[function(t,e,r){"use strict";function n(t,e){function r(e){var r=t.mockAxis;return i.Axes.tickText(r,r.c2l(e),"hover").text}var n=e.hoverinfo;if("none"===n)return function(t){delete t.nameLabel,delete t.textLabel};var o="all"===n?p.hoverinfo.flags:n.split("+"),a=-1!==o.indexOf("name"),s=-1!==o.indexOf("location"),l=-1!==o.indexOf("z"),c=-1!==o.indexOf("text"),u=!a&&s;return function(t){var n=[];u?t.nameLabel=t.id:(a&&(t.nameLabel=e.name),s&&n.push(t.id)),l&&n.push(r(t.z)),c&&n.push(t.tx),t.textLabel=n.join("<br>")}}var i=t("../../plotly"),o=t("d3"),a=t("../../components/color"),s=t("../../components/drawing"),l=t("../../components/colorscale/get_scale"),c=t("../../components/colorscale/make_scale_function"),u=t("../../lib/topojson_utils").getTopojsonFeatures,h=t("../../lib/geo_location_utils").locationToFeature,f=t("../../lib/array_to_calc_item"),d=t("../../constants/geo_constants"),p=t("./attributes"),g=e.exports={};g.calcGeoJSON=function(t,e){for(var r,n=[],i=t.locations,o=i.length,a=u(t,e),s=(t.marker||{}).line||{},l=0;o>l;l++)r=h(t.locationmode,i[l],a),void 0!==r&&(r.z=t.z[l],void 0!==t.text&&(r.tx=t.text[l]),f(s.color,r,"mlc",l),f(s.width,r,"mlw",l),n.push(r));return n.length>0&&(n[0].trace=t),n},g.plot=function(t,e,r){var a,s=t.framework,l=t.topojson,c=s.select("g.choroplethlayer"),u=s.select("g.baselayer"),h=s.select("g.baselayeroverchoropleth"),f=d.baseLayersOverChoropleth;c.selectAll("*").remove(),h.selectAll("*").remove();var p=c.selectAll("g.trace.scatter").data(e);p.enter().append("g").attr("class","trace choropleth"),p.each(function(e){function r(e){if(t.showHover){var r=t.projection(e.properties.ct);s(e),i.Fx.loneHover({x:r[0],y:r[1],name:e.nameLabel,text:e.textLabel},{container:t.hoverContainer.node()})}}if(e.visible===!0){var a=g.calcGeoJSON(e,l),s=n(t,e);o.select(this).selectAll("path.choroplethlocation").data(a).enter().append("path").attr("class","choroplethlocation").on("mouseover",r).on("mouseout",function(){i.Fx.loneUnhover(t.hoverContainer)}).on("mousedown",function(){i.Fx.loneUnhover(t.hoverContainer)}).on("mouseup",r)}});for(var v=0;v<f.length;v++)a=f[v],u.select("g."+a).remove(),t.drawTopo(h,a,r),t.styleLayer(h,a,r);g.style(t)},g.style=function(t){t.framework.selectAll("g.trace.choropleth").each(function(t){var e=o.select(this),r=t.marker||{},n=r.line||{},i=t.zmin,u=t.zmax,h=l(t.colorscale),f=c(h,i,u);e.selectAll("path.choroplethlocation").each(function(t){o.select(this).attr("fill",function(t){return f(t.z)}).call(a.stroke,t.mlc||n.color).call(s.dashLine,"",t.mlw||n.width)})})}},{"../../components/color":299,"../../components/colorscale/get_scale":310,"../../components/colorscale/make_scale_function":315,"../../components/drawing":317,"../../constants/geo_constants":333,"../../lib/array_to_calc_item":340,"../../lib/geo_location_utils":345,"../../lib/topojson_utils":360,"../../plotly":365,"./attributes":437,d3:70}],441:[function(t,e,r){"use strict";var n=t("../heatmap/attributes"),i=t("../scatter/attributes"),o=t("../../lib/extend").extendFlat,a=i.line;e.exports={z:n.z,x:n.x,x0:n.x0,dx:n.dx,y:n.y,y0:n.y0,dy:n.dy,text:n.text,transpose:n.transpose,xtype:n.xtype,ytype:n.ytype,zauto:n.zauto,zmin:n.zmin,zmax:n.zmax,colorscale:n.colorscale,autocolorscale:n.autocolorscale,reversescale:n.reversescale,showscale:n.showscale,connectgaps:n.connectgaps,autocontour:{valType:"boolean",dflt:!0,description:["Determines whether of not the contour level attributes at","picked by an algorithm.","If *true*, the number of contour levels can be set in `ncontours`.","If *false*, set the contour level attributes in `contours`."].join(" ")},ncontours:{valType:"integer",dflt:0},contours:{start:{valType:"number",dflt:null},end:{valType:"number",dflt:null},size:{valType:"number",dflt:null},coloring:{valType:"enumerated",values:["fill","heatmap","lines","none"],dflt:"fill",description:["Determines the coloring method showing the contour values.","If *fill*, coloring is done evenly between each contour level","If *heatmap*, a heatmap gradient is coloring is applied","between each contour level.","If *lines*, coloring is done on the contour lines.","If *none*, no coloring is applied on this trace."].join(" ")},showlines:{valType:"boolean",dflt:!0,description:["Determines whether or not the contour lines are drawn.","Has only an effect if `contours.coloring` is set to *fill*."].join(" ")}},line:{color:o({},a.color,{description:["Sets the color of the contour level.","Has no if `contours.coloring` is set to *lines*."].join(" ")}),width:a.width,dash:a.dash,smoothing:o({},a.smoothing,{description:["Sets the amount of smoothing for the contour lines,","where *0* corresponds to no smoothing."].join(" ")})},_nestedModules:{colorbar:"Colorbar"}}},{"../../lib/extend":344,"../heatmap/attributes":450,"../scatter/attributes":493}],442:[function(t,e,r){"use strict";var n=t("../../plotly"),i=t("../heatmap/calc");e.exports=function(t,e){var r=i(t,e),o=e.contours;if(e.autocontour!==!1){var a={type:"linear",range:[e.zmin,e.zmax]};n.Axes.autoTicks(a,(e.zmax-e.zmin)/(e.ncontours||15)),o.start=n.Axes.tickFirst(a),o.size=a.dtick,a.range.reverse(),o.end=n.Axes.tickFirst(a),o.start===e.zmin&&(o.start+=o.size),o.end===e.zmax&&(o.end-=o.size),o.end+=o.size/100,e._input.contours=o}return r}},{"../../plotly":365,"../heatmap/calc":451}],443:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../plotly"),o=t("../../components/colorscale/get_scale"),a=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,s="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+s).remove(),r.showscale===!1)return void i.Plots.autoMargin(t,s);var l=a(t,s);e[0].t.cb=l;var c=r.contours,u=r.line,h=c.size||1,f=Math.floor((c.end+h/10-c.start)/h)+1,d=o(r.colorscale),p="lines"===c.coloring?0:1,g=n.scale.linear().interpolate(n.interpolateRgb),v=d.map(function(t){return(t[0]*(f+p-1)-p/2)*h+c.start}),m=d.map(function(t){return t[1]});if("heatmap"===c.coloring){r.zauto&&r.autocontour===!1&&(r.zmin=c.start-h/2,r.zmax=r.zmin+f*h),l.filllevels({start:r.zmin,end:r.zmax,size:(r.zmax-r.zmin)/254}),v=d.map(function(t){return t[0]*(r.zmax-r.zmin)+r.zmin});var y=n.extent([r.zmin,r.zmax,c.start,c.start+h*(f-1)]),b=y[r.zmin<r.zmax?0:1],x=y[r.zmin<r.zmax?1:0];b!==r.zmin&&(v.splice(0,0,b),m.splice(0,0,m[0])),x!==r.zmax&&(v.push(x),m.push(m[m.length-1]))}g.domain(v).range(m),l.fillcolor("fill"===c.coloring||"heatmap"===c.coloring?g:"").line({color:"lines"===c.coloring?g:u.color,width:c.showlines!==!1?u.width:0,dash:u.dash}).levels({start:c.start,end:c.end,size:h}).options(r.colorbar)()}},{"../../components/colorbar/draw":302,"../../components/colorscale/get_scale":310,"../../plotly":365,d3:70}],444:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../heatmap/has_columns"),o=t("../heatmap/xyz_defaults"),a=t("../contour/style_defaults"),s=t("./attributes");e.exports=function(t,e,r,l){function c(r,i){return n.coerce(t,e,s,r,i)}var u=o(t,e,c);if(!u)return void(e.visible=!1);c("text"),c("connectgaps",i(e));var h=n.coerce2(t,e,s,"contours.start"),f=n.coerce2(t,e,s,"contours.end"),d=c("autocontour",!(h&&f));c(d?"ncontours":"contours.size"),a(t,e,c,l)}},{"../../lib":348,"../contour/style_defaults":449,"../heatmap/has_columns":455,"../heatmap/xyz_defaults":461,"./attributes":441}],445:[function(t,e,r){"use strict";var n=t("../heatmap/hover");e.exports=function(t,e,r,i){return n(t,e,r,i,!0)}},{"../heatmap/hover":456}],446:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style"),n.colorbar=t("./colorbar"),n.hoverPoints=t("./hover"),n.moduleType="trace",n.name="contour",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","2dMap","contour"],n.meta={description:["The data from which contour lines are computed is set in `z`.","Data in `z` must be a {2D array} of numbers.","Say that `z` has N rows and M columns, then by default,","these N rows correspond to N y coordinates","(set in `y` or auto-generated) and the M columns","correspond to M x coordinates (set in `x` or auto-generated).","By setting `transpose` to *true*, the above behavior is flipped."].join(" ")},e.exports=n},{"../../plots/cartesian":371,"./attributes":441,"./calc":442,"./colorbar":443,"./defaults":444,"./hover":445,"./plot":447,"./style":448}],447:[function(t,e,r){"use strict";function n(t,e,r){w.markTime("in Contour.plot");var n=r[0].trace,o=r[0].x,s=r[0].y,c=n.contours,u=n.uid,h=e.x(),f=e.y(),v=t._fullLayout,b="contour"+u,x=i(c,e,r[0]);if(n.visible!==!0)return void v._paper.selectAll("."+b+",.cb"+u+",.hm"+u).remove();"heatmap"===c.coloring?(n.zauto&&n.autocontour===!1&&(n._input.zmin=n.zmin=c.start-c.size/2,n._input.zmax=n.zmax=n.zmin+x.length*c.size),k(t,e,[r])):v._paper.selectAll(".hm"+u).remove(),a(x),l(x);var A=h.c2p(o[0],!0),M=h.c2p(o[o.length-1],!0),T=f.c2p(s[0],!0),E=f.c2p(s[s.length-1],!0),L=[[A,E],[M,E],[M,T],[A,T]],S=d(e,r,b);p(S,L,c),g(S,x,L,c),m(S,x,c),y(S,e,r[0],L),_.Lib.markTime("done Contour.plot")}function i(t,e,r){for(var n=t.size||1,i=[],o=t.start;o<t.end+n/10;o+=n)i.push({level:o,crossings:{},starts:[],edgepaths:[],paths:[],xaxis:e.x(),yaxis:e.y(),x:r.x,y:r.y,z:r.z,smoothing:r.trace.line.smoothing});return i}function o(t,e){var r=(e[0][0]>t?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,c,u,h=t[0].z,f=h.length,d=h[0].length,p=2===f||2===d;for(r=0;f-1>r;r++)for(i=[],0===r&&(i=i.concat(A)),r===f-2&&(i=i.concat(M)),e=0;d-1>e;e++)for(n=i.slice(),0===e&&(n=n.concat(T)),e===d-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]]],u=0;u<t.length;u++)c=t[u],l=o(c.level,s),l&&(c.crossings[a]=l,-1!==n.indexOf(l)&&(c.starts.push([e,r]),p&&-1!==n.indexOf(l,n.indexOf(l)+1)&&c.starts.push([e,r])))}function s(t,e,r){function n(t){return d[t%d.length]}var i,o=e.join(","),a=o,s=t.crossings[a],l=c(s,r,e),d=[f(t,e,[-l[0],-l[1]])],p=l.join(","),g=t.z.length,v=t.z[0].length;for(i=0;1e4>i;i++){if(s>20?(s=S[s][(l[0]||l[1])<0?0:1],t.crossings[a]=C[s]):delete t.crossings[a],l=L[s],!l){console.log("found bad marching index",s,e,t.level);break}if(d.push(f(t,e,l)),e[0]+=l[0],e[1]+=l[1],u(d[d.length-1],d[d.length-2])&&d.pop(),a=e.join(","),a===o&&l.join(",")===p||r&&(l[0]&&(e[0]<0||e[0]>v-2)||l[1]&&(e[1]<0||e[1]>g-2)))break;s=t.crossings[a]}1e4===i&&console.log("Infinite loop in contour?");var m,y,b,x,_,w,k,A=u(d[0],d[d.length-1]),M=0,T=.2*t.smoothing,E=[],z=0;for(i=1;i<d.length;i++)k=h(d[i],d[i-1]),M+=k,E.push(k);var j=M/E.length*T;for(i=d.length-2;i>=z;i--)if(m=E[i],j>m){for(b=0,y=i-1;y>=z&&m+E[y]<j;y--)m+=E[y];if(A&&i===d.length-2)for(b=0;y>b&&m+E[b]<j;b++)m+=E[b];_=i-y+b+1,w=Math.floor((i+y+b+2)/2),x=A||i!==d.length-2?A||-1!==y?_%2?n(w):[(n(w)[0]+n(w+1)[0])/2,(n(w)[1]+n(w+1)[1])/2]:d[0]:d[d.length-1],d.splice(y+1,i-y+1,x),i=y+1,b&&(z=b),A&&(i===d.length-2?d[b]=d[d.length-1]:0===i&&(d[d.length-1]=d[0]))}if(d.splice(0,z),!(d.length<2))if(A)d.pop(),t.paths.push(d);else{r||console.log("unclosed interior contour?",t.level,o,d.join("L"));var P=!1;t.edgepaths.forEach(function(e,r){if(!P&&u(e[0],d[d.length-1])){d.pop(),P=!0;var n=!1;t.edgepaths.forEach(function(e,i){!n&&u(e[e.length-1],d[0])&&(n=!0,d.splice(0,1),t.edgepaths.splice(r,1),i===r?t.paths.push(d.concat(e)):t.edgepaths[i]=t.edgepaths[i].concat(d,e))}),n||(t.edgepaths[r]=d.concat(e))}}),t.edgepaths.forEach(function(e,r){!P&&u(e[e.length-1],d[0])&&(d.splice(0,1),t.edgepaths[r]=e.concat(d),P=!0)}),P||t.edgepaths.push(d)}}function l(t){var e,r,n,i,o;for(n=0;n<t.length;n++){for(i=t[n],o=0;o<i.starts.length;o++)r=i.starts[o],s(i,r,"edge");for(e=0;Object.keys(i.crossings).length&&1e4>e;)e++,r=Object.keys(i.crossings)[0].split(",").map(Number),s(i,r);1e4===e&&console.log("Infinite loop in contour?")}}function c(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!==M.indexOf(t)?i=-1:n=-1,[n,i]}function u(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 c=(t.level-o)/(t.z[i+1][n]-o);return[a.c2p(t.x[n],!0),s.c2p((1-c)*t.y[i]+c*t.y[i+1],!0)]}function d(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 p(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 g(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=v(t,r);e?x.select(this).attr("d",e).style("stroke","none"):x.select(this).remove()})}function v(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,c,u,h,f=t.edgepaths.length||t.z[0][0]<t.level?"":"M"+e.join("L")+"Z",d=0,p=t.edgepaths.map(function(t,e){return e}),g=!0;p.length;){for(h=_.Drawing.smoothopen(t.edgepaths[d],t.smoothing),f+=g?h:h.replace(/^M/,"L"),p.splice(p.indexOf(d),1),a=t.edgepaths[d][t.edgepaths[d].length-1],c=-1,l=0;4>l;l++){if(!a){console.log("missing end?",d,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]),u=0;u<t.edgepaths.length;u++){var v=t.edgepaths[u][0];Math.abs(a[0]-s[0])<.01?Math.abs(a[0]-v[0])<.01&&(v[1]-a[1])*(s[1]-v[1])>=0&&(s=v,c=u):Math.abs(a[1]-s[1])<.01?Math.abs(a[1]-v[1])<.01&&(v[0]-a[0])*(s[0]-v[0])>=0&&(s=v,c=u):console.log("endpt to newendpt is not vert. or horz.",a,s,v)}if(a=s,c>=0)break;f+="L"+s}if(c===t.edgepaths.length){console.log("unclosed perimeter path");break}d=c,g=-1===p.indexOf(d),g&&(d=p[0],f+="Z")}for(d=0;d<t.paths.length;d++)f+=_.Drawing.smoothclosed(t.paths[d],t.smoothing);return f}function m(t,e,r){var n=e[0].smoothing,i=t.selectAll("g.contourlevel").data(r.showlines===!1?[]:e);i.enter().append("g").classed("contourlevel",!0),i.exit().remove();var o=i.selectAll("path.openline").data(function(t){return t.edgepaths});o.enter().append("path").classed("openline",!0),o.exit().remove(),o.attr("d",function(t){return _.Drawing.smoothopen(t,n)}).style("stroke-miterlimit",1);var a=i.selectAll("path.closedline").data(function(t){return t.paths});a.enter().append("path").classed("closedline",!0),a.exit().remove(),a.attr("d",function(t){return _.Drawing.smoothclosed(t,n)}).style("stroke-miterlimit",1)}function y(t,e,r,n){var i="clip"+r.trace.uid,o=e.plot.selectAll("defs").data([0]);o.enter().append("defs");var s=o.selectAll("#"+i).data(r.trace.connectgaps?[]:[0]);if(s.enter().append("clipPath").attr("id",i),s.exit().remove(),r.trace.connectgaps===!1){var c={level:.9,crossings:{},starts:[],edgepaths:[],paths:[],xaxis:e.x(),yaxis:e.y(),x:r.x,y:r.y,z:b(r),smoothing:0};a([c]),l([c]);var u=v(c,n),h=s.selectAll("path").data([0]);h.enter().append("path"),h.attr("d",u)}else i=null;t.call(_.Drawing.setClipUrl,i),e.plot.selectAll(".hm"+r.trace.uid).call(_.Drawing.setClipUrl,i)}function b(t){var e,r,n=t.trace._emptypoints,i=[],o=t.z.length,a=t.z[0].length,s=[];for(e=0;a>e;e++)s.push(1);for(e=0;o>e;e++)i.push(s.slice());for(e=0;e<n.length;e++)r=n[e],i[r[0]][r[1]]=0;return t.zmask=i,i}var x=t("d3"),_=t("../../plotly"),w=t("../../lib"),k=t("../heatmap/plot");e.exports=function(t,e,r){for(var i=0;i<r.length;i++)n(t,e,r[i])};var A=[1,9,13,104,713],M=[4,6,7,104,713],T=[8,12,14,208,1114],E=[2,3,11,208,1114],L=[null,[-1,0],[0,-1],[-1,0],[1,0],null,[0,-1],[-1,0],[0,1],[0,1],null,[0,1],[1,0],[1,0],[0,-1]],S={104:[4,1],208:[2,8],713:[7,13],1114:[11,14]},C={1:4,2:8,4:1,7:13,8:2,11:14,13:7,14:11}},{"../../lib":348,"../../plotly":365,"../heatmap/plot":459,d3:70}],448:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../plotly"),o=t("../../components/colorscale/get_scale"),a=t("../heatmap/style");e.exports=function(t){n.select(t).selectAll("g.contour").style("opacity",function(t){return t.trace.opacity}).each(function(t){var e=n.select(this),r=t.trace,a=r.contours,s=r.line,l="lines"===a.coloring,c=a.size||1,u=Math.floor((a.end+c/10-a.start)/c)+1,h=o(r.colorscale),f=l?0:1,d=n.scale.linear().domain(h.map(function(t){return(t[0]*(u+f-1)-f/2)*c+a.start})).interpolate(n.interpolateRgb).range(h.map(function(t){return t[1]}));e.selectAll("g.contourlevel").each(function(t,e){n.select(this).selectAll("path").call(i.Drawing.lineGroupStyle,s.width,l?d(a.start+e*c):s.color,s.dash)}),e.selectAll("g.contourbg path").style("fill",d(a.start-c/2)),e.selectAll("g.contourfill path").style("fill",function(t,e){return d(a.start+(e+.5)*c)})}),a(t)}},{"../../components/colorscale/get_scale":310,"../../plotly":365,"../heatmap/style":460,d3:70}],449:[function(t,e,r){"use strict";var n=t("../../components/colorscale/defaults");e.exports=function(t,e,r,i){var o,a=r("contours.coloring");"fill"===a&&(o=r("contours.showlines")),o!==!1&&("lines"!==a&&r("line.color","#000"),r("line.width",.5),r("line.dash")),r("line.smoothing"),"none"!==(e.contours||{}).coloring&&n(t,e,i,r,{prefix:"",cLetter:"z"})}},{"../../components/colorscale/defaults":308}],450:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../components/colorscale/attributes"),o=t("../../lib/extend").extendFlat;e.exports={z:{valType:"data_array"},x:n.x,x0:n.x0,dx:n.dx,y:n.y,y0:n.y0,dy:n.dy,text:{valType:"data_array"},transpose:{valType:"boolean",dflt:!1},xtype:{valType:"enumerated",values:["array","scaled"],description:["If *array*, the heatmap's x coordinates are given by *x*","(the default behavior when `x` is provided).","If *scaled*, the heatmap's x coordinates are given by *x0* and *dx*","(the default behavior when `x` is not provided)."].join(" ")},ytype:{valType:"enumerated",values:["array","scaled"],description:["If *array*, the heatmap's y coordinates are given by *y*","(the default behavior when `y` is provided)","If *scaled*, the heatmap's y coordinates are given by *y0* and *dy*","(the default behavior when `y` is not provided)"].join(" ")},zauto:i.zauto,zmin:i.zmin,zmax:i.zmax,colorscale:i.colorscale,autocolorscale:o({},i.autocolorscale,{dflt:!1}),reversescale:i.reversescale,showscale:i.showscale,zsmooth:{valType:"enumerated",values:["fast","best",!1],dflt:!1,description:["Picks a smoothing algorithm use to smooth `z` data."].join(" ")},connectgaps:{valType:"boolean",dflt:!1,description:["Determines whether or not gaps","(i.e. {nan} or missing values)","in the `z` data are filled in."].join(" ")},_nestedModules:{colorbar:"Colorbar"}}},{"../../components/colorscale/attributes":305,"../../lib/extend":344,"../scatter/attributes":493}],451:[function(t,e,r){"use strict";function n(t){function e(t){return c(t)?+t:void 0}var r,n,i,o,a,s,l=t.z;if(t.transpose){for(r=0,a=0;a<l.length;a++)r=Math.max(r,l[a].length);if(0===r)return!1;i=function(t){return t.length},o=function(t,e,r){return t[r][e]}}else r=l.length,i=function(t,e){return t[e].length},o=function(t,e,r){return t[e][r]};var u=new Array(r);for(a=0;r>a;a++)for(n=i(l,a),u[a]=new Array(n),s=0;n>s;s++)u[a][s]=e(o(l,a,s));return u}function i(t,e,r,n,i,o){var a,s,l,c=[],h=u.Plots.traceIs(t,"contour"),f=u.Plots.traceIs(t,"histogram");if(Array.isArray(e)&&!f&&"category"!==o.type){e=e.map(o.d2c);var d=e.length;if(!(i>=d))return h?e.slice(0,i):e.slice(0,i+1);if(h)c=e.slice(0,i);else if(1===i)c=[e[0]-.5,e[0]+.5];else{for(c=[1.5*e[0]-.5*e[1]],l=1;d>l;l++)c.push(.5*(e[l-1]+e[l]));c.push(1.5*e[d-1]-.5*e[d-2])}if(i>d){var p=c[c.length-1],g=p-c[c.length-2];for(l=d;i>l;l++)p+=g,c.push(p)}}else for(s=n||1,a=void 0===r?0:f||"category"===o.type?r:o.d2c(r),l=h?0:-.5;i>l;l++)c.push(a+s*l);return c}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;n<e.length;n++)i=e[n],t[i[0]][i[1]]=r[i[0]][i[1]];else l(t,e);for(n=0;n<e.length&&!(e[n][2]<4);n++);for(e=e.slice(n),n=0;100>n&&a>m;n++)a=l(t,e,o(a));return a>m&&console.log("interp2d didn't converge quickly",a),t}function s(t){var e,r,n,i,o,a,s,l,c=[],u={},h=[],f=t[0],d=[],p=[0,0,0],g=v(t);for(r=0;r<t.length;r++)for(e=d,d=f,f=t[r+1]||[],n=0;g>n;n++)void 0===d[n]&&(a=(void 0!==d[n-1]?1:0)+(void 0!==d[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===d.length-1&&a++,4>a&&(u[[r,n]]=[r,n,a]),c.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=((u[[r-1,n]]||p)[2]+(u[[r+1,n]]||p)[2]+(u[[r,n-1]]||p)[2]+(u[[r,n+1]]||p)[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)u[i]=s[i],c.push(s[i])}return c.sort(function(t,e){return e[2]-t[2]})}function l(t,e,r){var n,i,o,a,s,l,c,u,h,f,d,p,g,v=0;for(a=0;a<e.length;a++){for(n=e[a],i=n[0],o=n[1],d=t[i][o],f=0,h=0,s=0;4>s;s++)l=y[s],c=t[i+l[0]],c&&(u=c[o+l[1]],void 0!==u&&(0===f?p=g=u:(p=Math.min(p,u),g=Math.max(g,u)),h++,f+=u));if(0===h)throw"iterateInterp2d order is wrong: no defined neighbors";t[i][o]=f/h,void 0===d?4>h&&(v=1):(t[i][o]=(1+r)*t[i][o]-r*d,g>p&&(v=Math.max(v,Math.abs(t[i][o]-d)/(g-p))))}return v}var c=t("fast-isnumeric"),u=t("../../plotly"),h=t("../../lib"),f=t("../histogram2d/calc"),d=t("../../components/colorscale/calc"),p=t("./has_columns"),g=t("./convert_column_xyz"),v=t("./max_row_length");e.exports=function(t,e){function r(t){T=e._input.zsmooth=e.zsmooth=!1,h.notifier("cannot fast-zsmooth: "+t)}h.markTime("start convert x&y");var o,l,c,m,y,b,x,_,w=u.Axes.getFromId(t,e.xaxis||"x"),k=u.Axes.getFromId(t,e.yaxis||"y"),A=u.Plots.traceIs(e,"contour"),M=u.Plots.traceIs(e,"histogram"),T=A?"best":e.zsmooth;if(w._minDtick=0,k._minDtick=0,h.markTime("done convert x&y"),M){var E=f(t,e);o=E.x,l=E.x0,c=E.dx,m=E.y,y=E.y0,b=E.dy,x=E.z}else p(e)&&g(e,w,k),o=e.x?w.makeCalcdata(e,"x"):[],m=e.y?k.makeCalcdata(e,"y"):[],l=e.x0||0,c=e.dx||1,y=e.y0||0,b=e.dy||1,x=n(e),(A||e.connectgaps)&&(e._emptypoints=s(x),e._interpz=a(x,e._emptypoints,e._interpz));if("fast"===T)if("log"===w.type||"log"===k.type)r("log axis found");else if(!M){if(o.length){var L=(o[o.length-1]-o[0])/(o.length-1),S=Math.abs(L/100);for(_=0;_<o.length-1;_++)if(Math.abs(o[_+1]-o[_]-L)>S){r("x scale is not linear");break}}if(m.length&&"fast"===T){var C=(m[m.length-1]-m[0])/(m.length-1),z=Math.abs(C/100);for(_=0;_<m.length-1;_++)if(Math.abs(m[_+1]-m[_]-C)>z){r("y scale is not linear");break}}}var j=v(x),P="scaled"===e.xtype?"":e.x,I=i(e,P,l,c,j,w),R="scaled"===e.ytype?"":e.y,O=i(e,R,y,b,x.length,k);u.Axes.expand(w,I),u.Axes.expand(k,O);var N={x:I,y:O,z:x};if(d(e,x,"","z"),A&&e.contours&&"heatmap"===e.contours.coloring){var D="contour"===e.type?"heatmap":"histogram2d";N.xfill=i(D,P,l,c,j,w),N.yfill=i(D,R,y,b,x.length,k)}return[N]};var m=.01,y=[[-1,0],[1,0],[0,-1],[0,1]]},{"../../components/colorscale/calc":306,"../../lib":348,"../../plotly":365,"../histogram2d/calc":471,"./convert_column_xyz":453,"./has_columns":455,"./max_row_length":458,"fast-isnumeric":74}],452:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),o=t("../../plotly"),a=t("../../lib"),s=t("../../components/colorscale/get_scale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,c="cb"+r.uid,u=s(r.colorscale),h=r.zmin,f=r.zmax;if(i(h)||(h=a.aggNums(Math.min,null,r.z)),i(f)||(f=a.aggNums(Math.max,null,r.z)),t._fullLayout._infolayer.selectAll("."+c).remove(),!r.showscale)return void o.Plots.autoMargin(t,c);var d=e[0].t.cb=l(t,c);d.fillcolor(n.scale.linear().domain(u.map(function(t){return h+t[0]*(f-h)})).range(u.map(function(t){return t[1]}))).filllevels({start:h,end:f,size:(f-h)/254}).options(r.colorbar)(),a.markTime("done colorbar")}},{"../../components/colorbar/draw":302,"../../components/colorscale/get_scale":310,"../../lib":348,"../../plotly":365,d3:70,"fast-isnumeric":74}],453:[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,c=Math.min(o.length,a.length,s.length),u=void 0!==l&&!Array.isArray(l[0]);for(c<o.length&&(o=o.slice(0,c)),c<a.length&&(a=a.slice(0,c)),i=0;c>i;i++)o[i]=e.d2c(o[i]),a[i]=r.d2c(a[i]);var h,f,d,p=n.distinctVals(o),g=p.vals,v=n.distinctVals(a),m=v.vals,y=n.init2dArray(m.length,g.length);for(u&&(d=n.init2dArray(m.length,g.length)),i=0;c>i;i++)h=n.findBin(o[i]+p.minDiff/2,g),f=n.findBin(a[i]+v.minDiff/2,m),y[f][h]=s[i],u&&(d[f][h]=l[i]);t.x=g,t.y=m,t.z=y,u&&(t.text=d)}},{"../../lib":348}],454:[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 c(r,i){return n.coerce(t,e,s,r,i)}var u=o(t,e,c);return u?(c("text"),c("zsmooth"),c("connectgaps",i(e)&&e.zsmooth!==!1),void a(t,e,l,c,{prefix:"",cLetter:"z"})):void(e.visible=!1)}},{"../../components/colorscale/defaults":308,"../../lib":348,"./attributes":450,"./has_columns":455,"./xyz_defaults":461}],455:[function(t,e,r){"use strict";e.exports=function(t){return!Array.isArray(t.z[0])}},{}],456:[function(t,e,r){"use strict";var n=t("../../plotly"),i=t("../../lib");e.exports=function(t,e,r,o,a){if(!(t.distance<n.Fx.MAXDIST)){var s,l,c,u,h=t.cd[0],f=h.trace,d=t.xa,p=t.ya,g=h.x,v=h.y,m=h.z,y=h.zmask,b=g,x=v;if(t.index!==!1){try{c=Math.round(t.index[1]),u=Math.round(t.index[0])}catch(_){return void console.log("Error hovering on heatmap, pointNumber must be [row,col], found:",t.index)}if(0>c||c>=m[0].length||0>u||u>m.length)return}else{if(n.Fx.inbox(e-g[0],e-g[g.length-1])>n.Fx.MAXDIST||n.Fx.inbox(r-v[0],r-v[v.length-1])>n.Fx.MAXDIST)return;if(a){var w;for(b=[2*g[0]-g[1]],w=1;w<g.length;w++)b.push((g[w]+g[w-1])/2);for(b.push([2*g[g.length-1]-g[g.length-2]]),x=[2*v[0]-v[1]],w=1;w<v.length;w++)x.push((v[w]+v[w-1])/2);x.push([2*v[v.length-1]-v[v.length-2]])}c=Math.max(0,Math.min(b.length-2,i.findBin(e,b))),u=Math.max(0,Math.min(x.length-2,i.findBin(r,x)))}var k=d.c2p(g[c]),A=d.c2p(g[c+1]),M=p.c2p(v[u]),T=p.c2p(v[u+1]);a?(A=k,s=g[c],T=M,l=v[u]):(s=(g[c]+g[c+1])/2,l=(v[u]+v[u+1])/2,f.zsmooth&&(k=A=(k+A)/2,M=T=(M+T)/2));var E=m[u][c];y&&!y[u][c]&&(E=void 0);var L;return Array.isArray(f.text)&&Array.isArray(f.text[u])&&(L=f.text[u][c]),[i.extendFlat(t,{index:[u,c],distance:n.Fx.MAXDIST+10,x0:k,x1:A,y0:M,y1:T,xLabelVal:s,yLabelVal:l,zLabelVal:E,text:L})]}}},{"../../lib":348,"../../plotly":365}],457:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("./calc"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.moduleType="trace",n.name="heatmap",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","2dMap"],n.meta={description:["The data that describes the heatmap value-to-color mapping","is set in `z`.","Data in `z` can either be a {2D array} of values (ragged or not)","or a 1D array of values.","In the case where `z` is a {2D array},","say that `z` has N rows and M columns.","Then, by default, the resulting heatmap will have N partitions along","the y axis and M partitions along the x axis.","In other words, the i-th row/ j-th column cell in `z`","is mapped to the i-th partition of the y axis","(starting from the bottom of the plot) and the j-th partition","of the x-axis (starting from the left of the plot).","This behavior can be flipped by using `transpose`.","Moreover, `x` (`y`) can be provided with M or M+1 (N or N+1) elements.","If M (N), then the coordinates correspond to the center of the","heatmap cells and the cells have equal width.","If M+1 (N+1), then the coordinates correspond to the edges of the","heatmap cells.","In the case where `z` is a 1D {array}, the x and y coordinates must be","provided in `x` and `y` respectively to form data triplets."].join(" ")},e.exports=n},{"../../plots/cartesian":371,"./attributes":450,"./calc":451,"./colorbar":452,"./defaults":454,"./hover":456,"./plot":459,"./style":460}],458:[function(t,e,r){"use strict";e.exports=function(t){for(var e=0,r=0;r<t.length;r++)e=Math.max(e,t[r].length);return e}},{}],459:[function(t,e,r){"use strict";function n(t,e,r){function n(t,e){var r=e.length-2,n=s.constrain(s.findBin(t,e),0,r),i=e[n],o=e[n+1],a=s.constrain(n+(t-i)/(o-i)-.5,0,r),l=Math.round(a),c=Math.abs(a-l);return a&&a!==r&&c?{bin0:l,frac:c,bin1:Math.round(l+c/(a-l))}:{bin0:l,bin1:l,frac:0}}function h(t,e){if(void 0!==t){var r=W((t-L)/(S-L));return r[0]=Math.round(r[0]),r[1]=Math.round(r[1]),r[2]=Math.round(r[2]),ot+=e,at+=r[0]*e,st+=r[1]*e,lt+=r[2]*e,r}return[0,0,0,0]}function f(t,e,r){t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=Math.round(255*r[3])}function d(t,e,r,n){var i=t[r.bin0];if(void 0===i)return h(void 0,1);var o,a=t[r.bin1],s=e[r.bin0],l=e[r.bin1],c=a-i||0,u=s-i||0;return o=void 0===a?void 0===l?0:void 0===s?2*(l-i):2*(2*l-s-i)/3:void 0===l?void 0===s?0:2*(2*i-a-s)/3:void 0===s?2*(2*l-a-i)/3:l+i-a-s,h(i+r.frac*c+n.frac*(u+r.frac*o))}s.markTime("in Heatmap.plot");var p=r[0].trace,g=p.uid,v=e.x(),m=e.y(),y=t._fullLayout,b="hm"+g,x="cb"+g;if(y._paper.selectAll(".contour"+g).remove(),p.visible!==!0)return y._paper.selectAll("."+b).remove(),void y._paper.selectAll("."+x).remove();var _,w,k,A,M,T,E=r[0].z,L=p.zmin,S=p.zmax,C=l(p.colorscale),z=r[0].x,j=r[0].y,P=a.Plots.traceIs(p,"contour"),I=P?"best":p.zsmooth,R=E.length,O=u(E),N=!1,D=!1;for(T=0;void 0===_&&T<z.length-1;)_=v.c2p(z[T]),T++;for(T=z.length-1;void 0===w&&T>0;)w=v.c2p(z[T]),T--;for(_>w&&(k=w,w=_,_=k,N=!0),T=0;void 0===A&&T<j.length-1;)A=m.c2p(j[T]),T++;for(T=j.length-1;void 0===M&&T>0;)M=m.c2p(j[T]),T--;if(A>M&&(k=A,A=M,M=k,D=!0),P&&(z=r[0].xfill,j=r[0].yfill),"fast"!==I){var F="best"===I?0:.5;_=Math.max(-F*v._length,_),w=Math.min((1+F)*v._length,w),A=Math.max(-F*m._length,A),M=Math.min((1+F)*m._length,M)}var B=Math.round(w-_),U=Math.round(M-A);if(!(0>=B||0>=U)){var V,q;"fast"===I?(V=O,q=R):(V=B,q=U);var H=document.createElement("canvas");H.width=V,H.height=q;var G,Y,X=H.getContext("2d"),W=i.scale.linear().domain(C.map(function(t){return t[0]})).range(C.map(function(t){var e=o(t[1]).toRgb();return[e.r,e.g,e.b,e.a]})).clamp(!0);"fast"===I?(G=N?function(t){return O-1-t}:s.identity,Y=D?function(t){return R-1-t}:s.identity):(G=function(t){return s.constrain(Math.round(v.c2p(z[t])-_),0,B)},Y=function(t){return s.constrain(Math.round(m.c2p(j[t])-A),0,U)});var Z,Q,$,K,J,tt,et=Y(0),rt=[et,et],nt=N?0:1,it=D?0:1,ot=0,at=0,st=0,lt=0;if(s.markTime("done init png"),I){var ct=0,ut=new Uint8Array(B*U*4);if("best"===I){var ht,ft,dt,pt=new Array(z.length),gt=new Array(j.length),vt=new Array(B);for(T=0;T<z.length;T++)pt[T]=Math.round(v.c2p(z[T])-_);for(T=0;T<j.length;T++)gt[T]=Math.round(m.c2p(j[T])-A);for(T=0;B>T;T++)vt[T]=n(T,pt);for(Q=0;U>Q;Q++)for(ht=n(Q,gt),ft=E[ht.bin0],dt=E[ht.bin1],T=0;B>T;T++,ct+=4)tt=d(ft,dt,vt[T],ht),f(ut,ct,tt)}else for(Q=0;R>Q;Q++)for(J=E[Q],rt=Y(Q),T=0;O>T;T++)tt=h(J[T],1),ct=4*(rt*B+G(T)),f(ut,ct,tt);var mt=X.createImageData(B,U);mt.data.set(ut),X.putImageData(mt,0,0)}else for(Q=0;R>Q;Q++)if(J=E[Q],rt.reverse(),rt[it]=Y(Q+1),rt[0]!==rt[1]&&void 0!==rt[0]&&void 0!==rt[1])for($=G(0),Z=[$,$],T=0;O>T;T++)Z.reverse(),Z[nt]=G(T+1),Z[0]!==Z[1]&&void 0!==Z[0]&&void 0!==Z[1]&&(K=J[T],tt=h(K,(Z[1]-Z[0])*(rt[1]-rt[0])),X.fillStyle="rgba("+tt.join(",")+")",X.fillRect(Z[0],rt[0],Z[1]-Z[0],rt[1]-rt[0]));s.markTime("done filling png"),at=Math.round(at/ot),st=Math.round(st/ot),lt=Math.round(lt/ot);var yt=o("rgb("+at+","+st+","+lt+")");t._hmpixcount=(t._hmpixcount||0)+ot,t._hmlumcount=(t._hmlumcount||0)+ot*yt.getLuminance(),y._paper.selectAll("."+b).remove(),e.plot.select(".maplayer").append("svg:image").classed(b,!0).datum(r[0]).attr({xmlns:c.svg,"xlink:href":H.toDataURL("image/png"),height:U,width:B,x:_,y:A,preserveAspectRatio:"none"}),s.markTime("done showing png")}}var i=t("d3"),o=t("tinycolor2"),a=t("../../plotly"),s=t("../../lib"),l=t("../../components/colorscale/get_scale"),c=t("../../constants/xmlns_namespaces"),u=t("./max_row_length");e.exports=function(t,e,r){r.forEach(function(r){n(t,e,r)})}},{"../../components/colorscale/get_scale":310,"../../constants/xmlns_namespaces":337,"../../lib":348,"../../plotly":365,"./max_row_length":458,d3:70,tinycolor2:229}],460:[function(t,e,r){"use strict";var n=t("d3");e.exports=function(t){n.select(t).selectAll("image").style("opacity",function(t){return t.trace.opacity})}},{d3:70}],461:[function(t,e,r){"use strict";function n(t,e){var r=e(t),n=r?e(t+"type","array"):"scaled";return"scaled"===n&&(e(t+"0"),e("d"+t)),r}function i(t){for(var e,r=!0,n=!1,i=!1,a=0;a<t.length;a++){if(e=t[a],!Array.isArray(e)){r=!1;break}e.length>0&&(n=!0);for(var s=0;s<e.length;s++)if(o(e[s])){i=!0;break}}return r&&n&&i}var o=t("fast-isnumeric"),a=t("./has_columns");e.exports=function(t,e,r){var o,s,l=r("z");if(void 0===l||!l.length)return 0;if(a(t)){if(o=r("x"),s=r("y"),!o||!s)return 0}else{if(o=n("x",r),s=n("y",r),!i(l))return 0;r("transpose")}return e.z.length}},{"./has_columns":455,"fast-isnumeric":74}],462:[function(t,e,r){"use strict";function n(t){return{start:{valType:"number",dflt:null,description:["Sets the starting value for the",t,"axis bins."].join(" ")},end:{valType:"number",dflt:null,description:["Sets the end value for the",t,"axis bins."].join(" ")},size:{valType:"any",dflt:1,description:["Sets the step in-between value each",t,"axis bin."].join(" ")}}}var i=t("../bar/attributes"),o=t("../../lib").extendFlat,a=i.marker,s=a.line;e.exports={x:{valType:"data_array",description:["Sets the sample data to be binned on the x axis."].join(" ")},y:{valType:"data_array",description:["Sets the sample data to be binned on the y axis."].join(" ")},text:i.text,orientation:i.orientation,histfunc:{valType:"enumerated",values:["count","sum","avg","min","max"],dflt:"count",description:["Specifies the binning function used for this histogram trace.","If *count*, the histogram values are computed by counting the","number of values lying inside each bin.","If *sum*, *avg*, *min*, *max*,","the histogram values are computed using","the sum, the average, the minimum or the maximum","of the values lying inside each bin respectively."].join(" ")},histnorm:{valType:"enumerated",values:["","percent","probability","density","probability density"],dflt:"",description:["Specifies the type of normalization used for this histogram trace.","If **, the span of each bar corresponds to the number of","occurrences (i.e. the number of data points lying inside the bins).","If *percent*, the span of each bar corresponds to the percentage","of occurrences with respect to the total number of sample points","(here, the sum of all bin area equals 100%).","If *density*, the span of each bar corresponds to the number of","occurrences in a bin divided by the size of the bin interval","(here, the sum of all bin area equals the","total number of sample points).","If *probability density*, the span of each bar corresponds to the","probability that an event will fall into the corresponding bin","(here, the sum of all bin area equals 1)."].join(" ")},autobinx:{valType:"boolean",dflt:!0,description:["Determines whether or not the x axis bin attributes are picked","by an algorithm."].join(" ")},nbinsx:{valType:"integer",min:0,dflt:0},xbins:n("x"),autobiny:{valType:"boolean",dflt:!0,description:["Determines whether or not the y axis bin attributes are picked","by an algorithm."].join(" ")},nbinsy:{valType:"integer",min:0,dflt:0},ybins:n("y"),marker:{color:a.color,colorscale:a.colorscale,cauto:a.cauto,cmax:a.cmax,cmin:a.cmin,autocolorscale:a.autocolorscale,reversescale:a.reversescale,showscale:a.showscale,line:{color:s.color,colorscale:s.colorscale,cauto:s.cauto,cmax:s.cmax,cmin:s.cmin,autocolorscale:s.autocolorscale,reversescale:s.reversescale,width:o({},s.width,{dflt:0})}},_nestedModules:{error_y:"ErrorBars",error_x:"ErrorBars","marker.colorbar":"Colorbar"},_deprecated:{bardir:i._deprecated.bardir}}},{"../../lib":348,"../bar/attributes":416}],463:[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}},{}],464:[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}},{}],465:[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]<o)return r[t]=o,o-r[t]}return 0}}},{"fast-isnumeric":74}],466:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plotly"),o=t("../../lib"),a=t("./bin_functions"),s=t("./norm_functions"),l=t("./average");e.exports=function(t,e){if(e.visible===!0){var r,c=[],u=[],h=i.Axes.getFromId(t,"h"===e.orientation?e.yaxis||"y":e.xaxis||"x"),f="h"===e.orientation?"y":"x",d={x:"y",y:"x"}[f],p=h.makeCalcdata(e,f);e["autobin"+f]===!1&&f+"bins"in e||(e[f+"bins"]=i.Axes.autoBin(p,h,e["nbins"+f]),e._input[f+"bins"]=e[f+"bins"]);var g,v,m,y,b=e[f+"bins"],x="string"==typeof b.size,_=x?[]:b,w=[],k=[],A=0,M=e.histnorm,T=e.histfunc,E=-1!==M.indexOf("density"),L="max"===T||"min"===T,S=L?null:0,C=a.count,z=s[M],j=!1;for(Array.isArray(e[d])&&"count"!==T&&(y=e[d],j="avg"===T,C=a[T]),r=b.start,v=b.end+(b.start-i.Axes.tickIncrement(b.start,b.size))/1e6;v>r&&c.length<5e3;)g=i.Axes.tickIncrement(r,b.size),c.push((r+g)/2),u.push(S),x&&_.push(r),E&&w.push(1/(g-r)),j&&k.push(0),r=g;var P=u.length;for(r=0;r<p.length;r++)m=o.findBin(p[r],_),m>=0&&P>m&&(A+=C(m,r,u,y,k));j&&(A=l(u,k)),z&&z(u,A,w);var I=Math.min(c.length,u.length),R=[],O=0,N=I-1;for(r=0;I>r;r++)if(u[r]){O=r;break}for(r=I-1;r>O;r--)if(u[r]){N=r;break}for(r=O;N>=r;r++)n(c[r])&&n(u[r])&&R.push({p:c[r],s:u[r],b:0});return R}}},{"../../lib":348,"../../plotly":365,"./average":463,"./bin_functions":465,"./norm_functions":469,"fast-isnumeric":74}],467:[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,c){function u(r,i){return n.coerce(t,e,l,r,i)}var h=u("x"),f=u("y");u("text");var d=u("orientation",f&&!h?"h":"v"),p=e["v"===d?"x":"y"];if(!p||!p.length)return void(e.visible=!1);var g=e["h"===d?"x":"y"];g&&u("histfunc");var v="h"===d?["y"]:["x"];o(t,e,u,v),a(t,e,u,r,c),s(t,e,i.defaultLine,{axis:"y"}),s(t,e,i.defaultLine,{axis:"x",inherit:"y"})}},{"../../components/color":299,"../../components/errorbars/defaults":322,"../../lib":348,"../bar/style_defaults":426,"./attributes":462,"./bin_defaults":464}],468:[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={description:["The sample data from which statistics are computed is set in `x`","for vertically spanning histograms and","in `y` for horizontally spanning histograms.","Binning options are set `xbins` and `ybins` respectively","if no aggregation data is provided."].join(" ")},e.exports=n},{"../../plots/cartesian":371,"../bar/hover":419,"../bar/layout_attributes":421,"../bar/layout_defaults":422,"../bar/plot":423,"../bar/set_positions":424,"../bar/style":425,"../scatter/colorbar":496,"./attributes":462,"./calc":466,"./defaults":467}],469:[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}}},{}],470:[function(t,e,r){"use strict";var n=t("../histogram/attributes"),i=t("../heatmap/attributes");e.exports={x:n.x,y:n.y,z:{valType:"data_array"},marker:{color:{valType:"data_array"}},histnorm:n.histnorm,histfunc:n.histfunc,autobinx:n.autobinx,nbinsx:n.nbinsx,xbins:n.xbins,autobiny:n.autobiny,nbinsy:n.nbinsy,ybins:n.ybins,zauto:i.zauto,zmin:i.zmin,zmax:i.zmax,colorscale:i.colorscale,autocolorscale:i.autocolorscale,reversescale:i.reversescale,showscale:i.showscale,zsmooth:i.zsmooth,_nestedModules:{colorbar:"Colorbar"}}},{"../heatmap/attributes":450,"../histogram/attributes":462}],471:[function(t,e,r){"use strict";var n=t("../../plotly"),i=t("../../lib"),o=t("../histogram/bin_functions"),a=t("../histogram/norm_functions"),s=t("../histogram/average");e.exports=function(t,e){var r,l,c,u,h,f,d=n.Axes.getFromId(t,e.xaxis||"x"),p=e.x?d.makeCalcdata(e,"x"):[],g=n.Axes.getFromId(t,e.yaxis||"y"),v=e.y?g.makeCalcdata(e,"y"):[],m=Math.min(p.length,v.length);p.length>m&&p.splice(m,p.length-m),v.length>m&&v.splice(m,v.length-m),i.markTime("done convert data"),!e.autobinx&&"xbins"in e||(e.xbins=n.Axes.autoBin(p,d,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=n.Axes.autoBin(v,g,e.nbinsy,"2d"),"histogram2dcontour"===e.type&&(e.ybins.start-=e.ybins.size,e.ybins.end+=e.ybins.size),e._input.ybins=e.ybins),i.markTime("done autoBin"),h=[];var y,b,x=[],_=[],w="string"==typeof e.xbins.size?[]:e.xbins,k="string"==typeof e.xbins.size?[]:e.ybins,A=0,M=[],T=e.histnorm,E=e.histfunc,L=-1!==T.indexOf("density"),S="max"===E||"min"===E,C=S?null:0,z=o.count,j=a[T],P=!1,I=[],R=[],O="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";O&&"count"!==E&&(P="avg"===E,z=o[E]);var N=e.xbins,D=N.end+(N.start-n.Axes.tickIncrement(N.start,N.size))/1e6;for(f=N.start;D>f;f=n.Axes.tickIncrement(f,N.size))x.push(C),Array.isArray(w)&&w.push(f),P&&_.push(0);Array.isArray(w)&&w.push(f);var F=x.length;for(r=e.xbins.start,l=(f-r)/F,r+=l/2,N=e.ybins,D=N.end+(N.start-n.Axes.tickIncrement(N.start,N.size))/1e6,f=N.start;D>f;f=n.Axes.tickIncrement(f,N.size))h.push(x.concat()),Array.isArray(k)&&k.push(f),P&&M.push(_.concat());Array.isArray(k)&&k.push(f);var B=h.length;for(c=e.ybins.start,u=(f-c)/B,c+=u/2,L&&(I=x.map(function(t,e){return Array.isArray(w)?1/(w[e+1]-w[e]):1/l}),R=h.map(function(t,e){return Array.isArray(k)?1/(k[e+1]-k[e]):1/u})),i.markTime("done making bins"),f=0;m>f;f++)y=i.findBin(p[f],w),b=i.findBin(v[f],k),y>=0&&F>y&&b>=0&&B>b&&(A+=z(y,f,h[b],O,M[b]));if(P)for(b=0;B>b;b++)A+=s(h[b],M[b]);if(j)for(b=0;B>b;b++)j(h[b],A,I,R[b]);return i.markTime("done binning"),{x:p,x0:r,dx:l,y:v,y0:c,dy:u,z:h}}},{"../../lib":348,"../../plotly":365,"../histogram/average":463,"../histogram/bin_functions":465,"../histogram/norm_functions":469}],472:[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":308,"../../lib":348,"./attributes":470,"./sample_defaults":474}],473:[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={description:["The sample data from which statistics are computed is set in `x`","and `y` (where `x` and `y` represent marginal distributions,","binning is set in `xbins` and `ybins` in this case)","or `z` (where `z` represent the 2D distribution and binning set,","binning is set by `x` and `y` in this case).","The resulting distribution is visualized as a heatmap."].join(" ")},e.exports=n},{"../../plots/cartesian":371,"../heatmap/calc":451,"../heatmap/colorbar":452,"../heatmap/hover":456,"../heatmap/plot":459,"../heatmap/style":460,"./attributes":470,"./defaults":472}],474:[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":464}],475:[function(t,e,r){"use strict";var n=t("../histogram2d/attributes"),i=t("../contour/attributes");e.exports={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,zauto:i.zauto,zmin:i.zmin,zmax:i.zmax,colorscale:i.colorscale,autocolorscale:i.autocolorscale,reversescale:i.reversescale,showscale:i.showscale,autocontour:i.autocontour,ncontours:i.ncontours,contours:i.contours,line:i.line,_nestedModules:{colorbar:"Colorbar"}}},{"../contour/attributes":441,"../histogram2d/attributes":470}],476:[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 c=n.coerce2(t,e,a,"contours.start"),u=n.coerce2(t,e,a,"contours.end"),h=l("autocontour",!(c&&u));l(h?"ncontours":"contours.size"),o(t,e,l,s)}},{"../../lib":348,"../contour/style_defaults":449,"../histogram2d/sample_defaults":474,"./attributes":475}],477:[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={description:["The sample data from which statistics are computed is set in `x`","and `y` (where `x` and `y` represent marginal distributions,","binning is set in `xbins` and `ybins` in this case)","or `z` (where `z` represent the 2D distribution and binning set,","binning is set by `x` and `y` in this case).","The resulting distribution is visualized as a contour plot."].join(" ")},e.exports=n},{"../../plots/cartesian":371,"../contour/calc":442,"../contour/colorbar":443,"../contour/hover":445,"../contour/plot":447,"../contour/style":448,"./attributes":475,"./defaults":476}],478:[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",description:["Sets the Delaunay axis from which the triangulation of the mesh","takes place.","An alternative to setting the `i`, `j`, `k` indices triplets."].join(" ")},alphahull:{valType:"number",dflt:-1,description:["Sets the shape of the mesh","If *-1*, Delaunay triangulation is used","If *>0*, the alpha-shape algorithm is used","If *0*, the convex-hull algorithm is used","An alternative to the `i`, `j`, `k` indices triplets."].join(" ")},intensity:{valType:"data_array",description:["Sets the vertex intensity values,","used for plotting fields on meshes"].join(" ")},color:{valType:"color"},vertexcolor:{valType:"data_array",description:["Sets the color of each vertex","Overrides *color*."].join(" ")},facecolor:{valType:"data_array",description:["Sets the color of each face","Overrides *color* and *vertexcolor*."].join(" ")},opacity:o({},i.opacity),flatshading:{valType:"boolean",dflt:!1,description:["Determines whether or not normal smoothing is applied to the meshes,","creating meshes with a low-poly look."].join(" ")},contour:{show:o({},i.contours.x.show,{description:["Sets whether or not dynamic contours are shown on hover"].join(" ")}),color:o({},i.contours.x.color),width:o({},i.contours.x.width)},colorscale:n.colorscale,reversescale:n.reversescale,showscale:n.showscale,lighting:o({},i.lighting),_nestedModules:{colorbar:"Colorbar"}}},{"../../components/colorscale/attributes":305,"../../lib/extend":344,"../surface/attributes":529}],479:[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=c(t[1]),n=r.toRgb();return{index:e,rgb:[n.r,n.g,n.b,1]}})}function o(t){return t.map(d)}function a(t,e,r){for(var n=new Array(t.length),i=0;i<t.length;++i)n[i]=[t[i],e[i],r[i]];return n}function s(t,e){var r=t.glplot.gl,i=l({gl:r}),o=new n(t,i,e.uid);return o.update(e),t.glplot.add(i),o}var l=t("gl-mesh3d"),c=t("tinycolor2"),u=t("delaunay-triangulate"),h=t("alpha-shape"),f=t("convex-hull"),d=t("../../lib/str2rgbarray"),p=n.prototype;p.handlePick=function(t){if(t.object===this.mesh){var e=t.data.index;return t.traceCoordinate=[this.data.x[e],this.data.y[e],this.data.z[e]],!0}},p.update=function(t){function e(t,e,r){return e.map(function(e){return t.d2l(e)*r})}var r=this.scene,n=r.fullSceneLayout;this.data=t;var s,l=a(e(n.xaxis,t.x,r.dataScale[0]),e(n.yaxis,t.y,r.dataScale[1]),e(n.zaxis,t.z,r.dataScale[2]));if(t.i&&t.j&&t.k)s=a(t.i,t.j,t.k);else if(0===t.alphahull)s=f(l);else if(t.alphahull>0)s=h(t.alphahull,l);else{var c=["x","y","z"].indexOf(t.delaunayaxis);s=u(l.map(function(t){return[t[(c+1)%3],t[(c+2)%3]]}))}var p={positions:l,cells:s,ambient:t.lighting.ambient,diffuse:t.lighting.diffuse,specular:t.lighting.specular,roughness:t.lighting.roughness,fresnel:t.lighting.fresnel,opacity:t.opacity,contourEnable:t.contour.show,contourColor:d(t.contour.color).slice(0,3),contourWidth:t.contour.width,useFacetNormals:t.flatshading};t.intensity?(this.color="#fff",p.vertexIntensity=t.intensity,p.colormap=i(t.colorscale)):t.vertexColor?(this.color=t.vertexColor[0],p.vertexColors=o(t.vertexColor)):t.faceColor?(this.color=t.faceColor[0],p.cellColors=o(t.faceColor)):(this.color=t.color,p.meshColor=d(t.color)),this.mesh.update(p)},p.dispose=function(){this.glplot.remove(this.mesh),this.mesh.dispose()},e.exports=s},{"../../lib/str2rgbarray":358,"alpha-shape":39,"convex-hull":60,"delaunay-triangulate":71,"gl-mesh3d":107,tinycolor2:229}],480:[function(t,e,r){"use strict";var n=t("../../plotly"),i=t("../../lib"),o=t("./attributes");e.exports=function(t,e,r,a){function s(r,n){return i.coerce(t,e,o,r,n)}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 c=l(["x","y","z"]),u=l(["i","j","k"]);return c?(u&&u.forEach(function(t){for(var e=0;e<t.length;++e)t[e]|=0}),["lighting.ambient","lighting.diffuse","lighting.specular","lighting.roughness","lighting.fresnel","contour.show","contour.color","contour.width","colorscale","reversescale","flatshading","alphahull","delaunayaxis","opacity"].forEach(function(t){s(t)}),"intensity"in t?(s("intensity"),s("showscale",!0)):(e.showscale=!1,"vertexColor"in t?s("vertexColor"):"faceColor"in t?s("faceColor"):s("color",r)),e.reversescale&&(e.colorscale=e.colorscale.map(function(t){return[1-t[0],t[1]]}).reverse()),void(e.showscale&&n.Colorbar.supplyDefaults(t,e,a))):void(e.visible=!1)}},{"../../lib":348,"../../plotly":365,"./attributes":478}],481:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../heatmap/colorbar"),n.plot=t("./convert"),n.moduleType="trace",n.name="mesh3d",n.basePlotModule=t("../../plots/gl3d"),n.categories=["gl3d"],n.meta={description:["Draws sets of triangles with coordinates given by","three 1-dimensional arrays in `x`, `y`, `z` and","(1) a sets of `i`, `j`, `k` indices","(2) Delaunay triangulation or","(3) the Alpha-shape algorithm or","(4) the Convex-hull algorithm"].join(" ")},e.exports=n},{"../../plots/gl3d":391,"../heatmap/colorbar":452,"./attributes":478,"./convert":479,"./defaults":480}],482:[function(t,e,r){"use strict";var n=t("../../components/color/attributes"),i=t("../../plots/font_attributes"),o=t("../../plots/attributes"),a=t("../../lib/extend").extendFlat;e.exports={labels:{valType:"data_array"},label0:{valType:"number",dflt:0,description:["Alternate to `labels`.","Builds a numeric set of labels.","Use with `dlabel`","where `label0` is the starting label and `dlabel` the step."].join(" ")},dlabel:{valType:"number",dflt:1},values:{valType:"data_array"},marker:{colors:{valType:"data_array",description:["Sets the color of each sector of this pie chart.","If not specified, the default trace color set is used","to pick the sector colors."].join(" ")},line:{color:{valType:"color",dflt:n.defaultLine,arrayOk:!0,description:["Sets the color of the line enclosing each sector."].join(" ")},width:{valType:"number",min:0,dflt:0,arrayOk:!0,description:["Sets the width (in px) of the line enclosing each sector."].join(" ")}}},text:{valType:"data_array"},scalegroup:{valType:"string",dflt:"",description:["If there are multiple pies that should be sized according to","their totals, link them by providing a non-empty group id here","shared by every trace in the same group."].join(" ")},textinfo:{valType:"flaglist",flags:["label","text","value","percent"],extras:["none"],description:["Determines which trace information appear on the graph."].join(" ")},hoverinfo:a({},o.hoverinfo,{flags:["label","text","value","percent","name"]}),textposition:{valType:"enumerated",values:["inside","outside","auto","none"],dflt:"auto",arrayOk:!0,description:["Specifies the location of the `textinfo`."].join(" ")},textfont:a({},i,{}),insidetextfont:a({},i,{}),outsidetextfont:a({},i,{}),domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1],description:["Sets the horizontal domain of this pie trace","(in plot fraction)."].join(" ")},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1],description:["Sets the vertical domain of this pie trace","(in plot fraction)."].join(" ")}},hole:{valType:"number",min:0,max:1,dflt:0,description:["Sets the fraction of the radius to cut out of the pie.","Use this to make a donut chart."].join(" ")},sort:{valType:"boolean",dflt:!0,description:["Determines whether or not the sectors of reordered","from largest to smallest."].join(" ")},direction:{valType:"enumerated",values:["clockwise","counterclockwise"],dflt:"counterclockwise",description:["Specifies the direction at which succeeding sectors follow","one another."].join(" ")},rotation:{valType:"number",min:-360,max:360,dflt:0,description:["Instead of the first slice starting at 12 o'clock,","rotate to some other angle."].join(" ")},pull:{valType:"number",min:0,max:1,dflt:0,arrayOk:!0,description:["Sets the fraction of larger radius to pull the sectors","out from the center. This can be a constant","to pull all slices apart from each other equally","or an array to highlight one or more slices."].join(" ")}}},{"../../components/color/attributes":298,"../../lib/extend":344,"../../plots/attributes":366,"../../plots/font_attributes":374}],483:[function(t,e,r){"use strict";function n(t){if(!l){var e=a.defaults;l=e.slice();var r;for(r=0;r<e.length;r++)l.push(o(e[r]).lighten(20).toHexString());for(r=0;r<a.defaults.length;r++)l.push(o(e[r]).darken(20).toHexString())}return l[t%l.length]}var i=t("fast-isnumeric"),o=t("tinycolor2"),a=t("../../components/color"),s=t("./helpers");e.exports=function(t,e){var r,l,c,u,h,f,d=e.values,p=e.labels,g=[],v=t._fullLayout,m=v._piecolormap,y={},b=!1,x=0,_=v.hiddenlabels||[];if(e.dlabel)for(p=new Array(d.length),r=0;r<d.length;r++)p[r]=String(e.label0+r*e.dlabel);for(r=0;r<d.length;r++)l=d[r],i(l)&&(l=+l,0>l||(c=p[r],(void 0===c||""===c)&&(c=r),c=String(c),void 0===y[c]&&(y[c]=!0,u=o(e.marker.colors[r]),u.isValid()?(u=a.addOpacity(u,u.getAlpha()),m[c]||(m[c]=u)):m[c]?u=m[c]:(u=!1,b=!0),h=-1!==_.indexOf(c),h||(x+=l),g.push({v:l,label:c,color:u,i:r,hidden:h}))));if(e.sort&&g.sort(function(t,e){return e.v-t.v;
}),b)for(r=0;r<g.length;r++)f=g[r],f.color===!1&&(m[f.label]=f.color=n(v._piedefaultcolorcount),v._piedefaultcolorcount++);if(g[0]&&(g[0].vTotal=x),e.textinfo&&"none"!==e.textinfo){var w,k=-1!==e.textinfo.indexOf("label"),A=-1!==e.textinfo.indexOf("text"),M=-1!==e.textinfo.indexOf("value"),T=-1!==e.textinfo.indexOf("percent");for(r=0;r<g.length;r++)f=g[r],w=k?[f.label]:[],A&&e.text[f.i]&&w.push(e.text[f.i]),M&&w.push(s.formatPieValue(f.v)),T&&w.push(s.formatPiePercent(f.v/x)),f.text=w.join("<br>")}return g};var l},{"../../components/color":299,"./helpers":485,"fast-isnumeric":74,tinycolor2:229}],484:[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 c=a("labels");Array.isArray(c)||(a("label0"),a("dlabel"));var u=a("marker.line.width");u&&a("marker.line.color");var h=a("marker.colors");Array.isArray(h)||(e.marker.colors=[]),a("scalegroup");var f=a("text"),d=a("textinfo",Array.isArray(f)?"text+percent":"percent");if(a("hoverinfo",1===o._dataLength?"label+text+value+percent":void 0),d&&"none"!==d){var p=a("textposition"),g=Array.isArray(p)||"auto"===p,v=g||"inside"===p,m=g||"outside"===p;if(v||m){var y=s(a,"textfont",o.font);v&&s(a,"insidetextfont",y),m&&s(a,"outsidetextfont",y)}}a("domain.x"),a("domain.y"),a("hole"),a("sort"),a("direction"),a("rotation"),a("pull")}},{"../../lib":348,"./attributes":482}],485:[function(t,e,r){"use strict";r.formatPiePercent=function(t){var e=(100*t).toPrecision(3);return-1!==e.indexOf(".")?e.replace(/[.]?0+$/,"")+"%":e+"%"},r.formatPieValue=function(t){var e=t.toPrecision(10);return-1!==e.indexOf(".")?e.replace(/[.]?0+$/,""):e}},{}],486:[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("../../plots/cartesian"),n.categories=["pie","showLegend"],n.meta={description:["A data visualized by the sectors of the pie is set in `values`.","The sector labels are set in `labels`.","The sector colors are set in `marker.colors`"].join(" ")},e.exports=n},{"../../plots/cartesian":371,"./attributes":482,"./calc":483,"./defaults":484,"./layout_attributes":487,"./layout_defaults":488,"./plot":489,"./style":490,"./style_one":491}],487:[function(t,e,r){"use strict";e.exports={hiddenlabels:{valType:"data_array"}}},{}],488:[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":348,"./layout_attributes":487}],489:[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),c={scale:l*r.r*2/n,rCenter:1-l,rotate:0};if(c.scale>=1)return c;var u=o+1/(2*Math.tan(a)),h=r.r*Math.min(1/(Math.sqrt(u*u+.5)+u),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},d=1/o,p=d+1/(2*Math.tan(a)),g=r.r*Math.min(1/(Math.sqrt(p*p+.5)+p),s/(Math.sqrt(d*d+s/2)+d)),v={scale:2*g/t.width,rCenter:Math.cos(g/r.r)-g/o/r.r,rotate:(180/Math.PI*e.midangle+810)%180-90},m=v.scale>f.scale?v:f;return c.scale<1&&m.scale>c.scale?m:c}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,d,g=r.labelExtraY+(a?r.yLabelMax:r.yLabelMin),v=a?t.yLabelMin:t.yLabelMax,m=a?t.yLabelMax:t.yLabelMin,y=t.cyFinal+c(t.px0[1],t.px1[1]),b=g-v;if(b*h>0&&(t.labelExtraY=b),Array.isArray(e.pull))for(i=0;i<p.length;i++)o=p[i],o===t||(e.pull[t.i]||0)>=e.pull[o.i]||((t.pxmid[1]-o.pxmid[1])*h>0?(s=o.cyFinal+c(o.px0[1],o.px1[1]),b=s-v-t.labelExtraY,b*h>0&&(t.labelExtraY+=b)):(m+t.labelExtraY-y)*h>0&&(n=3*u*Math.abs(i-p.indexOf(t)),f=o.cxFinal+l(o.px0[0],o.px1[0]),d=f+n-(t.cxFinal+t.pxmid[0])-t.labelExtraX,d*u>0&&(t.labelExtraX+=d)))}var o,a,s,l,c,u,h,f,d,p,g,v,m;for(a=0;2>a;a++)for(s=a?r:n,c=a?Math.max:Math.min,h=a?1:-1,o=0;2>o;o++){for(l=o?Math.max:Math.min,u=o?1:-1,f=t[a][o],f.sort(s),d=t[1-a][o],p=d.concat(f),v=[],g=0;g<f.length;g++)void 0!==f[g].yLabelMid&&v.push(f[g]);for(m=!1,g=0;a&&g<d.length;g++)if(void 0!==d[g].yLabelMid){m=d[g];break}for(g=0;g<v.length;g++){var y=g&&v[g-1];m&&!g&&(y=m),i(v[g],y)}}}function s(t,e){var r,n,i,o,a,s,l,u,h,f,d=[];for(i=0;i<t.length;i++){if(a=t[i][0],s=a.trace,r=e.w*(s.domain.x[1]-s.domain.x[0]),n=e.h*(s.domain.y[1]-s.domain.y[0]),l=s.tiltaxis*Math.PI/180,u=s.pull,Array.isArray(u))for(u=0,o=0;o<s.pull.length;o++)s.pull[o]>u&&(u=s.pull[o]);a.r=Math.min(r/c(s.tilt,Math.sin(l),s.depth),n/c(s.tilt,Math.cos(l),s.depth))/(2+2*u),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===d.indexOf(s.scalegroup)&&d.push(s.scalegroup)}for(o=0;o<d.length;o++){for(f=1/0,h=d[o],i=0;i<t.length;i++)a=t[i][0],a.trace.scalegroup===h&&(f=Math.min(f,a.r*a.r/a.vTotal));for(i=0;i<t.length;i++)a=t[i][0],a.trace.scalegroup===h&&(a.r=Math.sqrt(f*a.vTotal))}}function l(t){function e(t){var e=h.r*Math.sin(t),r=-h.r*Math.cos(t);return d?[e*(1-s*n*n)+r*a*s,e*a*s+r*(1-s*i*i),Math.sin(o)*(r*i-e*n)]:[e,r]}var r,n,i,o,a,s,l,c,u,h=t[0],f=h.trace,d=f.tilt,p=f.rotation*Math.PI/180,g=2*Math.PI/h.vTotal,v="px0",m="px1";if("counterclockwise"===f.direction){for(l=0;l<t.length&&t[l].hidden;l++);if(l===t.length)return;p+=g*t[l].v,g*=-1,v="px1",m="px0"}for(d&&(o=d*Math.PI/180,r=f.tiltaxis*Math.PI/180,a=Math.sin(r)*Math.cos(r),s=1-Math.cos(o),n=Math.sin(r),i=Math.cos(r)),u=e(p),l=0;l<t.length;l++)c=t[l],c.hidden||(c[v]=u,p+=g*c.v/2,c.pxmid=e(p),c.midangle=p,p+=g*c.v/2,u=e(p),c[m]=u,c.largeArc=c.v>h.vTotal/2?1:0)}function c(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 u=t("d3"),h=t("../../plotly"),f=t("../../components/color"),d=t("./helpers");e.exports=function(t,e){var r=t._fullLayout;s(e,r._size);var c=r._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 s=u.select(this),c=e[0],p=c.trace,g=0,v=(p.depth||0)*c.r*Math.sin(g)/2,m=p.tiltaxis||0,y=m*Math.PI/180,b=[v*Math.sin(y),v*Math.cos(y)],x=c.r*Math.cos(g),_=s.selectAll("g.part").data(p.tilt?["top","sides"]:["top"]);_.enter().append("g").attr("class",function(t){return t+" part"}),_.exit().remove(),_.order(),l(e),s.selectAll(".top").each(function(){var s=u.select(this).selectAll("g.slice").data(e);s.enter().append("g").classed("slice",!0),s.exit().remove();var l=[[[],[]],[[],[]]],g=!1;s.each(function(a){function s(e){var r=t._fullLayout,n=t._fullData[p.index],o=n.hoverinfo;if("all"===o&&(o="label+text+value+percent+name"),!t._dragging&&r.hovermode!==!1&&"none"!==o&&o){var s=i(a,c),l=_+a.pxmid[0]*(1-s),u=w+a.pxmid[1]*(1-s),f=[];-1!==o.indexOf("label")&&f.push(a.label),n.text&&n.text[a.i]&&-1!==o.indexOf("text")&&f.push(n.text[a.i]),-1!==o.indexOf("value")&&f.push(d.formatPieValue(a.v)),-1!==o.indexOf("percent")&&f.push(d.formatPiePercent(a.v/c.vTotal)),h.Fx.loneHover({x0:l-s*c.r,x1:l+s*c.r,y:u,text:f.join("<br>"),name:-1!==o.indexOf("name")?n.name:void 0,color:a.color,idealAlign:a.pxmid[0]<0?"left":"right"},{container:r._hoverlayer.node(),outerContainer:r._paper.node()}),h.Fx.hover(t,e,"pie"),M=!0}}function f(){M&&(h.Fx.loneUnhover(r._hoverlayer.node()),M=!1)}function v(){t._hoverdata=[a],t._hoverdata.trace=e.trace,h.Fx.click(t,{target:!0})}function y(t,e,r,n){return"a"+n*c.r+","+n*x+" "+m+" "+a.largeArc+(r?" 1 ":" 0 ")+n*(e[0]-t[0])+","+n*(e[1]-t[1])}if(a.hidden)return void u.select(this).selectAll("path,g").remove();l[a.pxmid[1]<0?0:1][a.pxmid[0]<0?0:1].push(a);var _=c.cx+b[0],w=c.cy+b[1],k=u.select(this),A=k.selectAll("path.surface").data([a]),M=!1;if(A.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),k.select("path.textline").remove(),k.on("mouseover",s).on("mouseout",f).on("click",v),p.pull){var T=+(Array.isArray(p.pull)?p.pull[a.i]:p.pull)||0;T>0&&(_+=T*a.pxmid[0],w+=T*a.pxmid[1])}a.cxFinal=_,a.cyFinal=w;var E=p.hole;if(a.v===c.vTotal){var L="M"+(_+a.px0[0])+","+(w+a.px0[1])+y(a.px0,a.pxmid,!0,1)+y(a.pxmid,a.px0,!0,1)+"Z";E?A.attr("d","M"+(_+E*a.px0[0])+","+(w+E*a.px0[1])+y(a.px0,a.pxmid,!1,E)+y(a.pxmid,a.px0,!1,E)+"Z"+L):A.attr("d",L)}else{var S=y(a.px0,a.px1,!0,1);if(E){var C=1-E;A.attr("d","M"+(_+E*a.px1[0])+","+(w+E*a.px1[1])+y(a.px1,a.px0,!1,E)+"l"+C*a.px0[0]+","+C*a.px0[1]+S+"Z")}else A.attr("d","M"+_+","+w+"l"+a.px0[0]+","+a.px0[1]+S+"Z")}var z=Array.isArray(p.textposition)?p.textposition[a.i]:p.textposition,j=k.selectAll("g.slicetext").data(a.text&&"none"!==z?[0]:[]);j.enter().append("g").classed("slicetext",!0),j.exit().remove(),j.each(function(){var t=u.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(h.Drawing.font,"outside"===z?p.outsidetextfont:p.insidetextfont).call(h.util.convertToTspans),t.selectAll("tspan.line").attr({x:0,y:0});var e,r=h.Drawing.bBox(t.node());"outside"===z?e=o(r,a):(e=n(r,a,c),"auto"===z&&e.scale<1&&(t.call(h.Drawing.font,p.outsidetextfont),(p.outsidetextfont.family!==p.insidetextfont.family||p.outsidetextfont.size!==p.insidetextfont.size)&&(t.attr({"data-bb":""}),r=h.Drawing.bBox(t.node())),e=o(r,a)));var i=_+a.pxmid[0]*e.rCenter+(e.x||0),s=w+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,g=!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+")")})}),g&&a(l,p),s.each(function(t){if(t.labelExtraX||t.labelExtraY){var e=u.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,p.outsidetextfont.color).attr({"stroke-width":Math.min(2,p.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":299,"../../plotly":365,"./helpers":485,d3:70}],490:[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":491,d3:70}],491:[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":299}],492:[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":348}],493:[function(t,e,r){"use strict";var n=t("../../components/drawing"),i=t("./constants");e.exports={x:{valType:"data_array"},x0:{valType:"any",dflt:0,description:["Alternate to `x`.","Builds a linear space of x coordinates.","Use with `dx`","where `x0` is the starting coordinate and `dx` the step."].join(" ")},dx:{valType:"number",dflt:1,description:["Sets the x coordinate step.","See `x0` for more info."].join(" ")},y:{valType:"data_array"},y0:{valType:"any",dflt:0,description:["Alternate to `y`.","Builds a linear space of y coordinates.","Use with `dy`","where `y0` is the starting coordinate and `dy` the step."].join(" ")},dy:{valType:"number",dflt:1,description:["Sets the y coordinate step.","See `y0` for more info."].join(" ")},text:{valType:"string",dflt:"",arrayOk:!0,description:["Sets text elements associated with each (x,y) pair.","If a single string, the same string appears over","all the data points.","If an array of string, the items are mapped in order to the","this trace's (x,y) coordinates."].join(" ")},mode:{valType:"flaglist",flags:["lines","markers","text"],extras:["none"],description:["Determines the drawing mode for this scatter trace.","If the provided `mode` includes *text* then the `text` elements","appear at the coordinates. Otherwise, the `text` elements","appear on hover.","If there are less than "+i.PTS_LINESONLY+" points,","then the default is *lines+markers*. Otherwise, *lines*."].join(" ")},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2},shape:{valType:"enumerated",values:["linear","spline","hv","vh","hvh","vhv"],dflt:"linear",description:["Determines the line shape.","With *spline* the lines are drawn using spline interpolation.","The other available values correspond to step-wise line shapes."].join(" ")},smoothing:{valType:"number",min:0,max:1.3,dflt:1,description:["Has only an effect if `shape` is set to *spline*","Sets the amount of smoothing.","*0* corresponds to no smoothing (equivalent to a *linear* shape)."].join(" ")},dash:{valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid",description:["Sets the style of the lines. Set to a dash string type","or a dash length in px."].join(" ")}},connectgaps:{valType:"boolean",dflt:!1,description:["Determines whether or not gaps","(i.e. {nan} or missing values)","in the provided data arrays are connected."].join(" ")},fill:{valType:"enumerated",values:["none","tozeroy","tozerox","tonexty","tonextx"],dflt:"none",description:["Sets the area to fill with a solid color.","Use with `fillcolor`."].join(" ")},fillcolor:{valType:"color"},marker:{symbol:{valType:"enumerated",values:n.symbolList,dflt:"circle",arrayOk:!0,description:["Sets the marker symbol type.","Adding 100 is equivalent to appending *-open* to a symbol name.","Adding 200 is equivalent to appending *-dot* to a symbol name.","Adding 300 is equivalent to appending *-open-dot*","or *dot-open* to a symbol name."].join(" ")},opacity:{valType:"number",min:0,max:1,arrayOk:!0},size:{valType:"number",min:0,dflt:6,arrayOk:!0},color:{valType:"color",arrayOk:!0},maxdisplayed:{valType:"number",min:0,dflt:0,description:["Sets a maximum number of points to be drawn on the graph.","*0* corresponds to no limit."].join(" ")},sizeref:{valType:"number",dflt:1,description:["Has only an effect if `marker.size` is set to a numerical array.","Sets the scale factor used to determine the rendered size of","marker points. Use with `sizemin` and `sizemode`."].join(" ")},sizemin:{valType:"number",min:0,dflt:0,description:["Has only an effect if `marker.size` is set to a numerical array.","Sets the minimum size (in px) of the rendered marker points."].join(" ")},sizemode:{valType:"enumerated",values:["diameter","area"],dflt:"diameter",description:["Has only an effect if `marker.size` is set to a numerical array.","Sets the rule for which the data in `size` is converted","to pixels."].join(" ")},colorscale:{valType:"colorscale",description:["Sets the colorscale.","The colorscale must be an array containing","arrays mapping a normalized value to an","rgb, rgba, hex, hsl, hsv, or named color string.","At minimum, a mapping for the lowest (0) and highest (1)","values are required. For example,","`[[0, 'rgb(0,0,255)', [1, 'rgb(255,0,0)']]`.","To control the bounds of the colorscale in color space,","use cmin and cmax"].join(" ")},cauto:{valType:"boolean",dflt:!0,description:["Has only an effect if `marker.color` is set to a numerical array.","Determines the whether or not the color domain is computed","automatically."].join(" ")},cmax:{valType:"number",dflt:null,description:["Has only an effect if `marker.color` is set to a numerical array.","Sets the upper bound of the color domain."].join(" ")},cmin:{valType:"number",dflt:null,description:["Has only an effect if `marker.color` is set to a numerical array.","Sets the lower bound of the color domain."].join(" ")},autocolorscale:{valType:"boolean",dflt:!0,description:["Has only an effect if `marker.color` is set to a numerical array.","Determines whether or not the colorscale is picked using","values inside `marker.color`."].join(" ")},reversescale:{valType:"boolean",dflt:!1,description:["Has only an effect if `marker.color` is set to a numerical array.","Reverses the colorscale."].join(" ")},showscale:{valType:"boolean",dflt:!1,description:["Has only an effect if `marker.color` is set to a numerical array.","Determines whether or not a colorbar is displayed."].join(" ")},line:{color:{valType:"color",arrayOk:!0},width:{valType:"number",min:0,arrayOk:!0},colorscale:{valType:"colorscale",description:["Has only an effect if `marker.line.color` is set to a numerical array.","Sets the colorscale."].join(" ")},cauto:{valType:"boolean",dflt:!0,description:["Has only an effect if `marker.line.color` is set to a numerical array.","Determines the whether or not the color domain is computed","with respect to the input data."].join(" ")},cmax:{valType:"number",dflt:null,description:["Has only an effect if `marker.line.color` is set to a numerical array.","Sets the upper bound of the color domain."].join(" ")},cmin:{valType:"number",dflt:null,description:["Has only an effect if `marker.line.color` is set to a numerical array.","Sets the lower bound of the color domain."].join(" ")},autocolorscale:{valType:"boolean",dflt:!0,description:["Has only an effect if `marker.line.color` is set to a numerical array.","Determines whether or not the colorscale is picked using","the sign of values inside `marker.line.color`."].join(" ")},reversescale:{valType:"boolean",dflt:!1,description:["Has only an effect if `marker.line.color` is set to a numerical array.","Reverses the colorscale."].join(" ")}}},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,description:["Sets the positions of the `text` elements","with respects to the (x,y) coordinates."].join(" ")},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",description:["For polar chart only.","Sets the radial coordinates."].join("")},t:{valType:"data_array",description:["For polar chart only.","Sets the angular coordinates."].join("")},_nestedModules:{error_y:"ErrorBars",error_x:"ErrorBars","marker.colorbar":"Colorbar"}}},{"../../components/drawing":317,"./constants":497}],494:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/cartesian/axes"),o=t("../../lib"),a=t("./subtypes"),s=t("./marker_colorscale_calc");e.exports=function(t,e){var r=i.getFromId(t,e.xaxis||"x"),l=i.getFromId(t,e.yaxis||"y");o.markTime("in Scatter.calc");var c=r.makeCalcdata(e,"x");o.markTime("finished convert x");var u=l.makeCalcdata(e,"y");o.markTime("finished convert y");var h,f,d,p=Math.min(c.length,u.length);r._minDtick=0,l._minDtick=0,c.length>p&&c.splice(p,c.length-p),u.length>p&&u.splice(p,u.length-p);var g={padded:!0},v={padded:!0};if(a.hasMarkers(e)){if(h=e.marker,f=h.size,Array.isArray(f)){var m={type:"linear"};i.setConvert(m),f=m.makeCalcdata(e.marker,"size"),f.length>p&&f.splice(p,f.length-p)}var y,b=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/b),3)}:function(t){return Math.max((t||0)/b,3)},g.ppad=v.ppad=Array.isArray(f)?f.map(y):y(f)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||c[0]===c[p-1]&&u[0]===u[p-1]?e.error_y.visible||-1===["tonexty","tozeroy"].indexOf(e.fill)&&(a.hasMarkers(e)||a.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||c[0]===c[p-1]&&u[0]===u[p-1]?-1!==["tonextx","tozerox"].indexOf(e.fill)&&(v.padded=!1):v.tozero=!0,o.markTime("ready for Axes.expand"),i.expand(r,c,g),o.markTime("done expand x"),i.expand(l,u,v),o.markTime("done expand y");var x=new Array(p);for(d=0;p>d;d++)x[d]=n(c[d])&&n(u[d])?{x:c[d],y:u[d]}:{x:!1,y:!1};return void 0!==typeof f&&o.mergeArray(f,x,"ms"),t.firstscatter=!1,x}},{"../../lib":348,"../../plots/cartesian/axes":368,"./marker_colorscale_calc":506,"./subtypes":511,"fast-isnumeric":74}],495:[function(t,e,r){"use strict";e.exports=function(t){var e,r,n,i,o;for(e=0;e<t.length;e++)if(r=t[e],n=r.fill,"none"!==n&&"scatter"===r.type&&(r.opacity=void 0,"tonexty"===n||"tonextx"===n))for(i=e-1;i>=0;i--)if(o=t[i],"scatter"===o.type&&o.xaxis===r.xaxis&&o.yaxis===r.yaxis){o.opacity=void 0;break}}},{}],496:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),o=t("../../plotly"),a=t("../../lib"),s=t("../../components/colorscale/get_scale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,c=r.marker,u="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+u).remove(),void 0===c||!c.showscale)return void o.Plots.autoMargin(t,u);var h=s(c.colorscale),f=c.color,d=c.cmin,p=c.cmax;i(d)||(d=o.Lib.aggNums(Math.min,null,f)),i(p)||(p=o.Lib.aggNums(Math.max,null,f));var g=e[0].t.cb=l(t,u);g.fillcolor(n.scale.linear().domain(h.map(function(t){return d+t[0]*(p-d)})).range(h.map(function(t){return t[1]}))).filllevels({start:d,end:p,size:(p-d)/254}).options(c.colorbar)(),a.markTime("done colorbar")}},{"../../components/colorbar/draw":302,"../../components/colorscale/get_scale":310,"../../lib":348,"../../plotly":365,d3:70,"fast-isnumeric":74}],497:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],498:[function(t,e,r){"use strict";function n(t,e,r){var n=r("line.shape");"spline"===n&&r("line.smoothing")}var i=t("../../lib"),o=t("./attributes"),a=t("./constants"),s=t("./subtypes"),l=t("./xy_defaults"),c=t("./marker_defaults"),u=t("./line_defaults"),h=t("./text_defaults"),f=t("./fillcolor_defaults"),d=t("../../components/errorbars/defaults");e.exports=function(t,e,r,p){function g(r,n){return i.coerce(t,e,o,r,n)}var v=l(t,e,g),m=v<a.PTS_LINESONLY?"lines+markers":"lines";return v?(g("text"),g("mode",m),s.hasLines(e)&&(u(t,e,r,g),n(t,e,g),g("connectgaps")),s.hasMarkers(e)&&c(t,e,r,p,g),s.hasText(e)&&h(t,e,p,g),(s.hasMarkers(e)||s.hasText(e))&&g("marker.maxdisplayed"),g("fill"),"none"!==e.fill&&(f(t,e,r,g),s.hasLines(e)||n(t,e,g)),d(t,e,r,{axis:"y"}),void d(t,e,r,{axis:"x",inherit:"y"})):void(e.visible=!1)}},{"../../components/errorbars/defaults":322,"../../lib":348,"./attributes":493,"./constants":497,"./fillcolor_defaults":499,"./line_defaults":503,"./marker_defaults":507,"./subtypes":511,"./text_defaults":512,"./xy_defaults":513}],499:[function(t,e,r){"use strict";var n=t("../../components/color");e.exports=function(t,e,r,i){var o=!1;if(e.marker){var a=e.marker.color,s=(e.marker.line||{}).color;a&&!Array.isArray(a)?o=a:s&&!Array.isArray(s)&&(o=s)}i("fillcolor",n.addOpacity((e.line||{}).color||o||r,.5))}},{"../../components/color":299}],500:[function(t,e,r){"use strict";var n=t("../../components/color"),i=t("./subtypes");e.exports=function(t,e){var r,o;if("lines"===t.mode)return r=t.line.color,r&&n.opacity(r)?r:t.fillcolor;if("none"===t.mode)return t.fill?t.fillcolor:"";var a=e.mcc||(t.marker||{}).color,s=e.mlcc||((t.marker||{}).line||{}).color;return o=a&&n.opacity(a)?a:s&&n.opacity(s)&&(e.mlw||((t.marker||{}).line||{}).width)?s:"",o?n.opacity(o)<.3?n.addOpacity(o,.3):o:(r=(t.line||{}).color,r&&n.opacity(r)&&i.hasLines(t)&&t.line.width?r:t.fillcolor)}},{"../../components/color":299,"./subtypes":511}],501:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/graph_interact"),i=t("../../components/errorbars"),o=t("./get_trace_color");e.exports=function(t,e,r,a){var s=t.cd,l=s[0].trace,c=t.xa,u=t.ya,h=function(t){var r=Math.max(3,t.mrc||0);return Math.max(Math.abs(c.c2p(t.x)-c.c2p(e))-r,1-3/r)},f=function(t){var e=Math.max(3,t.mrc||0);return Math.max(Math.abs(u.c2p(t.y)-u.c2p(r))-e,1-3/e)},d=function(t){var n=Math.max(3,t.mrc||0),i=Math.abs(c.c2p(t.x)-c.c2p(e)),o=Math.abs(u.c2p(t.y)-u.c2p(r));return Math.max(Math.sqrt(i*i+o*o)-n,1-3/n)},p=n.getDistanceFunction(a,h,f,d);if(n.getClosest(s,p,t),t.index!==!1){var g=s[t.index],v=c.c2p(g.x,!0),m=u.c2p(g.y,!0),y=g.mrc||1;return t.color=o(l,g),t.x0=v-y,t.x1=v+y,t.xLabelVal=g.x,t.y0=m-y,t.y1=m+y,t.yLabelVal=g.y,g.tx?t.text=g.tx:l.text&&(t.text=l.text),i.hoverInfo(g,l,t),[t]}}},{"../../components/errorbars":323,"../../plots/cartesian/graph_interact":370,"./get_trace_color":500}],502:[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={description:["The scatter trace type encompasses line charts, scatter charts, text charts, and bubble charts.","The data visualized as scatter point or lines is set in `x` and `y`.","Text (appearing either on the chart or on hover only) is via `text`.","Bubble charts are achieved by setting `marker.size` and/or `marker.color`","to a numerical arrays."].join(" ")},e.exports=n},{"../../plots/cartesian":371,"./arrays_to_calcdata":492,"./attributes":493,"./calc":494,"./clean_data":495,"./colorbar":496,"./defaults":498,"./hover":501,"./plot":508,"./select":509,"./style":510,"./subtypes":511}],503:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){var i=(t.marker||{}).color;n("line.color",(Array.isArray(i)?!1:i)||r),n("line.width"),n("line.dash")}},{}],504:[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=k.c2p(t[e].y);return r===L||n===L?!1:[r,n]}function i(t){var e=t[0]/w._length,r=t[1]/k._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*M}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,c,u,h,f,d,p,g,v,m,y,b,x,_,w=e.xaxis,k=e.yaxis,A=e.connectGaps,M=e.baseTolerance,T=e.linear,E=[],L=n.BADNUM,S=.2,C=new Array(t.length),z=0;for(a=0;a<t.length;a++)if(s=r(a)){for(z=0,C[z++]=s,a++;a<t.length;a++){if(c=r(a),!c){if(A)continue;break}if(T){if(f=o(c,s),!(f<i(c)*S)){for(p=[(c[0]-s[0])/f,(c[1]-s[1])/f],u=s,v=f,m=b=x=0,d=!1,l=c,a++;a<t.length;a++){if(h=r(a),!h){if(A)continue;break}if(g=[h[0]-s[0],h[1]-s[1]],_=g[0]*p[1]-g[1]*p[0],b=Math.min(b,_),x=Math.max(x,_),x-b>i(h))break;l=h,y=g[0]*p[0]+g[1]*p[1],y>v?(v=y,c=h,d=!1):m>y&&(m=y,u=h,d=!0)}if(d?(C[z++]=c,l!==u&&(C[z++]=u)):(u!==s&&(C[z++]=u),l!==c&&(C[z++]=c)),C[z++]=l,a>=t.length||!h)break;C[z++]=h,s=h}}else C[z++]=c}E.push(C.slice(0,z))}return E}},{"../../plots/cartesian/axes":368}],505:[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":74}],506:[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){if(o.hasMarkers(t)){var e=t.marker;n(t,"marker")&&i(t,e.color,"marker","c"),n(t,"marker.line")&&i(t,e.line.color,"marker.line","c")}}},{"../../components/colorscale/calc":306,"../../components/colorscale/has_colorscale":311,"./subtypes":511}],507:[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 c,u=a.isBubble(t),h=(t.line||{}).color;h&&(r=h),l("marker.symbol"),l("marker.opacity",u?.7:1),l("marker.size"),l("marker.color",r),i(t,"marker")&&o(t,e,s,l,{prefix:"marker.",cLetter:"c"}),c=h&&e.marker.color!==h?h:u?n.background:n.defaultLine,l("marker.line.color",c),i(t,"marker.line")&&o(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",u?1:0),u&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode"))}},{"../../components/color":299,"../../components/colorscale/defaults":308,"../../components/colorscale/has_colorscale":311,"./subtypes":511}],508:[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)),l=i.extent(o.range.map(o.l2c));r.forEach(function(t,e){var n=t[0].trace;if(s.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>=l[0]&&t.y<=l[1]}),c=Math.ceil(o.length/i),u=0;r.forEach(function(t,r){var n=t[0].trace;s.hasMarkers(n)&&n.marker.maxdisplayed>0&&e>r&&u++});var h=Math.round(u*c/3+Math.floor(u/3)*c/7.1);t.forEach(function(t){delete t.vis}),o.forEach(function(t,e){0===Math.round((e+h)%c)&&(t.vis=!0)})}}})}var i=t("d3"),o=t("../../lib"),a=t("../../components/drawing"),s=t("./subtypes"),l=t("./arrays_to_calcdata"),c=t("./line_points");e.exports=function(t,e,r){function u(t){return t.filter(function(t){return t.vis})}n(t,e,r);var h=e.x(),f=e.y(),d=e.plot.select(".scatterlayer").selectAll("g.trace.scatter").data(r);d.enter().append("g").attr("class","trace scatter").style("stroke-miterlimit",2);var p,g,v,m="";d.each(function(t){var e=t[0].trace,r=e.line,n=i.select(this);if(e.visible===!0&&(t[0].node3=n,l(t),s.hasLines(e)||"none"!==e.fill)){var o,u,d,y,b="",x="";p="tozero"===e.fill.substr(0,6)||"to"===e.fill.substr(0,2)&&!m?n.append("path").classed("js-fill",!0):null,v&&(g=v.datum(t)),v=n.append("path").classed("js-fill",!0),-1!==["hv","vh","hvh","vhv"].indexOf(r.shape)?(u=a.steps(r.shape),d=a.steps(r.shape.split("").reverse().join(""))):u=d="spline"===r.shape?function(t){return a.smoothopen(t,r.smoothing)}:function(t){return"M"+t.join("L")},y=function(t){return"L"+d(t.reverse()).substr(1)};var _=c(t,{xaxis:h,yaxis:f,connectGaps:e.connectgaps,baseTolerance:Math.max(r.width||1,3)/4,linear:"linear"===r.shape});if(_.length){for(var w=_[0][0],k=_[_.length-1],A=k[k.length-1],M=0;M<_.length;M++){var T=_[M];o=u(T),b+=b?"L"+o.substr(1):o,x=y(T)+x,s.hasLines(e)&&T.length>1&&n.append("path").classed("js-line",!0).attr("d",o)}p?w&&A&&("y"===e.fill.charAt(e.fill.length-1)?w[1]=A[1]=f.c2p(0,!0):w[0]=A[0]=h.c2p(0,!0),p.attr("d",b+"L"+A+"L"+w+"Z")):"tonext"===e.fill.substr(0,6)&&b&&m&&g.attr("d",b+m+"Z"),m=x}}}),d.selectAll("path:not([d])").remove(),d.append("g").attr("class","points").each(function(t){
var e=t[0].trace,r=i.select(this),n=s.hasMarkers(e),l=s.hasText(e);!n&&!l||e.visible!==!0?r.remove():(n&&r.selectAll("path.point").data(e.marker.maxdisplayed?u:o.identity).enter().append("path").classed("point",!0).call(a.translatePoints,h,f),l&&r.selectAll("g").data(e.marker.maxdisplayed?u:o.identity).enter().append("g").append("text").call(a.translatePoints,h,f))})}},{"../../components/drawing":317,"../../lib":348,"./arrays_to_calcdata":492,"./line_points":504,"./subtypes":511,d3:70}],509:[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,c=t.xaxis,u=t.yaxis,h=[],f=l[0].trace,d=f.index,p=f.marker;if(n.hasMarkers(f)||n.hasText(f)){var g=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(r=0;r<l.length;r++)l[r].dim=0;else for(r=0;r<l.length;r++)o=l[r],a=c.c2p(o.x),s=u.c2p(o.y),e.contains([a,s])?(h.push({curveNumber:d,pointNumber:r,x:o.x,y:o.y}),o.dim=0):o.dim=1;return l[0].node3.selectAll("path.point").style("opacity",function(t){return((t.mo+1||g+1)-1)*(t.dim?i:1)}),l[0].node3.selectAll("text").style("opacity",function(t){return t.dim?i:1}),h}}},{"./subtypes":511}],510:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../components/drawing");e.exports=function(t){var e=n.select(t).selectAll("g.trace.scatter");e.style("opacity",function(t){return t[0].trace.opacity}),e.selectAll("g.points").each(function(t){n.select(this).selectAll("path.point").call(i.pointStyle,t.trace||t[0].trace),n.select(this).selectAll("text").call(i.textPointStyle,t.trace||t[0].trace)}),e.selectAll("g.trace path.js-line").call(i.lineGroupStyle),e.selectAll("g.trace path.js-fill").call(i.fillGroupStyle)}},{"../../components/drawing":317,d3:70}],511:[function(t,e,r){"use strict";e.exports={hasLines:function(t){return t.visible&&t.mode&&-1!==t.mode.indexOf("lines")},hasMarkers:function(t){return t.visible&&t.mode&&-1!==t.mode.indexOf("markers")},hasText:function(t){return t.visible&&t.mode&&-1!==t.mode.indexOf("text")},isBubble:function(t){return"object"==typeof t.marker&&Array.isArray(t.marker.size)}}},{}],512:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r,i){i("textposition"),n.coerceFont(i,"textfont",r.font)}},{"../../lib":348}],513:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n,i=r("x"),o=r("y");if(i)o?(n=Math.min(i.length,o.length),n<i.length&&(e.x=i.slice(0,n)),n<o.length&&(e.y=o.slice(0,n))):(n=i.length,r("y0"),r("dy"));else{if(!o)return 0;n=e.y.length,r("x0"),r("dx")}return n}},{}],514:[function(t,e,r){"use strict";function n(t){return{show:{valType:"boolean",dflt:!1,description:["Sets whether or not projections are shown along the",t,"axis."].join(" ")},opacity:{valType:"number",min:0,max:1,dflt:1},scale:{valType:"number",min:0,max:10,dflt:2/3,description:["Sets the scale factor determining the size of the","projection marker points."].join(" ")}}}var i=t("../scatter/attributes"),o=t("../../constants/gl_markers"),a=t("../../lib/extend").extendFlat,s=i.line,l=i.marker,c=l.line;e.exports={x:{valType:"data_array"},y:{valType:"data_array"},z:{valType:"data_array"},text:a({},i.text,{description:["Sets text elements associated with each (x,y,z) triplet.","If a single string, the same string appears over","all the data points.","If an array of string, the items are mapped in order to the","this trace's (x,y,z) coordinates."].join(" ")}),mode:a({},i.mode,{dflt:"lines+markers"}),surfaceaxis:{valType:"enumerated",values:[-1,0,1,2],dflt:-1,description:["If *-1*, the scatter points are not fill with a surface","If *0*, *1*, *2*, the scatter points are filled with","a Delaunay surface about the x, y, z respectively."].join(" ")},surfacecolor:{valType:"color"},projection:{x:n("x"),y:n("y"),z:n("z")},line:{color:s.color,width:s.width,dash:s.dash},marker:{color:l.color,symbol:{valType:"enumerated",values:Object.keys(o),dflt:"circle",arrayOk:!0},size:a({},l.size,{dflt:8}),sizeref:l.sizeref,sizemin:l.sizemin,sizemode:l.sizemode,opacity:a({},l.opacity,{arrayOk:!1,description:["Sets the marker opacity.","Note that the marker opacity for scatter3d traces","must be a scalar value for performance reasons.","To set a blending opacity value","(i.e. which is not transparent), set *marker.color*","to an rgba color and use its alpha channel."].join(" ")}),colorscale:l.colorscale,cauto:l.cauto,cmax:l.cmax,cmin:l.cmin,autocolorscale:l.autocolorscale,reversescale:l.reversescale,showscale:l.showscale,line:{color:c.color,width:a({},c.width,{arrayOk:!1}),colorscale:c.colorscale,cauto:c.cauto,cmax:c.cmax,cmin:c.cmin,autocolorscale:c.autocolorscale,reversescale:c.reversescale}},textposition:a({},i.textposition,{dflt:"top center"}),textfont:i.textfont,_nestedModules:{error_x:"ErrorBars",error_y:"ErrorBars",error_z:"ErrorBars","marker.colorbar":"Colorbar"}}},{"../../constants/gl_markers":336,"../../lib/extend":344,"../scatter/attributes":493}],515:[function(t,e,r){"use strict";var n=t("../scatter/arrays_to_calcdata"),i=t("../scatter/marker_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":492,"../scatter/marker_colorscale_calc":506}],516:[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;o<t.length;o++){var s=n(+t[o],o);i[o]=[-s[0]*r,s[1]*r]}return i}function i(t){for(var e=0;e<t.length;e++)if(t[e])return t[e].length;return 0}function o(t,e){var r=[n(t.x,t.error_x,e[0]),n(t.y,t.error_y,e[1]),n(t.z,t.error_z,e[2])],o=i(r);if(0===o)return null;for(var a=new Array(o),s=0;o>s;s++){for(var l=[[0,0,0],[0,0,0]],c=0;3>c;c++)if(r[c])for(var u=0;2>u;u++)l[u][c]=r[c][s][u];a[s]=l}return a}var a=t("../../components/errorbars/compute_error");e.exports=o},{"../../components/errorbars/compute_error":321}],517:[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;n<t.length;++n){var l=t[n];!isNaN(l[i])&&isFinite(l[i])&&!isNaN(l[o])&&isFinite(l[o])&&(a.push([l[i],l[o]]),s.push(n))}var c=m(a);for(n=0;n<c.length;++n)for(var u=c[n],h=0;h<u.length;++h)u[h]=s[u[h]];return{positions:t,cells:c,meshColor:e}}function o(t){for(var e=[0,0,0],r=[[0,0,0],[0,0,0],[0,0,0]],n=[0,0,0],i=0;3>i;i++){var o=t[i];o&&o.copy_zstyle!==!1&&(o=t[2]),o&&(e[i]=o.width/2,r[i]=b(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 k[t]}function c(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 u(t,e){var r,n,i,u,h,f,d=[],p=t.fullSceneLayout,g=t.dataScale,v=p.xaxis,m=p.yaxis,w=p.zaxis,k=e.marker,M=e.line,T=e.x||[],E=e.y||[],L=e.z||[],S=T.length;for(n=0;S>n;n++)i=v.d2l(T[n])*g[0],u=m.d2l(E[n])*g[1],h=w.d2l(L[n])*g[2],d[n]=[i,u,h];if(Array.isArray(e.text))f=e.text;else if(void 0!==e.text)for(f=new Array(S),n=0;S>n;n++)f[n]=e.text;if(r={position:d,mode:e.mode,text:f},"line"in e&&(r.lineColor=b(M.color),r.lineWidth=M.width,r.lineDashes=M.dash),"marker"in e){var C=_(e);r.scatterColor=x(k,1,S),r.scatterSize=c(k.size,S,s,20,C),r.scatterMarker=c(k.symbol,S,l,"\u25cf"),r.scatterLineWidth=k.line.width,r.scatterLineColor=x(k.line,1,S),r.scatterAngle=0}"textposition"in e&&(r.textOffset=a(e.textposition),r.textColor=x(e.textfont,1,S),r.textSize=c(e.textfont.size,S,y.identity,12),r.textFont=e.textfont.family,r.textAngle=0);var z=["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 j=e.projection[z[n]];(r.project[n]=j.show)&&(r.projectOpacity[n]=j.opacity,r.projectScale[n]=j.scale)}r.errorBounds=A(e,g);var P=o([e.error_x,e.error_y,e.error_z]);return r.errorColor=P.color,r.errorLineWidth=P.lineWidth,r.errorCapSize=P.capSize,r.delaunayAxis=e.surfaceaxis,r.delaunayColor=b(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 d=t("gl-line3d"),p=t("gl-scatter3d"),g=t("gl-error3d"),v=t("gl-mesh3d"),m=t("delaunay-triangulate"),y=t("../../lib"),b=t("../../lib/str2rgbarray"),x=t("../../lib/gl_format_color"),_=t("../scatter/make_bubble_size_func"),w=t("../../constants/gl3d_dashes"),k=t("../../constants/gl_markers"),A=t("./calc_errors"),M=n.prototype;M.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}},M.update=function(t){var e,r,n,o,a=this.scene.glplot.gl,s=w.solid;this.data=t;var l=u(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},-1!==this.mode.indexOf("lines")?this.linePlot?this.linePlot.update(e):(this.linePlot=d(e),this.scene.glplot.add(this.linePlot)):this.linePlot&&(this.scene.glplot.remove(this.linePlot),this.linePlot.dispose(),this.linePlot=null);var c=t.opacity;if(t.marker&&t.marker.opacity&&(c*=t.marker.opacity),r={gl:a,position:l.position,color:l.scatterColor,size:l.scatterSize,glyph:l.scatterMarker,opacity:c,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=p(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=p(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=g(n),this.scene.glplot.add(this.errorBars)),l.delaunayAxis>=0){var f=i(l.position,l.delaunayColor,l.delaunayAxis);this.delaunayMesh?this.delaunayMesh.update(f):(f.gl=a,this.delaunayMesh=v(f),this.scene.glplot.add(this.delaunayMesh))}else this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose(),this.delaunayMesh=null)},M.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.remove(this.errorBars),this.errorBars.dispose()),this.textMarkers&&(this.scene.glplot.remove(this.textMarkers),this.textMarkers.dispose()),this.delaunayMesh&&(this.scene.glplot.remove(this.textMarkers),this.delaunayMesh.dispose())},e.exports=f},{"../../constants/gl3d_dashes":335,"../../constants/gl_markers":336,"../../lib":348,"../../lib/gl_format_color":346,"../../lib/str2rgbarray":358,"../scatter/make_bubble_size_func":505,"./calc_errors":516,"delaunay-triangulate":71,"gl-error3d":78,"gl-line3d":84,"gl-mesh3d":107,"gl-scatter3d":150}],518:[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<i.length&&(e.x=i.slice(0,n)),n<o.length&&(e.y=o.slice(0,n)),n<a.length&&(e.z=a.slice(0,n))),n}var i=t("../../lib"),o=t("../scatter/subtypes"),a=t("../scatter/marker_defaults"),s=t("../scatter/line_defaults"),l=t("../scatter/text_defaults"),c=t("../../components/errorbars/defaults"),u=t("./attributes");e.exports=function(t,e,r,h){function f(r,n){return i.coerce(t,e,u,r,n)}var d=n(t,e,f);if(!d)return void(e.visible=!1);f("text"),f("mode"),o.hasLines(e)&&s(t,e,r,f),o.hasMarkers(e)&&a(t,e,r,h,f),o.hasText(e)&&l(t,e,h,f);var p=(e.line||{}).color,g=(e.marker||{}).color;f("surfaceaxis")>=0&&f("surfacecolor",p||g);for(var v=["x","y","z"],m=0;3>m;++m){var y="projection."+v[m];f(y+".show")&&(f(y+".opacity"),f(y+".scale"))}c(t,e,r,{axis:"z"}),c(t,e,r,{axis:"y",inherit:"z"}),c(t,e,r,{axis:"x",inherit:"z"})}},{"../../components/errorbars/defaults":322,"../../lib":348,"../scatter/line_defaults":503,"../scatter/marker_defaults":507,"../scatter/subtypes":511,"../scatter/text_defaults":512,"./attributes":514}],519:[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={description:["The data visualized as scatter point or lines in 3D dimension","is set in `x`, `y`, `z`.","Text (appearing either on the chart or on hover only) is via `text`.","Bubble charts are achieved by setting `marker.size` and/or `marker.color`","Projections are achieved via `projection`.","Surface fills are achieved via `surfaceaxis`."].join(" ")},e.exports=n},{"../../constants/gl_markers":336,"../../plots/gl3d":391,"../scatter/colorbar":496,"./attributes":514,"./calc":515,"./convert":517,"./defaults":518}],520:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../plots/attributes"),o=t("../../lib/extend").extendFlat,a=n.marker,s=n.line,l=a.line;e.exports={lon:{valType:"data_array"},lat:{valType:"data_array"},locations:{valType:"data_array",description:["Sets the coordinates via location IDs or names.","Coordinates correspond to the centroid of each location given.","See `locationmode` for more info."].join(" ")},locationmode:{valType:"enumerated",values:["ISO-3","USA-states","country names"],dflt:"ISO-3",description:["Determines the set of locations used to match entries in `locations`","to regions on the map."].join(" ")},mode:o({},n.mode,{dflt:"markers"}),text:o({},n.text,{description:["Sets text elements associated with each (lon,lat) pair.","or item in `locations`.","If a single string, the same string appears over","all the data points.","If an array of string, the items are mapped in order to the","this trace's (lon,lat) or `locations` coordinates."].join(" ")}),line:{color:s.color,width:s.width,dash:s.dash},marker:{symbol:a.symbol,opacity:a.opacity,size:a.size,sizeref:a.sizeref,sizemin:a.sizemin,sizemode:a.sizemode,color:a.color,colorscale:a.colorscale,cauto:a.cauto,cmax:a.cmax,cmin:a.cmin,autocolorscale:a.autocolorscale,reversescale:a.reversescale,showscale:a.showscale,line:{color:l.color,width:l.width,colorscale:l.colorscale,cauto:l.cauto,cmax:l.cmax,cmin:l.cmin,autocolorscale:l.autocolorscale,reversescale:l.reversescale}},textfont:n.textfont,textposition:n.textposition,hoverinfo:o({},i.hoverinfo,{flags:["lon","lat","location","text","name"]}),_nestedModules:{"marker.colorbar":"Colorbar"}}},{"../../lib/extend":344,"../../plots/attributes":366,"../scatter/attributes":493}],521:[function(t,e,r){"use strict";var n=t("../scatter/marker_colorscale_calc");e.exports=function(t,e){var r=[{x:!1,y:!1,trace:e,t:{}}];return n(e),r}},{"../scatter/marker_colorscale_calc":506}],522:[function(t,e,r){"use strict";function n(t,e,r){var n,i,o=0,a=r("locations");return a?(r("locationmode"),o=a.length):(n=r("lon")||[],i=r("lat")||[],o=Math.min(n.length,i.length),o<n.length&&(e.lon=n.slice(0,o)),o<i.length&&(e.lat=i.slice(0,o)),o)}var i=t("../../lib"),o=t("../scatter/subtypes"),a=t("../scatter/marker_defaults"),s=t("../scatter/line_defaults"),l=t("../scatter/text_defaults"),c=t("./attributes");e.exports=function(t,e,r,u){function h(r,n){return i.coerce(t,e,c,r,n)}var f=n(t,e,h);return f?(h("text"),h("mode"),o.hasLines(e)&&s(t,e,r,h),o.hasMarkers(e)&&a(t,e,r,u,h),o.hasText(e)&&l(t,e,u,h),void h("hoverinfo",1===u._dataLength?"lon+lat+location+text":void 0)):void(e.visible=!1)}},{"../../lib":348,"../scatter/line_defaults":503,"../scatter/marker_defaults":507,"../scatter/subtypes":511,"../scatter/text_defaults":512,"./attributes":520}],523:[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").plot,n.moduleType="trace",n.name="scattergeo",n.basePlotModule=t("../../plots/geo"),n.categories=["geo","symbols","markerColorscale","showLegend"],n.meta={description:["The data visualized as scatter point or lines on a geographic map","is provided either by longitude/latitude pairs in `lon` and `lat`","respectively or by geographic location IDs or names in `locations`."].join(" ")},e.exports=n},{"../../plots/geo":376,"../scatter/colorbar":496,"./attributes":520,"./calc":521,"./defaults":522,"./plot":524}],524:[function(t,e,r){"use strict";function n(t,e,r){function n(t,n){h(t,e,n,r)}var i=t.marker;if(n(t.text,"tx"),n(t.textposition,"tp"),t.textfont&&(n(t.textfont.size,"ts"),n(t.textfont.color,"tc"),n(t.textfont.family,"tf")),i&&i.line){var o=i.line;n(i.opacity,"mo"),n(i.symbol,"mx"),n(i.color,"mc"),n(i.size,"ms"),n(o.color,"mlc"),n(o.width,"mlw")}}function i(t){for(var e=t.lon.length,r=new Array(e),n=0;e>n;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 l.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"),c=-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)),c&&n.push(t.tx||e.text),t.textLabel=n.join("<br>")}}var a=t("d3"),s=t("../../plots/cartesian/graph_interact"),l=t("../../plots/cartesian/axes"),c=t("../../lib/topojson_utils").getTopojsonFeatures,u=t("../../lib/geo_location_utils").locationToFeature,h=t("../../lib/array_to_calc_item"),f=t("../../components/color"),d=t("../../components/drawing"),p=t("../scatter/subtypes"),g=t("./attributes"),v=e.exports={};v.calcGeoJSON=function(t,e){var r,i,o,a,s,l,h=[],f=Array.isArray(t.locations);f?(s=t.locations,r=s.length,i=c(t,e),o=function(t,e){var r=u(t.locationmode,s[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 d=0;r>d;d++)a=o(t,d),a&&(l={lon:a[0],lat:a[1],location:f?t.locations[d]:null},n(t,l,d),h.push(l));return h.length>0&&(h[0].trace=t),h},v.plot=function(t,e){var r=t.framework.select("g.scattergeolayer"),n=t.topojson;r.selectAll("*").remove();var l=r.selectAll("g.trace.scatter").data(e);l.enter().append("g").attr("class","trace scattergeo"),l.each(function(t){p.hasLines(t)&&t.visible===!0&&a.select(this).append("path").datum(i(t)).attr("class","js-line")}),l.append("g").attr("class","points").each(function(e){function r(r){if(t.showHover){var n=t.projection([r.lon,r.lat]);h(r),s.loneHover({x:n[0],y:n[1],name:d?e.name:void 0,text:r.textLabel,color:r.mc||(e.marker||{}).color},{container:t.hoverContainer.node()})}}var i=a.select(this),l=p.hasMarkers(e),c=p.hasText(e);if(!l&&!c||e.visible!==!0)return void i.remove();var u=v.calcGeoJSON(e,n),h=o(t,e),f=e.hoverinfo,d="all"===f||-1!==f.indexOf("name");l&&i.selectAll("path.point").data(u).enter().append("path").attr("class","point").on("mouseover",r).on("mouseout",function(){s.loneUnhover(t.hoverContainer)}).on("mousedown",function(){s.loneUnhover(t.hoverContainer)}).on("mouseup",r),c&&i.selectAll("g").data(u).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.selectAll("g.points").each(function(t){a.select(this).selectAll("path.point").call(d.pointStyle,t),a.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||{};a.select(this).call(f.stroke,r.color).call(d.dashLine,r.dash||"",r.width||0)})}},{"../../components/color":299,"../../components/drawing":317,"../../lib/array_to_calc_item":340,"../../lib/geo_location_utils":345,"../../lib/topojson_utils":360,"../../plots/cartesian/axes":368,"../../plots/cartesian/graph_interact":370,"../scatter/subtypes":511,"./attributes":520,d3:70}],525:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../constants/gl2d_dashes"),o=t("../../constants/gl_markers"),a=t("../../lib/extend").extendFlat,s=n.line,l=n.marker,c=l.line;e.exports={x:n.x,x0:n.x0,dx:n.dx,y:n.y,y0:n.y0,dy:n.dy,text:a({},n.text,{description:["Sets text elements associated with each (x,y) pair to appear on hover.","If a single string, the same string appears over","all the data points.","If an array of string, the items are mapped in order to the","this trace's (x,y) coordinates."].join(" ")}),mode:{valType:"flaglist",flags:["lines","markers"],extras:["none"],description:["Determines the drawing mode for this scatter trace."].join(" ")},line:{color:s.color,width:s.width,dash:{valType:"enumerated",values:Object.keys(i),dflt:"solid"}},marker:{color:l.color,symbol:{valType:"enumerated",values:Object.keys(o),dflt:"circle",arrayOk:!0},size:l.size,sizeref:l.sizeref,sizemin:l.sizemin,sizemode:l.sizemode,opacity:l.opacity,colorscale:l.colorscale,cauto:l.cauto,cmax:l.cmax,cmin:l.cmin,autocolorscale:l.autocolorscale,reversescale:l.reversescale,showscale:l.showscale,line:{color:c.color,width:c.width,colorscale:c.colorscale,cauto:c.cauto,cmax:c.cmax,cmin:c.cmin,autocolorscale:c.autocolorscale,reversescale:c.reversescale}},fill:a({},n.fill,{values:["none","tozeroy","tozerox"]}),fillcolor:n.fillcolor,_nestedModules:{error_x:"ErrorBars",error_y:"ErrorBars","marker.colorbar":"Colorbar"}}},{"../../constants/gl2d_dashes":334,"../../constants/gl_markers":336,"../../lib/extend":344,"../scatter/attributes":493}],526:[function(t,e,r){"use strict";function n(t,e){this.scene=t,this.uid=e,this.xData=[],this.yData=[],this.textLabels=[],this.color="rgb(0, 0, 0)",this.name="",this.hoverinfo="all",this.idToIndex=[],this.bounds=[0,0,0,0],this.hasLines=!1,this.lineOptions={positions:new Float32Array,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,errors:new Float32Array,lineWidth:1,capSize:0,color:[0,0,0,1]},this.errorX=g(t.glplot,this.errorXOptions),this.errorX._trace=this,this.hasErrorY=!1,this.errorYOptions={positions:new Float32Array,errors:new Float32Array,lineWidth:1,capSize:0,color:[0,0,0,1]},this.errorY=g(t.glplot,this.errorYOptions),this.errorY._trace=this,this.hasMarkers=!1,this.scatterOptions={positions:new Float32Array,sizes:[],colors:[],glyphs:[],borderWidths:[],borderColors:[],size:12,color:[0,0,0,1],borderSize:1,borderColor:[0,0,0,1]},this.scatter=f(t.glplot,this.scatterOptions),this.scatter._trace=this,this.fancyScatter=d(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(S(t,r),L(e,r),r)}function s(t,e,r,n){var i=x(t,e,n);return i=Array.isArray(i[0])?i:o(m.identity,[i],n),l(i,L(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 c(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 u(t,e){var r=new n(t,e.uid);return r.update(e),r}var h=t("../../plotly"),f=t("gl-scatter2d"),d=t("gl-scatter2d-fancy"),p=t("gl-line2d"),g=t("gl-error2d"),v=t("fast-isnumeric"),m=t("../../lib"),y=t("../../components/errorbars"),b=t("../../lib/str2rgbarray"),x=t("../../lib/gl_format_color"),_=t("../scatter/subtypes"),w=t("../scatter/make_bubble_size_func"),k=t("../scatter/get_trace_color"),A=t("../../constants/gl_markers"),M=t("../../constants/gl2d_dashes"),T=["xaxis","yaxis"],E=n.prototype;E.handlePick=function(t){var e=this.idToIndex[t.pointId];return{trace:this,dataCoord:t.dataCoord,traceCoord:[this.xData[e],this.yData[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;var e=t.marker||{};if(Array.isArray(e.symbol)||"circle"!==e.symbol||Array.isArray(e.size)||Array.isArray(e.line.width)||Array.isArray(e.opacity))return!0;var r=e.color;if(Array.isArray(r))return!0;var n=Array.isArray(e.line.color);return Array.isArray(n)?!0:this.hasErrorX?!0:this.hasErrorY?!0:!1};var L=i.bind(null,function(t){return+t}),S=i.bind(null,b),C=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.isFancy(t)?this.updateFancy(t):this.updateFast(t),this.color=k(t,{})},E.updateFast=function(t){for(var e,r,n=this.xData=t.x,i=this.yData=t.y,o=n.length,a=new Array(o),s=new Float32Array(2*o),l=this.bounds,u=0,h=0,f=0;o>f;++f)e=n[f],r=i[f],v(e)&&v(r)&&(a[u++]=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=c(s,h),this.idToIndex=a,this.updateLines(t,s),this.updateError("X",t),this.updateError("Y",t);var d;if(this.hasMarkers){this.scatterOptions.positions=s;var p=b(t.marker.color),g=b(t.marker.line.color),m=t.opacity*t.marker.opacity;p[3]*=m,this.scatterOptions.color=p,g[3]*=m,this.scatterOptions.borderColor=g,d=t.marker.size,this.scatterOptions.size=d,this.scatterOptions.borderSize=t.marker.line.width,this.scatter.update(this.scatterOptions)}else this.scatterOptions.positions=new Float32Array,this.scatterOptions.glyphs=[],this.scatter.update(this.scatterOptions);this.scatterOptions.positions=new Float32Array,this.scatterOptions.glyphs=[],this.fancyScatter.update(this.scatterOptions),this.expandAxesFast(l,d)},E.updateFancy=function(t){var e,r,n,o,a,l,u,h,f=this.scene,d=f.xaxis,p=f.yaxis,g=this.bounds,v=this.xData=d.makeCalcdata(t,"x"),m=this.yData=p.makeCalcdata(t,"y"),b=y.calcFromTrace(t,f.fullLayout),x=v.length,_=new Array(x),k=new Float32Array(2*x),A=new Float32Array(4*x),M=new Float32Array(4*x),T=0,E=0,S=0,z=0,j="log"===d.type?function(t){return d.d2l(t)}:function(t){return t},P="log"===p.type?function(t){return p.d2l(t)}:function(t){return t};for(e=0;x>e;++e)n=j(v[e]),o=P(m[e]),isNaN(n)||isNaN(o)||(_[T++]=e,k[E++]=n,k[E++]=o,a=A[S++]=n-b[e].xs||0,l=A[S++]=b[e].xh-n||0,A[S++]=0,A[S++]=0,M[z++]=0,M[z++]=0,u=M[z++]=o-b[e].ys||0,h=M[z++]=b[e].yh-o||0,g[0]=Math.min(g[0],n-a),g[1]=Math.min(g[1],o-u),g[2]=Math.max(g[2],n+l),g[3]=Math.max(g[3],o+h));k=c(k,E),this.idToIndex=_,this.updateLines(t,k),this.updateError("X",t,k,A),this.updateError("Y",t,k,M);var I;if(this.hasMarkers){this.scatterOptions.positions=k,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 R,O=w(t),N=t.marker,D=N.opacity,F=t.opacity,B=s(N,D,F,x),U=C(N.symbol,x),V=L(N.line.width,x),q=s(N.line,D,F,x);for(I=i(O,N.size,x),e=0;T>e;++e)for(R=_[e],this.scatterOptions.sizes[e]=4*I[R],this.scatterOptions.glyphs[e]=U[R],this.scatterOptions.borderWidths[e]=.5*V[R],r=0;4>r;++r)this.scatterOptions.colors[4*e+r]=B[4*R+r],this.scatterOptions.borderColors[4*e+r]=q[4*R+r];this.fancyScatter.update(this.scatterOptions)}else this.scatterOptions.positions=new Float32Array,this.scatterOptions.glyphs=[],this.fancyScatter.update(this.scatterOptions);this.scatterOptions.positions=new Float32Array,this.scatterOptions.glyphs=[],this.scatter.update(this.scatterOptions),this.expandAxesFancy(v,m,I)},E.updateLines=function(t,e){if(this.hasLines){this.lineOptions.positions=e;var r=b(t.line.color);this.hasMarkers&&(r[3]*=t.marker.opacity);for(var n=Math.round(.5*this.lineOptions.width),i=(M[t.line.dash]||[1]).slice(),o=0;o<i.length;++o)i[o]*=n;switch(t.fill){case"tozeroy":this.lineOptions.fill=[!1,!0,!1,!1];break;case"tozerox":this.lineOptions.fill=[!0,!1,!1,!1];break;default:this.lineOptions.fill=[!1,!1,!1,!1]}var a=b(t.fillcolor);this.lineOptions.color=r,this.lineOptions.width=2*t.line.width,this.lineOptions.dashes=i,this.lineOptions.fillColor=[a,a,a,a]}else this.lineOptions.positions=new Float32Array;this.line.update(this.lineOptions)},E.updateError=function(t,e,r,n){var i=this["error"+t],o=e["error_"+t.toLowerCase()],s=this["error"+t+"Options"];"x"===t.toLowerCase()&&o.copy_ystyle&&(o=e.error_y),this["hasError"+t]?(s.positions=r,s.errors=n,s.capSize=o.width,s.lineWidth=o.thickness/2,s.color=a(o.color,1,1)):s.positions=new Float32Array,i.update(s)},E.expandAxesFast=function(t,e){for(var r,n,i,o=e||10,a=0;2>a;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};h.Axes.expand(n.xaxis,t,i),h.Axes.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=u},{"../../components/errorbars":323,"../../constants/gl2d_dashes":334,"../../constants/gl_markers":336,"../../lib":348,"../../lib/gl_format_color":346,"../../lib/str2rgbarray":358,"../../plotly":365,"../scatter/get_trace_color":500,"../scatter/make_bubble_size_func":505,"../scatter/subtypes":511,"fast-isnumeric":74,"gl-error2d":76,"gl-line2d":82,"gl-scatter2d":147,"gl-scatter2d-fancy":142}],527:[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"),c=t("../scatter/fillcolor_defaults"),u=t("../../components/errorbars/defaults"),h=t("./attributes");e.exports=function(t,e,r,f){function d(r,i){return n.coerce(t,e,h,r,i)}var p=a(t,e,d);return p?(d("text"),d("mode",p<i.PTS_LINESONLY?"lines+markers":"lines"),o.hasLines(e)&&l(t,e,r,d),o.hasMarkers(e)&&s(t,e,r,f,d),d("fill"),"none"!==e.fill&&c(t,e,r,d),u(t,e,r,{axis:"y"}),void u(t,e,r,{axis:"x",inherit:"y"})):void(e.visible=!1)}},{"../../components/errorbars/defaults":322,
"../../lib":348,"../scatter/constants":497,"../scatter/fillcolor_defaults":499,"../scatter/line_defaults":503,"../scatter/marker_defaults":507,"../scatter/subtypes":511,"../scatter/xy_defaults":513,"./attributes":525}],528:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("../scatter3d/calc"),n.plot=t("./convert"),n.moduleType="trace",n.name="scattergl",n.basePlotModule=t("../../plots/gl2d"),n.categories=["gl2d","symbols","errorBarsOK","markerColorscale","showLegend"],n.meta={description:["The data visualized as scatter point or lines is set in `x` and `y`","using the WebGl plotting engine.","Bubble charts are achieved by setting `marker.size` and/or `marker.color`","to a numerical arrays."].join(" ")},e.exports=n},{"../../plots/gl2d":388,"../scatter/colorbar":496,"../scatter3d/calc":515,"./attributes":525,"./convert":526,"./defaults":527}],529:[function(t,e,r){"use strict";function n(t){return{valType:"boolean",dflt:!1,description:["Sets whether or not the dynamic contours are projected","along the",t,"axis."].join(" ")}}function i(t){return{show:{valType:"boolean",dflt:!1,description:["Sets whether or not dynamic contours are shown along the",t,"axis"].join(" ")},project:{x:n("x"),y:n("y"),z:n("z")},color:{valType:"color",dflt:"#000"},usecolormap:{valType:"boolean",dflt:!1},width:{valType:"number",min:1,max:16,dflt:2},highlight:{valType:"boolean",dflt:!1},highlightColor:{valType:"color",dflt:"#000"},highlightWidth:{valType:"number",min:1,max:16,dflt:2}}}var o=t("../../components/colorscale/attributes"),a=t("../../lib/extend").extendFlat;e.exports={z:{valType:"data_array"},x:{valType:"data_array"},y:{valType:"data_array"},text:{valType:"data_array"},zauto:o.zauto,zmin:o.zmin,zmax:o.zmax,colorscale:o.colorscale,autocolorscale:a({},o.autocolorscale,{dflt:!1}),reversescale:o.reversescale,showscale:o.showscale,contours:{x:i("x"),y:i("y"),z:i("z")},hidesurface:{valType:"boolean",dflt:!1},lighting:{ambient:{valType:"number",min:0,max:1,dflt:.8},diffuse:{valType:"number",min:0,max:1,dflt:.8},specular:{valType:"number",min:0,max:2,dflt:.05},roughness:{valType:"number",min:0,max:1,dflt:.5},fresnel:{valType:"number",min:0,max:5,dflt:.2}},opacity:{valType:"number",min:0,max:1,dflt:1},_nestedModules:{colorbar:"Colorbar"}}},{"../../components/colorscale/attributes":305,"../../lib/extend":344}],530:[function(t,e,r){"use strict";var n=t("../../components/colorscale/calc");e.exports=function(t,e){n(e,e.z,"","z")}},{"../../components/colorscale/calc":306}],531:[function(t,e,r){"use strict";function n(t,e,r){this.scene=t,this.uid=r,this.surface=e,this.data=null,this.showContour=[!1,!1,!1],this.dataScale=1}function i(t,e){return void 0===e&&(e=1),t.map(function(t){var r=t[0],n=d(t[1]),i=n.toRgb();return{index:r,rgb:[i.r,i.g,i.b,e]}})}function o(t){var e=t.shape,r=[e[0]+2,e[1]+2],n=c(new Float32Array(r[0]*r[1]),r);return f.assign(n.lo(1,1).hi(e[0],e[1]),t),f.assign(n.lo(1).hi(e[0],1),t.hi(e[0],1)),f.assign(n.lo(1,r[1]-1).hi(e[0],1),t.lo(0,e[1]-1).hi(e[0],1)),f.assign(n.lo(0,1).hi(1,e[1]),t.hi(1)),f.assign(n.lo(r[0]-1,1).hi(1,e[1]),t.lo(e[0]-1)),n.set(0,0,t.get(0,0)),n.set(0,r[1]-1,t.get(0,e[1]-1)),n.set(r[0]-1,0,t.get(e[0]-1,0)),n.set(r[0]-1,r[1]-1,t.get(e[0]-1,e[1]-1)),n}function a(t){var e=Math.max(t[0].shape[0],t[0].shape[1]);if(g>e){for(var r=g/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;3>a;++a){var s=o(t[a]),l=c(new Float32Array(i),n);u(l,s,[r,0,0,0,r,0,0,0,1]),t[a]=l}return r}return 1}function s(t,e){var r=t.glplot.gl,i=l({gl:r}),o=new n(t,i,e.uid);return o.update(e),t.glplot.add(i),o}var l=t("gl-surface3d"),c=t("ndarray"),u=t("ndarray-homography"),h=t("ndarray-fill"),f=t("ndarray-ops"),d=t("tinycolor2"),p=t("../../lib/str2rgbarray"),g=128,v=n.prototype;v.handlePick=function(t){if(t.object===this.surface){var e=[Math.min(0|Math.round(t.data.index[0]/this.dataScale-1),this.data.z[0].length-1),Math.min(0|Math.round(t.data.index[1]/this.dataScale-1),this.data.z.length-1)],r=[0,0,0];Array.isArray(this.data.x[0])?r[0]=this.data.x[e[1]][e[0]]:r[0]=this.data.x[e[0]],Array.isArray(this.data.y[0])?r[1]=this.data.y[e[1]][e[0]]:r[1]=this.data.y[e[1]],r[2]=this.data.z[e[1]][e[0]],t.traceCoordinate=r;var n=this.scene.fullSceneLayout;t.dataCoordinate=[n.xaxis.d2l(r[0])*this.scene.dataScale[0],n.yaxis.d2l(r[1])*this.scene.dataScale[1],n.zaxis.d2l(r[2])*this.scene.dataScale[2]];var i=this.data.text;return i&&i[e[1]]&&void 0!==i[e[1]][e[0]]?t.textLabel=i[e[1]][e[0]]:t.textLabel="",t.data.dataCoordinate=t.dataCoordinate.slice(),this.surface.highlight(t.data),this.scene.glplot.spikes.position=t.dataCoordinate,!0}},v.setContourLevels=function(){for(var t=[[],[],[]],e=!1,r=0;3>r;++r)this.showContour[r]&&(e=!0,t[r]=this.scene.contourLevels[r]);e&&this.surface.update({levels:t})},v.update=function(t){var e,r=this.scene,n=r.fullSceneLayout,o=this.surface,s=t.opacity,l=i(t.colorscale,s),u=t.z,f=t.x,d=t.y,g=n.xaxis,v=n.yaxis,m=n.zaxis,y=r.dataScale,b=u[0].length,x=u.length,_=[c(new Float32Array(b*x),[b,x]),c(new Float32Array(b*x),[b,x]),c(new Float32Array(b*x),[b,x])],w=_[0],k=_[1],A=r.contourLevels;this.data=t,h(_[2],function(t,e){return m.d2l(u[e][t])*y[2]}),Array.isArray(f[0])?h(w,function(t,e){return g.d2l(f[e][t])*y[0]}):h(w,function(t){return g.d2l(f[t])*y[0]}),Array.isArray(d[0])?h(k,function(t,e){return v.d2l(d[e][t])*y[1]}):h(k,function(t,e){return v.d2l(d[e])*y[1]}),this.dataScale=a(_);var M={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,colorBounds:[t.zmin*y[2],t.zmax*y[2]]};"opacity"in t&&t.opacity<1&&(M.opacity=.25*t.opacity);var T=[!0,!0,!0],E=[!0,!0,!0],L=["x","y","z"];for(e=0;3>e;++e){var S=t.contours[L[e]];T[e]=S.highlight,E[e]=S.show,M.showContour[e]=S.show||S.highlight,M.showContour[e]&&(M.contourProject[e]=[S.project.x,S.project.y,S.project.z],S.show?(this.showContour[e]=!0,M.levels[e]=A[e],o.highlightColor[e]=M.contourColor[e]=p(S.color),S.usecolormap?o.highlightTint[e]=M.contourTint[e]=0:o.highlightTint[e]=M.contourTint[e]=1,M.contourWidth[e]=S.width):this.showContour[e]=!1,S.highlight&&(M.dynamicColor[e]=p(S.highlightColor),M.dynamicWidth[e]=S.highlightWidth))}M.coords=_,o.update(M),o.highlightEnable=T,o.contourEnable=E,o.visible=t.visible,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),s&&1>s&&(o.supportsTransparency=!0)},v.dispose=function(){this.glplot.remove(this.surface),this.surface.dispose()},e.exports=s},{"../../lib/str2rgbarray":358,"gl-surface3d":184,ndarray:208,"ndarray-fill":201,"ndarray-homography":206,"ndarray-ops":207,tinycolor2:229}],532:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/colorscale/defaults"),o=t("./attributes");e.exports=function(t,e,r,a){function s(r,i){return n.coerce(t,e,o,r,i)}var l,c,u=s("z");if(!u)return void(e.visible=!1);var h=u[0].length,f=u.length;if(s("x"),s("y"),!Array.isArray(e.x))for(e.x=[],l=0;h>l;++l)e.x[l]=l;if(s("text"),!Array.isArray(e.y))for(e.y=[],l=0;f>l;++l)e.y[l]=l;s("lighting.ambient"),s("lighting.diffuse"),s("lighting.specular"),s("lighting.roughness"),s("lighting.fresnel"),s("hidesurface"),s("opacity"),s("colorscale");var d=["x","y","z"];for(l=0;3>l;++l){var p="contours."+d[l],g=s(p+".show"),v=s(p+".highlight");if(g||v)for(c=0;3>c;++c)s(p+".project."+d[c]);g&&(s(p+".color"),s(p+".width"),s(p+".usecolormap")),v&&(s(p+".highlightColor"),s(p+".highlightWidth"))}i(t,e,a,s,{prefix:"",cLetter:"z"})}},{"../../components/colorscale/defaults":308,"../../lib":348,"./attributes":529}],533:[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("./convert"),n.moduleType="trace",n.name="surface",n.basePlotModule=t("../../plots/gl3d"),n.categories=["gl3d","noOpacity"],n.meta={description:["The data the describes the coordinates of the surface is set in `z`.","Data in `z` should be a {2D array}.","Coordinates in `x` and `y` can either be 1D {arrays}","or {2D arrays} (e.g. to graph parametric surfaces).","If not provided in `x` and `y`, the x and y coordinates are assumed","to be linear starting at 0 with a unit step."].join(" ")},e.exports=n},{"../../plots/gl3d":391,"../heatmap/colorbar":452,"./attributes":529,"./calc":530,"./convert":531,"./defaults":532}]},{},[12])(12)});